akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//もうなにがなにやら

int N, M;
int KM[100001];
vector<int> V[100001];
vector<ll> D[100001][2];
map<int, pair<ll, ll>> dp[100001];
map<int, int> BB[100001];
int C[100001];

void update(int x, int y, int A) {
	D[x][y][A] = (D[x][y][A * 2] * D[x][y][A * 2 + 1]) % M;
	if (A != 1) update(x, y, A / 2);
}

void add(int x, int y, int A, int B) {
	int C = A + KM[x];
	D[x][y][C] = B;
	update(x, y, C / 2);
}

ll check(int x, int y, int L, int R, int A, int l, int r) {
	if (L <= l && r <= R) return D[x][y][A];
	if (r <= L || R <= l) return 1;
	return (check(x, y, L, R, A * 2, l, (l + r) / 2) * check(x, y, L, R, A * 2 + 1, (l + r) / 2, r)) % M;
}

ll query(int x, int y, int L, int R) {
	return check(x, y, L, R, 1, 0, KM[x]);
}

pair<ll, ll> dfs(int A, int B) {
	if (dp[A][B] != mp(0ll, 0ll)) return dp[A][B];

	if (B == 0) {
		for (int i = 0; i < V[A].size(); i++) {
			auto P = dfs(V[A][i], A);
			add(A, 0, i, (P.first + P.second) % M);
			add(A, 1, i, P.second % M);
		}
		C[A] = 1;
		return mp(query(A, 0, 0, V[A].size() + 1), query(A, 1, 0, V[A].size() + 1));
	}
	else if (C[A]) {
		int kari = BB[A][B];
		ll kuro = query(A, 0, 0, kari) * query(A, 0, kari + 1, V[A].size() + 1) % M;
		ll siro = query(A, 1, 0, kari) * query(A, 1, kari + 1, V[A].size() + 1) % M;
		dp[A][B] = mp(kuro, siro);
		return mp(kuro, siro);
	}
	else {
		ll kuro = 1;
		ll siro = 1;
		for (int i = 0; i < V[A].size(); i++) {
			if (V[A][i] == B) continue;
			auto P = dfs(V[A][i], A);
			kuro = kuro * (P.first + P.second) % M;
			siro = siro * P.second % M;
		}
		dp[A][B] = mp(kuro, siro);
		return mp(kuro, siro);
	}
}


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


	cin >> N >> M;
	rep(i, N - 1) {
		int x, y;
		cin >> x >> y;
		V[x].pb(y);
		BB[x][y] = V[x].size() - 1;
		V[y].pb(x);
		BB[y][x] = V[y].size() - 1;
	}

	rep1(i, N) {
		int kari = 2 * V[i].size() + 10;
		int kari2 = 1;
		while (1 << kari2 < kari) kari2++;
		KM[i] = 1 << kari2 - 1;
		D[i][0].resize((1 << kari2) + 10);
		D[i][1].resize((1 << kari2) + 10);
		rep(j, D[i][0].size()) D[i][0][j] = 1;
		rep(j, D[i][1].size()) D[i][1][j] = 1;
	}
	
	pair<int, int> E[100001];
	rep(i, N) E[i] = mp(V[i + 1].size(), i + 1);
	sort(E, E + N);
	reverse(E, E + N);

	ll kotae[100001];
	rep(i, N) {
		kotae[E[i].second] = dfs(E[i].second, 0).first;
	}
	rep1(i, N) co(kotae[i]);

	Would you please return 0;
}

Measured memory_bytes: 107264
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

bool is_valid(ll num)
{
    unordered_set<int> num_set ={3,5,7};
    while (num>0)
    {
        int now = num%10;
        num/= 10;
        if(num_set.count(now)>0) num_set.erase(now);
    }
    return num_set.size() == 0;
}

int cnt=0;
int N;
void dfs(vector<ll> &cands)
{
    {
        vector<ll> new_cands;
        for (auto cand: cands)
        {
            for (auto n: {3,5,7})
            {
                long long now = cand*10+n;
                if (now <= N)
                    new_cands.push_back(now);
            }
        }
        swap(cands, new_cands);
    }
    for (auto cand: cands)
        if (is_valid(cand))
            ++cnt;
    
    if (cands.size() == 0) return;
    dfs(cands);
}
int main()
{
    cin >> N;
    vector<ll> cands={0};
    dfs(cands);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,K,R,S,P;
string str,str2,T;

bool ok[100005]={};
int main() {
	
	cout << fixed << setprecision(18);
	cin>>N>>K>>R>>S>>P>>T;
	long long int res=0;
	for(int i=0;i<K;i++){
		if(T[i]=='r'){res+=P;}
		else if(T[i]=='s'){res+=R;}
		else{res+=S;}
		ok[i]=true;
	}
	for(int i=K;i<N;i++){
		if(T[i]=='r'&&((T[i-K]=='r'&&!ok[i-K])||T[i-K]!='r')){res+=P;ok[i]=true;}
		else if(T[i]=='s'&&((T[i-K]=='s'&&!ok[i-K])||T[i-K]!='s')){res+=R;ok[i]=true;}
		else if(T[i]=='p'&&((T[i-K]=='p'&&!ok[i-K])||T[i-K]!='p')){res+=S;ok[i]=true;}
	}
	cout<<res<<endl;
} 

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int n;
int main()
{
    cin>>n;
    if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9 ){
        cout<<"hon"<<endl; return 0;
    }
    if (n%10 == 3){cout<<"bon"<<endl; return 0;}
    cout<<"pon"<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0;
    int ct = 0;
    bool flag = false;
    repd(i, 1, N) {
        if (A[i] > ct + 1) {
            ans = -1;
            ct = 0;
            break;
        }
        else if (A[i] == ct + 1) {
            ct = A[i];
        }
        else {
            ans += ct;
            ct = A[i];
        }
    }

    ans += ct;
    if (A[0] >= 1) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PP;
const int mod = 1000000007;

bool is_boin(char c) { return c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'; }
string make_code(string s, int k)
{
    string res = "";
    res += s[0];
    bool f = false;
    if (is_boin(s[0]))
        f = true;
    Rep(i, 1, s.size())
    {
        if (f && res.size() < k)
            res += s[i];
        f = is_boin(s[i]);
    }
    return res;
}

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

    int N;
    while (1)
    {
        cin >> N;
        if (N == 0)
            break;
        int ans = -1;
        vector<string> s(N);
        rep(i, N) cin >> s[i];
        Rep(k, 1, 51)
        {
            set<string> st;
            bool f = true;
            rep(i, N)
            {
                string t = make_code(s[i], k);
                if (st.find(t) == st.end())
                    st.insert(t);
                else
                    f = false;
            }
            if (f && ans == -1)
                ans = k;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3204
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
int max(const void *a, const void *b){return *(int*)b - *(int*)a;}

int x[200010];
int y[200010];

int main(void)
{
    int k,lx,ly,nx,ny,c;
    scanf("%d",&k);
    scanf("%d",&lx);
    scanf("%d",&ly);

    nx = 0;
    ny = 0;
    c =0;
    while(1)
    {
        int dm,nm;
        nm = abs(nx-lx)+abs(ny-ly);
        dm = abs(k - nm);
        //距離を詰める
        if(dm > k)
        {
            int rk;
            rk = k;
            if(abs(nx-lx) <= rk)
            {
                rk -= abs(nx-lx);
                nx = lx;
                if(ny < ly)
                {
                    ny += rk;
                }else{
                    ny -= rk;
                }
            }else{
                if(nx < lx)
                {
                    nx += rk;
                }else
                {
                    nx -= rk;
                }
            }
            x[c] = nx;
            y[c] = ny;
            c++;
        }else{
            if( (dm %2==1) && (k%2==0) )
            {
                printf("-1\n");
                return 0;
            }

            if( dm == 0) break;

            if( (dm %2==0) && (k%2==1) )
            {
                int t,dx,dy,dirx,diry;
                t = ( nm - 1 ) / 2;
                dx = abs(nx-lx);
                dy = abs(ny-ly);
                dirx = lx >= nx ? 1: -1;
                diry = ly >= ny ? 1: -1;

                if(dx>dy)
                {
                    nx += dirx * t; /* t近づく */
                    ny += (-diry) * (k-t); /* t離れる */
                }else
                {
                    nx += (-dirx) * (k-t); 
                    ny += diry * t; 
                }
                x[c] = nx;
                y[c] = ny;
                c++;
            }
            {
                int t,dx,dy,dirx,diry;
                nm = abs(nx-lx)+abs(ny-ly);
                t = nm / 2;
                dx = abs(nx-lx);
                dy = abs(ny-ly);
                dirx = lx >= nx ? 1: -1;
                diry = ly >= ny ? 1: -1;

                if(dx>dy)
                {
                    nx += dirx * t; /* t近づく */
                    ny += (-diry) * (k-t); /* t離れる */
                }else
                {
                    nx += (-dirx) * (k-t); 
                    ny += diry * t; 
                }
                x[c] = nx;
                y[c] = ny;
                c++;
            }
            

            break;
        }

    }
    x[c] = lx;
    y[c] = ly;
    c++; 

    printf("%d\n", c);
    for(int i=0;i<c;i++)
    {
        printf("%d %d\n", x[i],y[i]);
    }

    return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    String[] str2 = sc.nextLine().split(" ");
    int x = Integer.parseInt(str1[0]);
    int n = Integer.parseInt(str1[1]);
    int index = x;

    int[] num = new int[102];

    for(int i = 0 ; i < 102;i++) {
      num[i] = i;
    }
    

    for(int i = 0;i < n;i++) {
      num[Integer.parseInt(str2[i])] = -1;
    }
    int minIndex = -1;
    int maxIndex = -1;

    for(int i = 0 ; i < 102;i++) {
      if(i < index) {
        if(num[i] != -1) {
          minIndex = i;
        }
      }else {
        if(num[i] != -1) {
          maxIndex = i;
          break;
        }
      }
    }

    int ans = 0;
    if(minIndex != -1 && maxIndex != -1) {
      if(x - num[minIndex] <= num[maxIndex] - x) {
        ans = num[minIndex];
      }else {
        ans = num[maxIndex];
      }
    }else if(minIndex != -1 && maxIndex == -1) {
      ans = num[minIndex];
    }else {
      ans = num[maxIndex];
    }

    System.out.println(ans);

  }

}


Measured memory_bytes: 35692
using System;
class Program
{
	static void Main(string[] args)
	{
		 string[] line = System.Console.ReadLine().Trim().Split(' ');
		 var a = ulong.Parse(line[0]);
		 var b = ulong.Parse(line[1]);
		 Console.WriteLine(Math.Min(a%b,(a+b)/b*b-a));
	}
}


Measured memory_bytes: 13140
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n , k;
    cin >> n >> k;

    ll ans = 0;
    for (int i = 0; i < n; i++){
        if (i == 0) {
            ans += k;
        }else { 
            ans *= k-1;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>


int main(){
	int i;
	int z=0;
	int q=0;
char s[50];
char w[50];
char a[100];
scanf("%s",s);
scanf("%s",w);

	for(i=0;i<strlen(s)+strlen(w);i++){
		if((i+1)%2==0){
			
			a[i]=w[z];
			
			z++;
			
			
		}else{
			
			a[i]=s[q];
			q++;
		}
	
		
		
		
		
		
	}
for(i=0;i<strlen(s)+strlen(w);i++){
	
	printf("%c",a[i]);
	
	
}

	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

double stod (string s )
{
	stringstream ss (s);
	double res;
	ss >> res;

	return res;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.sme", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		vector <string> exp;
		stringstream ss(str);
		string s = "";

		while (ss >> s){
			exp.push_back(s);
		} // end if
	
		stack<double> S;
		int size = exp.size();
		double res = 0.0;
		int i;
		
		for (i = 0; i < size; ++i){
			if ( isdigit(exp[i][0] ) 
			|| ( exp[i].length() > 1 && exp[i][0] == '-' && isdigit(exp[i][1] ) ) ){
				S.push(stod(exp[i] ) );
			}else{
				double b = S.top(); S.pop();
				double a = S.top(); S.pop();
				
				char ope = exp[i][0];

				switch (ope){
					case '+': res = a + b; break;
					case '-': res = a - b; break;
					case '*': res = a * b; break;
					case '/': res = a / b; break;
				} // end switch
				S.push (res);
			} // end if
		} // end for

		res = S.top();
		
		printf ("%.6f\n", res );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
//#define ll long long
//#define INF LONG_MAX
using namespace std;

int main() {
  string S;
  cin >> S;
  int count = 0;
  for (int i = 0; i < 6; i++) {
    if(S[i] == '1') count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int d=n%10;
    if(d==2 || d==4 || d==5 || d==7 || d==9)
    cout<<"hon";
    else if(d==0 || d==1 || d==6 || d==8)
    cout<<"pon";
    else 
    cout<<"bon";
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


ll a[MAX], b[MAX];



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


  cin >> n;
  rep(i, n + 1) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) {
    if (b[i] < a[i]) {
      ans += b[i];
      a[i] -= b[i];
      b[i] = 0;
    }
    else {
      ans += a[i];
      b[i] -= a[i];
      a[i] = 0;
    }

    if (b[i] < a[i + 1]) {
      ans += b[i];
      a[i + 1] -= b[i];
      b[i] = 0;
    }
    else {
      ans += a[i + 1];
      b[i] -= a[i + 1];
      a[i + 1] = 0;
    }
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 1792
#include <iostream>

#define BUILDING_COUNT 4
#define FLOOR_COUNT 3
#define ROOM_COUNT 10

int main(void) {
  int residents[BUILDING_COUNT][FLOOR_COUNT][ROOM_COUNT] = {0};
  int n = 0;

  std::cin >> n;

  for (int i = 0; i < n; i++) {
    int b = 0;
    int f = 0;
    int r = 0;
    int v = 0;

    std::cin >> b >> f >> r >> v;

    residents[b - 1][f - 1][r - 1] += v;
  }

  for (int i = 0; i < BUILDING_COUNT; i++) {
    for (int j = 0; j < FLOOR_COUNT; j++) {
      for (int k = 0; k < ROOM_COUNT; k++) {
	std::cout << " " << residents[i][j][k];
      }
      
      std::cout << std::endl;      
    }

    if (i < (BUILDING_COUNT - 1)) {
      std::cout << "####################" << std::endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r);
void solve();


int main() {
    int k;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> k;
        pre.push_back(k);
    }
    for (int i = 0; i < n; i++) {
        cin >> k;
        in.push_back(k);
    }

    solve();
}


void rec(int l, int r) {
    if (l >= r) return ;
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m + 1, r);
    post.push_back(root);
}

void solve() {
    pos = 0;
    rec(0, pre.size());
    for (int i = 0; i < n; i++) {
        if ( i ) cout << " ";
        cout << post[i];
    }
    cout << "\n";
}



Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int>> adj[MAX];

void dijkstra()
{
  priority_queue<pair<int, int>> PQ;
  int color[MAX];
  int d[MAX];
  for (int i = 0; i < n; i++)
  {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while (!PQ.empty())
  {
    pair<int, int> f = PQ.top();
    PQ.pop();

    int u = f.second;
    color[u] = BLACK;

    // 最小値を取り出し、それが最短でなければ無視
    if (d[u] < f.first * (-1))
    {
      continue;
    }

    for (int j = 0; j < adj[u].size(); j++)
    {
      int v = adj[u][j].first;
      if (color[v] == BLACK)
      {
        continue;
      }
      if (d[v] > d[u] + adj[u][j].second)
      {
        d[v] = d[u] + adj[u][j].second;
        // priority_queueはデフォルトで大きい値を優先するため-1を掛ける
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }
  }

  for (int i = 0; i < n; i++)
  {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main()
{
  int k, u, v, c;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> u >> k;
    for (int j = 0; j < k; j++)
    {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}


Measured memory_bytes: 8016
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

typedef long long ll;

struct BC
{
  bool operator<(
    const BC & rhs
  )
  {
    return C < rhs.C;
  }
  ll B;
  ll C;
};

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  auto * const a = &A[0];
  for (ll i = 0; i < N; ++i)
    cin >> a[i];
  vector<BC> _BC(M);
  auto * bc = &_BC[0];
  for (ll i = 0; i < M; ++i)
    cin >> bc[i].B >> bc[i].C;
  sort(a, a + N);
  sort(_BC.rbegin(), _BC.rend());
  bc = &_BC[0];
  ll j = 0;
  for (ll i = 0; i < N; ++i)
  {
    if (bc[j].C <= a[i])
      break;
    a[i] = bc[j].C;
    --bc[j].B;
    if (0 == bc[j].B)
      ++j;
    if (M == j)
      break;
  }
  cout << accumulate(a, a + N, static_cast<ll>(0));
  return 0;
}


Measured memory_bytes: 2560
fun main(args: Array<String>) {
  val S = readLine()!!
  var r = ""
  for(s in S){
    when(s){
      '0' -> r += "0"
      '1' -> r += "1"
      else -> r = when(r.length){
        0, 1 -> ""
        else -> r.substring(0, r.length-1)
      }
    }
  }
  println(r)
}

Measured memory_bytes: 33364
#include <stdio.h>

int main () {

    int i, j, n;
    int a[45];

    a[0] = 1;
    a[1] = 1;

    for (i = 2; i < 45; i++) {
        a[i] = a[i - 1] + a[i - 2];
    }

    scanf("%d", &n);

    printf("%d\n", a[n]);

    return 0;

}


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

int V[4];
string R;

void brute(string s, int sum, int k){
	if(k < 4)
		brute(s + "-" + to_string(V[k]), sum - V[k], k + 1), brute(s + "+" + to_string(V[k]), sum + V[k], k + 1);
	else if(sum == 7) R = s + "=7"; 
}

int main(){
	for(int i = 0; i < 4; i++) V[i] = cin.get() - '0';
	brute(to_string(V[0]), V[0], 1);
	cout << R << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = l; i<r;i++)
#define dec(i, l, r) for (int i = l; i>=r;i--)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int,int>>
#define ii pair<int,int>
#define   max(a, b) (((a)<(b))?b:a)
#define min(a, b) ((a>b)?b:a)
#define mp(i, j) make_pair(i,j)
#define ull unsigned long long int
#define ll  long long int
#define pie 3.141592653589793238
#define inf ((ll)1e18)
#define eps 1e-14
#define mod ((int)1e9+7)
#define maxlg 18
#define maxn 400002
#define left(i) ((i)<<1)
#define right(i) (((i)<<1)+1)

vii adj[maxn];
int dist[maxn];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
 #endif
   int n,k;
    cin>>k>>n;
    if (k&1) {
        stack<int> stk;
        rep (i,0,n)
        stk.push ((k+1)/2);

        int del = n-1;
        int elem = n;
        int add=0;
        if ((n&1)==0)add++;
        rep (i,0,(n)/2) {
            int toDel = stk.top();

            stk.pop();

            if (toDel-1!=0) {
                stk.push(toDel-1);
                while(stk.size()!=n) {

                    stk.push(k);

                }
            }






        }

        int m = stk.size();
        rep (i,0,m) {
            dist[m-1-i] = stk.top();
            stk.pop();
        }
        rep (i,0,m) {
            cout<<dist[i]<<" ";
        }
    } else {
        cout<<k/2<<" ";
        rep (i,0,n-1)cout<<k<<" ";
    }
    return 0;
}
























Measured memory_bytes: 13900
n = gets.to_i
nums = gets.split.map(&:to_i).sort.reverse
sum_a = 0
sum_b = 0

(0...n).each do |i|
  if (i%2).zero?
    sum_a += nums[i]
  else
    sum_b += nums[i]
  end
end

puts sum_a - sum_b

Measured memory_bytes: 1788
S = list(input())
if len(list(set(S))) != 1:
    i =0
    count = 0
    while True:
        if S[i] != S[i+1]:
            count += 1
            S[i] = S[i + 1]
        i += 1
        if i == (len(S)-1):
            break
else:
    count = 0
print(count)
            

Measured memory_bytes: 3956
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n,m,a,b;
  int cc[SIZE] = {};

  scanf("%d%d",&n,&m);

  for(int i=0;i<m;i++){
    scanf("%d%d",&a,&b);

    cc[a-1]++;
    cc[b-1]++;
  }

  for(int i=0;i<n;i++){
    printf("%d\n",cc[i]);
  }
  
  return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(in.hasNext()) {
			int a=in.nextInt();
			if(a>=1800) {
				System.out.println(1);
			}else if(a>=1600) {
				System.out.println(2);
			}else if(a>=1400) {
				System.out.println(3);
			}else if(a>=1200) {
				System.out.println(4);
			}else if(a>=1000) {
				System.out.println(5);
			}else if(a>=800) {
				System.out.println(6);
			}else if(a>=600) {
				System.out.println(7);
			}else if(a>=400) {
				System.out.println(8);
			}
		}
	}
}


Measured memory_bytes: 35664
x,y =map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P =pair<int,int>;

int main(){
    int n;
     cin >> n;
     vector <ll> h(n);
     rep(i,n) cin >> h[i];

     int ans;
     int k;
     ans=0;
     k=0;

     rep(i,n-1){
         if(h[i]<h[i+1]){
             ans=max(ans,k);
             k=0;
         }
         else{
             ++k;
         }
     }
     ans=max(ans,k);

     cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<deque>
#include<iomanip>
#include<algorithm>
#include<set>
#include<queue>
#include<bitset>
#include<stack>
#include<unordered_set>
#include<cstring>
using namespace std;
//	int x=atoi(s.c_str()); s_to_in;
int dx[] = { -1,0,0,1 };
int dy[] = { 0,1,-1 ,0 };
#define endl '\n'
long long mo = 1e9;
const long double P = 3.141592653589793238L;
void trust_yourself()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
long long gcd(long long x, long long y)
{
	if (x == 0)
		return y;
	return gcd(y%x, x);
}
long long fast_power(long long x, long long y, long long mo)
{
	long long p = 1;
	while (y)
	{
		if (y & 1)
			p = (p*x) % mo;
		y = (y >> 1); //y/=2
		x = (x*x) % mo;
	}

	return p;
}
long long convert_to_num(string x) {
	long long  num = 0;
	for (int i = 0; i < x.size(); i++) {
		num *= 2;
		num += x[i] - '0';
	}
	return num;
}

long long com(long long n, long long r) {
	long long p = 1, p1 = 1;
	for (long long i = r + 1; i <= n; i++) {
		p = p * i;
		p /= p1;
		p1++;
	}
	return p;
}


int main()
{
	trust_yourself();
	//freopen("hussien.in", "r", stdin);
	
	int n; set<string>s;
	cin >> n;
	for (string x; n--;) {
		cin >> x;
		s.insert(x);
	}
	cout << s.size();
	return 0;

}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define leps(j,n) for(int j=1; j<(n); j++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

#define return(Z) re:(Z)

long long h[10000010],x[10000010],z[10000010];

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,c;
    cin>>a>>b>>c;

    a=a-b;
    a=a%c;
    cout<<a<<'\n';
}

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

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

  vector<int> a(n);
  int cnt[3];
  fill_n(cnt, 3, 0);  
  for ( int i = 0; i < n; i++ ) cin >> a[i], cnt[a[i]%3]++;
  
  int tmp[3];
  for ( int i = 0; i < 3; i++ ) tmp[i] = cnt[i];

  int ans = 1;
  if ( cnt[1] ) {
    int sum = 1;
    int cnt1 = 1+cnt[0];
    cnt[1]--;
    cnt[0] = 0;
    while ( 1 ) {     
      if ( sum == 1 ) {
	if ( cnt[1] <= 0 ) break;
	cnt1++;
	sum++;
	sum %= 3;
	cnt[1]--;
      } else if ( sum == 2 ) {
	if ( cnt[2] <= 0 ) break;
	cnt1++;	
	sum += 2;
	sum %= 3;
	cnt[2]--;	
      }
    }
    if ( sum == 1 && cnt[2] ) cnt1++;
    else if ( sum == 2 && cnt[1] ) cnt1++;

    ans = max(ans, cnt1);    
  }

  for ( int i = 0; i < 3; i++ ) cnt[i] = tmp[i];
  if ( cnt[2] ) {
    int sum = 2;
    int cnt1 = 1+cnt[0];    
    cnt[2]--;
    cnt[0] = 0;
    while ( 1 ) {
      if ( sum == 1 ) {
	if ( cnt[1] <= 0 ) break;
	cnt1++;
	sum++;
	sum %= 3;
	cnt[1]--;
      } else if ( sum == 2 ) {
	if ( cnt[2] <= 0 ) break;
	cnt1++;
	sum += 2;
	sum %= 3;
	cnt[2]--;	
      }
    }
    if ( sum == 1 && cnt[2] ) cnt1++;
    else if ( sum == 2 && cnt[1] ) cnt1++;
    ans = max(ans, cnt1);    
  }

  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 4680
using System;


namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int tarou = 0;
            int hanako = 0;
            for (int i = 0;i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int ani = string.Compare(input[0], input[1]); 
                if (ani < 0)
                {
                    hanako += 3;
                }
                else if(ani > 0)
                {
                    tarou += 3;
                }
                else
                {
                    hanako += 1;
                    tarou += 1;
                }
          }
            Console.WriteLine(tarou + " " + hanako);
        }
    }
 }

Measured memory_bytes: 10028
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

ans n x = if n >= x
	then 0
	else 1 + ans (n * 101 `div` 100) x

main :: IO ()
main = do
	x <- readLn
	print $ ans 100 x


Measured memory_bytes: 4224
N,x = map(int, input().split())
li = list(map(int, input().split()))
li.sort()
a = 0
an = 0
while a < N:
    x -= li[a]
    if x < 0:
        break
    an += 1
    a += 1
if x > 0:
    an -= 1
print(an)

Measured memory_bytes: 9144
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
map<string,ll>mp;
map<ll,ll>mpp;
int main()
{
    ll n,m,i,j,k,s=0,x;

    cin>>n>>k;

    ll d[k+5];
    while(k--)
    {
        cin>>m;
        //mpp[m]++;
        for(i=0; i<m; i++)
        {

            cin>>x;
            mpp[x]++;
        }
    }
    for(i=1; i<=n; i++)
    {
        if(mpp[i]==0)s++;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3640
#include<stdio.h>
int main()
{
    int a[3][3];
    int f[3][3];
    int i,j;
    for(i=0; i<3; i++)
    {
        for(j=0; j<3; j++)
        {
            scanf("%d",&a[i][j]);
            f[i][j]=0;
        }
    }
    int n;
    scanf("%d",&n);
    int b[n];
    for(i=0; i<n; i++)
    {
        scanf("%d",&b[i]);

        for(j=0; j<3; j++)
        {
            for(int k=0; k<3; k++)
            {
                if(b[i]==a[j][k])
                {
                    f[j][k]=1;
                }

            }
        }
    }
    if(f[0][0]==1&&f[0][1]==1&&f[0][2]==1 ||
            f[0][0]==1&&f[1][0]==1&&f[2][0]==1 ||
            f[0][0]==1&&f[1][1]==1&&f[2][2]==1 ||
            f[0][1]==1&&f[1][1]==1&&f[2][1]==1 ||
            f[0][2]==1&&f[1][2]==1&&f[2][2]==1 ||
            f[1][0]==1&&f[1][1]==1&&f[1][2]==1 ||
            f[2][0]==1&&f[2][1]==1&&f[2][2]==1 ||
            f[2][0]==1&&f[1][1]==1&&f[0][2]==1)
    {
        printf("Yes\n");
    }

    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)


int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
        cin >>a.at(i);
    }
    
    for(int i=n-2;i>=0;i--){ 
        if(a.at(i)-1>a.at(i+1)) {
            cout << "No" << endl;
            return 0;
        }
        if(a.at(i)-1==a.at(i+1)){
            a.at(i)--;
        }
        else continue;
  }

  rep(i,n-1){
      if(a.at(i)>a.at(i+1)) {
          cout << "No" << endl; 
          return 0;
          }
          else continue;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 1024
/*    कर्मण्येवाधिकारस्ते मा फलेषु कदाचन । मा कर्मफलहेतुर्भुर्मा ते संगोऽस्त्वकर्मणि ॥    */
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) cout << (#x) <<"="<< x << endl;
#define bug2( x , y ) cout << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;
#define bug3( x , y , z ) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;
#define bug4( x , y , z , w) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;
#define bug5( x , y , z , w ,p) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;
#define bug6( x , y , z , w ,p , q) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;
#define bugn( x , n ){ cout<<(#x)<<":";for(int i=0;i<n;i++)cout<<(#x)<<"["<<i<<"]:"<< x[i] << "    "; cout<<endl;}
#define bugnm( x , n , m ){ cout<<(#x)<<endl;for(int i=0;i<n;i++){ cout<<"Row #"<<i<<":"; for(int j=0;j<m;j++) cout<<x[i][j]<<"     "; cout << endl;}}
using namespace std;	


int32_t main()
{
	IOS
	int k,a,b;cin>>k>>a>>b;
	if(  a + (k-(a%k))%k <= b ){
		cout<<"OK";
	}
	else cout<<"NG"<<endl;

	
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

void solve(ll n) {
	if (n < 26)
		putchar(n + 'a');
	else {
		solve(n / 26 - 1);
		putchar(n % 26 + 'a');
	}
}

int main() {
	ll n; cin >> n;
	solve(n - 1);
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N, W;
vector<int> w, v;

int main() {
  cin >> N >> W;
  w.resize(N), v.resize(N);

  rep(i, N) cin >> w[i] >> v[i];

  vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));

  rep(i, N) rep(j, W + 1) {
    dp[i + 1][j] = dp[i][j];
    if (j - w[i] >= 0) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
  }

  cout << dp[N][W] << endl;
  return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    
    int d = 0;
    int t = n;
    while (t > 0) {
        d += (t % 10);
        t /= 10;
    }
    
    if (n % d == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
long long n, m, mx0, mx1, my0, my1, c, mn=9e20, x[55], y[55];
int main() {
	long long i, j, i2, j2, x0, x1, y0, y1, k;
	cin>>n>>m;
	for(i=0; i<n; i++) cin>>x[i]>>y[i];
	for(i=0; i<n; i++) for(j=i+1; j<n; j++) {
		x0 = min(x[i], x[j]);
		y0 = min(y[i], y[j]);
		for(i2=0; i2<n; i2++) for(j2=i2+1; j2<n; j2++) {
			x1 = max(x[i2], x[j2]);
			y1 = max(y[i2], y[j2]);
			mx0 = min(x0, x1);
			mx1 = max(x0, x1);
			my0 = min(y0, y1);
			my1 = max(y0, y1);
			c = 0;
			for(k=0; k<n; k++) {
				if(mx0<=x[k] && x[k]<=mx1 && my0<=y[k] && y[k]<=my1) c++;
			}
			if(c>=m) mn = min(mn, (mx1-mx0)*(my1-my0));
		}
	}
	cout<<mn;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	if(n==m)cout<<"Yes";
	else cout<<"No";
	return 0;
}


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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    double d;
    int n; cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        double x, y; cin>>x>>y;
        if (sqrt(x*x + y*y) <= d) ans++;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 3824
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=500005;

LL ans[100];
int n;

int main(){
    ans[0]=2;
    ans[1]=1;
    for(int i=2;i<=86;i++)ans[i]=ans[i-1]+ans[i-2];
    while(~scanf("%d", &n)){
        printf("%lld\n", ans[n]);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){

int x,y;
cin>>x>>y;

int i;
for(i=1;i<999;i++){

    int a=i;
    int b=i+1;
    a=a*(a+1)/2;
    b=b*(b+1)/2;
    if(x<a&&y<b){

        if(a-x==b-y){
            cout<<a-x<<endl;
            return 0;
        }
    }

}
cout<<1<<endl;

return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    vector<int> v1,v2;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(i%2==0)v1.push_back(a);
        else v2.push_back(a);
    }
    n/=2;
    int cnt[2][100010]={};
    for(int i=0;i<n;i++)cnt[0][v1[i]]++;
    for(int i=0;i<n;i++)cnt[1][v2[i]]++;
    int num1[2]={},num2[2]={};
    for(int i=0;i<=100000;i++){
        if(cnt[0][num1[0]]<cnt[0][i]){
            num1[1]=num1[0];
            num1[0]=i;
        }
        else if(cnt[0][num1[1]]<cnt[0][i]){
            num1[1]=i;
        }
        if(cnt[1][num2[0]]<cnt[1][i]){
            num2[1]=num2[0];
            num2[0]=i;
        }
        else if(cnt[1][num2[1]]<cnt[1][i]){
            num2[1]=i;
        }
    }
    int ans=INF;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            if(num1[i]==num2[j])continue;
            int tmp=0;
            for(int k=0;k<n;k++){
                if(v1[k]!=num1[i])tmp++;
                if(v2[k]!=num2[j])tmp++;
            }
            ans=min(ans,tmp);
        }
    }
    cout<<ans<<endl;

}

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

int main(){
    int n;
    cin>>n;
    int p1[50],p2[50];
    for(int i=0;i<n;i++)
    {
        cin>>p1[i];
        p2[i] = p1[i];
    }
    int count=0;
    sort(p1,p1+n);
    for(int i=0;i<n;i++)
    {
        if(p1[i] != p2[i])count++;
    }

    if(count != 0 && count != 2)
    {
        cout<<"NO";
    }else{
        cout<<"YES";
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main() {
    string A, B;
    cin >> A >> B;
    if (A.size() > B.size()) {
        cout << "GREATER\n";
    } else if (A.size() < B.size()) {
        cout << "LESS\n";
    } else {
        rep(i, A.size()) {
            if (A[i] > B[i]) {
                cout << "GREATER\n";
                return 0;
            } else if (A[i] < B[i]) {
                cout << "LESS\n";
                return 0;
            }
        }
        cout << "EQUAL\n";
    }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class A
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());
            var H = int.Parse(Console.ReadLine());
            Console.WriteLine((A + B) * H / 2);
        }
    }
}


Measured memory_bytes: 27172
#include <stdio.h>

int main()
{
    int N,K,i,tmp;
    int count=0,ans=0;

    scanf("%d %d",&N,&K);

    int A[N+1];
    int d[N+1];
    for(i=0;i<=N;i++){
        A[i]=0;
        d[i]=0;
    }
    for(i=0;i<N;i++){
        scanf("%d",&tmp);
        A[tmp]++;
    }

     for(i=0;i<=N;i++){
        d[A[i]]++;
    }

    for(i=N;i>0;i--){
        if(count>=K){
            ans += i*d[i];
        }else if(count+d[i]>K){
            ans += i*(count+d[i]-K);
        }
        count += d[i];
    }

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

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  int n; cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  vector<int> g1(n+1), g2(n+1);
  g1[0] = 0;
  REP(i,n) g1[i+1] = gcd(g1[i], a[i]);
  g2.back() = 0;
  REPR(i,n-1) g2[i] = gcd(g2[i+1], a[i]);
  
  int ans = 0;
  REP(i,n){
    ans = max(ans, gcd(g1[i], g2[i+1]));
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;

int n,a,b,c;  
string s;

int main() {
  cin >> a >> b >> c;
  if(a+b>=c)
  cout << b+c << endl;
  else 
  cout << a+b+b+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

int N,K,A[101010];
ll to[101010], from[101010];

int main(){
  cin>>N>>K;
  rep(i,N) cin>>A[i];
  from[0]=1;
  rep(i,N){
    fill(to,to+101010,0);
    for(int j=0;j<=K;j++){
      int k=min(K+1,j+A[i]+1);
      (to[j]+=from[j])%=MOD;
      to[k]=(to[k]-from[j]+MOD)%MOD;
    }
    rep(j,K) (to[j+1]+=to[j])%=MOD;
    swap(from,to);
  }
  cout<<from[K]<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;

    vector<long long> C(60);
    for (int i=0; i<60; i++)
        for (long long a: A)
            C[i] += a>>i&1;

    vector<int> R;
    for (int i=59; i>=0; i--)
        if (C[i]>0 && C[i]%2==0)
            R.push_back(i);
    int h = (int)R.size();

    vector<vector<int>> M(h, vector<int>(N));
    for (int i=0; i<h; i++)
        for (int j=0; j<N; j++)
            M[i][j] = A[j]>>R[i]&1;

    int c = 0;
    for (int y=0; y<h; y++)
    {
        for (int x=c; x<N; x++)
            if (M[y][x]!=0)
            {
                for (int i=0; i<h; i++)
                    swap(M[i][x], M[i][c]);
                break;
            }
        if (M[y][c]!=0)
        {
            for (int x=0; x<N; x++)
                if (x!=c && M[y][x] != 0)
                    for (int i=0; i<h; i++)
                        M[i][x] ^= M[i][c];
            c++;
        }
    }

    long long ans = 0;
    for (long long a: A)
        ans ^= a;
    for (int y=0; y<h; y++)
    {
        int c = 0;
        for (int m: M[y])
            c += m;
        if (c%2!=0)
            ans += 1LL<<(R[y]+1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 24960
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	int a,b,x;
	string s="NO";
	cin>>a>>b>>x;
	if(b>=x-a&&x-a>=0){
		s="YES";
	}
	cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256