akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdio>
#define ll long long
using namespace std;

inline int read(){
	int sum=0,f=1;char c=getchar();
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0'){sum=sum*10+c-'0';c=getchar();}
	return f*sum;
}

const int N=5005;
const int M=2002;
const int P=2000001;
const int Mod=1000000007;
int n,a[P],b[P];
int f[N][N],cj[P]={1};

inline ll fpow(int a,int b){
	ll ret=1;
	for(;b;a=1ll*a*a%Mod,b>>=1) if(b&1) ret=1ll*ret*a%Mod;
	return ret;
}

inline ll inv(int x){
	return fpow(x,Mod-2);
}

inline ll C(int m,int n){
	if(n<m) return 0;
	return 1ll*cj[n]*inv(cj[m])%Mod*inv(cj[n-m])%Mod;
}

signed main(){
//	freopen("3.in","r",stdin);
	n=read();
	for(int i=1;i<P;i++) cj[i]=1ll*cj[i-1]*i%Mod;
	for(int i=1;i<=n;i++)
		a[i]=read(),b[i]=read();
	for(int i=1;i<=n;i++) f[M-a[i]][M-b[i]]++;
	for(int i=1;i<N;i++)
		for(int j=1;j<N;j++) f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%Mod;
	ll ans=0;
	for(int i=1;i<=n;i++) ans=(ll)(ans+f[a[i]+M][b[i]+M])%Mod;   
	for(int i=1;i<=n;i++) ans=(ll)(ans-C(a[i]<<1,(a[i]+b[i])<<1))%Mod;
	ans=(ans+Mod)%Mod;
	ans=1ll*ans*inv(2)%Mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 108800
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct{
    char s[11];
    int p;
    int cnt;
} dict;

int cmp(const void *a, const void *b){
    return ((dict *)b)->p - ((dict *)a)->p;
}

int scmp(const void *a, const void *b){
    return strcmp(((dict *)a)->s, ((dict *)b)->s);
}

int main(void){
    int n, i;
    scanf("%d", &n);
    dict rest[n];
    for(i=0; i<n; i++){
        scanf("%s %d", rest[i].s, &rest[i].p);
        rest[i].cnt = i + 1;
    }
    qsort(rest, n, sizeof(dict), cmp);
    qsort(rest, n, sizeof(dict), scmp);
    for(i=0; i<n; i++)
        printf("%d\n", rest[i].cnt);

    return 0;
}

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

bool check(int X, int Y, int a, int b, int c) {
    return X <= a + c/2 && Y <= b + c/2;
}

int po(int A, int B, int C, int a, int b, int c) {
    return A*a + B*b + C*c;
}

int main() {
    int A;
    int B;
    int C;

    int X;
    int Y;

    int a;
    int b ;
    int c;

    int sum = 0;

    scanf("%d%d%d%d%d", &A, &B, &C, &X, &Y);
    a = X;
    b = Y;
    c = 0;
    sum = A*a + B*b + C*c;

    while(true) {
        if(po(A, B, C, a - 1, b - 1, c + 2) < sum && check(X, Y, a - 1, b - 1, c + 2) && 0 < a && 0 < b) {
            a -= 1;
            b -= 1;
            c += 2;
            sum = po(A, B, C, a, b, c);
        }
        else if(po(A, B, C, a - 1, b, c + 2) < sum && check(X, Y, a - 1, b, c + 2) && 0 < a) {
            a -= 1;
            c += 2;
            sum = po(A, B, C, a, b, c);
        }
        else if(po(A, B, C, a, b - 1, c + 2) < sum && check(X, Y, a, b - 1, c + 2) && 0 < b) {
            b -= 1;
            c += 2;
            sum = po(A, B, C, a, b, c);
        }else{
            break;
        }
    }
    printf("%d\n", sum);
}


Measured memory_bytes: 256
/*
 * src.cpp
 *
 *  Created on: 2016/10/01
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=100;

int N;
int A[MAX_N];
int dict[MAX_N];

void solve(){
	int d=0,md=N;
	REP(i,N){
		d=max(d,A[i]);
		md=min(md,A[i]);
		dict[A[i]]++;
	}
	bool flg=false;
	FOR(i,d/2+1,d+1){
		if (dict[i]<2){
			flg=true;
		}
	}
	if (d%2==0){
		if (dict[d/2]!=1){
			flg=true;
		}
	}else{
		if (dict[d/2+1]!=2){
			flg=true;
		}
	}
	if (flg){
		cout<<"Impossible"<<endl;
		return ;
	}
	if (md<(d+1)/2){
		cout<<"Impossible"<<endl;
	}else{
		cout<<"Possible"<<endl;
	}
}

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	solve();
	return 0;
}


Measured memory_bytes: 256
#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(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))

int H,W;
int A[82][82];
int B[82][82];
int C[82][82];// +C or -C
bool D[82][82][6402*2]={};// p

int main(){
	cin >> H >> W;
	FOR(i,0,H)FOR(j,0,W){
		cin >> A[i][j];
	}
	FOR(i,0,H)FOR(j,0,W){
		cin >> B[i][j];
		C[i][j] = abs(A[i][j]-B[i][j]);
	}
	D[0][0][C[0][0]]=1;

	FOR(i,0,H){
		FOR(j,0,W){// 確定していく
			if(i>0){
				FOR(k,0,80*(i+j+2)+1){
					if(not D[i-1][j][k])continue;
					int a[2];
					a[0] = abs( k - C[i][j] );
					a[1] = abs( k + C[i][j] );
					FOR(l,0,2){
						if( a[l]>=0 && not D[i][j][a[l]]){
							D[i][j][a[l]]=true;
						}
					}
				}
			}
			if(j>0){
				FOR(k,0,80*(i+j+2)+1){
					if(not D[i][j-1][k])continue;
					int a[2];
					a[0] = abs( k - C[i][j] );
					a[1] = abs( k + C[i][j] );
					FOR(l,0,2){
						if( a[l]>=0 && not D[i][j][a[l]]){
							D[i][j][a[l]]=true;
						}
					}
				}
			}
		}
	}
	FOR(i,0,80*(H+W)+1){
		if(D[H-1][W-1][i]){
			cout << i << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 83328
#include <algorithm>
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::vector;

static vector<int> B;

class compare
{
public:
  bool operator()(int const &a, int const &b)
  {
    return B[a] < B[b];
  }
};

int
main()
{
  int N;
  cin >> N;
  vector<int> R(N);
  vector<int> A(N);
  B.resize(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i] >> B[i];
    R[i] = i;
  }
  std::sort(R.begin(), R.end(), compare());
  long time = 0;
  bool yes = true;
  for (int i = 0; i < N; i++)
  {
    time += A[R[i]];
    if (B[R[i]] < time)
    {
      yes = false;
      break;
    }
  }
  cout << (yes ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    int N;
    cin>>N;
    vector<pair<int,int>> A(N);
    rep(i,N){
        int a;
        cin>>a;
        A[i].first=a;
        A[i].second=i%2;
    }
    sort(A.begin(),A.end());
    int ans=0;
    rep(i,N){
        if(A[i].second%2 != i%2) ans++;
    }
    cout<<ans/2<<endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;*/
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef vector<int> vec;
//typedef pair<int,int> pii;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define fi first
#define se second
/*#define tupfi(v,i) get<0>(v[i])
#define tupse(v,i) get<1>(v[i])
#define tupth(v,i) get<2>(v[i])
#define mt make_tuple */
#define pb push_back
#define mp make_pair
#define rrep(i,a,b) for(int i = (a-1); i >= b; i--)
#define endl "\n"
typedef long long ll;
int main(){
ios::sync_with_stdio(0);
cin.tie(0); 
	ll t;t=1;
	while(t--){
			ll n,k;
			cin>>n>>k;
			if(n<k)cout<<min(n,k-n)<<endl;
			else if(n==k)cout<<0<<endl;
			else {
				ll a;
				a=n%k;
				ll b=abs(k-a);
				cout<<min(a,b)<<endl;
			}
	}
	return 0;
	}

Measured memory_bytes: 256
//Silk Road AOJ:0611
//???????¨???????????????????
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define min 2100000000
int n,m,d[1000],c[1000],dp[1001][1001];
int main(){
	scanf("%d %d",&n,&m);
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++)	dp[i][j]=min;
	}
	for(int i=1;i<=n;i++) cin >> d[i];
	for(int i=1;i<=m;i++) cin >> c[i];
	dp[0][0]=0;
	for(int i=0;i<m;i++){
		for(int j=0;j<=n;j++){
			if(dp[i+1][j]>dp[i][j])	dp[i+1][j]=dp[i][j];
			if(dp[i+1][j+1]>d[j+1]*c[i+1]+dp[i][j]){
				if(j+1<=n)	dp[i+1][j+1]=d[j+1]*c[i+1]+dp[i][j];
			}
		}
	}
	cout << dp[m][n] <<endl;
	return 0;
}

Measured memory_bytes: 5160
#include<iostream>
#include<cstdio>
#include<algorithm>

char a[3000000],b[3000000];
int x,y,k;

void go(int S,int dis){
	for (int i=S+1;i<=S+dis;i++)
		if (a[i]||b[i]){
			a[i]++;b[i]++;
			a[S]=0;b[S]=0;
			int I=i+1,J=i+1;
			if (a[i]==2){
				while (a[I]){a[I]=0;I++;}
				a[i]=0;a[I]=1;
			}
			if (b[i]==2){
				while (b[J]){b[J]=0;J++;}
				b[i]=0;b[J]=1;
			}
			if (a[I]&b[I]) go(I,dis-i+S);
			if (a[J]&b[J]) go(J,dis-i+S);
			return;
		}
	a[S+dis]++;b[S+dis]++;
	a[S]--;b[S]--;
}

int main(){
	scanf("%d%d%d",&x,&y,&k);
	scanf("%s%s",a,b);
	for (int i=0;i<x;i++){a[i]-='0';}
	for (int i=0;i<y;i++){b[i]-='0';}
	std::reverse(a,a+x);std::reverse(b,b+y);
	for (int i=std::max(x-1,y-1);i>=0;i--) if (a[i]&b[i]) go(i,k);
	int I=2999999;while (!a[I]) I--;I++;while (I--) printf("%d",a[I]);printf("\n");
	int J=2999999;while (!b[J]) J--;J++;while (J--) printf("%d",b[J]);printf("\n");
}

Measured memory_bytes: 7168
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    String ans = "Yay!";
    if((a > 8) || (b > 8)) ans = ":(";
    System.out.println(ans);
  }
}

Measured memory_bytes: 22356
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
string s;
long long ans;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

void dfs(int depth, string str){
    if(depth == s.size()){
        //cout << str << endl;
        vector<string> num = split(str, '+');
        for(int i = 0; i < num.size(); i++){
            ans += stol(num[i]);
        }
        return;
    }
    // 入れるか入れないかの二通り
    for(int i = 0; i < 2; i++){
        if(depth == s.size()-1){
            dfs(depth + 1, str + s[depth]);
            break;
        }
        if(i == 0){
            dfs(depth + 1, str + s[depth] + '+');
        }else {
            dfs(depth + 1, str + s[depth]);
        }

    }
}
int main(){
    cin >> s;
    //2^(d - 1) d...桁数
    dfs(0, "");
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int D;
vi c(26);
vector<vector<ll>> s(365, vector<ll>(26));
vi ans(365);

ll eval() {
    vi last(26, 0);

    ll score = 0;
    REP(i, D) {
        int t = ans[i];

        score += s[i][t];
        last[t] = i + 1;

        REP(j, 26) {
            score -= c[j] * (i + 1 - last[j]);
        }
    }

    return score;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    cin >> D;

    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_int_distribution<int> d_rng(0, 364);
    std::uniform_int_distribution<int> t_rng(0, 25);

    REP(i, 26) cin >> c[i];

    vi last(26, 0);
    REP(i, D) {
        vll s(26);
        REP(j, 26) cin >> s[j];

        vll p(26);
        ll p_all = 0;
        REP(j, 26) {
            p[j] = c[j] * (i + 1 - last[j]);
            p_all += p[j];
        }

        REP(j, 26) {
            s[j] -= p_all - p[j];
        }

        int idx = max_element(ALL(s)) - s.begin();

        last[idx] = i + 1;
        ans[i] = idx;
    }

    ll score = eval();

    REP(i, 1e5) {
        int d = d_rng(mt), t = t_rng(mt);
        if (ans[d] == t) {
            --i;
            continue;
        }

        int old = ans[d];

        ans[d] = t;
        ll new_score = eval();
        if (score < new_score) {
            score = new_score;
        } else {
            ans[d] = old;
        }
    }

    for (auto &e: ans) {
        print(e + 1);
    }

}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong x,y;
    cin >> x;
    y = 100;
    for(llong i=1;i<4000;i++){
        y *= 1.01;
        if(x <= y){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int x, y, flag;

int main() {
    int v = 700;
    string s;
    cin >> s;
    if(s.at(0)=='o')
        v+=100;
    if(s.at(1)=='o')
        v+=100;
    if(s.at(2)=='o')
        v+=100;
    cout << v << endl;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N, Q; 
    cin >> N >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 21724
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n;
  cin >> n;
  vi d(n);
  rep(i,n) cin >> d[i];
  
  int ans = 0;
  rep(i,n) {
    rep(j,i) {
      ans += d[i]*d[j];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> visited = new HashSet<>();
        int cnt = 0;
        while(n > 0) {
          n--;
          int num = sc.nextInt();
          if(visited.contains(num)) continue;
          visited.add(num);
          cnt++;
        }
        System.out.println(cnt);
    }
}

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

vector<int> hm(100003);

int main(){
    IOS;

    int n;
    cin >> n;
    int ans = 0;
    int fl = 0;
    for(int i=0,val;i<n;i++){
        cin >> val;
        if(val == i+1){
            if(fl){
                fl = 0;
                continue;
            }
            ans++;
            fl = 1;
        }
        else fl = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
X = int(input())
if 400 <= X and X <= 599:
  print(8)
elif 600 <= X and X <= 799:
  print(7)
elif 800 <= X and X <= 999:
  print(6)
elif 1000 <= X and X <= 1199:
  print(5)
elif 1200 <= X and X <= 1399:
  print(4)
elif 1400 <= X and X <= 1599:
  print(3)
elif 1600 <= X and X <= 1799:
  print(2)
elif 1800 <= X and X <= 1999:
  print(1)

Measured memory_bytes: 9140
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,v,p,a[100010],ans;
bool ok[100010];
int main()
{
	scanf("%d %d %d %d",&n,&m,&v,&p);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	long long sum=0;
	for(int i=n;i;--i)
	{
		if(i+p>n)ok[i]=1,++ans;
		else 
		{
			if(a[i]==a[i+1])ok[i]=ok[i+1],ans+=ok[i];
			else if(a[i]+m>=a[n-p+1])
			{
				if(i+p-1>=v)++ans,ok[i]=1;
				else if(1ll*(a[i]+m)*(n-p+1-i)-sum>=1ll*(v-i-p+1)*m)++ans,ok[i]=1;
			}
		}
		if(i<=n-p+1)sum+=a[i];
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

void preorder(int id, int* type, int* left, int* right, int* parent, int* sibling) {
    std::cout << " " << id;
    if (left[id] >= 0) {
        preorder(left[id], type, left, right, parent, sibling);
    }
    if (right[id] >= 0) {
        preorder(right[id], type, left, right, parent, sibling);
    }
}

void inorder(int id, int* type, int* left, int* right, int* parent, int* sibling) {
    if (left[id] >= 0) {
        inorder(left[id], type, left, right, parent, sibling);
    }
    std::cout << " " << id;
    if (right[id] >= 0) {
        inorder(right[id], type, left, right, parent, sibling);
    }
}

void postorder(int id, int* type, int* left, int* right, int* parent, int* sibling) {
    if (left[id] >= 0) {
        postorder(left[id], type, left, right, parent, sibling);
    }
    if (right[id] >= 0) {
        postorder(right[id], type, left, right, parent, sibling);
    }
    std::cout << " " << id;
}

int main() {
    int n, root;
    int left[25], right[25], type[25], depth[25], height[25], deg[25]={}, parent[25], sibling[25];
    std::cin >> n;
    for (int i=0; i<n; i++) {
        parent[i] = -1;
        sibling[i] = -1;
        type[i] = 1;
        depth[i] = -1;
        height[i] = -1;
    }
    for (int i=0; i<n; i++) {
        int id;
        std::cin >> id;
        std::cin >> left[id] >> right[id];
        if (left[id] >= 0) {
            deg[id]+=1;
            parent[left[id]] = id;
        }
        if (right[id] >= 0) {
            deg[id]+=1;
            parent[right[id]] = id;
        }
        if (deg[id] == 2) {
            sibling[left[id]] = right[id];
            sibling[right[id]] = left[id];
        } else if (deg[id] == 0) {
            type[id] = 2;
        }
    }
    for (int i=0; i<n; i++) {
        if (parent[i] == -1) {
            type[i] = 0;
            root=i;
        }
    }

    std::cout << "Preorder\n";
    preorder(root, type, left, right, parent, sibling);
    std::cout << "\nInorder\n";
    inorder(root, type, left, right, parent, sibling);
    std::cout << "\nPostorder\n";
    postorder(root, type, left, right, parent, sibling);
    std::cout << "\n";

    return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<long long>a(N+1);
  a.at(0)=2;
  a.at(1)=1;
  for(int i=0;i<N-1;i++){
    a.at(i+2)=a.at(i+1)+a.at(i);
  }
  cout<<a.at(N)<< endl;
  
  
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
}

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

#define N 1000000007

int main(){
  int n;
  cin >> n;
  int64_t res1=1, res2=1, res3=1;
  for(int i=0; i<n; i++){
    res1*=10;
    res2*=8;
    res3*=9;
    res1%=N;
    res2%=N;
    res3%=N;
  }
  int64_t res=res1-2*res3+res2;
  if(res<0) res+=N;
  if(res<0) res+=N;
  cout << res;
  return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, 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; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	string s;
	cin >> s;

	if (s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
}

Measured memory_bytes: 3620
x, y, z, k = map(int, input().split())
alist = list(sorted(map(int, input().split()), key=lambda x: -x)) + [-pow(10, 10)]
blist = list(sorted(map(int, input().split()), key=lambda x: -x)) + [-pow(10, 10)]
clist = list(sorted(map(int, input().split()), key=lambda x: -x)) + [-pow(10, 10)]

setk = set([(0, 0, 0, alist[0] + blist[0] + clist[0])])
outk = set()

for _ in range(k):
  tmpk = None
  tmpi = 0
  for i, _k in enumerate(setk):
    if tmpk is None:
      tmpk = _k
      tmpi = i
    elif tmpk[3] < _k[3]:
      tmpk = _k
      tmpi = i
  print(tmpk[3])
  outk.add(tmpk)
  setk.discard(tmpk)
  if (tmpk[0] + 1, tmpk[1], tmpk[2], tmpk[3] - alist[tmpk[0]] + alist[tmpk[0] + 1]) not in outk:
    setk.add((tmpk[0] + 1, tmpk[1], tmpk[2], tmpk[3] - alist[tmpk[0]] + alist[tmpk[0] + 1]))
  if (tmpk[0], tmpk[1] + 1, tmpk[2], tmpk[3] - blist[tmpk[1]] + blist[tmpk[1] + 1]) not in outk:
    setk.add((tmpk[0], tmpk[1] + 1, tmpk[2], tmpk[3] - blist[tmpk[1]] + blist[tmpk[1] + 1]))
  if (tmpk[0], tmpk[1], tmpk[2] + 1, tmpk[3] - clist[tmpk[2]] + clist[tmpk[2] + 1]) not in outk:
    setk.add((tmpk[0], tmpk[1], tmpk[2] + 1, tmpk[3] - clist[tmpk[2]] + clist[tmpk[2] + 1]))


Measured memory_bytes: 4720
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint gcd( lint m, lint n )
{
	lint a=max(m,n),b=min(m,n);
	if(m==0) return n;if(n==0) return m;
	if(a%b==0) return b;
	return gcd(b,a-b*(a/b));
}
int n;
lint a[10100];
bool ng[4001000];
vector<lint> so;
bool ch(lint x,lint mo){
	if(mo>1145141919 && mo<2) return false;
	//if(mo<2) return false;
	lint now=0;
	for(int i=n;i>=0;i--){
		now=now*x+a[i];now%=mo;
	}
	//cout<<a[n]<<' '<<a[n-2]<<endl;
	//cout<<x<<' '<<mo<<' '<<now<<endl;
	return (now==0);
}
bool cal(lint ko){
	//cout<<ko<<endl;
	rep(i,30){
		lint x=rand()%ko;
		if(!ch(x,ko)) return false;
	}
	return true;
}
int main()
{
	cin>>n;
	for(int i=n;i>=0;i--) cin>>a[i];//cout<<a[0]<<a[1]<<a[2]<<a[3]<<endl;
	memset(ng,false,sizeof(ng));
	for(int i=2;i<100100;i++){
		if(ng[i]) continue;
		so.pb(i);
		for(int j=i*2;j<100100;j+=i) ng[j]=true;
	}
	lint sum=0;
	rep(i,n+1) sum+=a[i];
	//cout<<sum<<endl;
	sum=abs(sum);
	//sum=gcd(sum,abs(a[0]));
	rep(i,n+1) sum=gcd(sum,abs(a[i]));
	vector<lint> ko;
	int f=0;
	if(sum!=0){
		rep(i,so.size()){
			if(sum%so[i]==0){
				ko.pb(so[i]);
				while(sum%so[i]==0) sum/=so[i];
			}
		}
		if(sum>1) ko.pb(sum);
	}
	//else{
		REP(i,2,n+10){
			if(!ng[i]) ko.pb(i);
		}
	//}
	
	sort(All(ko));ko.erase(unique(All(ko)),ko.end());
	rep(i,ko.size()){
		if(cal(ko[i])) cout<<ko[i]<<endl;
	}
}


Measured memory_bytes: 4480
#include <iostream>
#include <vector>
#include <algorithm>

#define h first
#define p second.first
#define q second.second
#define all(c) (c).begin(),(c).end()

using namespace std;

typedef pair<int,int>pii;
typedef pair<int,pii>piii;

int main(void){

	int n,m,a;

	while(cin >> n >> m >> a,n|m|a){
		vector<piii>v(m);
		for(int i=0;i<m;i++)cin >> v[i].h >> v[i].p >> v[i].q;
		sort(all(v));
		reverse(all(v));

		for(int i=0;i<m;i++){
			if(v[i].p==a)a=v[i].q;
			else if(v[i].q==a)a=v[i].p;
		}

		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

typedef pair<int, int> P;
#define fs first
#define sc second

int main() {
    string s;
    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
const int N=2e5+5;
int n;
void solve(){
	puts("Yes");
	printf("%d %d\n",1,2),printf("%d %d\n",2,3),printf("%d %d\n",3,n+1),printf("%d %d\n",n+1,n+2),printf("%d %d\n",n+2,n+3);
	for(R int i=5;i<=n;i+=2){
//		printf("%d %d\n",i,1),printf("%d %d\n",i-1,1);
//		printf("%d %d\n",i,i-1+n),printf("%d %d\n",i-1,i+n);
		printf("%d %d\n",i-1,i),printf("%d %d\n",i,1),
		printf("%d %d\n",1,n+i-1),printf("%d %d\n",n+i-1,n+i);
	}
	if(n&1^1)printf("%d %d\n",n,n-1),printf("%d %d\n",n+(n^1^(n-1)),n+n);
}
int main(){
	scanf("%d",&n);
	if(n^(n&-n))return solve(),0;
	return puts("No"),0;
}

Measured memory_bytes: 2304
def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    print('%d %d %f' % (a[0] // a[1], a[0] % a[1], a[0] / a[1]))

if __name__ == "__main__":
    main()


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007


int main() {
	ll n;
	cin>>n;
	ll ch[200010];
	map<ll,ll>q;
	for(ll i=0;i<n;i++){
		cin>>ch[i];
		q[ch[i]]++;
	}
	ll cnt=0;
	for(auto itr=q.begin();itr!=q.end();itr++){
		ll val=itr->second;
		cnt+=val*(val-1)/2;
	}
	for(ll i=0;i<n;i++){
		ll now=ch[i];
		ll t=q[now];
		cout << cnt-q[now]*(q[now]-1)/2+(q[now]-1)*(q[now]-2)/2<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 13012
n = int(input())
S = []
A = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}

for i in range(n):
    S.append(input())

for i in range(n):
    if S[i][0] in A:
        A[S[i][0]] += 1

m = A['M']
a = A['A']
r = A['R']
c = A['C']
h = A['H']

print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)

Measured memory_bytes: 9760
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int n,x=0,y=0,ans=100000,c=0;
  cin>>n>>x;
  y++;
  while(1){
    if(y<x){
      y--;
      c++;
      y+=n;
    }
    else break;
  }
  co(c);
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;
int main(void){
    int n,tmp,alice,bob;
    vector<int>a;

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> tmp;
        a.push_back(tmp);
    }

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    alice=0;
    bob=0;

    for(int i=1;i<=n;i++){
        if(i%2)bob+=a.at(i-1);
        else alice+=a.at(i-1);
    }
    
    cout << abs(alice-bob) << endl;
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define pi 3.1415926

int main() {
    int n, m, i, s = 0, nr;
    cin >> n >> m;
    for (i = 1; i <= m; i++) {
        cin >> nr;
        s += nr;
    }
    if (s > n)
        cout << -1;
    else
        cout << n - s;
    return 0;
}


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

int main(){

    string s;
    cin >> s;

    string t="aiueo";

    rep(i,5){
        if(s[0]==t[i]){
            cout << "vowel" << endl;
            return 0;
        }
    }

    cout << "consonant" << endl;

    return 0;
}

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

int main(){
  string s,t;
  ll ans=0;
  cin>>s>>t;
  for(int i=0;i+t.size()-1<s.size();i++){
    ll tmp=0;
    for(int j=0;j<t.size();j++){
      if(i+j<s.size() && s[i+j]==t[j])tmp++;
    }
    ans=max(ans,tmp);
  }
  cout<<(int)t.size()-ans<<endl;
}


Measured memory_bytes: 3596
abcd = input()
l = len(abcd)

ans = ''
for i in range(2**(l-1)):
    s = int(abcd[0])
    tasi = abcd[0]
    for j in range(l-1):
        if i & 1<<j > 0:
            s += int(abcd[j+1])
            tasi += '+' + abcd[j+1]
        else:
            s -= int(abcd[j+1])
            tasi += '-' + abcd[j+1]
    if s == 7:
        ans = tasi + '=7'
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
//
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n=sc.nextInt();
		int[] permutations =new int[n+1]; //Piを入れる配列
		int min=n ;
		int[] mins =new int[n+1];//P1~Piの最小値を保存する配列
		for (int i=1;i<=n;i++) {
			permutations[i] = sc.nextInt();
			if (i==1) {
				min=permutations[1];
			}
			min = Math.min(min,permutations[i]);
			mins[i] =min;
		}
		int ans =0;
		for (int i=1;i<=n;i++) {
			if(permutations[i]==mins[i]) {
				ans ++;
			}
		}
		System.out.println(ans);
		
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//メソッド置き場

	//----------------------------------------
}

Measured memory_bytes: 80144
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

bool f[100010];

int main(){
	int n, m;
	cin>>n>>m;
	f[1] = true;
	vi v(n + 10, 1);
	rep(i, m){
		int x, y;
		cin>>x>>y;
		v[y]++;
		v[x]--;
		if(v[x]==0 && f[x] == true){
			f[x] = false;
			f[y] = true;
		}
		else if(f[x] == true){
			f[y] = true;
		}
	}
	int ans = 0;
	rep(i, n + 1) ans += f[i] == true ? 1 : 0;
	cout<<ans<<endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

ll N, K;
vector<ll> A(200010), F(200010);
bool isOK(ll key, ll cnt) {
    rep(i, N) {
        if (A[i] * F[i] > key) {
            cnt += (A[i] - key / F[i]);
        }
    }

    if (cnt <= K)
        return true;
    else
        return false;
}

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

    cin >> N >> K;
    A.resize(N), F.resize(N);
    rep(i, N) { cin >> A[i]; }
    rep(i, N) { cin >> F[i]; }

    sort(all(A));
    sort(all(F), greater<ll>());

    ll ng = -1, ok = pow(10, 12) + 5;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isOK(mid, 0))
            ok = mid;
        else
            ng = mid;
    }

    cout << ok << endl;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int h, w, a, b; cin >> h >> w >> a >> b;

  rep(i, h) {
    rep(j, w) {
      if((i<b)^(j<a)) cout << 1;
      else cout << 0;
    }
    cout << endl;
  }
}
      


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 5e6+5;
int vis[15]={0},c[15];
int a[15][15],ans=inf,n,m,s;
bool check();
void dfs(int x,int money);
int main()
{
	cin>>n>>m>>s;
	for(int i=1;i<=n;i++)
	for(int j=0;j<=m;j++)
	cin>>a[i][j];
	dfs(1,0);
	if(ans==inf)cout<<-1;
	else cout<<ans;
	return 0;
}
bool check()
{
	for(int i=1;i<=m;i++)
	if(c[i]<s)return false;
	return true;
}
void dfs(int x,int money)
{
	if(check())
	{
		ans=min(ans,money);
		return;
	}
	for(int i=x;i<=n;i++)
	{
		if(!vis[i])
		{
			vis[i]=1;
			for(int j=1;j<=m;j++)
			c[j]+=a[i][j];
			dfs(i,money+a[i][0]);
			vis[i]=0;
			for(int j=1;j<=m;j++)
			c[j]-=a[i][j];
		}
	}
}

Measured memory_bytes: 3612
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(x) x.begin(), x.end()
#define OUT(x) cout<<x<<endl;

#define I(x) int x; cin>>x;
#define VI(v,n) vector<int> v; v.resize(n); REP(i,n) cin>>v[i];
#define VINT(x) vector<int> x;
#define LI(x) long long x; cin>>x;
#define VLI(v,n) vector<lint> v; v.resize(n); REP(i,n) cin>>v[i];
#define VLINT(x) vector<long long> x;
#define D(x) double x; cin>>x;
#define VD(v,n) vector<double> v; v.resize(n); REP(i,n) cin>>v[i];
#define VDOUBLE(x) vector<double> x;
#define STR(x) string x; cin>>x;
#define VSTR(v,n) vector<string> v; v.resize(n); REP(i,n) cin>>v[i];
#define VSTRING(x) vector<string> x;

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int main()
{
	I(N);
	VSTR(A, N);
	VINT(C);
	VINT(R);

	bool any = false;
	REP(i, N)
	{
		REP(j, N)
		{
			if (A[i][j] == '#') any = true;
		}
	}

	if (!any)
	{
		OUT(-1);
		return 0;
	}

	// comp_r represnts the num of complete rows.
	int comp_r = 0;
	REP(i, N)
	{
		int c = 0;
		REP(j, N)
		{
			if (A[i][j] == '#') c++;
		}
		R.push_back(c);
		if (c == N) comp_r++;
	}

	// comp_c represents the num of complete columns.
	int comp_c = 0;
	REP(i, N)
	{
		int c = 0;
		REP(j, N)
		{
			if (A[j][i] == '#') c++;
		}
		C.push_back(c);
		if (c == N) comp_c++;
	}

	if (comp_r != 0)
	{
		OUT(N - comp_c);
	}
	else
	{
		int y = INT32_MAX;
		REP(i, N)
		{
			if (C[i] == 0)
			{
				if (R[i] != 0)
				{
					y = min(N - R[i] + 1, y);
				}
			}
			else
			{
				y = min(N - R[i], y);
			}
		}
		OUT(N - comp_c + y);
	}

	return 0;
}

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

int main(){
  int n;
  cin >> n;
  long a[n+1],b[n];
  for(int i = 0;i < n+1;i++){
    cin >> a[i];
  }
  for(int i = 0;i < n;i++){
    cin >> b[i];
  }
  long result = 0;
  for(int i = 0;i < n;i++){
    if(a[i] >= b[i]){
      result += b[i];
    }
    else{
      b[i] -= a[i];
      result += a[i];
      if(b[i] > a[i+1]){
        result += a[i+1];
        a[i+1] = 0;
      }
      else{
        result += b[i];
      	a[i+1] -= b[i];
      }
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define lambda(res,...) (function<res(__VA_ARGS__)>)[&](__VA_ARGS__) -> res
#define method(name,res,...) function<res(__VA_ARGS__)> name = (function<res(__VA_ARGS__)>)[&](__VA_ARGS__) -> res
#define foreach(i,n) for(auto &i:(n))

using namespace std;

int alphabet_size(string str){
	int res= 0 ;
	foreach(i,str){
		if('a'<=i and i<='z')++res;
	}
	return res;
}	

int main(){
	string str;
	cin >> str;
	map<char,int> m;
	for(int i = 0;i<alphabet_size(str);++i){
		char c;
		int num;
		cin >> c >> num;
		m[c] = num;
	}

	method(func,int,string str){
		if(str.size()==1){
			return m[str[0]];
		}
		int deapth = 0;
		int pos = 0;
		for(int i=0;i<str.size();++i){
			if(str[i]=='['){
				++deapth;
			}else if(str[i]==']'){
				--deapth;
			}else if(deapth==1 and str[i]=='-'){
				pos = i;
				break;
			}
		}
		int a = func(str.substr(1,pos-1));
		int b = func(str.substr(pos+1,str.size()-pos-2));
		if(min(a,b) or !max(a,b)){
			cout << "No" << endl;
			exit(0);
		}
		return max(a,b) - 1;
	};
	if(func(str)){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
}




Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
bool r[100005];
int main()
{
    int b, k;
    cin >> b >> k;
    int n[b];
    for(int i = 0; i < b; i++)
    {
    	cin >> n[i];
	}
	for(int i = 1; i <= k; i++)
	{
		bool lr = 0;
		for(int j = 0; j < b; j++)
		{
			if(i >= n[j])
			{
				lr |= (!r[i-n[j]]);
			}
		}
		r[i] = lr;
	}
	if(r[k] == 1)
	{
		cout << "First" << endl;
	}
	else
	{
		cout << "Second" << endl;
	}
}



Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    set<ll> st;
    rep(i, n) {
        ll a;
        cin >> a;
        st.insert(a);
    }

    ll m = st.size();

    if(n%2 == m%2) {
        out(m);
    }
    else {
        out(m-1);
    }
    
    re0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

ll N,M;
vector<vector<ll>> edge;
vector<ll> depth,cnt;
vector<pll> ans;

void dfs(ll u,ll p){
  for(auto &v:edge[u]){
    if(v==p){continue;}
    if(depth[v]!=-1){
      if(depth[v]<depth[u]){
        cnt[u]++;
        ans.push_back({u,v});
      }
      continue;
    }
    depth[v]=depth[u]+1;
    dfs(v,u);
  }
  if(cnt[u]&1){
    assert(p!=-1);
    cnt[u]++;
    ans.push_back({u,p});
  }
  else if(p!=-1){
    cnt[p]++;
    ans.push_back({p,u});
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N>>M;
  edge.resize(N);
  depth.resize(N,-1);
  cnt.resize(N);
  if(M&1){cout<<-1<<endl; return 0;}
  for(int i=0;i<M;i++){
    ll a,b;
    cin>>a>>b;
    a--; b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  depth[0]=0;
  dfs(0,-1);
  for(auto &I:ans){I.F++; I.S++; cout<<I<<endl;}

  return 0;
}


Measured memory_bytes: 16368
#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
    int n,d;
    cin >> n >> d;
    int i=1;
    ll nokori=n;
    while(1){
        nokori=nokori-(2*d+1);
        if(nokori<=0){
            cout << i << endl;
            break;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    int n, k; cin >> n >> k;
    double a[200001]; INITA(a, 0, 200000, 0);
    double mx = 0;
    double tot = 0;
    double num = 0;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        a[i] = (double) tmp * (tmp + 1) / 2 / tmp;
        tot += a[i];
        num++;
        if (num == k) {
            mx = max(mx, tot);
            tot -= a[i-k+1];
            num--;
        }
    }

    cout.precision(17);
    cout << fixed << mx << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  ll k = 10;
  if(n % 2) {
    cout << 0 << endl;
    return 0;
  }
  while(k <= n) {
    ans += n / k;
    k *= 5;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n := getInt()
	hs := make([]int, n+2)
	hs[0], hs[n+1] = 0, 0
	for i := 1; i <= n; i++ {
		hs[i] = getInt()
	}

	ans := 0
	for {
		l := -1
		r := -1
		mini := 101
		for i, h := range hs {
			if h != 0 {
				if l == -1 {
					l = i
				}
				r = i
				mini = min(mini, h)
			}

			if (l != -1) && (h == 0) {
				break
			}
		}
		if l == -1 {
			break
		}

		for i := l; i <= r; i++ {
			hs[i] -= mini
		}
		ans += mini
	}

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Apr 26 15:10:33 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(5);
    REP(i, 5) std::cin >> a[i];
    Int mi = *std::min_element(a.begin(), a.end());
    std::cout << (n + mi - 1) / mi + 4 << std::endl;
}


Measured memory_bytes: 256