akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 


int main() {
  string s,t;
  cin >> s >>t;
  int ans = INF;

  for (int i=0; i+t.length() <= s.length(); i++) {
    int num = 0;
    for(int j=0;j<t.length(); j++) {
      if (s[i+j] != t[j]) num++;
    }
    chmin(ans,num);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
int main(){
    int a,b;
    int i,j,k;
    int ans;
    while(1){
        scanf("%d %d",&a,&b);
        if(a==0&&b==0){
            break;
        }
        ans=0;
        for(i=1;i<a-1;i++){
            for(j=i+1;j<a;j++){
                for(k=j+1;k<a+1;k++){
                    if(i+j+k==b) ans++;
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1844
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using P = pair<int, int>;

signed main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  vector<P> c(n);
  rep(i, n) cin >> c[i].second >> c[i].first;
  sort(begin(c), end(c));
  int s = 0;
  rep(i, n) s += c[i].second;
  // int rem = b[n - 1];
  bool flg = true;
  repr(i, n) {
    if (s > c[i].first)
      flg = false;
    else
      s -= c[i].second;
    // cerr << s << " " << c[i - 1] << " " << b[i - 1] << " " << flg << endl;
  }
  cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 6528
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char S[10005],dam[9];
int N,i,l,t;
 
int cmp(const void *a,const void *b){return *(int*)a-*(int*)b;}
 
int dfs(int s,int e)
{
	int i,j,c,p=0,t;
	int a[4000];
	for(j=s+1;j+1<e;)
	{
		if(S[j]=='[')//not leaf
		{
			for(i=j+1,c=1;i<=e&&c!=0;i++)
			{
				if(S[i]=='[')c++;
				else if(S[i]==']')c--;
			}
			a[p++]=dfs(j,i-1);
			j=i;
		}
		else//leaf
		{
			for(i=j;(c=sscanf(S+i,"%d",&t));i+=(sprintf(dam,"%d",t)+2))
				a[p++]=t;
			qsort(a,p,sizeof(int),cmp);
			for(i=t=0;i<p/2+1;i++)
				t+=a[i]/2+1;
					return t;
		}
	}
	qsort(a,p,sizeof(int),cmp);
	for(i=t=0;i<p/2+1;i++)
		t+=a[i];
	return t;
}
 
int main()
{
	for(scanf("%d\n",&N);N--;)
	{
		gets(S);
		for(i=0,l=strlen(S);i<l;i++)
		{
			if((S[i]=='['&&'0'<=S[i+1]&&S[i+1]<='9')||(S[i]==']'&&'0'<=S[i-1]&&S[i-1]<='9'))
				S[i]=' ';
		}
		//puts(S);
		printf("%d\n",dfs(0,l));
	}
	return 0;
}

Measured memory_bytes: 724
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    fact();
    int N, M, K;
    cin >> N >> M >> K;
    int pattern = Mul(C(N * M, K), (K *(K - 1))/ 2);
    int ave = Div((N + M), 3);
    int sum = Mul(pattern, ave);
    //cout << pattern << " " << ave << " " << sum << endl;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

char albt[26] = {'a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x',
                 'y','z'};


//fill(score, score+202020, 0);

bool check(vector<ll> va, vector<ll> vf, ll n, ll k, ll mid){
    ll t = 0;
    for (int i=0;i<n;i++){
        ll tmp = va[i] * vf[i];
        if (tmp > mid) t += (va[i] - mid/vf[i]);

        if (t > k) return false;
        // cout << i << " " << va[i] << " " << vf[i] << " " << t << endl;
    }
    return true;
}

int main(){
  ll n, k;
  cin >> n >> k;
  
  vector<ll> va;
  vector<ll> vf;
  for (int i=0;i<n;i++){
    ll a;
    cin >> a;
    va.push_back(a);
  }

  for (int i=0;i<n;i++){
    ll f;
    cin >> f;
    vf.push_back(f);
  }

  sort(va.begin(), va.end());
  sort(vf.begin(), vf.end(), greater<int>());

  ll low = 0;
  ll high = 1e12;
  ll mid;
  while(low <= high){
      mid = (low + high)/2;
      // cout << "new: " << mid << " " << low << " " << high << " " << endl;
      if (check(va, vf, n, k, mid)) high = mid-1;
      else low = mid+1;
  }

  if(check(va, vf, n, k, mid)) cout << mid << endl;
  else cout << mid+1 << endl;
}



Measured memory_bytes: 6640
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
int main(void){
  int x,y;
  cin>>x>>y;
  ll ans=0;
  if(x==1){
    ans+=300000;
  }else if(x==2){
    ans+= 200000;
  }else if(x==3){
    ans+= 100000;
  }if(y==1){
    ans+=300000;
  }else if(y==2){
    ans+= 200000;
  }else if(y==3){
    ans+= 100000;
  }
  if(x==1 && y==1){
    ans+=400000;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    ll ans = 0;
    if(n == 1)ans += 300000;
    if(m == 1)ans += 300000;
    if(n == 2)ans += 200000;
    if(m == 2)ans += 200000;
    if(n == 3)ans += 100000;
    if(m == 3)ans += 100000;
    if(m == 1 && n == 1)ans += 400000;
    cout << ans;
}   

Measured memory_bytes: 256
#仮設
#LRの間からは子供たちが離れていきRLの間に子どもたちがたまっていく 
# ⇒ LR が一つ一つのかたまりの区切りとなる
#RLの子供のたまり方は
# RLの数を足した数が偶数なら同じ数だけたまる
# 奇数のときは、Rの数が奇数ならばRのほうが多く貯まる

# 最後はLと決まっており、LRが区切りとなるため最後にRを付加する

#最初はR,最後はL
S = input()

#最後にRを付加する
S = S + 'R'

#各文字数のカウンタ(LRが見つかるまでカウントする)
L_count = 0
R_count = 0

#RLのときの添字
R_ind = 0
L_ind = 0

#答えの配列
ans = [0] * (len(S) -1) 

for i in range(len(S) -1 ):
    if S[i] == 'R':
        R_count += 1
        #RLのときは添字を覚えておく
        if S[i+1] == 'L':
            R_ind = i
            L_ind = i+1

    if S[i] == 'L':
        L_count += 1
        #LRのときは区切りがつくのでそれまでの計算をする
        if S[i+1] == 'R':
            #RとLの文字数が足して偶数のときは半分ずつRLのところに振り分ける
            if ( (R_count + L_count) % 2 == 0):
                ans[R_ind] = int((R_count + L_count) / 2)
                ans[L_ind] = int((R_count + L_count) / 2)
                R_count = 0
                L_count = 0
            else:
                #Rが奇数のときRのほうが1多くなる
                if R_count % 2 == 1 :
                    ans[R_ind] = ((R_count + L_count) // 2 )+ 1
                    ans[L_ind] = (R_count + L_count) - ans[R_ind]
                    R_count = 0
                    L_count = 0
                else:
                    ans[R_ind] = ((R_count + L_count) // 2 )
                    ans[L_ind] = (R_count + L_count) - ans[R_ind]
                    R_count = 0
                    L_count = 0
ans = map(str,ans)
print(" ".join(ans))


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

int main() {
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a, a+N, greater<int>());
    int ret = 0;
    for (int i =0; i< N; i++) ret += a[i] * (i & 1 ? -1 : 1);
    cout << ret << endl;

    return 0;
}


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

// x 以上の要素の数を求める
int find(int x, vector<int> l, int n) {
	int ans = 0;
	for (int i=n-1;i>=0;i--) {
		if (l[i] >= x) {
			ans++;
		}
		else {
			break;
		}
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	vector<int> l(n);
	rep(i,n) {
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	int ans = 0;
	for (int i=0; i<n; i++) {
		for (int j=i+1; j<n; j++) {
			int a = l[i];
			int b = l[j];
			ans += max(0, n-j-1-find(a+b, l, n));
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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--)
typedef long long LL;
LL N,M;
LL A[100001];
vector<LL>v;
LL count(LL x, LL y){
	LL lb=-1;
	LL ub=N;
	while(ub-lb>1){
		LL mid=(ub+lb)/2;
		if(A[x]+v[mid]>=y){
			lb=mid;
		}else{
			ub=mid;
		}
	}
	return lb;
}

bool check(LL x){
	LL num=0;
	REP(i,N){
		num+=(count(i,x)+1);
	}
	//cout<<num<<" "<<x<<endl;
	if(num>=M){
		return true;
	}else{
		return false;
	}
}

LL binary_search(){
	LL lb=0;
	LL ub=2000001;
	while(ub-lb>1){
		LL mid=(ub+lb)/2;
		if(check(mid)==true){
			lb=mid;
		}else{
			ub=mid;
		}
	}
	return lb;
}

LL S[100001];
LL answer(LL num){
	REP(i,N){
		if(i==0){
			S[0]=v[0];
		}else{
			S[i]=S[i-1]+v[i];
		}
	}
	LL ans=0;
	LL cc=0;
	REP(i,N){
		LL temp=count(i,num);
		cc+=temp+1;
		//cout<<temp<<endl;
		ans+=(A[i])*(temp+1);
		//cout<<ans<<" ans"<<endl;
		if(temp!=-1){
			ans+=S[temp];
			//cout<<ans<<" ans2"<<endl;
		}
	}
	cc=max((LL)0,cc-M);
	return (ans-cc*num);
}

int main(){
	cin>>N>>M;
	REP(i,N){
		cin>>A[i];
		v.push_back(A[i]);
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	LL temp=binary_search();
	//cout<<temp<<endl;
	cout<<answer(temp)<<endl;
}

Measured memory_bytes: 2676
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define f first
#define s second
#define mp make_pair
#define pb push_back

int main(void){
  string a[3];
  int t = 0;
  rep(i,3)cin>>a[i];

  //rep(w,3)cout<<(char)(w+'a')<<" "<<a[w]<<endl;;
  while(true){
    if(a[t].size() == 0)break;
    int w = a[t][0] - 'a';
    a[t] = a[t].substr(1,a[t].size());
    t = w;
  //  rep(w,3)cout<<(char)(w+'a')<<" "<<a[w]<<endl;;
  }
  cout<<(char)(t+'A')<<endl;

 
}

Measured memory_bytes: 256
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 3e5+7 ;
const int INF = 1e18 ;
const int MOD = 1e9 + 7 ;
string s ;

void solve(){
	int  n ;
	cin >> n ;
	int ans = ceil(1.0 * n /2) ;
	cout << ans << endl ;

}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Measured memory_bytes: 256
#include <iostream>

int main() {

    int a,b;

    std::cin >> a >> b;

    if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
        std::cout << "Possible" << std::endl;
    }
    else{
        std::cout << "Impossible" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll              long long int
#define ull             unsigned long long int
#define mod             1000000007 
#define pb              push_back
#define mp              make_pair
#define count_1(n)      __builtin_popcountll(n) //set bits
#define fr              first
#define sc              second

bool isPrime(ll n) {

  if (n == 1) {
    return false;
  }

  for (ll i = 2; i*i <=n; i++) {
    if (n % i == 0) return false;
  }

  return true;
}

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

int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        if (arr[mid] == x) 
            return mid; 
  
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    return -1; 
} 



int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n,sum=0;
    cin>>n;
    ll dp[n+1];
    dp[0]=1;
    dp[1]=0;
    dp[2]=0;
    for(int i=3;i<=n;i++){
        sum+=dp[i-3];
        sum%=mod;
        dp[i]=sum;
    }
    cout<<dp[n];
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long int

int32_t main() {
    // int x, k, d;
    // cin >> x >> k >> d;
    // int val = x / d;
    // int rem = x % d;
    // x = abs(x);
    // if (k <= val) {
    //     cout << x - k * d << endl;
    // } else if ((k - val) & 1) {
    //     cout << abs(rem - d) << endl;
    // } else {
    //     cout << x - val * d << endl;
    // }
    int X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    int Q = X / D;
    int R = X % D;
    if (Q >= K) {
        cout << X - K * D << endl;
    } else if ((K - Q) & 1) {
        cout << abs(R - D) << endl;
    } else {
        cout << X - Q * D << endl;
    }

    return 0;
}

/*
else {
    int rem = x % d;
    k -= val;
    if (k & 1) {
        cout << abs(rem - d) << endl;
    } else {
        cout << abs(x - val * d) << endl;
    }
}
*/

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

const ll INF = 1000000000;
const int MAX_N = 1000;

int N;
int A[20];
int x[20][20];
int y[20][20];

int counter(int x){
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

void solve(){
    cin >> N;

    for(int i = 1; i <= N; i++){
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++){
           cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++){
        bool ok = true;
        for(int i = 1; i <= N; i++){
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++){
                if(((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]){
                    ok = false;
                }
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }

    cout << ans << endl;

    return;
}

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


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007


constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool flag=true;


int main() {
    int S,A,B,C,D;
    cin>>S;

    D=S%10;
    S=S/10;
    C=S%10;
    S=S/10;
    B=S%10;
    S=S/10;
    A=S%10;
    
    string ans;
    if(A+B+C+D==7){ans=to_string(A)+'+'+to_string(B)+'+'+to_string(C)+'+'+to_string(D)+"=7";}
    if(A+B+C-D==7){ans=to_string(A)+'+'+to_string(B)+'+'+to_string(C)+'-'+to_string(D)+"=7";}
    if(A+B-C+D==7){ans=to_string(A)+'+'+to_string(B)+'-'+to_string(C)+'+'+to_string(D)+"=7";}
    if(A+B-C-D==7){ans=to_string(A)+'+'+to_string(B)+'-'+to_string(C)+'-'+to_string(D)+"=7";}
    if(A-B+C+D==7){ans=to_string(A)+'-'+to_string(B)+'+'+to_string(C)+'+'+to_string(D)+"=7";}
    if(A-B+C-D==7){ans=to_string(A)+'-'+to_string(B)+'+'+to_string(C)+'-'+to_string(D)+"=7";}
    if(A-B-C+D==7){ans=to_string(A)+'-'+to_string(B)+'-'+to_string(C)+'+'+to_string(D)+"=7";}
    if(A-B-C-D==7){ans=to_string(A)+'-'+to_string(B)+'-'+to_string(C)+'-'+to_string(D)+"=7";}
    cout<< ans;

  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;
	static int[] par, dep, ch;

	static void solve() {
		int[] a=ir.nextIntArray(3);
		Arrays.sort(a);
		out.println(a[0]==a[1]?a[2]:a[0]);
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string t;
int a[4005],s[5][4005],u[5];
 int main(){
 	int n;
 	cin>>n>>t;
 	for(int i=1;i<=n;i++)
 	{
 		if(t[i-1]=='R') a[i]=0;
 		if(t[i-1]=='G') a[i]=1;
 		if(t[i-1]=='B') a[i]=2;
	 }
	 for(int i=1;i<=n;i++)
	   {
	   	 for(int j=0;j<3;j++)s[j][i]=s[j][i-1];
	   	 s[a[i]][i]=s[a[i]][i-1]+1;
	   }
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]==a[j])continue;
			memset(u,0,sizeof(u));
			u[a[i]]=1;u[a[j]]=1;
			int x;
			for(int k=0;k<3;k++)
			   if(u[k]==0)x=k;
			ans+=s[x][n]-s[x][j];
			if(j-i+j<=n&&a[j-i+j]==x)ans--;
		}
	}
 cout<<ans;
return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {
  
  int N;
  cin >> N;
  ll ten = 1, nine = 1, eight = 1;
  rep(i,N) {
    ten *= 10; ten %= MOD;
    nine *= 9; nine %= MOD;
    eight *= 8; eight %= MOD;
  }

  ll ans = ten + MOD - nine * 2 % MOD + eight;
  ans %= MOD;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=100005;
const int MOD=1e9+7;
 

// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
 
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/

int k,n;
cin>>k>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int mx=arr[0]+k-arr[n-1];
//trace1(mx);
for(int i=0;i<n-1;i++)
{
	
	mx=max(mx,arr[i+1]-arr[i]);
	//trace1(mx);
}
cout<<k-mx<<endl;

}


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

int main()
{
    int X, Y;

    cin >> X >> Y;

    if (Y % 2 == 0 && Y >= 2 * X && Y <= 4 * X)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3580
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include <string>

using namespace std;
const int maxn = 1e5+5;
int t1[maxn], t2[maxn], c[maxn];
int ra[maxn], height[maxn];
int sa[maxn], num[maxn];
int n;
 
bool cmp(int *r, int a, int b, int l)
{
    return r[a]==r[b]&&r[a+l]==r[b+l];
}
 
void da(int str[], int sa[], int ra[], int height[], int n, int m)
{
    n++;
    int i, j, p, *x = t1, *y = t2;
    for(i = 0; i < m; i++) c[i] = 0;
    for(i = 0; i < n; i++) c[x[i]=str[i]]++;
    for(i = 1; i < m; i++) c[i] += c[i-1];
    for(i = n-1; i >= 0; i--) sa[--c[x[i]]] = i;
    for(j = 1; j <= n; j<<=1)
    {
        p = 0;
        for(i = n-j; i < n; i++) y[p++] = i;
        for(i = 0; i < n; i++) if(sa[i] >= j) y[p++] = sa[i]-j;
        for(i = 0; i < m; i++) c[i] = 0;
        for(i = 0; i < n; i++) c[x[y[i]]]++;
        for(i = 1; i < m; i++) c[i] += c[i-1];
        for(i = n-1; i >= 0; i--) sa[--c[x[y[i]]]] = y[i];
        swap(x, y);
        p = 1; x[sa[0]] = 0;
        for(i = 1; i < n; i++)
            x[sa[i]] = cmp(y, sa[i-1], sa[i], j) ? p-1 : p++;
        if(p >= n) break;
        m = p;
    }
    int k = 0;
    n--;
    for(i = 0; i <= n; i++) ra[sa[i]] = i;
    for(i = 0; i < n; i++)
    {
        if(k) k--;
        j = sa[ra[i]-1];
        while(str[i+k]==str[j+k]) k++;
        height[ra[i]] = k;
    }
}
 
bool judge(int x)
{
    int mmin = 1, mmax = 1;
    for(int i = 1; i <= n; i++)
    {
        if(height[i] < x)
        {
            mmin = sa[i];
            mmax = sa[i];
        }
        else
        {
            mmin = min(mmin, sa[i]);
            mmax = max(mmax, sa[i]);
            if(mmax-mmin >= x) return 1;
        }
    }
    return 0;
}
 
string ss;
int main(void)
{
    while(cin >> n )
    {
        cin >> ss;
        for(int i = 0; i < n; i++)
            num[i] = ss[i] - '0';
        da(num, sa, ra, height, n, 1024);
        int l = 0, r = n, ans = 0;
        while(l <= r)
        {
            int mid = (l+r)/2;
            if(judge(mid)) l = mid+1, ans = mid;
            else r = mid-1;
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 384
N,M=map(int, input().split())
R=[tuple(map(int, input().split())) for _ in range(M)]
for i in range(0 if N==1 else 10**(N-1), 10**N):
    T = str(i)
    flag = True
    for s,c in R:
        if int(T[s-1]) != c:
            flag = False
            break
    if flag:
        print(i)
        exit()
print(-1)

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

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

	return 0;
}

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

int n, m;

int main(void){
  cin >> n >> m;
  vector<pair<int, int>> p(n);
  vector<pair<int, int>> res(n, {(int)1e9, -1}); //dist, j
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    p[i] = {a, b};
  }
  for(int i = 0; i < m; i++){
    int c, d;
    cin >> c >> d;
    for(int j = 0; j < n; j++){
      int dist = abs(p[j].first-c) + abs(p[j].second-d);
      if(dist < res[j].first) res[j] = {dist, i};
    }
  }
  for(int i = 0; i < n; i++){
    cout << res[i].second+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
using namespace std;
string s;
int main(){
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++) if(s[i]=='C')
        for(int j=i+1;j<len;j++) if(s[j]=='F'){
            puts("Yes");
            return 0;
        }
    puts("No");
    return 0;
}

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

int main () {
  int A, B;
  cin >> A >> B;
  
  int r = 0;
  
   for (int i = A; i <= B; i++) {
     int s = i % 10; int t = i / 10000 % 10;
     int u = i / 10 % 10; int v = i / 1000 % 10;
     if (s == t && u == v) r++;
   }
  cout << r << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, L;
  cin >> N >> L;
  vector<int> a(N);
  cin >> a;
  for (int i = 1; i < N; ++i)
    if (a[i] + a[i - 1] >= L) {
      cout << "Possible\n";
      for (int j = 1; j < i; ++j)
        cout << j << '\n';
      for (int j = N - 1; j > i; --j)
        cout << j << '\n';
      cout << i << '\n';
      exit(0);
    }
  cout << "Impossible\n";

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 1280
package main

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

var sc = bufio.NewScanner(os.Stdin)

var slice [][]int
var dp [][]float64

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	slice = make([][]int, n)
	for i := 0; i < n; i++ {
		slice[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			slice[i][j] = nextInt()
		}
	}

	dp = make([][]float64, 1000000)
	for i := 0; i < len(dp); i++ {
		dp[i] = make([]float64, 3)
	}

	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			for k := 0; k < 3; k++ {
				if j == k {
					continue
				}
				chmax(&dp[i+1][k], dp[i][j]+float64(slice[i][k]))

			}
		}
	}

	res := 0.0
	for i := 0; i < 3; i++ {
		chmax(&res, dp[n][i])
	}

	fmt.Println(int(res))
}

func abs(a int) int {
	if a < 0 {
		return -1 * a
	}

	return a
}

func chmin(a *float64, b float64) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

func chmax(a *float64, b float64) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}


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

int main(){
  int n;
  cin >> n;
  long long int l[87];
  l[0]=2,l[1]=1;
  for(int i=0;i<85;i++){
    l[i+2]=l[i+1]+l[i];
  }
  cout << l[n] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int abs(int a,int b){
	return (a>b)?a:b;
}
int main(){
	fast_io
	int a,b; cin>>a>>b;
	int ans=a-1;
	if(b>=a) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    char a[101] = { 0 };
    char b[101] = { 0 };
    char c[101] = { 0 };
    scanf("%s %s %s", a, b, c);
    printf("%c%c%c\n", a[0], b[0], c[0]);
    return 0;
}


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

int main() {
    int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
    if (a + b <= 2 * c) {
        cout << a * x + b * y << endl;
    } else {
        int ans = 2 * c * min(x, y);
        if (x > y) {
            ans += (x - y) * min(a, 2 * c);
        } else {
            ans += (y - x) * min(b, 2 * c);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <cassert>
#include <unordered_map>

#define _(x) { cout << #x << " = " << x << " "; }

const double E = 1e-8;
const double PI = acos(-1);

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long x;
    cin >> x;
    long long ax =  1000 * (x / 500);
    x -= 500 * (x / 500);
    if (x > 0) ax += 5 * (x / 5);
    cout << ax << '\n';
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int s;
  cin>>s;
  if(s/100%10!=s/1000 && s%100/10!=s%10 && s/100%10!=s%100/10)cout<<"Good"<<endl;
 
  
  else cout<<"Bad"<<endl;

}


Measured memory_bytes: 256
H,W = map(int,input().split())
mas = [list(input()) for i in range(H)]
new_mas = [row for row in mas if "#" in row]
new_mas2 = [column for column in list(zip(*new_mas)) if "#" in column]
for i in list(zip(*new_mas2)):
    for j in i:
        print(j,end="")
    print()


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

 
using namespace std;
 
const int N=3000+5;
 
int n,a[N];
int m,b[N];
int dp[N][N];
int ans[N],sz=0;
 
string s,t;
 
int main()
{
    cin>>s>>t;
    n=s.size();
    m=t.size();
    for(int i=1;i<=n;i++)
    {
        a[i]=(s[i-1]);
    }
    for(int i=1;i<=m;i++)
    {
        b[i]=(t[i-1]);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int x=n;
    int y=m;
    while(x && y)
    {
        if(a[x]==b[y])
        {
            ans[++sz]=a[x];
            x--;
            y--;
        }
        else
        {
            if(dp[x][y]==dp[x-1][y])
            {
                x--;
            }
            else
            {
                y--;
            }
        }
    }
    for(int i=sz;i>=1;i--)
    {
        cout<<char(ans[i]);
    }
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 35584
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC optimize "-O3"
# define int long long
  
using namespace std;
  
const int N = 1e5 + 7;
const int mod = 1e9 + 7;

vector < int > adj[N];

void solve() {
	int n;
	cin >> n;
	vector < int > a(n);
	map < int, int > mp;
	int ans = 0;
	for ( int i = 0; i < n; i++ ) {
		cin >> a[i];
		ans += mp[ i - a[i] ];
		mp[ a[i] + i ]++;
	}
	cout << ans;
}

int32_t main() {
	speed;
	int T = 1;
	// cin >> T;
	while ( T-- ) {
		solve();
	}
}

Measured memory_bytes: 29756
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
    long long int n,x;
    cin >> n >> x;
    vector<long long int> a(n);
    long long int cnt = 0, pre;
    for( int i=0; i<n; ++i ){
        cin >> a[i];
        if (i){
            auto diff = max( a[i]+a[i-1]-x-pre, 0ll );
            cnt += diff;
            pre = min ( diff, a[i] );
        }
    }
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1000001; //check the limits, dummy


ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

ll inv(ll base) {
	return modExp(base, MOD-2);
}

ll mul(ll A, ll B) {
	return (A*B)%MOD;
}

ll add(ll A, ll B) {
	return (A+B)%MOD;
}

ll dvd(ll A, ll B) {
    return mul(A, inv(B));
}

ll sub(ll A, ll B) {
    return (A-B+MOD)%MOD;
}

ll* facs = new ll[MX];
ll* facInvs = new ll[MX];

ll choose(ll a, ll b) {
	if (b > a) return 0;
	if (a < 0) return 0;
	if (b < 0) return 0;
    ll cur = facs[a];
    cur = mul(cur, facInvs[b]);
    cur = mul(cur, facInvs[a-b]);
    return cur;
}

void initFacs() {
	facs[0] = 1;
	facInvs[0] = 1;
	FOR(i, 1, MX) {
		facs[i] = (facs[i-1] * i) % MOD;
		facInvs[i] = inv(facs[i]);
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    initFacs();
	
    ll X, Y; cin >> X >> Y;
    if ((X+Y)%3 != 0) {
        cout << 0 << endl; return 0;
    }

    if (max(X, Y) > 2*min(X, Y)) {
        cout << 0 << endl; return 0;
    }
    int K=(X+Y)/3;
    X -= (X+Y)/3; Y -= K;
    
    cout << choose(X+Y, X) << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 15872
#include <bits/stdc++.h>
typedef long long ll;

#define pll pair<ll,ll>
#define ff first
#define snd second
#define pb push_back
#define vll vector<ll>
#define vpll vector<pll>
#define endl "\n"
#define MOD 1000000007
using namespace std;

ll const N = 1e5+1;


void solve()
{
   ll n;
   cin>>n;
   ll ans = 0;
   ll p = n/500;
   n = n%500;
   ans+= (1000*p);
   p = n/5;
   ans+= (5*p);
   std::cout << ans;
}
 
int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
	    int t=1;
	    //cin>>t;
	    while(t--)
	    {
	            solve();
	    }
	    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define de(x) cout << #x << " = " << x << endl
#define rep(i, a, b) for(int i=(a); i<(b); i++)
//-----
const int N=111;
int dx[2]={1, -1};
int h, w, n;
int ans[N][N];
int main() {
	scanf("%d%d%d", &h, &w, &n);
	int x=0, y=0;
	rep(i, 0, n){
		int t;
		scanf("%d", &t);
		while(t){
			ans[x][y]=i+1;
			t--;
			y+=dx[x&1];
			if(y==w&&x%2==0)x++, y--;
			if(y==-1&&x%2==1)x++, y=0;
		}
	}
	rep(i, 0, h)rep(j, 0, w)printf("%d%c", ans[i][j], " \n"[j==w-1]);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1114514];
int main(){
	ll n;
	cin>>n;
	ll num;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i==0)num=a[0];
		else num=__gcd(a[i],num);
	}
	map<ll,ll>mp;
	for(int i=0;i<n;i++){
		ll x=sqrt(a[i]);

		if(a[i]%2==0){
			mp[2]++;
			if(mp[2]==2){
				if(num==1){
					cout<<"setwise coprime";
					return 0;
				}else{
					cout<<"not coprime";
					return 0;
				}
			}
			if(mp[2]==n){
				cout<<"not coprime";
				return 0;
			}
			while(a[i]%2==0)a[i]/=2;
		}
		for(int j=3;j<=x;j+=2){
			if(a[i]%j==0){
				mp[j]++;
				if(mp[j]==2){
					if(num==1){
						cout<<"setwise coprime";
						return 0;
					}else{
						cout<<"not coprime";
						return 0;
					}
				}
				if(mp[j]==n){
					cout<<"not coprime";
					return 0;
				}
				while(a[i]%j==0)a[i]/=j;
			}
		}
		if(a[i]>1)mp[a[i]]++;
		if(mp[a[i]]==2){
			if(num==1){
				cout<<"setwise coprime";
				return 0;
			}else{
				cout<<"not coprime";
				return 0;
			}
		}
		if(mp[a[i]]==n){
			cout<<"not coprime";
			return 0;
		}
	}
	cout<<"pairwise coprime";
	return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++)
  {
    cin >> h[i];
  }

  const int INF = 1e9;

  vector<int> dp(n+1,INF);
  dp[0] = 0;
  for (int i = 1; i < n; i++)
  {
    for (int j = 1; j <= k; j++)
    {
      if(i-j>=0){
        dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
      }
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
/*
 * atcoder/abc122/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 100100;
int N, Q;
string S;
ll acc[MAX];

void solve() {
  cin >> N >> Q >> S;
  acc[0] = 0;
  loop(n,0,N) {
    if (n == 0) acc[0] = 0;
    else acc[n] = acc[n-1] + (S[n-1] == 'A' and S[n] == 'C');
  }
  ll l, r;
  loop(q,0,Q) {
    cin >> l >> r;
    cout << acc[r-1] - acc[l-1] << endl;
  }
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
int main()
{
    int p,i,count=0,r=0;
    char ar[100000];
    scanf("%s",ar);
    p=strlen(ar);
    if(ar[0]=='A')
    {
        for(i=1;i<p;i++)
        {
            if(i>1 && i<p-1)
            {
                if(ar[i]=='C') count++;
            }
            if(ar[i]>='A' && ar[i]<='Z' && ar[i]!='C' && ar[i]!='A') r++;
        }
        if(count==1 && r==0) printf("AC\n");
        else printf("WA\n");
    }
    else printf("WA\n");
    return 0;
}


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

// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 200007

#define ll long long int

ll mod=1e9+7;



int main(){
	int n;
	cin>>n;
	for(int i=1;i<=min(5,n);i++)
		cout<<0<<endl;
	if(n<6){

	}
	else{
		map<int,int> mp;
		int h=sqrt(2*n);
		for(int x=2;x<=h;x++){
			for(int y=2;y<=h;y++){
				for(int z=2;z<=h;z++){
					int sum=x+y+z;
					if(sum%2)
						continue;
					sum/=2;
					int ans= x*x + y*y + z*z ;
					if(ans<=2*n && ans%2==0){
						//cout<<x<<" "<<y<<" "<<z<<" "<<ans<<endl;
						if(sum-x<1||sum-y<1||sum-z<1)
							continue;
						ans/=2;
						mp[ans]++;
					}
				}
			}
		}
		for(int i=6;i<=n;i++)
			cout<<mp[i]<<endl;
	}
}

Measured memory_bytes: 4084
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long

signed main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int b[n];
  for (int i = 0; i < n; i++) {
    b[i] = a[i];
  }
  sort(b, b + n);
  int l = b[n / 2 - 1], r = b[n / 2];
  for (int i = 0; i < n; i++) {
    if (a[i] <= l) cout << r << endl;
    else cout << l << endl;
  }
  return 0;
}


Measured memory_bytes: 5376
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    ans = 0
    cnt = 0
    for _ in range(n):
        ai = ni()
        if ai == 0:
            ans += cnt // 2
            cnt = 0
        else:
            cnt += ai
    ans += cnt // 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 13684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s, t;
    cin >> s >> t;
    ll ans = len(t);
    rep(i, len(s) - len(t) + 1) {
        string ss = s.substr(i, len(t));
        ll cnt = 0;
        rep(j, len(t)) {
            if (ss[j] != t[j]) {
                cnt++;
            }
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
N = int(input())
S = str(input())

DP = [[-1] * 1001 for i in range(4)]
DP[0][0] = 0

for i in range(N):
    for j in reversed(range(3)):
        for k in reversed(range(1001)):
            if DP[j][k] != -1:
                if j == 0:
                    DP[j + 1][k + int(S[i]) * 100] = 0
                if j == 1:
                    DP[j + 1][k + int(S[i]) * 10] = 0
                if j == 2:
                    DP[j + 1][k + int(S[i]) * 1] = 0

Sum = 0
for k in range(1001):
    if DP[3][k] == 0:
        Sum += 1
print(Sum)



Measured memory_bytes: 44200
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
int A1[101], A2[101], S1[101], S2[101];

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

  cin >> N;
  rep(i, N) cin >> A1[i];
  rep(i, N) cin >> A2[i];

  rep(i, N){
    if (i==0){
      S1[i] = A1[i];
      continue;
    }
    S1[i] = S1[i-1]+A1[i];
  }

  rep_down(i, N){
    if (i==N-1){
      S2[i] = A2[i];
      continue;
    }
    S2[i] = S2[i+1]+A2[i];
  }
  int ans = 0;
  rep(i, N){
    ans = max(ans, S1[i]+S2[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256