akhauriyash/Code-Regression huggingface dataset:
#import <Foundation/Foundation.h>

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

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *s = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
        int n = [s intValue];
        NSString *answer = @"ABC";
        if(n>=1000){
            answer = @"ABD";
        }
        
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[answer dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }   
    return 0;
}

Measured memory_bytes: 2404
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<deque>
using namespace std;
typedef pair<int,int> P;

int W,N,v[1000],w[1000];
int I;

P dp[1001][1001];
bool done[1001][1001];
P solve(int i,int r){
    if(done[i][r]) return dp[i][r];
    P result;
    if(i==N) result=P(0,r);
    else {
        if(r-w[i]>=0){
            P p=solve(i+1,r-w[i]);
            p.first+=v[i];
            result=max(p,solve(i+1,r));
        }else{
            result=solve(i+1,r);
        }
    }
    done[i][r]=true;
    return dp[i][r]=result;
}

int main(){
    while(I++,scanf("%d%d",&W,&N),W){
        for(int i=0;i<N;i++)scanf("%d,%d",v+i,w+i);
        memset(done,0,sizeof(done));
        P p=solve(0,W);
        printf("Case %d:\n%d\n%d\n",I,p.first,W-p.second);
    }
}

Measured memory_bytes: 9640
Inputs()= parse.(Int,split(readline()))
Input()=parse.(Int,readline())
function main()
    N=Input()
    Y=0
    for x=1:N
        sum::Int64=(x+1)*x/2
        if sum>=N
            Y=x
            break
        end
    end
    except=(Y+1)*Y/2-N
    for i=1:Y
        if i==except
            continue
        end
        println(i)
    end
end
main()

Measured memory_bytes: 163524
fun main(args: Array<String>) {
    abc120c()
}

fun abc120c() {
    val s = readLine()!!.toCharArray()
    val redCount = s.count { it == '0' }
    val blueCount = s.size - redCount

    val remain = Math.abs(redCount - blueCount)

    val removedCount = (s.size - remain)

    println(removedCount)
}


Measured memory_bytes: 33628
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll A[5];
    rep(i,5) cin >> A[i];
  	ll k;
  	cin >> k;
  	string out = "Yay!";
    rep(i,5){
      rep(j,5){
        if(abs(A[i]-A[j]>k)) out = ":(";
      }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000000
#define mod 1000000007
using namespace std;
using LL = long long;

int main(){
    int n,m;cin>>n>>m;
    vector<int> a(n);for(int i=0;i<n;i++)cin>>a[i];
    vector<pair<int,int>> cb(m);for(int i=0;i<m;i++)cin>>cb[i].second>>cb[i].first;

    sort(a.rbegin(),a.rend());
    sort(cb.rbegin(),cb.rend());
    vector<int> b(n);
    int buf=0;
    for(int i=0;i<m && buf<n;i++){
        for(int j=0;j<cb[i].second && buf+j<n;j++){
            b[buf+j]=cb[i].first;
        }
        buf+=cb[i].second;
    }
//for(int i=0;i<n;i++)cout<<b[i]<<" ";cout<<endl;
    sort(b.begin(),b.end());

    for(int i=0;i<n;i++)b[i]=max(a[i],b[i]);
    LL ans=0;
    for(int i=0;i<n;i++)ans+=b[i];
    cout<<ans<<endl;



    //for(int i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
    //for(int i=0;i<n;i++)cout<<b[i]<<" ";cout<<endl;
}


Measured memory_bytes: 1792
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  string s,t,u;
  int a,b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  if(s==u)a--;
  else b--;
  cout << a << " " << b << endl;  


return 0;
}
///....


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;
const int inf = 1001001001;
int dy[] = {1,0,-1,0};
int dx[] = {0,1,0,-1};



int main(){
  int h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--; cw--;dh--; dw--;
  vector<string> g(h);
  rep(i,h) cin >> g[i];

  vector<vector<int>> seen (h,vector<int>(w,inf));
  deque<pair<int,int>> q;
  pair<int ,int> st = {ch,cw};
  seen[ch][cw] = 0;
  q.push_front(st);

  while(!q.empty()){

    
    int cy = q.front().first;
    int cx = q.front().second;
    q.pop_front();

    rep(i,4){
      int ny = cy + dy[i];
      int nx = cx + dx[i];
      if(ny<0 || ny>h-1 || nx<0 || nx>w-1) continue;
      if(g[ny][nx]=='#') continue;
      pair<int,int> next = {ny,nx};
      if(seen[ny][nx] > seen[cy][cx]){
        seen[ny][nx] = seen[cy][cx];
        q.push_front(next);
      }
    }
    for(int j = -2; j <=2; j++){
      for(int k = -2; k <=2; k++){
      int ny = cy + j;
      int nx = cx + k;
      if(ny<0 || ny>h-1 || nx<0 || nx>w-1) continue;
      pair<int,int> next = {ny,nx};
      if(g[ny][nx]=='#') continue;
         if(seen[ny][nx] > seen[cy][cx]){
         seen[ny][nx] = seen[cy][cx]+1;
         q.push_back(next);
         }
      }
    }

    
  }
  if(seen[dh][dw] == inf) cout << -1 << endl;
  else cout << seen[dh][dw] << endl;
}


                                      


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

int main()
{
    int N, counT = 0;
    cin >> N;

    char str[N];
    scanf("%s", &str);

    for(int i=0; i<N-2; i++)
    {
        if(str[i]=='A' && str[i+1]=='B' && str[i+2]=='C')
        {
            counT++;
            i += 2;
        }
    }

    cout << counT;

    return 0;
}


Measured memory_bytes: 3708
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    int a[8];
    int b[]={4,1,4,1,2,1,2,1};
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]){
        if(a[0]==-1)break;
        int sum=999999999, data=0;
        rep(i,8){
            int tmp = 0;
            rep(j,8){
                tmp += max(0,a[j]-b[(i+j)%8]);
            }
            if(tmp<sum){
                sum=tmp;
                data=0;
                rep(j,8){
                    data*=10;
                    data+=b[(i+j)%8];
                }
            }
            else if(tmp==sum){
                int t=0;
                rep(j,8){
                    t*=10;
                    t+=b[(i+j)%8];
                }
                if(data>t){
                    sum=tmp;
                    data=t;
                }

            }
        }
        int ans[8];
        rep(i,8){
            ans[i]=data%10;
            data/=10;
        }
        for(int i=7;i>=0;i--){
            if(i!=7)cout<<" ";
            cout<<ans[i];
        }
        cout<<endl;
    }
}

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a==1&&b!=1)
    cout<<"Alice"<<endl;
  else if(a!=1&&b==1)
    cout<<"Bob"<<endl;
  else if(a==b)
    cout<<"Draw"<<endl;
  else if(a>b)
    cout<<"Alice"<<endl;
  else
    cout<<"Bob"<<endl;

}


Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
    int N, A[1005], B[1005], X, i, j;
    char S[30005];
    scanf("%d%s", &N, S);
    for (i=0; i<=999; i++) A[i]=0;
    A[100*(S[0]-'0')+10*(S[1]-'0')+(S[2]-'0')]=1;
    for (i=3; i<N; i++) {
        for (j=0; j<=999; j++) B[j]=0;
        for (j=0; j<=999; j++) {
            if (A[j]==1) {
                // printf("%d %d\n", i, j);
                B[100*(j/100)+10*(j/10%10)+(S[i]-'0')]=1;
                B[100*(j/100)+10*(j%10)+(S[i]-'0')]=1;
                B[100*(j/10%10)+10*(j%10)+(S[i]-'0')]=1;
                // printf("%d %d %d %d\n", i, 100*(j/100)+10*(j/10%10)+(S[i]-'0'), 100*(j/100)+10*(j%10)+(S[i]-'0'), 100*(j/10%10)+10*(j%10)+(S[i]-'0'));
                // printf("(%d %d %d %d)\n", j/100, j/10%10, j%10, S[i]-'0');
            }
        }
        for (j=0; j<=999; j++) {
            if (B[j]==1) A[j]=1;
        }
    }
    X=0;
    for (i=0; i<=999; i++) {
        if (A[i]==1) {
            X++;
            // printf("[%d]\n", i);
        }
    }
    printf("%d", X);
    // printf("%d", 100*(S[0]-'0')+10*(S[1]-'0')+(S[2]-'0'));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;
typedef vector<vi> mat;

inline ll read(){
	ll Hashimoto=0,Kanna=1;
	char I_Love=getchar();
	while(I_Love<'0'||I_Love>'9'){
		if(I_Love=='-')Kanna=-1;
		I_Love=getchar();
	}
	while(I_Love>='0'&&I_Love<='9'){
		Hashimoto=Hashimoto*10+I_Love-'0';
		I_Love=getchar();
	}
	return Hashimoto*Kanna;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<Kanna;I_Love++)cout<<Hashimoto[I_Love]<<(I_Love==Kanna-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<Kanna;I_Love++)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define inf (ll)1e9
#define linf (ll)1e18
#define mod (inf+7)

int n,a[222222];
ll sum[222222];
ll ans=linf;

inline ll s(int l,int r){//[l,r)
	if(l==0)return sum[r-1];
	return sum[r-1]-sum[l-1];
}

int solve(int tl,int tr,int typo){//[l,r)
	int l=typo,r=tr-tl-typo;
	while(l<r-1){
		int mid=l+r>>1;
		if(s(tl,tl+mid)>=s(tl+mid,tr))r=mid;
		else l=mid; 
	}
	return l;
}

int I_Love_Hashimoto_Kanna() {
  fastio;
  cin>>n;
  FOR(i,0,n){
  	cin>>a[i];
  	sum[i]=a[i];
  	if(i)sum[i]+=sum[i-1];
  }
  
  FOR(i,2,n-1){
  	//[0,i)
  	int umn=solve(0,i,1);
  	FOR(j,umn,min(umn+2,i-1)+1){
  		//[i,n)
  		int mnu=solve(i,n,1);
  		FOR(k,mnu,min(mnu+2,n-i-1)+1){
  			ll mx=0,mn=linf;
  			ll val;
				
				val=s(0,j);
  			mx=max(mx,val);mn=min(mn,val);
  			
				val=s(j,i);
  			mx=max(mx,val);mn=min(mn,val);
  			
				val=s(i,i+k);
  			mx=max(mx,val);mn=min(mn,val);
  			
				val=s(i+k,n);
  			mx=max(mx,val);mn=min(mn,val);
  			
  			ans=min(ans,mx-mn);
			}
		}
	}
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstring>

using namespace std;

int main() {
  int N;
  string S;
  int calc_1[10], calc_2[10], calc_3[10];
  int flg_1 = 0, flg_2 = 0, flg_3 = 0;
  int n;
  int total = 0;

  cin >> N;
  cin >> S;

  memset(calc_1, 0, sizeof(calc_1));
  memset(calc_2, 0, sizeof(calc_2));
  memset(calc_3, 0, sizeof(calc_3));
  for (int i = 0; i < N-2; i++) {
    n = (int)(S[i]-'0');
    //cout << S[i] << endl;
    if (calc_1[n] > 0) continue;
    calc_1[n]++;
    flg_1 += n+1;
    memset(calc_2, 0, sizeof(calc_2));
    flg_2 = 0;

    for (int j = i+1; j < N-1; j++) {
      n = (int)(S[j]-'0');
      //cout << " " << S[j] << endl;
      //cout << "       " << calc_2[n] << endl;
      if (calc_2[n] > 0) continue;
      calc_2[n]++;
      flg_2 += n+1;
      memset(calc_3, 0, sizeof(calc_3));
      flg_3 = 0;

      for (int k = j+1; k < N; k++) {
        n = (int)(S[k]-'0');
        //cout << "  " << S[k] << endl;
        //cout << S[i] << S[j] << S[k] << endl;
        if (calc_3[n] > 0) continue;
        calc_3[n]++;
        flg_3 += n+1;

        total++;
        /*
        if (flg_3 == 55 || k == N-1) {
          memset(calc_3, 0, sizeof(calc_3));
          flg_3 = 0;
          break;
        }
        */
      }
      /*
      if (flg_2 == 55 || j == N-2) {
        memset(calc_2, 0, sizeof(calc_2));
        flg_2 = 0;
        break;
      }
      */
    }
    if (flg_1 == 55) break;
  }

  cout << total << endl;

  return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    // need to make it chronological?
    bool ok = true;
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while(b <= a) {
        b *= 2;
        k--;
    }
    while(c <= b) {
        c *= 2;
        k--;
    }
    if(k < 0) ok = false;
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<bool> vb;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

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

	int N, K; cin >> N >> K;
	vi D(K); FOR(i, 0, K) cin >> D[i];
	int ans;
	for (int n = N; n <= 99999; n++) {
		bool ok = true;
		for (int d : D) {
			int t = n;

			while (t > 0) {
				if (t % 10 == d) {
					ok = false;
					break;
				}
				t /= 10;
			}
			if (!ok) break;
		}

		if (ok) {
			ans = n;
			break;
		}
	}

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


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

using namespace std;

const int N = 110, INF = 1e9 + 10;

int n, a[N];

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  int mn = INF;
  for (int i = -100; i <= 100; ++i) {
    int tmp = 0;
    for (int j = 0; j < n; ++j) {
      tmp += (a[j] - i) * (a[j] - i);
    }
    mn = min(mn, tmp);
  }
  printf("%d\n", mn);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int a = N;
		int b = M;
		String ss = String.valueOf(N);
		String sss = String.valueOf(M);
		String[] ans = new String[2];
		for( int i=0; i<a; i++ ){
			ans[0] += sss;
		}
		for( int i=0; i<b; i++ ){
			ans[1] += ss;
		}
		Arrays.sort(ans);
		System.out.println(ans[0].substring(4));
	}
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define ntuples(type1,type2,type3,v,n) vector<tuple<type1,type2,type3>> v(n);for(size_t i=0;i<(n);i++){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) acm(all(v),0l)


int main() {
  int n,q;
  cin>>n>>q;
  npairs(int, int, ab, n-1);
  sort(all(ab));
  npairs(int, int, px, q);
  sort(all(px));
  /*
  map<int, int> ab(n-1);
  for (size_t i = 0; i < n-1; i++) {
    int a,b;
    cin>>a>>b;
    ab.insert(make_pair(a,b));
  }
  map<int, int> px(q);
  for (size_t i = 0; i < q; i++) {
    int a,b;
    cin>>a>>b;
    px.insert(make_pair(a,b));
  }
  */
  vector<int> cnt(n+1,0);
  for (size_t i = 0; i < q; i++) {
    cnt[px[i].first]+=px[i].second;
  }
  for (size_t i = 0; i < n-1; i++) {
    cnt[ab[i].second]+=cnt[ab[i].first];
  }
  for (size_t i = 1; i < n+1; i++) {
    cout<<cnt[i];
    if(i!=n)cout<<" ";
  }
}

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

using namespace std;

int main() {
    string s, t;

    cin>>s;
    cin>>t;
    for(int i = 0; i < s.length(); i++) {
        s.insert(s.begin(), s[s.length() - 1]);
        s.pop_back();
        if(s == t) {
            printf("Yes");
            break;
        }

        if(i == s.length() - 1) {
            printf("No");
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import sys
line = 999
prm = list()
while line != 0 :
    line = int(sys.stdin.readline())
    prm.append(line)

for i in range(len(prm)):
    if prm[i] == 0 :
        break
    print 'Case ' + str(i+1) + ': ' + str(prm[i])

Measured memory_bytes: 6808
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll power(ll a, ll b){
  ll ans = 1;
  if(b%2==0){
    REP(i, b/2){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans;
  }else{
    b = b/2;
    REP(i, b){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans* a;
  }
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(void){

  string s, t;
  cin>>s>>t;
  ll ans = 0;

  REP(i, s.size()){
    if(s[i]!=t[i]) ans++;
  }
  cout<<ans<<endl;

  return 0;
  
}

Measured memory_bytes: 3920
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.{NumericRange, Queue}
import scala.collection.mutable
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val map = scala.collection.mutable.Map[String, Int]()
    val A = sc.nextInt
    for (_ <- Range(0, A)) {
      val S = sc.next
      if (!map.contains(S)) (map(S) = 0)
      map(S) += 1
    }
    val B = sc.nextInt
    for (_ <- Range(0, B)) {
      val S = sc.next
      if (!map.contains(S)) (map(S) = 0)
      map(S) -= 1
    }
    println(math.max(map.maxBy(x => x._2)._2, 0))
  }

  def gcd(i: Long, j: Long): Long = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 25544
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;

int main() {
    int A,B;
    cin >> A >> B;
    int sum = 0;
    if(A > B){
        sum += A;
        A--;
    }else{
        sum += B;
        B--;
    }
    if(A > B){
        sum += A;
    }else{
        sum += B;
    }
    cout << sum << endl;
}

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

int t=0;
char S[200001],T[200001];
int main(){

    cin >> S >> T;
    int length=sizeof S / sizeof S[0];
    for(int i=0 ; i<length ; i++){
        if(S[i]!=T[i]) { t+=1; }
    }
    cout << t << endl;
}

Measured memory_bytes: 3960
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int n;
    cin >> n;
    vector <ii> p(n+1);
    vector <int> t(n+1);
    for (int i = 1; i <= n; ++i) {
        cin >> t[i] >> p[i].f >> p[i].s;
    }
    for (int i = 0; i + 1 <= n; ++i) {
        if (abs(p[i+1].f-p[i].f) + abs(p[i+1].s-p[i].s) > t[i+1]-t[i]) {
            cout << "No" << endl;
            exit(0);
        }   
        if ((abs(p[i+1].f-p[i].f) + abs(p[i+1].s-p[i].s))%2 != (t[i+1]-t[i])%2) {
            cout << "No" << endl;
            exit(0);
        }   
    }   
    cout << "Yes" << endl;
}

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

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

    int N, H;
    cin >> N >> H;
    vector<ll> a(N), b(N);
    REP(i, N) cin >> a[i] >> b[i];
    int x = *max_element(ALL(a));
    sort(ALL(b), greater<int>());
    ll sum = 0;
    int ans = 0;
    REP(i, N) {
        if (b[i] < x) break;
        sum += b[i];
        ans++;
        if (sum >= H) {
            cout << ans << endl;
            return 0;
        }
    }
    ans += (H - sum + x - 1) / x;
    cout << ans << endl;

}

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

using namespace std;
const int MAXN = 100000 + 10;

int data[MAXN], n, k, ans;

int main(){
	scanf("%d%d", &n, &k);
	
	for(register int i=0; i<n; i++){
		scanf("%d", &data[i]);
	}
	
	int minn = 0x3f3f3f3f;
	int stamp = -1;
	
	for(register int i=0; i<n; i++){
		if(data[i] < minn){
			minn = data[i];
			stamp = i;
		}
	}
	
	for(register int i=0; i<n; i++){
		if(data[i] != minn){
			ans++;
		}
	}
	
	cout<<ceil((double)ans/(k-1));
	return 0;
}


Measured memory_bytes: 640
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N, A;
  cin >> N;
  unordered_set<ll> s;
  REP(i, N) {
    cin >> A;
    if (s.count(A) == 0) {
      s.emplace(A);
    } else {
      s.erase(A);
    }
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 7132
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	ll n,d;
	cin>>n>>d;
	ll int x[n],y[n];
	ll int ans=0;
	rep(i,n){
		cin>>x[i]>>y[i];
		if(x[i]*x[i]+y[i]*y[i]<=d*d)ans++;
	}
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 6760
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;
int app[26];
int main() {
  string S; cin >> S;
  string ans = S;
  bool f = true;
  if ( S.length() == 26 ) {
    if ( S == "zyxwvutsrqponmlkjihgfedcba" ) {
      cout << -1 << endl;
      return 0;
    } else {
      for ( int i = S.length()-1; i > 0; i-- ) {
	if (S[i] > S[i-1] ) {
	  ans = S.substr(0,i-1);
	  f = false;
	  break;
	}
      }
      if (f) {
	ans = ((S[0] -'a')+1)+'a';
	cout << ans << endl;
	return 0;
      }      
    }
  }

  for ( int i = 0; i < ans.length(); i++ ) {
    app[ans[i]-'a']++;
  }

  for ( int i = 0; i < 26; i++ ) {
    if ( app[i] == 0 ) {
      string tmp = ans;
      tmp += i+'a';
      // cout << tmp << endl;
      if ( tmp > S ) {
      ans += i+'a';
      break;
      }
    }
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ar array
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  set<int> s;
  int A = a;
  for(int i=0; i<c; i++) if(a<=b) s.insert(a++);
  for(int i=0; i<c; i++) if((b+1)-c>=A)s.insert((++b)-c);
  for(auto x : s){
    cout << x << '\n';
  }
  return 0;
}


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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a - c) <= d || abs(a - b) <= d && abs(b - c) <= d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

int main() {
  while (true) {
    int t, n, s, f;
    cin >> t;
    if (t == 0) break;
    cin >> n;
    rep (i, n) {
      cin >> s >> f;
      t -= f - s;
    }
    if (t <= 0) cout << "OK" << endl;
    else cout << t << endl;
  }
  return 0;
}

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

int main() {

    string b;
    cin >> b;
    if(b == "A"){
        cout << "T";
    }
    else if(b == "T"){
        cout << "A";
    }
    else if(b == "C"){
        cout << "G";
    }
    else {
        cout << "C";
    }
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;

void solve(){
  string s;
  cin>>s;
  int q;
  cin>>q;
  deque<char>dq;
  int n=s.size();
  rep(i,n){
    dq.emplace_back(s[i]);
  }
  int x=0;
  while(q--){
    int query;
    cin>>query;
    if(query==1){
      x^=1;
    }
    else {
      int f;
      char c;
      cin>>f>>c;
      f--;
      f^=x;
      if(f==0){
        dq.push_front(c);
      }
      else dq.push_back(c);
    }
  }
  if(x==1)reverse(all(dq));
  for(auto x:dq){
    cout<<x;
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
ll m=1000000007;
int main()
{
	fast;
	ll n,m,t;
	cin>>n>>m>>t;
	map<ll,ll>r,c;
	map<pair<ll,ll>,ll > a;
	while(t--)
	{
		ll x,y;cin>>x>>y;
		x--;
		y--;
		r[x]++;
		c[y]++;
		a[{x,y}]=1;
	}
	
	ll count=0,rans=0;
	for(auto i:r)
	{
		if(i.second>=count)
		{
			count=i.second;
			rans=i.first;
		}
	}
	ll lclcount=count;
	ll cans;
	for(auto i:c)
	{
		ll tep=i.second;
		if(tep+lclcount>count && a[{rans,i.first}]==0 )
		{
			count=tep+lclcount;
			cans=i.first;
		}
		else if(tep+lclcount-1>count && a[{rans,i.first}]==1)
		{
			count=tep+lclcount-1;
			cans=i.first;
		}
	}



	ll count1=0;
	for(auto i:c)
	{
		if(i.second>=count1)
		{
			count1=i.second;
			cans=i.first;
		}
	}
	lclcount=count1;

	for(auto i:r)
	{
		ll tep=i.second;
		if(tep+lclcount>count && a[{i.first,cans}]==0 )
		{
			count1=tep+lclcount;
			rans=i.first;
		}
		else if(tep+lclcount-1>count && a[{i.first,cans}]==1)
		{
			count1=tep+lclcount-1;
			rans=i.first;
		}
	}
	
	//cout<<rans<<" "<<cans<<nl;
	cout<<max(count,count1);

}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);






int main()
{
//    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,k,n;
    char s[50];
    S("%d %d %s",&n,&k,&s);
    for(i=0; i<n; i++)
    {
        if(i == k-1)
        {
            P("%c",s[i]+32);
        }
        else
        {
            P("%c",s[i]);
        }
    }
    return 0;
}







LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


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 f(int n){
    if(n == 0) return 0;
    else{
        return f(n%__builtin_popcount(n))+1;
    }
}
 
int main(void){
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int> x(n);
    rep(i, n) x[i] = s[i] - '0';
    int pc = 0;
    rep(i, n){
        pc += x[i];
    }
    vector<int> ans(n);
    rep(b, 2){
        int npc = pc;
        if(b == 0) npc++;
        else npc--;
        if(npc<=0) continue;
        int r0 = 0;
        rep(i, n){
            r0 = (r0*2)%npc;
            r0 += x[i];
        }
        int k = 1;
        for(int i = n-1;i>=0;--i){
            if(x[i] == b){
                int r = r0;
                if(b == 0){
                    r = (r+k)%npc;
                }
                else{
                    r = (r-k+npc)%npc;
                }
                ans[i] = f(r)+1;
            }
            k = (k*2)%npc;
        }
    }
    rep(i, n){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5244
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;


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

Measured memory_bytes: 3672
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define F first
#define S second   
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).end()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef vector<int> vi;
typedef pair<int, int> pii; 
typedef pair<int , pii> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int n , m;
    cin >> n >> m ;
    vector<pii> v ;
    rep(i , m){
        int x, y;
        cin >> x >> y;
        v.pb({n-x,y});
        if(y == 0 && x == 1 && n > 1){
            cout << -1;
            return;
        }else if(y == 0 && x == 1){
            cout << 0;
            return;
        }
    }
    int st = po(10 , n - 1) - (n == 1);
    int en = po(10 , n) - 1;
    repA(x , st , en){
        int d[n];
        int i = x;
        rep(j , n){
            d[j] = i % 10 ;
            i /= 10; 
        }
        int f = 1;
        trav(con , v){
            if(d[con.F] != con.S) f = 0;
        }
        if(f){
            cout << x ;
            return ;
        }
    }
    cout << -1;


}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int cnt = 0;
    int[] a = new int[N + 1];
    for (int i = 1; i <= N; i++)
      a[i] = sc.nextInt();

    for (int i = 1; i <= N; i++) {
      if ((i % 2 != 0) && (a[i] % 2 != 0))
        cnt++;
    }
    System.out.println(cnt);
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;

  vector<int> A(M);
  int Atotal=0;
  for(int i =0; i<M; i++){
    cin >>A.at(i);
    Atotal += A.at(i);
  }

  int ans = N - Atotal;

  if (ans <0) cout << "-1" << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3588
/*
ID: yzshang1
LANG: C++11
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int (i) = 1; (i) <= (int)n; (i)++)
#define rep(i, n) for (int (i) = 0; (i) < (int)n; (i)++)
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;

int main() {
	int n, m;
	cin >> n >> m;
	if (m == n) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	s = readline() |> chomp
	d = zeros(Int,n)
	m = zeros(Int,n+1)
	c = zeros(Int,n+1)
	for i in 1:n
		m[i+1] = m[i]
		c[i+1] = c[i]
		if s[i]=='D'
			d[i] = 1
		elseif s[i]=='M'
			m[i+1] += 1
		elseif s[i]=='C'
			c[i+1] += 1
		end
	end
	bc = zeros(Int,n+1)
	for i in 1:n
		bc[i+1] = bc[i]
		if s[i]=='C'
			bc[i+1] += m[i+1]
		end
	end
	query = readline() |> parseInt
	ka = readline() |> split |> parseMap
	for q in 1:query
		k = ka[q]-1
		ans = 0
		for i in 1:n
			if d[i]==1
				ans += bc[min(i+k,n)+1]-bc[i+1]-(c[min(i+k,n)+1]-c[i+1])*m[i+1]
			end
		end
		println(ans)
	end
end

main()

Measured memory_bytes: 167048
# C - Go to School
n = (int)(input())

a = list(map(int, input().split()))
map = {}

for i in range(n):
    map[a[i]] = i + 1

a.sort()

result = ""
for j in a:
    print(map[j], end="")
    if len(a) != j:
        print(' ', end="")

Measured memory_bytes: 20704
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] W = new int[N];
        for(int i = 0; i < N; i++)
        {
            W[i] = int.Parse(input[i]);
        }
        int left = 0;
        int right = 0;
        int l = 0;
        int r = N - 1;
        for (int i = 0; i < N; i++)
        {
            if (left <= right) { left += W[l];l++; }
            else { right += W[r]; r--; }
        }
        Console.WriteLine(Math.Abs(left-right));
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int a[111];
bool used[111];
int main()
{
	int x,n;
	cin>>x>>n;
	for(int i=0;i<n;i++){ 
		cin>>a[i];
		used[a[i]]=true;
	} 
	int ans=x;
	for(int i=1;i<x+ans;i++)
		if(!used[i])
			ans=min(ans,x-i);
	cout<<x-ans<<endl;
	return 0;
}

Measured memory_bytes: 3552
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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


#define REP(i, n) for(ll i = 0; i < n; i++)






























int main(){
    string s;
    cin >> s;
    string a;
    ll ans = 0;
    REP(i, 3){
        a += "R";
        if(s.find(a) != -1){
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

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

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


    int cnt=0;

    int a = 0;
    vector<int> v(N*N, 0);

    for(int j=1; j<N+1; j++){
        for(int k=1; k<N+1; k++){
            if(j>=k){
                //cout << "j, k : " << j << "," << k << " : " << k << endl;
                //int tmp = j%k;
                v[a] = gcd(j, k);
                //cout << "j, k : " << j << "," << k << " : " << v[a] << endl;
                a++;
            }
            else if(j<k){
                //int tmp = k%j;
                v[a] = gcd(k, j);
                //cout << "j, k : " << j << "," << k << " : " << v[a] << endl;
                a++;
            }
            else{
                /* ここには入らない */
            }
        }
    }

    for(int i=1; i<N+1; i++){
        for(int j=0; j<a; j++){
            if(i>=v[j]){
                //int tmp = i%v[j];
                int tmp = gcd(i, v[j]);
                cnt = cnt + tmp;
                //cout << "i, k : " << i << "," << v[j] << " : " << tmp << endl;
            }
            else if(i<v[j]){
                //int tmp = v[j]%i;
                int tmp = gcd(v[j], i);
                cnt = cnt + tmp;
                //cout << "i, k : " << i << "," << v[j] << " : " << tmp << endl;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3636
/*
author : seryu
title : ABC176C_"Step"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
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; }

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ma = 0;
    ll ans = 0;
    rep(i, n)
    {
        chmax(ma, a[i]);
        ans += max(ma-a[i], 0);
    }
    cout << ans << endl;
    return;	
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;
const ll mod=1000000007;

int N;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>N;
	ll ans=0,sum=0;
	for(int i=0;i<N;i++){
		ll t; cin>>t;
		ans=(ans+sum*t)%mod;
		sum=(sum+t)%mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <iostream>
using namespace std;

vector<int> sqf(int n) {
    vector<bool> b(n, true);
    for (int p = 2; p * p < n; p++) {
        if (b[p]) {
            for (int q = p * p; q < n; q += p * p)
                b[q] = false;
        }
    }
    vector<int> result;
    for (int p = 1; p < n; p++) if (b[p]) result.push_back(p);
    return result;
}

int main() {
    int n; cin >> n;
    unordered_map<long long, int> cnt;
    for (int i = 0; i < n; i++) {
        long long s; cin >> s;
        for (long long i = 2; i * i * i <= s; i++) {
            long long c = i * i * i;
            while (s % c == 0) s /= c;
        }
        cnt[s]++;
    }
    vector<pair<long long, long long> > S;
    vector<int> ns = sqf(100001);
    for (long long i = 0; i < ns.size(); i++) {
        long long a = ns[i];
        if (a * a * a > 1e10) break;
        for (int j = i + 1; j < ns.size(); j++) {
            long long b = ns[j];
            if (a * b * b > 1e10) break;
            S.push_back({a * a * b, a * b * b});
        }
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    int ans = 0;
    for (auto [a, b] : S) {
        auto i = cnt.find(a), j = cnt.find(b);
        int x = i == cnt.end() ? 0 : i->second, y = j == cnt.end() ? 0 : j->second;
        ans += max(x, y);
        if (i != cnt.end()) cnt.erase(i);
        if (j != cnt.end()) cnt.erase(j);
    }
    for (auto [k, v] : cnt) ans += k == 1 ? 1 : v;
    cout << ans << endl;
}


Measured memory_bytes: 74752
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define MOD 1000000007
using namespace std;

int main(){
  int n, sum=0;
  string str;
  string abc = "ABC";
  cin >> n >> str;

  rep(i, n - 2){
    int cnt = 0;
    rep(j, 3){
      if (str[i + j] == abc[j])
        cnt++;
    }
    if (cnt == 3)
      sum++;
  }

  cout << sum << endl;

  return 0;
 } 


Measured memory_bytes: 256