akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N, M;
	cin >> N >> M;
	VI X(M);
	VI Y(M);
	VI box(N);
	bool bo[100000] = { false };
	bo[0] = true;

	REP(i, N) {
		box[i] = 1;
	}

	REP(i, M) {
		cin >> X[i] >> Y[i];
		X[i]--;
		Y[i]--;
	}

	REP(i, M) {
		box[X[i]]--;
		box[Y[i]]++;

		if (bo[X[i]])
			bo[Y[i]] = true;

		if (box[X[i]] == 0)
			bo[X[i]] = false;

	}

	int ans = 0;

	REP(i, N) {
		if (bo[i])
			ans++;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2688
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int r,c;
        scanf("%d %d",&r,&c);
        int s[r+1][c+1];
        for(int i=0;i<r;i++){
                s[i][c]=0;
                for(int j=0;j<c;j++){
                        scanf("%d",&s[i][j]);
                        s[i][c]+=s[i][j];
                        if(i){
                                s[r][j]+=s[i][j];
                        }else{
                                s[r][j]=s[i][j];
                        }
                }
        }
        s[r][c]=0;
        for(int i=0;i<c;i++){
                s[r][c]+=s[r][i];
        }
        for(int i=0;i<=r;i++){
                for(int j=0;j<=c;j++){
                        if(j!=c){
                                printf("%d ",s[i][j]);
                        }else{
                                printf("%d\n",s[i][j]);
                        }
                }
        }
        return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  for(int i=0;i<n;i++){
    cin >> x[i] >> u[i];
  }
  
  long long y=0;
  long double b=0.0;
  
  for(int i=0;i<n;i++){
    if(u[i]=="JPY") y+=x[i];
    if(u[i]=="BTC") b+=x[i];
  }
  cout << fixed << setprecision(8) << (double)y+b*380000.0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647

int main() {
  int n,m;
  cin >> n >> m;
  int ans = 0;
  ans += n*(n-1)/2;
  ans += m*(m-1)/2;
  cout << ans;
  hinata;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int N=100010;
const int inf=1e9;
int a[N];
int main(){
	int n;
	int minn=inf,cntmin=0,mx=0,cntmx=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]<minn) minn=a[i],cntmin=0;
		if(a[i]==minn) cntmin++;
		if(a[i]>mx) mx=a[i];
	}
	for(int i=2;i<=n;i++) if(abs(a[i]-a[i-1])>1) {
		puts("No");return 0;
	}
	if(minn==mx) {
		if(minn<=n/2||minn==n-1)
		puts("Yes");
		else puts("No");
	}
	else{
		n-=cntmin;mx-=cntmin;
		if(mx<=0) puts("No");
		else{
			if(n/2>=mx) puts("Yes");else puts("No");
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

int main() {
	ll b;
	while (cin >> b, b) {
		ll a, n;
		for (ll i = 1; i*i <= 2 * b; i++) {
			if ((2 * b) % i == 0) {
				ll x = (2 * b) / i;
				if ((x - i + 1) % 2 == 0) {
					a = (x - i + 1) / 2;
					n = i;
				}
			}
		}
		cout << a << " " << n << endl;
	}
}


Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int n;
  int l[3];
  for(cin >> n;n>0;n--){
    cin>>l[0]>>l[1]>>l[2];
    sort(l,l+3);
    if (l[0]*l[0]+l[1]*l[1] == l[2]*l[2])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

int main() {
    int K, N, dist;
    cin >> K >> N;
    int A[N];
    for(int i = 0; i < N; ++i) cin >> A[i];
    
    sort(A, A+N, greater<int>());

    //要素間の最長距離
    int mxd = K + A[N-1] - A[0];
    for(int i = 1; i < N; ++i) mxd = max(A[i-1] - A[i], mxd);

    //K - 要素間の最長距離
    dist = K - mxd;

    cout << dist << endl;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))
ans = "APPROVED"
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            ans = "DENIED"
            break
    else:
        continue
print(ans)

Measured memory_bytes: 3060
import queue
import copy
import math
from collections import deque
import bisect


a, b, c, d = map(int, input().split())

i = 0
while a > 0 and c > 0:
    if i % 2 == 0:
        c -= b
    else:
        a -= d
    i += 1

print("Yes") if a > 0 else print("No")

Measured memory_bytes: 9748
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll pow_m2 = 1;
    string s = "";
    if(n == 0) s = "0";
    while(n!=0) {
        if(n%(pow_m2*(-2)) != 0) {
            n -= pow_m2;
            s = to_string(1)+s;
        } else {
            s = to_string(0)+s;
        }
        pow_m2*=-2;
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mi first
#define ma second
#define N 100000000
#define fo(i,m,n) for(int i=m;i<n;i++)
#define M 7
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
using ul=unsigned long long;
using pii=pair<int,int>;
using vvi=vector<vector<int>>;
using vi=vector<int>;
using pll=pair<ll,ll>;
using vsi=vector<set<int>>;
using vll=vector<ll>;

ll power(ll a,ll n){
    ll j=0;
    ll x=1;
    while(1ll<<j<=n){
        if(1ll<<j&n)
            x=(x*a)%mod;

        a=a*a%mod;
        j++;
    }

    return x;
}

int gcd(int a,int b){
    if(b==0)
        return a;
    else
        return gcd(b,a%b);

}

int lb(vi &a,int x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;
    while(l<=r){
        int mid=(l+r)/2;
        if(x>=a[mid]){
            l=mid+1;
            ind=mid;
        }
        else
            r=mid-1;

    }

    return ind+1;

}

int up(vll &a,ll x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;

    while(l<=r){
        int mid=(l+r)/2;
        if(a[mid]>x){
            r=mid-1;
            ind=mid;
        }
        else
            l=mid+1;

    }

    return ind;
}

ll max(ll a,ll b){
    if(a>b)
        return a;
    else
        return b;

}

ll min(ll a, ll b){
    if(a>b)
        return b;
    else
        return a;

}

void yn(bool a){
    if(a)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

}


struct fenwick_tree{
    int n;
    int* bit;
    fenwick_tree(int n){
        this->n=n;
        bit=new int[n+1];
        fill(bit,bit+n+1,0);
    }

    void update(int idx,int x){
        while(idx<=n){
            bit[idx]+=x;
            x+=(x&-x);
        }
    }

    int query(int r){
        int tot;
        while(r){
            tot+=bit[r];
            r-=(r&-r);
        }
        return tot;
    }

};


int main(){
    string s;
    cin>>s;
    int p=0;
    int m=0;
    fo(i,0,3){
        if(s[i]=='S'){
            m=max(m,i-p);
            p=i+1;
        }

    }
    m=max(m,3-p);
    cout<<m<<endl;

}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#define ll long long

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

int main()
{
    char a;
    cin >> a;
    if (a - 'A' < 26)
    {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'a' << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	int a,b,c,ans=99999;
	cin >> a >> b >> c;
	FOR(i,max({a,b,c}),100){
		int ki=(i-a)%2+(i-b)%2+(i-c)%2;
		if(ki%2)continue;
		ans = 3*i - (a+b+c) + 1;
		break;
	}
	cout << ans/2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a;
    cin>>a;
    while(a!=0)
    {
        if(a%10==9)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        a/=10;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
k = gets.chomp.to_i
a,b = gets.chomp.split(" ").map(&:to_i)
n = b - a + 1

if(a % k == 0)
  m = b/k - a/k + 1
else
  m = b/k - a/k
end

if(m == 0)
  puts "NG"
else
  puts "OK"
end


Measured memory_bytes: 14248
import math
while 1:
    d,e = map(int,input().split())
    if d == 0 and e == 0:
        break
    Min = 9999999999
    for i in range(d+1):
        y = d - i
        ans = abs(math.sqrt(i**2+y**2) - e)
        Min = min(Min,ans)
    print(Min)


Measured memory_bytes: 5672
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(int argc, const char * argv[]) {
    
    int N;
    cin >> N ;
    
    float f;
    
    if(N%2 == 0)
    {
        f=0.5f;
    }
    
    else
    {
        f = (float)(N+1) / (2*N);
    }
    
    cout << f << endl;
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){

	int N, K ,X, Y;
	int ans=0;

	scanf("%d\n%d\n%d\n%d", &N, &K, &X, &Y);

	if(K>N){
		ans = N * X;
	}
	else{
		ans = K * X;
		ans += (N-K) * Y;
	}

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

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 	int a,b;
 	cin>>a>>b;
	if(a==1 && b==2){
      	cout<<3<<'\n';
    }
  	if(a==1 && b==3){
      	cout<<2<<'\n';
    }
  	if(a==2 && b==1){
      cout<<3<<'\n';
    }
  	if(a==2 && b==3){
      	cout<<1<<'\n';
    }
  	if(a==3 && b==1){
      	cout<<2<<'\n';
    }
  	if(a==3 && b==2){
      	cout<<1<<'\n';
    }
  	
    return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int  long long

int n, m, q;
vector <int> a, b, c, d;
int ans;

void dfs(vector <int> v)
{
	if(v.size() == n)
	{
		int sm = 0;
		for(int i = 0; i < q; i++)
		{
			if(v[b[i]] - v[a[i]] == c[i]) sm += d[i];
		}
		ans = max(ans, sm);
		return ;
	}
	int t = (v.size() ? v.back() : 1);
	for(int i = t; i <= m; i++)
	{
		v.push_back(i);
		dfs(v);
		v.pop_back();
	}
}

int32_t main()
{	
	IOS
	cin >> n >> m >> q;
	a = b = c = d = vector <int>(q);
	for(int i = 0; i < q; i++)
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--; b[i]--;
	}
	vector <int> v;
	dfs(v);
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include <string.h>
 
int main(void){
    char s[10];

    scanf("%s", &s);

    int i =0;

while(s[2*i]!=NULL){
   if(s[2*i] != 'h'){
       printf("No");
  //   printf("%c", s[0]);
       return 0;
   }else{
       if(s[2*i + 1] != 'i' || s[2*i+1] == NULL){
           printf("No");
           return 0;
       }
   }
  i++;
}

printf("Yes");
return 0;
}

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

int main() {
  string S ; 
  cin >> S ; 
  int cnt = 0 ; 
  int N = S.size() ; 
  
  
    if(N % 2 == 1 ){
    for (int i = 0 ; i < N/2 ;i++){
      if( S.at(i) != S.at(N - i-1)){
        cnt++ ; 
      }
    }
  }
  else {
     for (int i = 0 ; i < N/2 ;i++){
          if( S.at(i) != S.at(N - i-1)){
            cnt++ ; 
          }
        }
  }

  cout << cnt << endl ;
  
  
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <climits>
#include <math.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
int main()
{
  int N;
  ll a, t, now;
  int p;
  cin >> N;
  vector<int> vecA;
  vector<int> vecB;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    vecA.push_back(a);
  }
  for (int i = 0; i < N; ++i) {
    cin >> a;
    vecB.push_back(a);
  }
  vector<int> check(N);
  int ans[30];
  for (int i = 0; i < 30; ++i) {
    now = 0;
    t = pow(2,i);
    for (int j = 0; j < N; ++j) {
      check[j] = vecA[j]%(2*t);
    }
    sort(all(check));
    for (int j = 0; j < N; ++j) {
      a = vecB[j]%(t*2);
      now += (lower_bound(all(check),t*2-a) - lower_bound(all(check), t-a)) + (lower_bound(all(check), 4*t-a) - lower_bound(all(check), t*3-a));
    }
    ans[i] = now%2;
  }
  ll ret = 0;
  for (int i = 0; i < 30; ++i) {
    ret += ans[i]*pow(2,i);
  }
  cout << ret << "\n";
  return 0;
}


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

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;}

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  while(1){
    int a, b;
    char op;
    cin >> a >> op >> b;
    if(op == '?') return 0;
    if(op == '+') cout << (a + b) << endl;
    if(op == '-') cout << (a - b) << endl;
    if(op == '*') cout << (a * b) << endl;
    if(op == '/') cout << (a / b) << endl;
  }
}






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

int main() {
	
	
	string s;cin >>s;
	bool ok = true;
	if(s[0] != 'A')ok=false;
	
	int cnt = 0;
	
	for(int i=2;i<s.length()-1;i++) if(s[i]=='C')cnt++;
	if(cnt !=1)ok=false;
	
	cnt = 0;
	
	rep(i,s.size()) if('a'-s[i]>0)cnt++;
	if(cnt != 2) ok=false;
	
	cout <<(ok?"AC":"WA") << endl;
	
	
	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

long long f(long long n, long long x) {
  if (n == -1) return 0;
  else return n/x + 1;
}

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


  
  cout << f(b, x) - f(a-1, x) << endl;
  
  return 0;
}

      
  

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();

        int x = cin.Int();
        int y = cin.Int();

        int[] group = { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
        Console.WriteLine(group[x] == group[y] ? "Yes" : "No");
        Console.ReadLine();
    }

}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
// #include <fstream>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define LB(c,x) lower_bound(ALL(c),x)
#define UB(c,x) upper_bound(ALL(c),x)
#define COUNT(c,x) (int)(UB(c,x)-LB(c,x))

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

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}


signed main()
{
  // string filename; cin >> filename;
  // ifstream in(filename);
  // cin.rdbuf(in.rdbuf());

  const int MAX_N = 100000;

  int N; cin >> N;
  vector<int> num(MAX_N);

  rep(i, 0, N) {
    int a; cin >> a;
    if (a-1 >= 0) {
      num[a-1]++;
    }
    num[a]++;
    if (a+1 < MAX_N) {
      num[a+1]++;
    }
  }

  int m = 0;
  rep(i, 0, MAX_N) {
    m = max(m, num[i]);
  }
  cout << m << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

// #define DEBUG 100

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const ll mod = 1e9 + 7,maxn = 100010;
const double PI = acos(-1);



int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    for (int i=1; i<=n; i++){
        if (i==k) cout << char(s[i-1] + 32);
        else cout << s[i-1];
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<29;
using pint = pair<int,int>;

using Graph = vector<vector<int>>;
vector<int> color;
void dfs(const Graph &G,int v,int cur=0){
    color[v]=cur;
    for(auto next_v : G[v]){
        if(color[next_v]!=-1) continue;
        dfs(G,next_v,1-cur);
    }
}

int main() {
    int n;
    cin>>n;
    Graph G(3*n);
    int p=n;
    rep(i,n-1){
        int u,v,w;
        cin>>u>>v>>w;
        u--,v--;
        if(w%2==0){
            G[u].push_back(p);
            G[p].push_back(u);
            G[v].push_back(p);
            G[p].push_back(v);
            p++;
        }
        else{
            G[u].push_back(v);
            G[v].push_back(u);
        }
    }
    color.assign(p,-1);
    dfs(G,0);

    rep(i,n) cout<<color[i]<<endl;
}

Measured memory_bytes: 15360
#include<bits/stdc++.h>
using namespace std;
int dp[3005][3005];
int main(){
  string s,t;
  cin>>s>>t;
  int slen = s.length();
  int tlen = t.length();
  
  for(int i=0;i<=slen;++i){
    dp[i][0]= 0;
  }
  
  for(int i=0;i<=tlen;++i){
	dp[0][i]= 0;
  }
  
  for(int i=0;i<slen;++i){
    for(int j=0;j<tlen;++j){
      if(s[i]==t[j]){
        dp[i+1][j+1] = dp[i][j]+1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
      }
    }
  }
  /*
  for(int i=0;i<=slen;++i){
    for(int j=0;j<=tlen;++j){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }
  
  cout<<dp[slen][tlen]<<endl;
  */
  string res = "";
  int i = slen;
  int j = tlen;
  
  while(i>0 && j>0 && dp[i][j]>0 ){
    while(dp[i-1][j]==dp[i][j]){
      --i;
    }
    while(dp[i][j-1]==dp[i][j]){
      --j;
    }
    //cout<<i<<" "<<j<<endl;
    res = s[i-1] + res;
    i--;
    j--;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 35456
from collections import deque    
H,W = map(int, input().split())
maze = []
ans = 0
dist =[]
q = deque([])
tmp = 0

for i in range(H):
    maze.append(input())

for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            continue
        dist = [[-1]*W for i in range(H)] # 配列の初期化
        q.append([i,j]) #初期値挿入
        dist[i][j] = 0
        while(q):
            a,b = q.popleft()
            if a + 1 < H:
                if maze[a+1][b] == '.' and dist[a+1][b] == -1:
                    q.append([a+1, b])
                    dist[a+1][b] = dist[a][b] + 1
                    tmp = dist[a+1][b] 
            if a > 0:
                if maze[a-1][b] == '.' and dist[a-1][b] == -1:
                    q.append([a-1, b])
                    dist[a-1][b] = dist[a][b] + 1
                    tmp = dist[a-1][b]
            if b + 1 < W:
                if maze[a][b+1] == '.' and dist[a][b+1] == -1:
                    q.append([a, b+1])
                    dist[a][b+1] = dist[a][b] + 1
                    tmp = dist[a][b+1]
            if b > 0:
                if maze[a][b-1] == '.' and dist[a][b-1] == -1:
                    q.append([a, b-1])
                    dist[a][b-1] = dist[a][b] + 1
                    tmp = dist[a][b-1]
        ans = max(ans,tmp)


print(ans)
        
            
            
            
        
        



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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i++)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)



//library----------------------------------------------

signed main(){
    CIN(N);
    SCIN(s,t);
    rep(i,N){
        printf("%c",s[i]);
        printf("%c",t[i]);
    }
    printf("\n");
    return 0;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
  return 0;
}

Measured memory_bytes: 3592
n = int(input())

tarr = []
xarr = []
yarr = []

tarr.append(0)
xarr.append(0)
yarr.append(0)


for i in range(n):
    t, x, y = map(int, input().split())
    tarr.append(t)
    xarr.append(x)
    yarr.append(y)

for i in range(1, n+1):
    if (tarr[i] % 2 == 0 and (xarr[i] + yarr[i]) % 2 == 1) or (tarr[i] % 2 == 1 and (xarr[i] + yarr[i]) % 2 == 0):
        print('No')
        exit()

    if tarr[i] - tarr[i - 1] < xarr[i] + yarr[i] - xarr[i - 1] - yarr[i - 1]:
        print('No')
        exit()

print('Yes')


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    ll n,k;
    cin>>n>>k;
    ll a[n];
    rep(i,n){
        cin>>a[i];
    }
    ll dp[k+1];
    //dp[i] で現在iこの状況で石を取り去らなければならないときの勝敗
    rep(i,k+1){
        dp[i]=0;
    }
    for (int i=1;i<k+1;i++){

        rep(j,n){
            if (i<a[j]){
                continue;
            }
            else{
                if (dp[i-a[j]]==0){
                    dp[i]=1;
                }//行き先に相手を負かせられる手があるなら勝利
            }
        }
    }
    if (dp[k]){
        cout<<"First"<<endl;
    }
    else{
        cout<<"Second"<<endl;
    }


    return 0;
}

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

const int N = 100;
int f[N + 1][10], a[N];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	memset(f, 0xc1, sizeof f);
	f[0][0] = 0;
	for (int i = 0; i < n; ++i) {
		for (int md = 0; md < 10; ++md) f[i + 1][md] = f[i][md];
		for (int md = 0; md < 10; ++md) if (f[i][md] >= 0) {
			int &x = f[i + 1][(md + a[i]) % 10];
			x = max(x, f[i][md] + a[i]);
		}
	}
	int res = 0;
	for (int md = 1; md < 10; ++md) res = max(res, f[n][md]);
	cout << res << '\n';
	return 0;
}


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

int main()
{
    int alphabet_max = 26;
    long long N;
    const long long MOD = 1000000007;
    cin >> N;
    string S;
    cin >> S;
    long long kosuu[26];
    for (int i = 0; i < alphabet_max; i++)
    {
        kosuu[i] = 0;
        for (int j = 0; j < N; j++)
        {
            if (S.at(j) == 'a' + i)
            {
                kosuu[i]++;
            }
        }
        kosuu[i]++;
    }
    long long ans = 1;
    for (int i = 0; i < alphabet_max; i++)
    {
        ans *= kosuu[i];
        ans %= MOD;
    }
    if (ans == 0)
    {
        cout << MOD - 1 << endl;
        return 0;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>

int main(){
  long long int n;
  scanf("%lld", &n);
  long long int rn = sqrt(n);
  long long int ans = n;
  long long int a;
  for(int i = 1; i <= rn; i++){
    if(n % i == 0){
      a = i + n / i - 2;
      if(a < ans){
        ans = a;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
 string s;
  int t=0;
 cin>>s;
  if(s=="RRR"){t=3;}
  else if(s=="RRS" || s=="SRR"){t=2;}
  else if(s=="SSS"){t=0;}
  else {t=1;}
 
  cout<<t<<endl;
}

Measured memory_bytes: 3464
#include <iostream>
#include <set>

using namespace std;

set<int> st;

bool is_n_ok(int n) {
    bool flag=true;
    while(n!=0) {
        if(st.count(n%10)) {
            flag = false;
            break;
        }
        n /= 10;
    }
    return flag;
}

int main() {
    int N, K;
    cin >> N >> K;
    for(int k=0; k<K; k++) {
        int d;
        cin >> d;
        st.insert(d);
    }
    
    while(!is_n_ok(N)) {
        N++;
    }
    
    cout << N << endl;

    return 0;
    
}

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

using namespace std;

char Pool[200000000];
inline void *operator new(size_t size) { static char *p = Pool; return (p += size) - size; }
inline void operator delete(void*) { }

namespace program
{
	namespace seg_tree
	{
		struct node
		{
			int a, b, val, tag;
			node *lt, *rt;
			node(int _a, int _b);
			void maintain() { val = max(lt -> val, rt -> val) + tag; }
			void update(int x, int y, int d);
		};

		node::node(int _a, int _b) : a(_a), b(_b), val(0), tag(0)
		{
			if(a < b)
			{
				int mid = (a + b) >> 1;
				lt = new node(a, mid);
				rt = new node(mid + 1, b);
			}
		}

		void node::update(int x, int y, int d)
		{
			if(x <= a && b <= y)
			{
				val += d;
				tag += d;
			}
			else
			{
				int mid = (a + b) >> 1;
				if(x <= mid)
					lt -> update(x, y, d);
				if(y > mid)
					rt -> update(x, y, d);
				maintain();
			}
		}
	}

	const int MAXN = 300000;
	int w, h, n, ans = 0;
	struct point { int x, y; } P[MAXN + 10];
	struct vt { int i, v; } S1[(MAXN << 1) + 10], S2[(MAXN << 1) + 10];

	inline bool cmp(const point &a, const point &b) { return a.y < b.y; }
	inline void to_max(int &x, int y) { if(x < y) x = y; }

	void calc()
	{
		int t1 = 0, t2 = 0;
		int mid = w >> 1;
		seg_tree::node *seg = new seg_tree::node(0, n);
		S1[++t1] = (vt){ -1, mid };
		S1[++t1] = (vt){ 0, 0 };
		S2[++t2] = (vt){ -1, mid + 1 };
		S2[++t2] = (vt){ 0, w };
		seg -> update(0, 0, w);
		sort(P + 1, P + n + 1, cmp);
		for(int i = 1; i <= n; i++)
		{
			to_max(ans, (P[i].y + seg -> val) << 1);
			if(P[i].x <= mid)
			{
				while(S1[t1].v < P[i].x)
				{
					vt t = S1[t1--];
					seg -> update(S1[t1].i + 1, t.i, t.v - P[i].x);
				}
				S1[++t1] = (vt){ i - 1, P[i].x };
			}
			else
			{
				while(S2[t2].v > P[i].x)
				{
					vt t = S2[t2--];
					seg -> update(S2[t2].i + 1, t.i, P[i].x - t.v);
				}
				S2[++t2] = (vt){ i - 1, P[i].x };
			}
			S1[++t1] = (vt){ i, 0 };
			S2[++t2] = (vt){ i, w };
			seg -> update(i, i, w - P[i].y);
		}
		ans = max(ans, (h + seg -> val) << 1);
	}

	void work()
	{
		scanf("%d%d%d", &w, &h, &n);
		for(int i = 1; i <= n; i++)
			scanf("%d%d", &P[i].x, &P[i].y);
		calc();
		swap(w, h);
		for(int i = 1; i <= n; i++)
			swap(P[i].x, P[i].y);
		calc();
		printf("%d\n", ans);
	}
}

int main()
{
	program::work();
	return 0;
}


Measured memory_bytes: 46208
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
#define Endl "\n"
#define tests int t1234;cin>>t1234;for(int i1234=1;i1234<=t1234;i1234++)
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);std::cout << std::fixed;std::cout << setprecision(0);
#define takearr(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i]
#define pii pair<int,int>
#define F first
#define S second
#define rep(i,n) for( int i=0;i<(int)n;i++)
#define f(i,a,b) for( int i=(int)a;i<=(int)b;i++)
#define mods ((1000000007))
#define init1d(arr,n,val) for(int i=0;i<n;i++)arr[i]=val;
#define init2d(arr,x,y,val) for(int i=0;i<x;i++)for(int j=0;j<y;j++)arr[i][j]=val;
#define pb push_back
#define mass(vec) (int)vec.size()
#define lb(arr,n,val) ((int)(lower_bound(arr,arr+n,val)-arr))
#define ub(arr,n,val) ((int)(upper_bound(arr,arr+n,val)-arr))


typedef tree<int,null_type, less<>, rb_tree_tag,tree_order_statistics_node_update> oset;
//order_of_key   *find_by_order
typedef tree<int,int, less<>, rb_tree_tag,tree_order_statistics_node_update> omap;
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: ", cerr << to_string(__VA_ARGS__) << endl<<endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); }string to_string(string &s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; }string to_string(const char* s) { string tmp(s); return to_string(tmp); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(char c){ return string({c}); }template<size_t N> string to_string(bitset<N> &b, int x1=0, int x2=1e9){ string t = ((x1 < b.size()) ? (b.to_string()).substr(x1, x2-x1+1) : "");reverse(begin(t), end(t)); return '"' + t + '"'; }template <typename A, typename... C> string to_string(A (&v), int x1=0, int x2=1e9, C... coords);int l_v_l_v_l = 0, t_a_b_s = 0;template <typename A, typename B> string to_string(pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")";l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' ');string res = ""; bool first = true; if(l_v_l_v_l == 0) res += endl; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1);auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++;if(e != l){ if(rnk > 1) { res += endl; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]";if(l_v_l_v_l == 0) res += endl; return res; }

int gcd(int x,int y)
{
  if(x==0)return y;
  return gcd(y%x,x);
}

bool comp(pii a,pii b)
{
  return (a.F<b.F);
}

int32_t main(){
  fastio;
  string s;cin>>s;int z=0,on=0;
  rep(i,mass(s))
    {
    if(s[i]=='0')z++;
    else on++;
    }
    cout<<2*min(z,on)<<endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
	int n, p;cin>>n>>p;
	int m=0;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		m+=(t%2!=0);
	}
	if(m==0) cout<<(p==0?(ll)pow((float)2, n):0)<<endl;
	else cout<<ll(pow((float)2, m-1)*pow((float)2, n-m))<<endl;
}


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

int main(){
    int a;
    cin>>a;
    vector<int> data(a);
    for(int k = 0; k < a; k++){
        cin>>data[k];
    }

    int flag =1;
    int swap = 0;
    while(flag){
        flag = 0;
        for(int i = a-1; i >= 1; i--){
            if(data[i] < data[i-1]){
                int tmp = data[i];
                data[i] = data[i-1];
                data[i-1] = tmp;
                flag = 1;
                swap++;
            }
        }
    }

    for(int i = 0; i < a; i++){
        cout<<data[i];
        if(i != a-1){
            cout<<" ";
        }else{
            cout<<endl;
        }
    }
    cout<<swap<<endl;
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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 solve(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    //いつか限界が来る
    if(b>d){
        cout<<"No"<<endl;
        return ;
    }
    //最初から無理やん
    if(a<b){
        cout<<"No"<<endl;
        return ;
    }
    //b>dをふまえると超余裕
    if(b<=c+1){
        cout<<"Yes"<<endl;
        return ;
    }

    //c<x<bかつx=A+gcd(b,d)となるようなxが存在するか
    ll g=gcd(b,d);
    ll x=(b-a%g+g-1)/g*g+a%g-g;
    if(x>c){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
}

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

    int q;cin>>q;
    while(q--) solve();
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List

import Data.Vector (Vector, (!), (//))
import qualified Data.Vector as V

main :: IO ()
main = solve <$> readLn <*> f >>= print
  where
    f = V.fromList <$> sort <$> map read <$> words <$> getLine

solve :: Int -> Vector Int -> Int
solve n v = length $ do
  i <- [0 .. n-3]
  j <- [i+1 .. n-2]
  k <- [j+1 .. n-1]
  let x = v ! i
  let y = v ! j
  let z = v ! k
  guard $ x < y && y < z && x + y > z
  return ()


Measured memory_bytes: 4916
#include <iostream>
using namespace std;

int main() {
    int N;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];
    int num[110]={0};
    for(int i=0;i<N;++i) num[a[i]]++;
    int ans=0;
    for(int i=1;i<=100;++i){
        if(num[i])++ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
s=list(map(int,input().split()))

cnt=0
for i in range(1,n-1):
    if s[i-1]<s[i] and s[i]<s[i+1]:
        cnt+=1
    if s[i-1]>s[i] and s[i]>s[i+1]:
        cnt+=1
print(cnt)

Measured memory_bytes: 61872
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans=0;
  string temp="";
  for(int i=0;i<n;i++){
    if(temp[0]!=s[i]){
      temp=s[i];
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
long long num[90];

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


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

char judge(int x){
    int a, b;
    int year = 0;
    int month = 0;

    if((x >= 0) && (x <= 99)) {
        year = 1;
    }
    if ((x >= 1) && (x <=12)){
        month = 1;
    }

    if(year * month == 1) {
        return 'a';
    }
    if((year == 1) && (month == 0)) {
        return 'y';
    }
    if((month == 1) && (year == 0)) {
        return 'm';
    }
    else{
        return 'n';
    }
}


int main(void){
  char buf[4];
  scanf("%s", buf);
  int a = (int)(buf[0]-'0') * 10 + (int)(buf[1]-'0');
  int b = (int)(buf[2]-'0') * 10 + (int)(buf[3]-'0');
  char A = judge(a);
  char B = judge(b);

  if((A == 'y') && ((B == 'm') || (B == 'a'))) {
      printf("YYMM\n");
      return 0;
  }

  if((B == 'y') && ((A == 'm') || (A == 'a'))) {
      printf("MMYY\n");
      return 0;
  }

  if((A == 'a') && (B == 'a')) {
      printf("AMBIGUOUS\n");
      return 0;
  }

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

Measured memory_bytes: 128
#include <stdio.h>

int main()
{
	int a,b;

	scanf("%d",&a);
	scanf("%d",&b);

	if(a == 1 && b == 2 || a == 2 && b == 1){
		printf("3");
	}
	else if(a == 2 && b == 3 || a == 3 && b == 2){
		printf("1");
	}
	else if(a == 3 && b == 1 || a == 1 && b == 3){
		printf("2");
	}

	return 0;
}


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

int main() {
    int K,ans;
    cin >> K;
    if (K % 2 == 0) {
        ans = K/2 * K/2;
    } else {
        ans = (K+1)/2 * (K-1)/2;
    }
    cout << ans << endl;
}


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

#define MAX 100005
#define int long long
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int dp[101][100005];

int helper(int weight[], int value[], int n, int maxWeight, int index, int weightTillNow){
	if(index == n){
		return 0;
	}
	if(dp[index][weightTillNow] != -1){
		return dp[index][weightTillNow];
	}
	int ans1 = 0, ans2 = 0;
	if(weightTillNow + weight[index] <= maxWeight){
		ans1 = value[index] + helper(weight, value, n, maxWeight, index + 1, weightTillNow + weight[index]);
	}
	ans2 = helper(weight, value, n, maxWeight, index + 1, weightTillNow);

	dp[index][weightTillNow] = max(ans1, ans2);
	return max(ans1, ans2);
}

int32_t main(){
	int n, w;
	cin>>n>>w;

	//Initialize DP Array with value -1.
	for(int i = 0; i < 101; i++){
		for(int j = 0; j < 100005; j++)dp[i][j] = -1;
	}

	int weight[n], value[n];
	for(int i = 0; i < n; i ++){
		cin>>weight[i]>>value[i];
	}	

	cout<<helper(weight, value, n, w, 0, 0);
}

Measured memory_bytes: 79104
#include "cstdio"
#include "cstring"
#include "algorithm"
#define YES 1
#define NO 2
#define SAME 3
using namespace std;
bool cmp(const char a,const char b)
{
	return a>b;
}
char sc[101],tc[101];
int main()
{
	int flag=SAME; 
	int i,lens,lent,s;
	scanf("%s",sc);
	scanf("%s",tc);
	lens=strlen(sc);
	lent=strlen(tc);
	sort(sc,sc+lens);
	sort(tc,tc+lent,cmp);
	s=min(lens,lent);
	for(i=0;i<s;i++)
	{
		if(tc[i]>sc[i])
		{
			flag=YES;
			break;
		}
		if(sc[i]>tc[i])
		{
			flag=NO;
			break;
		}
	}
	if(flag==SAME)
	{
		if(lens>=lent)
		{
			flag=NO;
		}
		else
		{
			flag=YES;
		}
	}
	if(flag==YES)
	{
		printf("Yes\n");
	}
	else if(flag==NO)
	{
		printf("No\n");
	}
	return 0;
}

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

//7/13

int main(){

    int N, X;
    cin >> N >> X;

    vector<int> okasi_amount(N);
    for(int i=0; i<N; i++){
        cin >> okasi_amount.at(i);
    }

    int count =0;
    int sum = 0;
    for(int i=0; i<N; i++){
        sum += okasi_amount.at(i);
        count++;
    }
    X -= sum;

    sort(okasi_amount.begin(), okasi_amount.end());
    
    while(X >= okasi_amount.at(0)){
        X -= okasi_amount.at(0);
        count++;
    }

    cout << count << endl;

}

Measured memory_bytes: 256
def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

N = int_raw()

def main():
    ans = 0 
    for idx in range(1,N+1):
        if(idx*idx)+idx>=N:
            break
        if (N-idx)%idx == 0:
            ans += (N-idx)//idx
    return ans


print(main())


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

int main() {
    ll X;
    cin >> X;

    ll ans = (X / 500) * 1000;
    X %= 500;
    ans += (X / 5) * 5;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 13;
const int N = 2e5 + 5;
int n, m, x, c[M], a[M][M];

int solve(int i, vector <int> lvl)
{
	int ok = 1;
	for(auto &l : lvl)
		if(l < x)
			ok = 0;

	if(ok == 1)	return 0;

	if(i >= n)	return 1e12;

	int ans = solve(i + 1, lvl);
	for(int j = 0; j < m; j++)
		lvl[j] += a[i][j];
	ans = min(ans, c[i] + solve(i + 1, lvl));

	return ans;
}
 
int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	cin >> n >> m >> x;
	for(int i = 0; i < n; i++)
	{
		cin >> c[i];
		for(int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	vector <int> lvl(m, 0);
	int ans = solve(0, lvl);
	cout << (ans >= 1e12 ? -1 : ans);
    	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a,b,c;
  cin>>a>>b>>c;
  int count=0;
  if(a%2==1||b%2==1||c%2==1){
    cout<<0;
  }
  else if(a==b&&b==c){
    cout<<-1;
  }
  if(a==b&&b==c){
    
  }
  else if(a%2==0&&b%2==0&&c%2==0){
    while(a%2==0&&b%2==0&&c%2==0){
      int64_t s=a;
      int64_t t=b;
      int64_t u=c;
      a=(t+u)/2;
      b=(s+u)/2;
      c=(s+t)/2;
      count++;
    }
    cout<<count;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string s;
  vector<string> v;
  while(cin>>s) v.push_back(s);
  stack<int> st; 
  for(int i=0;i<(int)v.size();i++){
    if(v[i][0]=='+'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l+r);
      continue;
    }
    if(v[i][0]=='-'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l-r);
      continue;
    }
    if(v[i][0]=='*'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l*r);
      continue;
    }
    st.push(stoi(v[i]));
  }
  cout<<st.top()<<endl;
  return 0;
}

Measured memory_bytes: 3168
fn main() {
    let alphabet = "abcdefghijklmnopqrstuvwxyz";

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let ch = buf.chars().nth(0).unwrap();

    println!("{}", alphabet.chars().nth(alphabet.find(ch).unwrap() + 1).unwrap());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main() {
    ll d,t,s;cin >>d>>t>>s;
    if(d<=s*t)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int,int> mii;
typedef unordered_map<int,int> umii;
typedef queue<int> qi;

int ile[200005];
//int ile[200005];
//int uf[200005];

//int find(int x) {
	//if (uf[x] == x) return x;
	//uf[x] = find(uf[x]);
	//return uf[x];
//}

//void Union(int a, int b) {
	//int sa = find(a);
	//int sb = find(b);
	//if (sa < sb) {
		//uf[sb] = sa;
		//ile[sa] += ile[sb];
	//}
	//else {
		//uf[sa] = sb;
		//ile[sb] += ile[sa];
	//}
//}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	for (int i = 1; i < n; i ++) {
		int x; cin >> x;
		ile[x] ++;
	}
	
	for (int i = 1; i <= n; i ++) {
		cout << ile[i] << '\n';
	}
	
	
	return 0;
}


Measured memory_bytes: 4436