akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;


int main(){
	double t1, t2;

	while( cin >> t1 >> t2 ){
		if( t1 < 35.5 && t2 < 71.0){
			cout << "AAA" << endl;
		}else if( t1 < 37.5 && t2 < 77.0){
			cout << "AA" << endl;
		}else if( t1 < 40.0 && t2 < 83.0){
			cout << "A" << endl;
		}else if( t1 < 43.0 && t2 < 89.0){
			cout << "B" << endl;
		}else if( t1 < 50.0 && t2 < 105.0){
			cout << "C" << endl;
		}else if( t1 < 55.0 && t2 < 116.0){
			cout << "D" << endl;
		}else if( t1 < 70.0 && t2 < 148.0){
			cout << "E" << endl;
		}else{
			cout << "NA" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N, K;

int main(void)
{
	cin >> N >> K;
	LL ans = 0;
	for (int b = K + 1; b <= N; ++b) {
		LL beet = (N / b);
		LL can = beet * (b - K);
		LL ei1333 = N - (beet * b) + 1 - K;
		ei1333 = max(ei1333, 0LL);
		can += ei1333;
		if (K == 0)--can;
		ans += can;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def ss(i, t)
  return case i
  when 0...t[0]
    0
  when t[0]...t[1]
    1
  when t[1]...t[2]
    2
  when t[2]...t[3]
    3
  when t[3]...t[4]
    4
  when t[4]...t[5]
    5
  when t[5]...t[6]
    6
  else
    7
  end
end

r = ["AAA", "AA", "A", "B", "C", "D", "E", "NA"]
t1 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
t2 = [71, 77, 83, 89, 105, 116, 148]

while gets
  a, b = $_.split.map(&:to_f)
  puts r[[ss(a, t1), ss(b, t2)].max]
end

Measured memory_bytes: 8676
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    long long sum = 0;
    for(int i = 0; i < N; i++){
        sum += A[i];
    }

    vector<long long> tempSumList(N);
    tempSumList[0] = 0;
    int temp = 0;
    long long tempSum = 0;
    long long tempSumSum = 0;
    while(true){

        int next1 = A[temp];
        int next2 = A[(temp + 1) % N]; 

        temp += 2;
        if(temp >= N){
            temp -= N;
        }

        tempSum += 2 * (next2 - next1);
        tempSumSum += tempSum;
        tempSumList[temp] = tempSum;
        
        if(temp == 0){
            break;
        }
    }

    int first = (sum - tempSumSum) / N;

    for(int i = 0; i < N; i++){
        cout << first + tempSumList[i];
        if(i == N - 1){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }

    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int keta = 0;
  int ans = 0;
  int X = 0;
  for(int i=1; i <= N; i++){
  keta = 0;
  X = i;
  while(X != 0){
  X /= 10;
  keta++;
  }
  if(keta%2 == 1)ans++;
  }
  cout << ans <<endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	for(int i=0; i<N; i++){
	    cin >> s[i];
	}
	int M;
	cin >> M;
	vector<string> t(M);
	for(int i=0; i<M; i++){
	    cin >> t[i];
	}
	
	map<string, int> mp;
	for(int i=0; i<N; i++){
	    if(mp.find(s[i]) != mp.end()){
	        mp[s[i]]++;
	    }
	    else{
	        mp.emplace(s[i], 1);
	    }
	}
	for(int i=0; i<M; i++){
	    if(mp.find(t[i]) != mp.end()){
	        mp[t[i]]--;
	    }
	    else{
	        mp.emplace(t[i], -1);
	    }
	}

    int ans=0;
    auto begin = mp.begin(), end = mp.end();
	for(auto itr = begin; itr != end; itr++){
	    if(itr->second > ans){
	        ans = itr->second;
	    }
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#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() {
  ll N, K;
  cin >> N >> K;
  N %= K;
  cout << min(N, K - N) << endl;
  // if (N < K) {
  //   cout << min(N, K - N) << endl;
  // } else if (N == K) {
  //   cout << 0 << endl;
  // } else {
  //   cout << N % K << endl;
  // }
  // while (abs(K - N) < N) {
  //   N = abs(K - N);
  // }
  // cout << N << endl;
}


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

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

  long long int i = 0, ans = 0;
  for(i = 0; ans < n; i++){ ans += i; }

  for(int j = 1; j < i; j++){
    if(j != (ans - n)){
      cout << j << endl;
    }
  }
  
  return 0;
}


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

using namespace std;

int main(int argc, const char * argv[]) {

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

    int n; cin >> n;
    vector<double> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    
    sort(v.begin(), v.end());
    
    double ans = v[0];
    for (int i = 1; i < n; i++) {
        ans = (ans + v[i]) / 2.;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn=1e6+100;

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

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


vector<int>gun[100005];

int main(){
	int a,b;
	int x,y;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x>>y;
		gun[x].push_back(y);
	}
	int cevap=0;
	for(int i=0;i<=b;i++){
		for(int j=0;j<gun[i].size();j++){
			pq.push(gun[i][j]);
		}
		if(pq.size()>0){
			int kl=pq.top();
			pq.pop();
			cevap=cevap+kl;
		}
	}
	cout<<cevap;
}

Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	int n; cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) cin >> d[i];

	set<int> values;

	for (int i = 0; i < n; i++)
	{
		values.insert(d[i]);
	}

	cout << values.size() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (long long int i = 0; i <= (n); ++i)
#define rep1(i,n) for (long long int i = 1; i <= (n); ++i)
#define REP(a,b) for (long long int i = a; i <= (b); ++i) 
#define ps push_back 
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	ll count = 0;
	bool end = true;
	cin >> s;
	ll ans = 0;
	ll size = s.length();
	ll save = 0;
	while(end){
		if (s[count] == 'A') {
			save = count;
			end = false;
		}
		++count;
	}
	end = false;
	REP(save + 1, size - 1) {
		if (s[i] == 'Z') {
			ans = i;
	    }
	}
	cout << ans - save + 1<< endl;
	return 0;
	}

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

int D, G;
vector<int> p(11), c(11);
int mi=1e6;

void dfs(int i, int g, int n, vector<int> v){
    //cout << i <<" "<< g <<" "<< n << endl;
    if(i==D+1){
        //cout << g <<" "<< n << endl;
        //for(int l=0; l<v.size(); l++) cout << v[l] <<" ";
        //cout << endl;
        if(g<G){
            int k;
            for(k=v.size()-1; k>=0; k--){
                if(v[k]==0) break;
            }
            k++;
            for(int j=0; j<p[k]; j++){
                g += k*100;
                n += 1;
                //cout <<" "<< g << endl;
                if(g>=G) break;
            }
        }
        if(g>=G)
            mi = min(mi, n);
        
        return;
    }
    
    v.push_back(1);
    dfs(i+1, g+(i*100*p[i]+c[i]), n+p[i], v);
    v.pop_back();
    v.push_back(0);
    dfs(i+1, g, n, v);
    v.pop_back();
}

int main(){
    cin >> D >> G;
    for(int i=1; i<=D; i++) cin >> p[i] >> c[i];
    
    vector<int> t;
    
    dfs(1,0,0, t);
    cout << mi << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
double r;
double M_PI=3.14159265359,menseki=0,enshu=0;
scanf("%lf",&r);
menseki=r*r*M_PI;
enshu=2*r*M_PI;
printf("%.6lf %.6lf\n",menseki,enshu);
return 0;
}

Measured memory_bytes: 652
//Connect Cities 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int>par;
    UnionFind(int n){par=vector<int>(n,-1);}
    int root(int x){
        if(par[x]<0)return x;
        return par[x]=root(par[x]);
    }
    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y)return false;
        if(par[x]>par[y])swap(x, y);
        par[x]+=par[y];
        par[y]=x;
        return true;
    }
    bool same(int x,int y){return root(x)==root(y);}
    int size(int x){return -par[root(x)];}
};

signed main (){
    int n,m;cin>>n>>m;
    UnionFind uf(n);
    rep(i,0,m){
        int a,b;cin>>a>>b;
        a--;b--;
        uf.unite(a,b);
    }
    set<int>ans;
    rep(i,0,n){
        ans.insert(uf.root(i));
    }
    cout<<ans.size()-1<<nnn;
    return 0;
}

Measured memory_bytes: 7920
// C - Go to School
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
int in(){int x;cin>>x;return x;}

int main(){
	int N = in();
	vector<int> A(N+1);
	for(int no=1; no<=N; ++no) A[in()] = no;
	for(int nin=1; nin<=N; ++nin) printf("%d ", A[nin]);
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>
#include <queue>

typedef long long ll;

using namespace std;



int main(){
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    bool flag = true;

    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        if(mp.find(x) != mp.end()){
            if(mp[x] != y) flag = false;
            continue;
        }
        mp.insert(make_pair(x, y));
    }

    if(flag){
        if(mp.find(1) != mp.end()){
            if(mp[1] == 0 && n != 1){
                cout << -1 << endl;
                return 0;
            }
        } else {
            if(n != 1){
                mp.insert(make_pair(1, 1));
            } else {
                mp.insert(make_pair(1, 0));
            }
        }
        for(int i = 1; i <= n; i++){
            if(mp.find(i) == mp.end()){
               mp[i] = 0;
            }
            cout << mp[i];
            if(i == n){
                cout << endl;
            }
        }
    } else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let xor = Array.fold_left ( lxor ) 0 as_ in
  Array.iter (fun a -> Printf.printf "%d " @@ a lxor xor) as_;
  print_newline ()


Measured memory_bytes: 7620
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];
ll d[101];


//long longしか使わない
//素数は1より大きい
int main() {
	ll x, y;
	cin >> x >> y;
	rep(i, x + 1) {
		ll res = 2 * i + 4 * (x - i);
		if (res == y) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


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

char s[200005];
int main()
{
    map<string,bool>a;
	int n,x=0,i,j,b[200005]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&s);
		if(a[s]==false)
		x++;
		a[s]=true;
	}
	/*for(i=1;i<n;i++)
	{
		for(j=0;j<i;j++)
		{
			if(b[j])
			continue;
			if(strcmp(s[j],s[i])==0)
			break;
		}
		if(j==i)
		x++;
	}*/
	printf("%d\n",x);
} 

Measured memory_bytes: 19360
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;


bool cmp(const pair<int,int> &a, const pair<int,int> &b){
	return a.second > b.second;
}

int main(void){
	int n,m;
	cin>>n>>m;
	pair<int, int> work[n];
	rep(i,n)cin>>work[i].first>>work[i].second;
	sort(work,work+n,cmp);
	//rep(i,n)cout<<work[i].first<<" "<<work[i].second<<endl;

	int limit=m,cnt=0;
	bool day[m+1];
	int next[m+1];
	rep(i,m){
		day[i+1]=true;
		next[i+1]=i+1;
	}
	ll ans=0;
	rep(i,n){
		if(work[i].first <= limit && cnt != m){
			ans+=work[i].second;
			cnt++;
			if(!day[next[work[i].first]]){
				while(!day[next[work[i].first]])next[work[i].first]++;
			}
			day[next[work[i].first]]=false;
			if(next[work[i].first] == limit){
				while(!day[limit])limit--;
			}
			next[work[i].first]++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
  string s;
  cin >> s;
  int ans = 700;
  rep(i,3){
    if(s[i]=='o')ans+=100;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main() {
	int n; cin >> n;
	if (n >= 0 and n < 1000) cout << 1000 - n;
	else
	{	if (n % 1000 != 0) {
			cout << 1000 - (n % 1000);
		} else cout << "0";
	}


	return 0;
}

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

inline int mymod(int a, int m) { return (a % m + m) % m; }

int main() {
  int n;
  cin >> n;
  vector<int> count(13, 0);
  for (int i = 0; i < n; i += 1) {
    int d;
    cin >> d;
    count[d] += 1;
  }
  count[0]++;
  for (auto i : count) {
    if (i >= 3) {
      cout << 0 << endl;
      return 0;
    }
  }
  int ans = 0;
  for (int bit = 0; bit < (1 << 13); bit++) {
    // bitの下からi番目の位が立っている＝iの距離にある人を若いほうに割り当てる
    vector<int> a;
    for (int i = 0; i <= 12; i++) {
      if (count[i] == 0)
        continue;
      if (count[i] == 2) {
        a.push_back(i);
        a.push_back(24 - i);
        // 互いの距離を最大化したいので、両方に振り分けた方がいい
        continue;
      }
      if (bit >> i & 1) {
        a.push_back(i);
      } else {
        a.push_back(24 - i);
      }
    }
    int m = 13;
    for (int i = 0; i < a.size(); i++) {
      for (int j = i + 1; j < a.size(); j++) {
        m = min({m, mymod(a[i] - a[j], 24), mymod(a[j] - a[i], 24)});
      }
    }
    ans = max(ans, m);
  }
  cout << ans << endl;
}


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

int main(){
    vector<int> s={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << s.at(k-1) <<endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
n = len(S)

plus = []
for i in range(2**(n-1)):
    tmp = [""] * n
    for j in range(n-1):
        if i >> j & 1:
            tmp[j] = "+"
    plus.append(tmp)

ans = 0
for p in plus:
    s = ""
    for i in range(n):
        s = s + S[i] + p[i]
    ans += eval(s)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define sc second
#define fi first
#define pii pair <int,int>
#define ll long long
#define int ll
#define lowbit(a) a&-a
using namespace std;

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

const int N=100005;
const int Mod=1e9+7;
int n,m,a[N],b[N],d[N],t1,t2;
ll t[N],ans=1;
pair <int,int> c[N];

inline void add(int x,ll k){
	for(int i=x;i<=t2;i+=lowbit(i)) t[i]=(t[i]+k)%Mod;	
}

inline ll ask(int x){
	ll ret=0;
	for(int i=x;i;i-=lowbit(i)) ret=(ret+t[i])%Mod;
	return ret;
}

bool cmp(pii a,pii b){return a.fi!=b.fi? a.fi<b.fi:a.sc>b.sc;}

signed main(){
	n=read();m=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=m;i++) b[i]=read();
	for(int i=1;i<=n;i++){
		if(a[i]<=b[1]||a[i]>=b[m]) continue;
		int k=lower_bound(b+1,b+m+1,a[i])-b;
		if(a[i]==b[k]) continue;
		c[++t1]=pii(a[i]-b[k-1],b[k]-a[i]);d[++t2]=b[k]-a[i];
	}
	sort(d+1,d+t2+1);int l=unique(d+1,d+t2+1)-d-1;
	for(int i=1;i<=t1;i++){
		c[i].second=lower_bound(d+1,d+l+1,c[i].second)-d;
	}
	sort(c+1,c+t1+1,cmp);t1=unique(c+1,c+t1+1)-c-1;
	for(int i=1;i<=t1;i++){
		ll sum=ask(c[i].sc-1)+1;
		ans=(ans+sum)%Mod;add(c[i].sc,sum);
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
    int N; long long K;
    cin >> N >> K;
    vector<pair<long long, long long> > v(N);
    for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;

    // ソート
    sort(v.begin(), v.end());
    
    // a_i が小さい順に b_i を合計して K 以上になる瞬間をとらえる
    long long res = 0;
    long long sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += v[i].second;
        if (sum >= K) {
            res = v[i].first; // sum >= K になった瞬間の a_i
            break;
        }
    }
    cout << res << endl;
}

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

for i in range(1, n + 1):
  x = i
  if x % 3 == 0:
    print(' {}'.format(i), end = '')
  else:
    while x > 0 :
      if x % 10 == 3:
        print(' {}'.format(i), end = '')
        break
      x //= 10
print()
  



Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
#define I(x,y) ((x)*R+(y))
#define rint register int
inline int read(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}
int n, R, N, S, _, d[2], c[360005]; vector<int> C[2], e[2][360005]; inline void Add(int a, int b){e[_][a].push_back(b), e[_][b].push_back(a);}
void DFS(int p, int t){c[p] ^= 4<<_; t?c[p]|=1<<_:0; for(int v:e[_][p]) if(c[v]&4<<_) DFS(v,!t);}
int main()
{
	n = read(); R = n<<1; N = n*n; S = R*R; d[0] = read(); d[1] = read(); fill(c,c+S,12);
	for(rint i = 0, l, s; i < R; i++) for(_ = 0; _ < 2; l = d[_]-i*i, l>=0&&(s=sqrt(l+.5),s*s==l)&&s<R ? C[_].push_back(i),0 : 0, _++);
	for(rint i = 0, j, k, s; i < R; i++) for(j = 0; j < R; j++) for(_ = 0; _ < 2; _++)
		for(int l:C[_]) s = sqrt(d[_]-l*l+.5), j+s<R ? i+l<R?Add(I(i,j),I(i+l,j+s)),0:0, i>=l?Add(I(i,j),I(i-l,j+s)),0:0 : 0;
	_ = 0; for(rint i = 0; i < S; c[i]&4<<_?DFS(i,0),0:0, i++); _ = 1; for(rint i = 0; i < S; c[i]&4<<_?DFS(i,0),0:0, i++);
	for(rint i = 0, j; i < 4; i++) if(count(c,c+S,i) >= N){for(j = 0; j < S; c[j]==i&&(N-->0)?printf("%d %d\n",j/R,j%R),0:0, j++); return 0;}
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (A + B >= C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  
  
  
  
}


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

int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int sum = accumulate(all(a), 0);
    int cnt = 0;
    rep(i,n) {
        if (a[i]*(m*4) >= sum) cnt++;
    }
    cout << ((cnt >= m) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.bitmanip;

void main() {
  immutable n = readln.strip.to!int;
  auto s = readln.strip;
  BitArray m1, m2, m3;
  m1.length = 10;
  m2.length = 100;
  m3.length = 1000;
  debug stderr.writeln (s);
  foreach (i; 0 .. n) {
    int x = s[i].to!int - 48;
    foreach (k; m2.bitsSet ()) {
      m3[10 * k + x] = true;
    }
    foreach (k; m1.bitsSet ()) {
      m2[10 * k + x] = true;
    }
    m1[x] = true;
  }
  int c;
  foreach (k; m3.bitsSet()) ++c;
  writeln (c);
}



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

using namespace std;

int main()
{
    vector<int> vec;
    int n,k;cin >> n >> k;
    for(int a = 0;a < n;a++){
        int b;cin >> b;
        vec.push_back(b);
    }
    sort(vec.begin(),vec.end());

    int ans = 1e9;
    for(int a = 0;a < n-k+1;a++){
        ans = min(ans, vec.at(a+k-1)-vec.at(a));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for (int i=(a); i<(b); ++i)
#define FORD(i,a,b) for (int i=(a)-1; i>=(b); --i)

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

vector<int> adj[222222];
int color[222222];

bool go(int v, int c) {
  if (color[v]) return color[v] == c;
  color[v] = c;
  for (int u: adj[v]) if (!go(u, 3-c)) return false;
  return true;
}

int main() {
  // ios_base::sync_with_stdio(0);

  int N, M;
  scanf("%d%d", &N, &M);
  REP(i,M) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  bool bipartite = go(0, 1);
  if (bipartite) {
    vector<int> byc(2, 0);
    REP(i,N) byc[color[i]-1]++;
    LL result = byc[0] * (LL)byc[1] - M;
    printf("%lld\n", result);
  } else {
    printf("%lld\n", N*(LL)(N-1)/2 - M);
  }
}


Measured memory_bytes: 9344
import sys
readline = sys.stdin.readline

D,G = map(int,readline().split())
P = [0] * D
C = [0] * D
for i in range(D):
  P[i],C[i] = map(int,readline().split())

# 全部解く問題をどれにするか、全探索

ans = 10 ** 9
for i in range(2 ** D):
#  print("bin(i)",bin(i)[2:].zfill(2))
  score = 0
  solve = 0
  for j in range(D):
    if (i >> j) & 1:
      score += P[j] * (j + 1) * 100 + C[j]
      solve += P[j]
#  print("score",score,"solve",solve)
  rest = G - score
#  print("score",score,"rest",rest)

  # 残りの点数を、高いほうから埋めていく
  if rest <= 0:
    if ans > solve:
      ans = solve
    continue
  for j in range(D - 1,-1,-1):
    if (i >> j) & 1 == 0:
      if (P[j] - 1) * (j + 1) * 100 == rest:
        solve += (P[j] - 1)
        rest = 0
        break
      if (P[j] - 1) * (j + 1) * 100 < rest:
        rest -= (P[j] - 1) * (j + 1) * 100
        solve += (P[j] - 1)
      else:
        p = (j + 1) * 100
#        print("p",p,"(rest + p - 1) // p",(rest + p - 1) // p)
        solve += (rest + p - 1) // p
        rest = 0
        break
  if rest > 0:
    continue
  if solve < ans:
    ans = solve
#  print("ans",ans)
    
print(ans)
    

      
      


Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define vc vector<int>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define inf 0x3f3f3f3f
#define t_case int tt; cin>>tt; while (tt--)
#define lnginf 9223372036854775807
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define For(i,j,k) for (int i=(int)(j);i<(int)(k);i++)
#define ins insert
#define in(x); { for (auto &i : x) cin >> i; }
#define out(x); { for (auto i : x) cout<<i<<' ' ; }
#define PI 3.14159265359
const long long LL_INF = (long long) 2e18 + 5;
using namespace std;
void solve() {
	map<int, int> m;
	int n; cin >> n;
	vector<int> v(n) in(v);
	sort(rall(v));
	int  ans = 0;
	For(i, 0, n) {
		if (!i)m[v[i]] += 1;
		else m[v[i]] += 2;
	}
	int need = n - 1;
	auto it = --m.end();
	while (need) {
		if (need >= it->second) {
			ans += it->second * it->first;
			need -= it->second;
		}
		else {
			ans += need * it->first;
			break;
		}
		it--;
	}
	cout << ans << '\n';

}
int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif


	fastio solve();


}


Measured memory_bytes: 17128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int n,ans[300000];
int main(){
    string s;
	cin>>n>>s;
	for(int i=1;i<n;i++)if(s[i]=='E')ans[0]++;
	for(int i=1;i<n;i++){
		if(s[i-1]=='E'&&s[i]=='E')ans[i]=ans[i-1]-1;
		if(s[i-1]=='E'&&s[i]=='W')ans[i]=ans[i-1];
		if(s[i-1]=='W'&&s[i]=='W')ans[i]=ans[i-1]+1;
		if(s[i-1]=='W'&&s[i]=='E')ans[i]=ans[i-1];
	}
	sort(ans,ans+n);
	cout<<ans[0]<<endl;
}


Measured memory_bytes: 1796
let f a b c d e =
  let comp x y = if x <= y then 1 else -1
  in
  match List.sort comp [a;b;c;d;e] with
    [a;b;c;d;e] -> Printf.printf "%d %d %d %d %d\n"  a b c d e
  | _ -> ()
let () = Scanf.scanf "%d %d %d %d %d\n" f;;

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch)
{
    if (ch == 'A') return 1;
    else if (ch == 'T') return 2;
    else if (ch == 'C') return 3;
    else if (ch == 'G') return 4;
    return 0;
}

long long getKey(char str[]) {
    long long sum = 0;
    int p = 1;
    int len = strlen(str);
    for (int i = 0; i < len; i++) {
        sum += p*getChar(str[i]);
        p *= 5;
    }
    return sum;
}

int h1(int key)
{
    return key % M;
}

int h2(int key)
{
    return 1 + (key % (M - 1));
}

int find(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for (i = 0; ; i++) {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for (i = 0; ; i++) {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}


int main(int argc, char const *argv[])
{
    int i, n, h;
    char str[L], com[9];
    for (i = 0; i < M; i++) {
        H[i][0] = '\0';
    }
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s %s", com, str);
        if (com[0] == 'i') {
            insert(str);
        } else {
            if (find(str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}



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

int main()
{
ll n ;
cin >> n ;
vector<ll> d(n);
rep(i, n){
  cin >> d[i];
}
for (ll i = 0; i < n-1; i++)
{
  for (ll j = i+1; j < n; j++)
  {
    ans+=d[i]*d[j];
  }
  
}

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

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

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

signed main(){
	int R,G,B,N;
	cin>>R>>G>>B>>N;
	int ans=0;
	rep(r,N+1)rep(g,N+1){
		int tmp=N-r*R-g*G;
		if(tmp>=0&&tmp%B==0)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef unordered_map<ll, ll> uii;
typedef unordered_map<ll, ll> uuii;
typedef unordered_map<ll, ll> uuuii;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T> T gcd(T a, T b) {return (a == 0) ? b : gcd(b%a, a);}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b;}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec)); vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}




int main(int argc, const char* argv[]){

#if defined(__LOCAL__)
    std::string file_name = argv[1]; ifstream in_file(file_name.c_str()); cin.rdbuf(in_file.rdbuf());
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

    ll a; cin >> a;
    cout << a + a*a + a*a*a << endstr;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N << endl;
    } else {
        cout << 2 * N << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int N;
ll A, B, C;
int Q;
map<ll, ll> m;
int main(void){
    cin >> N;
    REP(i, N){
        cin >> A;
        m[A]++;
    }
    cin >> Q;
    ll res = 0;
    for (auto v : m) res += v.first*v.second;
    vector<ll> res_v;
    // res_v.push_back(res);
    REP(i,Q){
        cin >> B >> C;
        res -= B*m[B];
        res += C*m[B];
        res_v.push_back(res);
        m[C] += m[B];
        m.erase(B);
    }
    for (auto v : res_v) cout << v << endl;
    return 0;
}



Measured memory_bytes: 8188
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

using namespace std;
struct cell{
int a, b, c, d;
cell(int p, int q, int r, int s){
a = p, b = q, c = r, d = s;
}
};

class DMakeThemEven {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m; in >> n >> m;
		int arr[n+1][m+1];
		for(int i = 1; i<=n; ++i) for(int j = 1; j<=m; ++j) in >> arr[i][j];
		vector<cell> res;
        for(int i = 1; i<=n; ++i){
            for(int j = 1; j<m; ++j){
                if(arr[i][j]&1) --arr[i][j], ++arr[i][j+1], res.emplace_back(i, j, i, j+1);
            }
        }
        for(int i = 1; i<n; ++i) if(arr[i][m]&1) ++arr[i+1][m], res.emplace_back(i, m, i+1, m);
		out << res.size() << '\n';
		for(auto w: res) out << w.a << ' ' << w.b << ' ' << w.c << ' ' << w.d << '\n';
	}
};


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	DMakeThemEven solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 8432
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();
        long ans = 0;
        for (int i = 0; i < n - 1; i++) {
            int wa = a[i] + a[i + 1];
            if (wa > x) {
                if (a[i] > x) {
                    ans += a[i] - x;
                    ans += a[i + 1];
                    a[i + 1] = 0;
                } else {
                    int sa = x - a[i];
                    ans += a[i + 1] - sa;
                    a[i + 1] = sa;
                }

            }
        }

        System.out.println(ans);
    }

}

Measured memory_bytes: 51820
using System;

namespace questionA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var line1 = Console.ReadLine();
            bool isGood = true;
            for (int i = 0; i < 4 -1; i++)
            {
                isGood = isGood && line1[i] != line1[i + 1];
            }
            if(isGood)
            {
                Console.WriteLine("Good");
            }
            else
            {
                Console.WriteLine("Bad");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
struct mint {
    long long x;
    mint(long long _x=0):x((_x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint modpow(long long t) const {
        if (!t) return 1;
        mint a = modpow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return modpow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    friend std::ostream& operator<<(std::ostream& os, const mint& a){
        os << a.x;
        return os;
    }
};

int N;
mint f(int n, int a){
    mint res = 1;
    rep(i,a){
        res *= (n - i);
        res *= mint(a - i).inv();
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, a, b;

    cin >> n >> a >> b;
    mint ans = mint(2).modpow(n) - 1 - f(n,a) - f(n, b);
    cout << ans << endl;
    //cout << 2 ^ n - nCa - nCb - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int d[104];
    int S;
    cin >> N;
    S=N;
    REP(i,N){cin >> d[i];}
    sort(d,d+N);
    REP(i,N-1){
        if(d[i]==d[i+1]){
            S--;
        }
    }
    cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  n%=1000;
  cout << (1000-n)%1000 << endl;
}

Measured memory_bytes: 3628
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
    
A.sort()
count = 1
EraseFlag = True
for i in range(1,N):
    if A[i] == A[i-1]:
        if EraseFlag:
            count -=1
            EraseFlag = False
            continue
        else:
            count+=1
            EraseFlag = True
            continue
    else:
        count+=1
        EraseFlag = True
        
print(count)

Measured memory_bytes: 50392
#include <iostream>

using namespace std;

int H, W;
char S[55][55];

int main(void)
{
	cin >> H >> W;
	
	for(int i = 0; i <= H+1; i++){
		for(int j = 0; j <= W+1; j++){
			S[i][j] = '*';
		}
	}
	
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			cin >> S[i][j];
		}
	}
	
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			if(S[i][j] == '.'){
				
				int cnt = 0;
				for(int x = -1;  x <= 1; x++){
					for(int y = -1; y <= 1; y++){
						if(S[i+x][j+y] == '#') cnt++;
					}
				}
				
				S[i][j] = cnt + '0';
			}
			cout << S[i][j];
		}
		cout << endl;
	} 
	
	return 0;
}

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

int main() {
  long N;
  cin >> N;
  vector<long> A(N);
  for (long i = 0; i < N; i++) {
    cin >> A.at(i);
    A.at(i) = A.at(i) - (i + 1);
  }
  sort(A.begin(), A.end());
  long m = A.at(N / 2);
  long ans = 0;
  for (auto a : A) ans += abs(a - m);
  cout << ans << "\n";
}


Measured memory_bytes: 4848
cooking_time = [int(input()) for _ in range(5)]

min_fraction = 9
min_fraction_index = 0
for i in range(5):
    if cooking_time[i] % 10 != 0 and cooking_time[i] % 10 < min_fraction:
        min_fraction = cooking_time[i] % 10
        min_fraction_index = i



total_time = 0
for i in range(5):
    if i != min_fraction_index:
        if cooking_time[i] % 10 != 0:
            total_time += ((cooking_time[i] // 10) + 1) * 10
        else:
            total_time += cooking_time[i]
total_time += cooking_time[min_fraction_index]

print(total_time)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
main(){
  int A,B;
  scanf("%d %d",&A,&B);
  int M=max(-1000000,B-A+1);
  int N=min(1000000,B+A-1);
  printf("%d",M);
  for(int i=M+1;i<=N;i++)printf(" %d",i);
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

int main() {

  int64_t A, B, C;
  cin >> A >> B >> C;

  for(uint32_t i=1;i<A*B;i++) {
    int64_t SUM = A * i;
    if(SUM % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import sys
inp = int(input())
x=prime_factorize(inp)
a=0
xset = set(x)
for i in xset:
  z=x.count(i)
  a+=1
  n=2
  ar=(n*(n+1))/2
  while z>=ar:
    a+=1
    n+=1
    ar=(n*(n+1))/2
print(a)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const ll mod = 1e9 + 7;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> s, t;
  rep(i,n) {
    cin >> a[i];
    if (a[i] < 0) t.push_back(a[i]);
    else s.push_back(a[i]);
  }
 
  int S = s.size();
  int T = t.size();
  bool ok = false;
  if (S > 0) {
    if (n == k) ok = (T%2==0);
    else ok = true;
  } else {
    ok = (k%2==0);
  }
 
  mint ans = 1;
  if (!ok) {
    sort(a.begin(), a.end(), [](int x, int y) {
      return abs(x) < abs(y);
    });
    rep(i,k) ans *= a[i];
  } else {
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if (k%2 == 1) {
      ans *= s.back();
      s.pop_back();
    }
    vector<ll> p;
    while (s.size() >= 2) {
      ll x = s.back(); s.pop_back();
      x *= s.back(); s.pop_back();
      p.push_back(x);
    }
    while (t.size() >= 2) {
      ll x = t.back(); t.pop_back();
      x *= t.back(); t.pop_back();
      p.push_back(x);
    }
    sort(p.rbegin(), p.rend());
    rep(i,k/2) ans *= p[i];
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6360
# coding: utf-8
N = int(input())
S = input()
ans = []
for v in range(1000):
    used = [False for _ in range(len(S))]
    v = str(v).zfill(3)
    idx = 0
    for i in range(len(S)):
        if v[0] == S[i] and not used[i]:
            used[i] = True
            idx = i + 1
            break
    for i in range(idx, len(S)):
        if v[1] == S[i] and not used[i]:
            used[i] = True
            idx = i + 1
            break
    for i in range(idx, len(S)):
        if v[2] == S[i] and not used[i]:
            used[i] = True
            break
    if sum(used) == 3 and v not in ans:
        ans.append(v[:])
print(len(ans))

Measured memory_bytes: 120796
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

mat make(int n){
    if(n == 1){
        return {{0, 0}, {0, 1}};
    }else{
        mat res = make(n - 1);
        rep(i,1<<(n - 1)) rep(j, 1<<(n - 1)) res[i].push_back(res[i][j]);
        rep(i, 1<<(n - 1)) res.push_back(res[i]);
        reps(i, 1<<(n - 1), 1<<n) reps(j, 1<<(n - 1), 1<<n) res[i][j] = res[i][j] ^ 1;
        return res;
    }
}

int main() {
    cin>>N>>M;
    mat memo = make(max(N, M));
    reps(i, 1, 1<<N) {
        reps(j, 1, 1 << M) cout << (memo[i][j] + memo[i][j - 1] + memo[i - 1][j] + memo[i - 1][j - 1])%2;
        cout << endl;
    }
}

Measured memory_bytes: 9600