akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {
	
	int n, ans = 0;
	scanf("%d", &n);
	string s;
	rep(i, n) {
		scans(s);
		ans += (s == "E869120");
	}
	printf("%d\n", ans);

	Please AC;
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K;
  string S;
  string bun;
  cin >> K >> S;
  if(S.size() <= K){
    cout << S << endl;
  }
  else{
  // breakがなければこのループは i == 4 まで繰り返す
  for (int i = 0; i < K; i++) {
    cout << S.at(i);
  }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3600
class UnionFind:
  def __init__(self, v):
    # number of vertices
    self.v = v
    # parents of each node
    self.parents = [None] * v
    # heights of each node
    self.height = [None] * v

  def init(self):
    for i in range(self.v):
      self.parents[i] = i
      self.height[i] = 0

  def find(self, p):
    # finds the group containing p and return the position of its leader
    if self.parents[p] != p:
      self.parents[p] = self.find(self.parents[p])
    return self.parents[p]

  def union(self, p, q):
    parent_p = self.find(p)
    parent_q = self.find(q)

    if parent_p == parent_q: return

    if self.height[p] > self.height[q]:
      self.parents[q] = parent_p
    elif self.height[p] < self.height[q]:
      self.parents[p] = parent_q
    else:
      self.parents[parent_q] = parent_p
      self.height[p] += self.height[q]

  def same(self, p, q):
    return self.find(p) == self.find(q)

class Edge:
  def __init__(self, f, to, cost):
    self.f = f
    self.to = to
    self.cost = cost

  def __lt__(self, arg):
    return self.cost < arg.cost

n = int(input())
edges = []
for i in range(n):
  input_array = list(map(int, input().split()))
  for k in range(len(input_array)):
    if input_array[k] != -1:
      edges.append(Edge(i, k, input_array[k]))

union_find = UnionFind(n)
union_find.init()
edges.sort()

min_cost = 0
mst = []
while len(mst) < n-1:
  edge = edges.pop(0)
  if union_find.same(edge.f, edge.to) == False:
    min_cost += edge.cost
    union_find.union(edge.f, edge.to)
    mst.append(edge)

print(min_cost)


Measured memory_bytes: 7148
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    int n;
    cin>>n;
    mii m;
    for (int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        m[x]++;
        if (m[x]==2)
        {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";




}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;

int main()
{

	int a,b,n;
	while(cin>>a>>b>>n){
		a%=b;

		long long res=0;
		for(int i=0;i<n;i++){
			a*=10;
			res+=a/b;
			a%=b;
		}

		cout<<res<<endl;

	}


	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int gcd(int a,int b){
    if ( ( 0 == a ) || ( 0 == b ) )
		return 0;
	
    if (a<b){
        swap(a,b);        
    }
    if(a%b==0){
        return b;
    }
    else{
        
    return gcd(a,a%b);
    }
}

int gcd1(int a, int b) { return b ? gcd1(b, a%b) : a; }

int main() {
    int N;
    int a[100010];
    cin>>N;
    for(int i=0;i<N;i++) cin>>a[i];
    vector<int> front(N+1,0);
    vector<int> back(N+1,0);
    for(int i=0;i<N;i++){
        front[i+1]=gcd1(front[i],a[i]);
        
        //cerr<<front[i+1]<<" "<<back[i+1]<<endl;
    }
    for(int i=N-1;i>=0;i--){
        back[i]=gcd1(back[i+1],a[i]);
    }
    int ans=0;
    for(int i=0;i<N;i++){
        int tmp=gcd1(front[i],back[i+1]);
       // cerr<<front[i]<<" "<< back[i+1]<<endl;
        ans=max(ans,tmp);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	string s;
	ll k;
	cin >> s >> k;
	int no = s.size()+1, x;
	REP(i, s.size()){
		if(s[i]!='1'){
			no = i + 1;
			x = s[i] -'0';
			break;
		}
	}
	if(k < (ll)no) cout << 1 << endl;
	else cout << x << endl;
}

Measured memory_bytes: 3596
N = int(input())
ll = list(map(int,input().split()))
ll.sort()
ans = 0
for i in range(N-2):
    a = ll[0]
    b = 1
    for c in range(1,len(ll)-1):
        while (b<len(ll))and(ll[b]-ll[c] < a):
            b += 1
        ans += max(0,(b-c-1))
    del ll[0]
print(ans)


Measured memory_bytes: 44764
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main(){cout<<fixed<<setprecision(10);
		   int h,w;
           cin>>h>>w;
           vector<vin> a(h,vin(w));
           rep(i,0,h){
            rep(j,0,w){
              cin>>a[i][j];
            }
           }
           int cnt=0;
           vector<P> ans1(250010),ans2(250010);
           rep(i,0,h){
            rep(j,0,w){
              if(a[i][j]%2==1){
               ans1[cnt]=mp(i+1,j+1);
                
                if(j==w-1){
                      if(i!=h-1){
                        a[i+1][j]++;
                        ans2[cnt]=mp(i+2,j+1);
                      }
                      else{
                       continue; 
                      }
                }
                
                else{
                     a[i][j+1]++;
                  ans2[cnt]=mp(i+1,j+2);
                }
                cnt++;
              }
            }
           }
           cout<<cnt<<endl;
           rep(i,0,cnt){
            cout<<ans1[i].first<<" "<<ans1[i].second<<" "<<ans2[i].first<<" "<<ans2[i].second<<endl;
           }
}

Measured memory_bytes: 8184
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$M) =  explode(" ",trim(fgets(STDIN)));
//$W = explode(" ",trim(fgets(STDIN)));
for($i=0;$i<$M;$i++) {
  $A[] = trim(fgets(STDIN));
}
foreach($A as $v) {
  $m[$v]=true;
}
$mod = 1e9+7;
$dp[0]=1;
for($now=0;$now<$N;++$now) {
  for($next = $now+1;$next<=min($N,$now+2);++$next) {
    if (!isset($m[$next])) {
      $dp[$next]+=$dp[$now];
      $dp[$next]%=$mod;
    }
  }
}
printf("%d\n",$dp[$N]);


Measured memory_bytes: 16888
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
typedef long long int lli;
const lli mod = 1e9+7;
using namespace std;

int main()
{
	fast;
	string s;cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	cout<<"Yes";
	else
	cout<<"No";

}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main()
{
	int N;
	vector<long long int> lukas = {2,1};
	cin >> N;
	for (auto i = 2; i <= N; i++){
		lukas.push_back(lukas[i - 2] + lukas[i - 1]);
	}
	cout << lukas[N] << endl;

	return 0;
}



Measured memory_bytes: 256
use std::io;

fn read() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {

    let mut x = read();
    x.sort();
    println!("{} {} {}",x[0],x[1],x[2]);
    
    

    
}


Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    int c=0;
    int n;
    std::cin >> n;
    string s;
    std::cin >> s;
    rep(i,n-1){
        if(s[i]!=s[i+1])c++;
    }
    std::cout << c+1 << std::endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>

using namespace std;

void dfs(string s, int N) {
    if(s.size() == N) {
        cout << s << endl;
        return;
    } else {
        int i = 0;
        for(int j=0; j<s.size(); j++) {
            i = max(i, s[j]-'a');
        }
        for(int j=0; j<=i+1; j++) {
            s.push_back('a'+j);
            dfs(s, N);
            s.pop_back();
        }
    }
}

int main(void) {
    int N;
    cin >> N;
    dfs("a", N);
    return 0;
}


Measured memory_bytes: 1536
/*
 * author: Tran Minh Khoa
 * Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 7;
const long long INF = (long long) 1e18 + 7;

const int N = 123456;
const int M = 1010;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define sqrt(x) (x) * (x)

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define DEBUG(x) cerr << #x << " = " << x << '\n';
#define PR(x, a, b) { cerr << #x << " = "; REP(i, a, b) cerr << x[i] << ' '; cerr << '\n'; }
                 
int main() {
  #ifdef KM777
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  #endif
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr); cout.tie(nullptr);
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  int result = H * W - h * W - (H - h) * w; 
  cout << result << '\n';        
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

bool f(int64_t n, int64_t k) {
  if (n == 1)
    return true;
  else if (n < k)
    return false;

  if (n % k == 0)
    return f(n / k, k);
  else
    return f(n % k, k);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t N;
  cin >> N;
  int64_t res = 0;
  if (N > 100000) {
    for (int64_t i = 2; i * i < N + 1; i++) {
      if (f(N, i)) {
        res++;
        if (i != N / i && f(N, N / i)) {
          res++;
        }
      }
    }
    res += 2;
  } else {
    for (int64_t i = 2; i < N + 1; i++) {
      if (f(N, i)) {
        res++;
      }
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <bitset>
#include <climits>
#include <utility>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#define REP(i,n) for(int (i)=0;i<(int)(n);++(i))
#define REPIT(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define PB push_back
#define FT first
#define SD second
#define ZERO(x) memset(x,0,sizeof(x))
#define NEG(x) memset(x,-1,sizeof(x))
#define RI(x) scanf("%d",&(x))
#define RII(x,y) scanf("%d%d",&(x),&(y))
#define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define OIII(x,y,z) printf("%d %d %d\n",(x),(y),(z))
#define OII(x,y) printf("%d %d\n",(x),(y))
#define OI(x) printf("%d\n",(x))
#define OL(x) cout<<(x)<<endl
#define OLL(x,y) cout<<(x)<<" "<<(y)<<endl
#define OLLL(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define RS(s) scanf("%s",(s))
#define MP(x,y) make_pair((x),(y))
#define SZ(x) ((int)(x).size())
#define FIN(f) freopen(f,"r",stdin)
#define FOUT(f) freopen(f,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<int,int> PII;
const int MOD = 1e9+7;
const int maxn = 222222;
string s;
int main(int argc, char const *argv[])
{
    cin>>s;
    for(int i=0;i<SZ(s)-1;++i) {
        if(s[i] == s[i+1]) {
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
    }

    for(int i=0;i<SZ(s)-2;++i) {
        if(s[i] == s[i+2]) {
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }

    cout<<"-1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 512
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n;
    int[][] a;
    int i, j;

    for(;;){
      n = sc.nextInt();
      if(n == 0)break;
      a = new int[n + 1][n + 1];

      for(i = 0;i < n;i++)for(j = 0;j < n;j++)a[i][j] = sc.nextInt();

      for(i = 0;i < n;i++){
        for(j = 0;j < n;j++){
          a[i][n] += a[i][j];
          a[n][j] += a[i][j];
        }
        a[n][n] += a[i][n];
      }

      for(i = 0;i < n + 1;i++){
        for(j = 0;j < n;j++)System.out.printf("%5d", a[i][j]);
        System.out.printf("%5d%n", a[i][j]);
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 24560
#B
N, M, C = map(int,input().split())
BM = list(map(int, input().split())) #M
cnt = 0
for i in range(N):
    AM = list(map(int, input().split())) #M
    comp = C
    for j in range(M):
        comp += BM[j] * AM[j]
    if comp > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
#!/usr/bin/env python3

N, M = map(int, input().split())
ps = [list(input().split()) for _ in range(M)]
pen = [0]*N
rig = [0]*N

for i in range(M):
    if ps[i][1] == "AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1] == 0:
            pen[int(ps[i][0])-1] += 1

cnt1, cnt2 = 0, 0
for i in range(N):
    if rig[i] == 1:
        cnt1 += rig[i]
        cnt2 += pen[i]

print(cnt1, cnt2)

Measured memory_bytes: 27464
// https://atcoder.jp/contests/abc129/tasks/abc129_c

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int MOD = 1'000'000'007;

int N, M;
// int a[M_MAX];
int f[N_MAX + 1];
int dp[N_MAX + 1];

void solve() {
  // DUMP(f, N + 1);
  dp[0] = 1;
  REP(i, N) {
    FOR(j, 1, 2) if (i + j <= N && f[i + j] == 0) dp[i + j] = (dp[i + j] + dp[i]) % MOD;
  }
  // DUMP(dp, N + 1);
  printf("%d\n", dp[N]);
}

void input() {
  scanf("%d%d", &N, &M);
  REP(i, M) {
    int a;
    scanf("%d", &a);
    f[a] = 1;
  }
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	
	string str;
	cin >> str;
	
	if(str[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	
	int rc = 0;
	
	for(int i = 2;i < str.size() - 1;i++){
		if(str[i] == 'C')rc++;
	}
	
	if(rc != 1){
		cout << "WA" << endl;
		return 0;
	}
	
	int cou = 0;
	REP(i,str.size()){
		if(str[i] >= 'a' && str[i] <= 'z')cou++;
	}
	
	if(cou != str.size() - 2){
		cout << "WA" << endl;
		return 0;
	}
	
	cout << "AC" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>
//#include <functional>
//#include <cmath>

int64_t GetGcd(int64_t big, int64_t small){
    int64_t res = big % small;
    if(res == 0){
        return small;
    }
    else{
        return GetGcd(small, res);
    }
}

int64_t GetNumMulti(int64_t begin, int64_t end, int64_t factor){
    int64_t res = end/factor - begin/factor;
    if(begin % factor == 0){
        res++;
    }
    return res;
}

int main(){
    int64_t A,B,C,D;
    std::cin >> A >> B >> C >> D;
    
    //from A to B, check %C, %D -> 10^18
    //%C == 0, %D == 0, %C==0 and %D==0
    //Num(%C==0) ... B/C -A/C + 1
    //Num(%C==0 && %D==0) ... Num(%MCM == 0)

    //Find MCM
    //C*D / GCD
    int64_t gcd = 1;
    if(C >= D){
        gcd = GetGcd(C, D);
    }
    else{
        gcd = GetGcd(D, C);
    }
    int64_t lcm = C * D / gcd;

    int64_t num_modC = GetNumMulti(A, B, C);
    int64_t num_modD = GetNumMulti(A, B, D);
    int64_t num_modCD = GetNumMulti(A, B, lcm);
    int64_t res = (B - A + 1) - num_modC - num_modD + num_modCD;
    //std::cout << "gcd,mcm,num_modC,num_modD,num_modCD = " << gcd << "," << lcm << "," << num_modC << "," << num_modD << "," << num_modCD;
    std::cout << res;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  vector<int> A(3);
  for(auto& a : A) cin >> a;
  using Tuple = std::tuple<ui, ui, ui>;
  vector<Tuple> S{
    Tuple{0, 1, 2},
    Tuple{0, 2, 1},
    Tuple{1, 0, 2},
    Tuple{1, 2, 0},
    Tuple{2, 1, 0},
    Tuple{2, 0, 1},
  };

  vector<int> res{};
  for(const auto& s : S)
  {
    int a{};
    a += std::abs( A[std::get<1>(s)] - A[std::get<0>(s)] );
    a += std::abs( A[std::get<2>(s)] - A[std::get<1>(s)] );

    res.push_back(a);
  }

  cout << *boost::min_element(res) << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int A, B, C, D;
ll dp[3010][3010][2];

void solve() {
	cin >> A >> B >> C >> D;
	dp[A][B][0] = 1;
	rep(i, A, C + 1) {
		rep(j, B, D + 1) {
			rep(k, 0, 2) {
				if(k == 1) {
					ADD(dp[i + 1][j][0], dp[i][j][k]); //use
					ADD(dp[i][j + 1][1], dp[i][j][k] * i % mod); //don't use
				}
				else {
					ADD(dp[i + 1][j][0], dp[i][j][k] * j % mod);
					ADD(dp[i][j + 1][1], dp[i][j][k] * i % mod);
				}
			}
		}
	}
	cout << (dp[C][D][0] + dp[C][D][1]) % mod << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}




Measured memory_bytes: 144848
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let (sx, sy, tx, ty): (isize, isize, isize, isize) = (read(), read(), read(), read());
    let tx = (tx - sx) as usize;
    let ty = (ty - sy) as usize;
    let mut ans = "".to_owned();
    // 0, 0の右からtx, tyの下
    ans += &"R".to_owned().repeat(tx);
    ans += &"U".to_owned().repeat(ty);
    // tx, tyの右から0, 0の下
    ans += "R";
    ans += &"D".to_owned().repeat(ty + 1);
    ans += &"L".to_owned().repeat(tx + 1);
    ans += "U";
    // 0, 0の上からtx, tyの左
    ans += &"U".to_owned().repeat(ty);
    ans += &"R".to_owned().repeat(tx);
    // tx, tyの上から0, 0の左
    ans += "U";
    ans += &"L".to_owned().repeat(tx + 1);
    ans += &"D".to_owned().repeat(ty + 1);
    ans += "R";

    println!("{}", ans);
}


Measured memory_bytes: 2128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main() {
  int n; cin >> n;
  map<int, int> mp1, mp2;

  for (int i = 0; i < n; i++) {
    int v; cin >> v;
    if (i & 1) { // odd
      mp1[v]++;
    } else { // even
      mp2[v]++;
    }
  }
  vector<pair<int, int>> vp1, vp2;
  for (auto it = mp1.begin(); it != mp1.end(); it++) {
    int ele = it->first;
    int cnt = it->second;
    vp1.push_back(make_pair(cnt, ele));
  }
  vp1.push_back(make_pair(0, -1));
  for (auto it = mp2.begin(); it != mp2.end(); it++) {
    int ele = it->first;
    int cnt = it->second;
    vp2.push_back(make_pair(cnt, ele));
  }
  vp2.push_back(make_pair(0, -1));
  sort(vp1.begin(), vp1.end(), greater<pair<int, int>>());
  sort(vp2.begin(), vp2.end(), greater<pair<int, int>>());

  if (vp1[0].second != vp2[0].second) {
    cout << n-vp1[0].first-vp2[0].first << endl;
  } else {
    cout << min(n-vp2[0].first-vp1[1].first, n-vp1[0].first-vp2[1].first) << endl;
  }
  return 0;
}

Measured memory_bytes: 6136
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;


int main(void){
	int n;
	cin >> n;
	int h;
	cin >> h;
	int ans=0,cnt=0;
	rep(i,n-1){
		int here;
		cin >> here;
		if(h >= here)cnt++;
		else{
			if(ans < cnt)ans = cnt;
			cnt = 0;
		}
	  	h = here;
	}
	if(ans < cnt)ans = cnt;

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
s = gets.chomp.split('T').map(&:length)
obj = gets.chomp.split.map(&:to_i)
cmd = [s.select.with_index{|e, i|i % 2 == 0},
	s.select.with_index{|e, i|i % 2 == 1}]
cmd.each_with_index do |c,i|
	cur = 0
	if i==0
		cur = c.shift || 0
	end
	c.sort!.reverse!
	while nxt = c.shift
		if obj[i]<=cur
			cur -= nxt
		else
			cur += nxt
		end
	end
	if obj[i]!=cur
		puts "No"
		exit
	end
end
puts "Yes"

Measured memory_bytes: 2044
#include <iostream>

int main() {
    char x, y;
    std::cin >> x >> y;

    if (x == y) {
        std::cout << "=" << std::endl;
    } else if (x < y) {
        std::cout << "<" << std::endl;
    } else {
        std::cout << ">" << std::endl;
    }
}



Measured memory_bytes: 3596
#include <stdio.h>
 
int main()
{
   
  int A[100];
  int i=0, j=0, N=0, minj=0,a, n=0;
   
  scanf("%d", &N);
  for(i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
   
  for(i=0; i<=N-1; i++){
    minj = i;
    for(j=i; j<=N-1; j++){
      if(A[j] < A[minj]){
    minj = j;
      }
    }
    a = A[i];
    A[i] = A[minj];
    A[minj] = a;
    if(minj != i){
      n++;
    }
  }
  for(i=0; i<N; i++){
    printf("%d", A[i]);
    if(i == N-1) printf("\n");
    else printf(" ");
  }
  printf("%d\n", n);
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#include <map>
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main() {
    fastIO
    int a[101]={0};
    int x,n;
    cin>>x>>n;
    map<int,int>b;
    for (int i=0;i<n;i++) {
            cin>>a[i];
            b[a[i]]++;
    }

    for (int i=0;i<=100;i++) {
        if (b[x-i]==0) {
            cout<<x-i<<endl;
            break;
        }
        if (b[x+i]==0) {
            cout<<x+i<<endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3660
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int max = 0;
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		int p;
		cin >> p;
		sum += p;
		if (max < p) max = p;
	}
	cout << sum - max / 2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string S;
    cin >> S;
    int B = 0;
    ll ans = 0;
    for (const char c : S)
    {
        if (c == 'B')
        {
            ++B;
        }
        else
        {
            ans += B;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<list>
#include<map>
#include<stack>
#define ll long long
using namespace std;
const double pi=acos(-1);
int main()
{
	double a,b,v;
	scanf("%lf%lf%lf",&a,&b,&v);
	if(a*a*b>=2*v)
	{
		double x=2*v/(a*b);
		double arc=atan(b/x);
		double ans=arc*180/(pi);
		printf("%.10f",ans);
	}
	else
	{
		v=a*a*b-v;
		double x=2*v/(a*a);
		double arc=atan(a/x);
		double ans=90-arc*180/(pi);
		printf("%.10f",ans);
	}
} 

Measured memory_bytes: 640
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(void) {
	long int N[1000];
	long int a, b,ans;
	N[0] = 1;
	for (int i = 1;i < 1000;i++) {
		N[i] = N[i - 1] + i+1;
	}
	cin >> a >>b;
	cout << N[b-a-1]-b << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  
  int N,W;

  cin >>N>>W;

  int v[N+1],w[N+1];
  int dp[N+1][W+1];
  
  for(int i=1 ; i <= N ; i++)cin >>v[i]>>w[i];

  for(int i=0 ; i <= N ; i++)dp[i][0]=0;
  for(int i=0 ; i <= W ; i++)dp[0][i]=0;
  
  for(int i=1 ; i <= N ; i++){
    for(int j=1 ; j <= W ; j++){
      if(w[i] <= j){
	dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      }else{
	dp[i][j]=dp[i-1][j];
      }
    }
  }
  
  cout <<dp[N][W]<<endl;
  
  return 0;
}

Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int main (){
  int N;
  cin>>N;
  vector<int64_t> sum(87);
  sum[0]=2;
  sum[1]=1;
  for(int i=2;i<=N;i++){
    sum[i]=sum[i-1]+sum[i-2];
  }
  cout<<sum[N]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[])
{
	double n, k, i, j;
	double prob;
	double tmp;
	cin >> n >> k;

	for (i = 1; i <= n; i++) {
		tmp = 1.0 / n;
		if (i >= k) {
			prob += tmp;
			continue;
		}
		for (j = 2;; j *= 2) {
			tmp *=  0.50;
			if (i * j >= k)
				break;
		}
		prob += tmp;
	}
	cout << fixed << setprecision(12) << prob << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

const ll inf = 1LL<<60;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m; cin >> n >> m;
    vector<ll> div;
    for(ll i=1; i*i<=m; ++i){
        if(m%i == 0){
            div.push_back(i);
            if(m/i != i) div.push_back(m/i);
        }
    }
    sort(div.begin(), div.end(), greater<ll>());

    for(auto d:div){
        if(m/d >= n){
            cout << d << endl;
            return 0;
        }
    }

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define rep(i, n)  for (int i = 0; i < (n) ; ++i)
#define mod 1000000007

using namespace std;
using ll = long long;
const ll INF = 100000000;


int main() {
    int x;
    cin >> x;

    if (x >= 400 && x < 600) {
    cout<< 8;
    }else if (x >= 600 && x < 800) {
        cout<< 7;
    } else if (x >= 800 && x < 1000) {
        cout<< 6;
    } else if (x >= 1000 && x < 1200) {
        cout<< 5;
    }else if (x >= 1200 && x < 1400) {
        cout<< 4;
    }else if (x >= 1400 && x < 1600) {
        cout<< 3;
    }else if (x >= 1600 && x < 1800) {
        cout<< 2;
    }else if (x >= 1800 && x < 2000) {
        cout<< 1;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct UnionFind {
	vector<int> par,rank;
	int N;

	UnionFind(int n) {
		N = n;
		par.resize(n);
		rank.resize(n);

		rep(i,n) {
			par[i] = i;
			rank[i] = 0;
		}
	}

	int find(int x) {
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}

	void unite(int x,int y) {
		x = find(x);
		y = find(y);

		if(x == y) return;

		if(rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x,int y) {
		return find(x) == find(y);
	}

	int size() {
		int cnt = 0;
		rep(i,N) if(find(i) == i) cnt++;
		return cnt;
	}
};

int main() {
	int n, q;
	cin >> n >> q;

	UnionFind uf(n);
	rep(i, q) {
		int a, b, c;
		cin >> a >> b >> c;

		if(a == 0) {
			uf.unite(b, c);
		} else {
			if(uf.same(b, c)) {
				cout << 1 << endl;
			} else {
				cout << 0 << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc085_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, Y;
  cin >> N >> Y;

  rep(i, N + 1) {
    rep(j, N + 1) {
      int res = (Y - (10000 * i + 5000 * j));
      int n = N - i - j;
      if (n < 0) break;
      if (res == 1000 * n) {
        printf("%d %d %d", i, j, n);
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;


int main(){
	long long int  a,b[1000010],c,d,e,f,g,h,i;
  cin >> a ;
  
  for(int i=0;i<a;i++){
    cin >> b[i];
    
  }
  sort(b,b+a);
  d = 0;
  g = 0;
    while(i<a){
      c =b[i],e =0; 
  while(i<a && c==b[i]) e++ ,i++;
      g += e%2;
    }
  cout << g << endl;
  
 return 0;
}
      
  
  
  


Measured memory_bytes: 2432
#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll a, v, b, w, t; cin>>a>>v>>b>>w>>t;
  if(w>=v) { cout<<"NO"<<endl; return 0;}
  if(abs(a-b)<=(v-w)*t)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;

int main(void){
	int a, b, r;
	cin >> a >> b;

	while(a % b != 0){
		r = a % b;
		a = b;
		b = r;
	}

	printf("%d\n", b);

	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
int main(void){
    string s;
    cin>>s;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R'){
        cout<<3<<endl;
    }
    else if(s[0]=='R'&&s[1]=='R'){
        cout<<2<<endl;
    }else if(s[1]=='R'&&s[2]=='R'){
        cout<<2<<endl;
    }else if(s[0]=='S'&&s[1]=='S'&&s[2]=='S'){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cassert>
#include <memory>

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    
    int ans = 0;
    
    for (int i = 100; i > 0; i--) {
        for (int j = 0; j < n; j++) {
            if (h[j] == i) {
                if (j == 0 || h[j - 1] != i) {
                    ans++;
                }
            }
        }
        
        for (int j = 0; j < n; j++) {
            if (h[j] == i) {
                h[j]--;
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  ll mini, maxi, ans;
  if(n % 2 == 0) {
    mini = (a[n / 2 - 1] + a[n / 2]);
    maxi = (b[n / 2 - 1] + b[n / 2]);
    ans = (maxi - mini);
    ans += 1;
  } else {
    mini = a[(n + 1) / 2 - 1];
    maxi = b[(n + 1) / 2 - 1];
    maxi += 1;
    ans = maxi - mini;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6380
#include <iostream>
#include <vector>

using namespace std;

static int H, W;

char count_mine(vector<string>& layout, int y, int x) {
    int count = 0;

    // 左上、右上
    if (y - 1 >= 0 && x - 1 >= 0 && layout.at(y - 1).at(x - 1) == '#') count++;
    if (y - 1 >= 0 && x + 1 < W && layout.at(y - 1).at(x + 1) == '#') count++;

    // 上、下
    if (y - 1 >= 0 && layout.at(y - 1).at(x) == '#') count++;
    if (y + 1 < H && layout.at(y + 1).at(x) == '#')count++;

    // 左、右
    if (x - 1 >= 0 && layout.at(y).at(x - 1) == '#') count++;
    if (x + 1 < W && layout.at(y).at(x + 1) == '#') count++;

    // 左下、右下
    if (y + 1 < H && x - 1 >= 0 && layout.at(y + 1).at(x - 1) == '#') count++;
    if (y + 1 < H && x + 1 < W && layout.at(y + 1).at(x + 1) == '#') count++;

    return static_cast<char>(count + '0');
}

int main()
{
    cin >> H >> W;

    using vs = vector<string>;
    using vvc = vector<vector<char>>;

    vs layout(H);
    for (int i = 0; i < H; i++) {
        cin >> layout.at(i);
    }

    // 地雷の数を数える

    vvc count_layout(H, vector<char>(W));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (layout.at(i).at(j) == '#')
                count_layout.at(i).at(j) = layout.at(i).at(j);
            else
                count_layout.at(i).at(j) = count_mine(layout, i, j);
        }
    }

    // 結果を出力
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << count_layout.at(i).at(j);
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>

#include <algorithm>
using namespace std;

int main() {
  
   string l;
   int n=0;
  
 
  
  std::vector<string> vec(100);
  
   while(cin>>l){
     
     vec[n] = l;
    
        n++;
    }
   
   string a = vec[0];
   string b = vec[1];
   string c = vec[2];
 
   cout << a[0] << b[1] << c[2]<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cassert>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll, pll> tll;
const ll INF = 1e18;

struct State{
  ll dis, u, v, flag;
  State(ll a, ll b, ll c, ll d):dis(a), u(b), v(c), flag(d) {}
  bool operator<(const State &a) const {
    return dis > a.dis;
  }
};

int main(){
  ll n, m;
  cin >> n >> m;
  vector< vector<pll> > g(n);
  for(int i=0;i<m;i++){
    int x,y,t;
    cin >> x >> y >> t; x--; y--;
    g[x].emplace_back( make_pair(t,y) );
    g[y].emplace_back( make_pair(t,x) );
  }
  ll v,a,b,c;
  cin >> v >> a >> b >> c;

  vector< vector< vector<ll> > > d(n, vector< vector<ll> >(c, vector<ll>(2,INF)));
  assert(v<c);
  d[0][v][0] = 0;
  priority_queue<State> q;
  q.emplace( State(0,0,v,0) );

  while(not q.empty()){
    State state = q.top(); q.pop();
    ll dis = state.dis, u = state.u, v = state.v, flag = state.flag;
    if(d[u][v][flag] < dis) continue;

    ll nv = (a*v + b) % c;
    for(auto e : g[u]){
      ll ndis = dis + v*e.first, nu = e.second, nflag = (nu==n-1) ? 1 : flag;
      if(d[nu][nv][flag] > ndis){
        d[nu][nv][flag] = ndis;
        q.emplace( State(ndis, nu, nv, nflag) );
      }
    }
  }

  ll ans = INF;
  for(int i=0;i<c;i++) ans = min(ans, d[0][i][1]);
  cout << ans << endl;
}



Measured memory_bytes: 11892
#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

ll a[3005], dp[3005][3005];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    for (int len = 1; len <= n; len++) {
        for (int l = 1, r; l + len - 1 <= n; l++) {
            r = l + len - 1;
            dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1]);
        }
    }
    cout << dp[1][n] << endl;
	return 0;
}


Measured memory_bytes: 70016