akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){
    
    int N,K,Q,A[100010]={},C[100010]={},tmp;
    cin >> N>>K>>Q;

    for(int i=1;i<=Q;i++){
        cin>>A[i];
        C[A[i]]+=1;
    }

    for(int i=1;i<=N;i++){
        tmp = K-(Q-C[i]);
        if(tmp>0){
            cout << "Yes"<<endl;
        }else{
            cout <<"No"<<endl;
        }
    }


    return 0;

}

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

int main() {
    int n;
    cin >> n;
    vector<string> c[4] = {{"ihee", "ihdd", "ccgf", "bbgf"}, {"kji..", "kji..", "hffee", "h.gdd", "ccgbb"}, {"mmllkk", "jjiihh", "gfe...", "gfe...", "...dcb", "...dcb"}, {"oonnmm.", "llkk..h", "jjii..h", "....gfe", "....gfe", "....dcb", "....dcb"}};
    if (n == 2)
        cout << -1 << endl;
    else if (n == 3)
        cout << "aa.\n..a\n..a" << endl;
    else {
        int q = (n - 4) / 4, r = n % 4 + 4;
        for (int i = 0; i < n - r; i++) {
            for (int j = 0; j < n; j++) {
                if (j >= i / 4 * 4 && j < (i / 4 + 1) * 4)
                    cout << c[0][i % 4][j % 4];
                else
                    cout << ".";
            }
            cout << endl;
        }
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < 4 * q; j++) {
                cout << ".";
            }
            for (int j = 0; j < r; j++) {
                cout << c[r - 4][i][j];
            }
            cout << endl;
        }
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  ll n; cin >> n;
  if(n & 1LL) {
    puts("0");
    return 0;
  }
  ll ans = 0;
  while(n) {
    ll cur = n / 5LL;
    ans += cur / 2LL;
    n /= 5LL;
  }
  cout << ans << '\n';
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m;
    cin >> n >> m;
    ll a[m];
    ll sum = 0;
    rep(i, m) {
        cin >> a[i];
        sum += a[i];
    }

    ll ans = n-sum;
    if ( ans < 0 ) {
        ans = -1;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int a, v, b, w, t;
  cin >> a >> v;
  cin >> b >> w;
  cin >> t;

  double diff = abs(b - a);
  double inc = v - w;

  if (inc < 1) {
    cout << "NO" << endl;
    return 0;
  }

  if (diff / t <= inc) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};


int main(void){
    int N;
    cin >> N;
    int C[N], S[N], F[N];
    for(int i = 0; i < N-1; i++){
        cin >> C[i] >> S[i] >> F[i];
    }
    int t = 0;
    for(int i = 0; i < N-1; i++){
        if(t < S[i]){
            t = S[i];
        }
        if(t % F[i] != 0){
            t += F[i] - (t % F[i]);
        }
        t += C[i];
    }
    
    
    for(int n = 0; n < N; n++){
        int t = 0;
        for(int i = n; i < N-1; i++){
            if(t < S[i]){
                t = S[i];
            }
            if(t % F[i] != 0){
                t += F[i] - (t % F[i]);
            }
            t += C[i];
        }
        cout << t << endl;
    }
}


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

using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<int> l(N);
    for(int i=0; i<N; i++) {
        cin >> l[i];
    }
    sort(l.rbegin(), l.rend());
    cout << accumulate(l.begin(), l.begin()+K, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,dis=0; cin>>n;
    vector<int> a(n,0);
    rep(i,n) cin>>a[i];
    dis+=abs(a[0])+abs(a[n-1]);
    rep(i,n-1) dis+=abs(a[i]-a[i+1]);
    cout<<dis-(abs(a[0])+abs(a[0]-a[1])-abs(a[1]))<<endl;
    for(int i=1;i<n-1;i++) cout<<dis-(abs(a[i-1]-a[i])+abs(a[i+1]-a[i])-abs(a[i+1]-a[i-1]))<<endl;
    cout<<dis-(abs(a[n-1])+abs(a[n-2]-a[n-1])-abs(a[n-2]))<<endl;
}

Measured memory_bytes: 1664
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long h;

int main(){
    scanf("%ld", &h);
    for(long i = 1; i <= h; i <<= 1){
        h |= i;
    }
    printf("%ld\n", h);
}


Measured memory_bytes: 256
#include <stdio.h>

int N;

int count(int flg7, int flg5, int flg3, long long int kei, long long int digit) {
	if (kei > N) {
		return 0;
	}

	int cnt = 0;

	if (flg7 != 0 && flg5 != 0 && flg3 != 0) {
		cnt = 1;
	}

	cnt = cnt + count(1, flg5, flg3, kei + 7 * digit, digit * 10);
	cnt = cnt + count(flg7, 1, flg3, kei + 5 * digit, digit * 10);
	cnt = cnt + count(flg7, flg5, 1, kei + 3 * digit, digit * 10);

	return cnt;
}

int main() {
	scanf("%d", &N);
	
	printf("%d", count(0, 0, 0, 0, 1));

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n;
    cin>>n;
    string s1;
    cin>>s1;
    //vector<char> v1;
    int ans = 0;
    loop(i,0,n-1)
    {
       if(s1[i]!=s1[i+1])
        ans++;
    }

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



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

int main()
{
	int N,T,c[110]={0},t[110]={0};
	int min;
	cin >> N >> T;
	for(int i=0;i<N;i++)
	{
		cin >> c[i] >> t[i];
	}
	
	min=2000;
	for(int i=0;i<N;i++)
	{
		if(t[i]>T)continue;
		if(c[i]<min)min=c[i];
	}
	if(min==2000)cout << "TLE";
	else cout << min;
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

ans = len(make_divisors(N-1))-1
ls = make_divisors(N)[1:]

for i in ls:
    n = N
    while n % i == 0:
        n //= i
    if n % i == 1:
        ans += 1

print(ans)    


Measured memory_bytes: 9472
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-18
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=tmp*10+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll tmp=1; for(;b;b>>=1){if(b&1)tmp=tmp*a%mod; a=a*a%mod;} return tmp;}
using namespace std;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
char a[50][50];
int n,m;
int main()
{
	int i,j;
	n=read(); m=read();
	for(i=0;i<n;i++)scanf("%s",a[i]);
	for(i=0;i<n;i++)
		for(j=0;j<m;j++){
			if(a[i][j]=='.')continue;
			int flag=0;
			for(int k=0;k<4;k++){
				int x=i+dx[k],y=j+dy[k];
				if(x<0||x>=n||y<0||y>=m)continue;
				if(a[x][y]=='#')flag=1;
			}
			if(!flag){
				printf("No\n"); return 0;
			}
		}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
/**
 *    author:  tourist
 *    created: 26.05.2018 15:10:27       
**/
#include <bits/stdc++.h>

using namespace std;

class dsu {
  public:
  vector<int> p;
  int n;

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  vector<vector<int>> graph(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  vector<int> add(n);
  iota(add.begin(), add.end(), 0);
  sort(add.begin(), add.end(), [&](int i, int j) {
    return a[i] - b[i] < a[j] - b[j];
  });
  dsu d(n);
  vector<long long> sum_b(n);
  vector<long long> ans(n);
  for (int i = 0; i < n; i++) {
    sum_b[i] = b[i];
    ans[i] = max(a[i], b[i]);
  }
  vector<int> was(n, 0);
  for (int i : add) {
    set<int> s;
    for (int j : graph[i]) {
      if (was[j]) {
        s.insert(d.get(j));
      }
    }
    for (int j : s) {
      sum_b[i] += sum_b[j];
      d.unite(j, i);
    }
    if (!s.empty()) {
      long long best = (long long) 1e18;
      for (int j : s) {
        long long sum_b_without = sum_b[i] - sum_b[j];
        long long cur = max(ans[j] + sum_b_without, a[i] + sum_b_without - b[i]);
        best = min(best, cur);
      }
      ans[i] = best;
    }
    was[i] = 1;
  }
  cout << ans[d.get(0)] << '\n';
  return 0;
}


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

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long

signed main(){
	int s;
	cin>>s;
	cout<<0<<" "<<0<<" ";
	int l=s;
	int x=sqrt(l)+1;
	if(x>1e9)x=1e9;
	int r=(x*x)-s;
	int rg=1;
	for(int i=1;i*i<r;i++){
		if(r%i==0){
			rg=i;
		}
	}
	cout<<x<<" "<<rg<<" "<<r/rg<<" "<<x<<endl;
	//cout<<x*x-(r/rg*rg)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int ans = 0;
  if (K >= A) ans += A, K -= A;
  else ans += K, K = 0;
  if (K >= B) K -= B;
  if (K >= C) ans -= C, K -= C;
  else ans -= K, K = 0;
  cout << ans;

  return 0;
}

// created by Daniel yuan
/*
     ________
    /        \
   / /      \ \
  / /        \ \
  \            /
   \  ______  /
    \________/
*/


Measured memory_bytes: 3652
word_counts = Hash.new(0)
max = ""
words = gets.chomp.split(nil)
words.each do |word|
  word_counts[word] += 1

  max = word if (word.length > max.length)
end
ws = word_counts.sort{|a,b|a[1]<=>b[1]}.reverse!
puts "#{ws[0][0]} #{max}"

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

using namespace std;

bool cmp(char a, char b){
  return a > b;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = min(s.length(), t.length());
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), cmp);
  bool ok = true;
  for(int i=0; i<n; i++){
    if(s[i] < t[i]){
      ok = false;
      break;
    }
    if(s[i] > t[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  if(ok && s.length() >= t.length()) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin >> a;
	cin >> b;
	if(a<b){
		cout << "a < b" << endl;
	}else if(a>b){
		cout << "a > b" << endl;
	}else if(a == b ){
		cout << "a == b" << endl;
	}
return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<iostream>
using namespace std;
const int N=22;
const int mod=1e9+7;
const int S=1<<20;
int go[S][N],put[S];
int f[S],n,m,k,a,b,c;
int need1[S],need2[S],ans;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=k;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		need1[a]|=(1<<b-1);
		need2[a]|=c*(1<<b-1);
	}
	n--;
	for (int T=0;T<(1<<n);T++)
	{
		for (int i=0;i<n;i++) go[T][i]=-1;
		int id=0;
		for (int i=0;i<n;i++)
		{
			if (T&(1<<i))
			{
				if (i>0&&!(T&(1<<i-1))) go[T][id]=T^(1<<i)^(1<<i-1);
				id++;
			}
		}
	}
	for (int T=0;T<(1<<n);T++)
	{
		put[T]=-1;
		for (int i=n-1;i>=0;i--)
			if (!(T&(1<<i))) {put[T]=T^(1<<i);break;}
	}
	f[0]=1;
	for (int i=1;i<=m;i++)
	{
		for (int T=0;T<(1<<n);T++)
			if (put[T]!=-1) f[put[T]]=(f[put[T]]+f[T])%mod;
		for (int id=0;id<n;id++)
			for (int T=(1<<n)-1;T>=0;T--)
				if (go[T][id]!=-1) f[go[T][id]]=(f[go[T][id]]+f[T])%mod;
		for (int T=0;T<(1<<n);T++)
			if ((need1[i]&T)!=need2[i]) f[T]=0; 
	}
	for (int i=0;i<(1<<n);i++) ans=(ans+f[i])%mod;
	printf("%d",ans);
}

Measured memory_bytes: 57600
import heapq
N = int(input())
T = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append([b, 1])
    T[b].append([a, 1])


def dijkstra(x):
    d = [float('inf')] * N
    d[x] = 0
    visited = {x}

    # d, u
    hq = [(0, x)]

    while hq:
        u = heapq.heappop(hq)[1]
        visited.add(u)

        for node, cost in T[u]:
            if (node not in visited) and d[node] > d[u] + cost:
                d[node] = d[u] + cost
                heapq.heappush(hq, (d[u]+cost, node))
    return d


Black = dijkstra(0)
White = dijkstra(N - 1)

Black_point = 0
for b, w in zip(Black, White):
    if b <= w:
        Black_point += 1

if Black_point > N // 2:
    print('Fennec')
else:
    print('Snuke')


Measured memory_bytes: 54940
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <ctime>
#include <cmath>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct P
{
    int x,y;
    bool operator<(const P &a)const{
        if(y!=a.y)
        return y>a.y;
        return x>a.x;
    }
};
vector<int> v[200456];
int a,b,c,n,m,i,k,o[4513],d,e,dy[5]={0,0,-1,1,0},dx[5]={0,1,1,1,2};
int l[301100];
long long x,y,z[1111][33];
P u1[100100],u2[100100];
int j[200][10200];
priority_queue<P> q;
//long long x=0,y=0,z[99];

//deque<int> d;
//'1'==49;
map<int,int > p;
string r,r1;
//char r[1000];
bool asd(P a,P b)
{
   if(a.x-a.y!=b.x-b.y)
    return a.y-a.x<b.y-b.x;
   return a.x<b.x;
}

int f(int t,int w)
{
    if(w<0) return -1087654321;
    if(t==a) return 0;
    if(j[t][w]) return j[t][w];
    return j[t][w]=max(f(t+1,w-l[t+1])+o[t+1],f(t+1,w));

}

int main()
{
    cin>>r;
    if(r[0]=='Y'&&r[1]=='A'&&r[2]=='K'&&r[3]=='I')
        puts("Yes");
    else puts("No");
}


Measured memory_bytes: 5760
#include <stdio.h>

void solve(int num[][2], int n) {
    int total = 0;
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
            for (int k = j + 1; k < n; k++)
            {
                if (num[i][0] + num[j][0] > num[k][0] && num[j][0] + num[k][0] > num[i][0] && num[i][0] + num[k][0] > num[j][0])
                    total += num[i][1] * num[j][1] * num[k][1];
            }

    printf("%d", total);
}

int main(void)
{
    int N, n = 0;
    scanf("%d", &N);
    int num[N][2];

    for (int i = 0; i < N; i++)
    {
        int tmp;
        scanf("%d", &tmp);
        int j;
        for (j = 0; j < n; j++)
            if (tmp == num[j][0])
            {
                num[j][1]++;
                break;
            }

        if (j == n)
        {
            num[n][0] = tmp;
            num[n][1] = 1;
            n++;
        }
    }

    solve(num, n);
    return 0;
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	string N;
  cin >> N;
  if(N[N.length() - 1] == 's')
    N += "es";
else N += 's';
  cout << N << endl;

return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main(){
	int N, K;
	cin >> N >> K;
	vector<int> P(N);
	REP(i, N) {
		cin >> P[i];
	}
	sort(P.begin(), P.end());
	int ret = 0;
	REP(i, K) {
		ret += P[i];
	}
	cout << ret << endl;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;

		int n = cin.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < a.length; i++)
			a[i] = cin.nextLong();

		long millis = System.currentTimeMillis();

		long ans = solve(n, a);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static long solve(int n, long[] a) {
		long ans = 0;
		long[] opes = new long[n];
		while (true) {
			boolean any = false;
			long sum = 0;
			for (int i = 0; i < n; i++) {
				opes[i] = a[i] / n;
				sum += opes[i];
				any |= opes[i] != 0;
				a[i] %= n;
			}
			for (int i = 0; i < n; i++)
				a[i] += sum - opes[i];

			ans += sum;
			if (!any)
				break;
		}
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 23252
h,w=map(int,input().split())
k=[]
for i in range(h):
	a=list(input().split())
	k.append(a)
for i in range(h):
	for j in range(w):
		if k[i][j]=="snuke":
			print(chr(65+j)+str(i+1))
			break


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	while(1){
	int taro[110]={},hana[110]={},ta=0,ha=0,cnt=0,nw=0;

	int N;
	cin>>N;
	if(N==0){
		break;
	}
	for(int i=0;i<N;i++){
		cin>>taro[i];
	}
	for(int i=1;i<=2*N;i++){
		for(int j=0;j<N;j++){
			if(i==taro[j]){
				break;
			}
		
		if(j==N-1){
			hana[cnt]=i;
			cnt++;
		}
		}
	}
	sort(taro,taro+N);
	sort(hana,hana+N);
	ta=N;
	ha=N;
	while(1){
		if(ta==0 || ha==0){
			break;
		}
		for(int i=0;i<N;i++){
			if(nw<taro[i]){
				nw=taro[i];
				taro[i]=0;
				ta--;
				break;
			}
			if(i==N-1){
				nw=0;
			}
		}
		if(ta==0){
			break;
		}
		for(int i=0;i<N;i++){
			if(nw<hana[i]){
				nw=hana[i];
				hana[i]=0;
				ha--;
				break;
			}
			if(i==N-1){
				nw=0;
			}
		}


	}
	cout<<ha<<endl<<ta<<endl;
	}


	return 0;
}

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

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

  ll ans = 0;
  for (int i = 1; i <= N; ++i) {
    int p = N / i;
    int r = N % i;
    int n = max(0, i - 1 - K + 1);
    int m = max(0, r - K + 1);
    ans += (ll)p * n + m;
  }

  if (K == 0)
    ans -= N;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define bg begin
namespace IO{
	
cs int RLEN=1<<20|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
	(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob)?EOF:*ib++;
}
inline int read(){
	char ch=gc();
	int res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
	return f?res:-res;
}
inline ll readll(){
	char ch=gc();
	ll res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
	return f?res:-res;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	return top;
}
inline char readchar(){
	char ch=gc();
	while(isspace(ch))ch=gc();
	return ch;
}

}
using IO::read;
using IO::readll;
using IO::readstring;
using IO::readchar;
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int N=200005;
struct pt{
	ll x,y;
	pt(ll _x=0,ll _y=0):x(_x),y(_y){}
	friend inline pt operator -(cs pt &a,cs pt &b){
		return pt(a.x-b.x,a.y-b.y);
	}
	friend inline ll operator *(cs pt &a,cs pt &b){
		return a.x*b.y-a.y*b.x;
	}
}q[N];
int n,top,b[N];
ll a[N],tmp[N],c[N];
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	n=read();
	for(int i=1;i<=n;i++)a[i]=readll();
	for(int i=1;i<=n;i++)b[i]=read();
	int ps=1,m=0;
	for(int i=2;i<=n;i++)if(a[i]>a[ps])ps=i;
	for(int i=ps;i<=n;i++)tmp[m++]=a[i];
	for(int i=1;i<ps;i++)tmp[m++]=a[i];
	tmp[m]=tmp[0];
	for(int i=0;i<=n;i++)a[i]=tmp[i];
	m=0;
	for(int i=ps;i<=n;i++)tmp[m++]=b[i];
	for(int i=1;i<ps;i++)tmp[m++]=b[i];
	tmp[m]=tmp[0];
	for(int i=0;i<=n;i++)b[i]=tmp[i];
	for(int i=2;i<=n;i++)c[i]=2ll*(c[i-1]+b[i-1])-c[i-2];
	for(int i=0;i<=n;i++){
		pt now=pt(i,a[i]-c[i]);
		while(top>=2&&(q[top]-q[top-1])*(now-q[top-1])>=0)top--;
		q[++top]=now;
	}
	ll res=0;
	for(int i=2;i<=top;i++){
		int d=q[i].x-q[i-1].x;
		res+=q[i-1].y*(d+1)+q[i].y*(d-1);
	}
	for(int i=0;i<n;i++)res+=2*c[i];
	printf("%.15lf\n",0.5*res/n);return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a > b){
    cout << "a > b" << endl;
  }
  else if(a < b){
    cout << "a < b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3060
/* Bismillahir Rahmanir Rahim. */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


int main() {
	ios_base::sync_with_stdio(false);
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ll a,b,c;
	cin>>a>>b>>c;
	c=c-a-b;
	if(4*a*b<(c*c) && c>=0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD!string;
	auto B = RD!string;
	auto C = RD!string;
	
	writeln(A[0], B[0], C[0]);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
n,m=map(int,input().strip().split(' '))
a=list(map(int,input().strip().split(' ')))
x=sum(a) 
count=0 
x=x/(4*m)
for i in a:
    if i>=x:
        count+=1 
    if count>=m:
        break 
if count>=m :
    print('Yes') 
else:
    print('No')
    

Measured memory_bytes: 9108
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
// DSU
/*
const int maxn=100009;
int arr[maxn];
int sz[maxn];
void init(){rep(i,maxn){arr[i]=i;sz[i]=1;}}
int root(int a){while(a!=arr[a]){arr[a]=arr[arr[a]];a=arr[a];}return a;}
int check(int a,int b){if(root(a)==root(b))return 1;return 0;}
int un(int a,int b)
{
  int roota=root(a);int rootb=root(b);
  if(sz[roota]>=sz[rootb]){sz[roota]+=sz[rootb];arr[rootb]=roota;}
  else {sz[rootb]+=sz[roota];arr[roota]=rootb;}
}
*/
int32_t main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
   fastio
   int n;
   cin>>n;
   int arr[n];
   rep(i,n)cin>>arr[i];
   if(n==1)
   {
     cout<<"Yes\n";
     exit(0);
   }
   int flag=0;
   repre(i,1,n-1)
   {
     if(arr[i]==arr[i-1])continue;
     if(arr[i]>arr[i-1])
     {
       if(arr[i]-1>=arr[i-1])arr[i]--;
       continue;
     }
     else
     {
       flag=1;
       break;
     }
   }
   if(flag==1)cout<<"No\n";
   else cout<<"Yes\n";

   return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#define N 100000
 
int getDepth(int u);
void print(int v);

typedef struct{
  int parent;
  int left;
  int right;
}Node;
 
Node Tree[N];
int n;
int Depth[N];
int child[N];
 
int main(void){
  int i, j;
  int degree;
  int vertex;
 
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = -1;
    Tree[i].left = -1;
    Tree[i].right = -1;
  }
 
  for ( i = 0; i < n; i++ ){
    scanf("%d",&vertex);
	scanf("%d",&degree);
    for ( j = 0; j < degree; j++ ){
      scanf("%d", &child[j]);
 
      Tree[child[j]].parent = vertex;
       
      if(j == 0)
    Tree[vertex].left = child[0];
       
      else
    Tree[child[j - 1]].right = child[j];
    }
  }
   
  for ( i = 0; i < n; i++ )
    Depth[i] = getDepth(i);
   
  for ( i = 0; i < n; i++ )
    print(i);
   
  return 0;
}
 
int getDepth(int u){
  int d = 0;
 
  while(Tree[u].parent >= 0){
    u = Tree[u].parent;
    d++;
  }
 
  return d;
}
 
void print(int v){
 
  int i;
  int cnt = 0;
 
  printf("node %d: parent = %d, depth = %d, ",v,Tree[v].parent,Depth[v]);
 
  if(Tree[v].parent == -1)
    printf("root, [");
 
  else if(Tree[v].left == -1)
    printf("leaf, [");
 
  else
    printf("internal node, [");
 
  v= Tree[v].left;
  while(v != -1){
    if(cnt == 0)
      printf("%d",v); 
 
    else
      printf(", %d",v);
   
    v = Tree[v].right;
    cnt++;
 }
    printf("]\n");
}

Measured memory_bytes: 2564
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();

        int[] x = new int[N + 1];
        x[N] = Integer.MAX_VALUE - 1;
        int[] y = new int[N + 1];
        y[N] = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int a = in.i();
            x[i] = i - a;
            y[i] = i + a;
        }
        Arrays.sort(x);
        Arrays.sort(y);

        long ans = 0;

        int i = 0;
        int j = 0;
        while (true) {
            if (i == N || x[N - 1] < y[j]) {
                break;
            } else if (x[i] < y[j]) {
                i++;
            } else if (x[i] == y[j]) {
                int cx = 0;
                int cy = 0;
                int v = x[i];
                while (x[i] == v) {
                    i++;
                    cx++;
                }
                while (y[j] == v) {
                    j++;
                    cy++;
                }
                ans += (long)cx * cy;
            } else {
                j++;
            }
        }

        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 40840
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.util.StringTokenizer;

/**
 *
 * @author 91968
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException{
        // TODO code application logic here
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        
        StringTokenizer st;
        
        st = new StringTokenizer(in.readLine());
        
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        
        st = new StringTokenizer(in.readLine());
        
        int h[] = new int[n];
        
        for(int i = 0; i < n; i++){
        
            h[i] = Integer.parseInt(st.nextToken());
        }
        
        int dp[] = new int[n];
        for(int i = 1; i < n; i++)
            dp[i] = Integer.MAX_VALUE;
                    
        for(int i = 0; i < n; i++){
        
            for(int j = 1; j <= k; j++){
            
                if(i+j < n)
                    dp[i+j] = Math.min(dp[i+j], dp[i]+Math.abs(h[i+j] - h[i]));
            }
        }
        System.out.println(dp[n-1]);
    }
    
}


Measured memory_bytes: 34096
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>

#define INF INT_MAX>>1 //要climits#includ

using namespace std;

typedef long long ll;

int dx[] ={0, 1, 0, -1};
int dy[] ={-1, 0, 1, 0};

typedef struct robot{
	int x;
	int y;
	int dir;
	int cost;
}robot;

int main() {
	while(1) {
		int w, h; cin >> w >> h;
		if(!w && !h) break;

		int s[30][30];
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				cin >> s[i][j];
			}
		}
		int c[4];
		for(int i=0; i<4; i++){
			cin >> c[i];
		}

		int dp[30][30][4];
		fill(dp[0][0], dp[30][0], INF);
		dp[0][0][1] = 0;
		robot initial ={0, 0, 1, 0};
		queue<robot> q;
		q.push(initial);

		while(!q.empty()) {
			robot prev = q.front(); 
			q.pop();

			if(prev.cost > dp[prev.y][prev.x][prev.dir]) continue;

			//回転方向
			for(int i = 0; i < 4; i++) {
				robot next;
				next.dir = (prev.dir + i) % 4;
				next.cost = prev.cost;
				if(s[prev.y][prev.x] != i) next.cost += c[i];
				next.y = prev.y + dy[next.dir];
				next.x = prev.x + dx[next.dir];
				if(next.y < 0 || next.y >= h || next.x < 0 || next.x >= w) continue;
				if(dp[next.y][next.x][next.dir] > next.cost) {
					dp[next.y][next.x][next.dir] = next.cost;
					q.push(next);
				}
				
			}
		}

		int ans = INT_MAX;
		for(int i = 0; i < 4; i++){
			ans = min(ans, dp[h - 1][w - 1][i]);
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Security;
using System.Threading;
using System.Xml.Serialization;

namespace AtCoderCs
{

    class Program
    {

        const int mod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine();

            for (int i = arg.Length / 2 - ((arg.Length & 1) != 0 ? 0 : 1); 0 < i; i--)
                if (string.Compare(arg, 0, arg, i, i) == 0)
                {
                    Console.WriteLine(i * 2);
                    return;
                }

            Console.WriteLine(0);

        }
    }
}


Measured memory_bytes: 13404
#include <stdio.h>

int main()
{
	int n, p, q, i, j, owan, buf[51];

	while (1) {
	// 人数読み込み
	scanf("%d %d", &n, &p);

	if (n == 0 && p == 0)
		break;

	// 初期化
	owan = p;
	for (i = 0; i < n; i++)
		buf[i] = 0;

	for (q = 0; !(owan == 0 && buf[q] == p); q = (q + 1) % n) {
		if (owan != 0) {
			buf[q]++;
			owan--;
		} else {
			owan = buf[q];
			buf[q] = 0;
		}
	}
	printf("%d\n", q);
	}
	return 0; 
}

Measured memory_bytes: 600
l = [input() for i in range(3)]
l2 = ["A", "B", "C"]
cr = 0
while True:
    if l[cr] == "":
        print(l2[cr])
        exit()
    else:
        cr2 = l2.index(l[cr][0].upper())
        l[cr] = l[cr][1:]
        cr = cr2


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

int n;

int dp[31][1000001]={};
int d[31][1000001]={};

const ll INF=100000000001;
int main() {
	int c;

	cin>>n;

	ll a[100]={};
	a[0]=2;
	a[1]=1;
	for(int i=2;i<87;++i){
		a[i]=a[i-1]+a[i-2];
	}
		cout<<a[n]<<endl;
	return 0;
}


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

#define M 1050000
#define L 14

char H[M][L]; /* Hash Table */

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

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); 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);
  while(1){
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){

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

int main(){
    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: 14964
n = int(input())
taro, hanako = 0, 0
for i in range(n):
	s1, s2 = map(str, input().split())
	if s1 == s2:
		taro+= 1
		hanako += 1
	elif s1 > s2:
		taro += 3
	else :
		hanako += 3

print("{} {}".format(taro, hanako))


Measured memory_bytes: 5604
#include <iostream>
#include <algorithm>

#define MOD int(1e9+7)

using namespace std;

typedef long long ll;

ll power(ll a,ll n){
    if(n == 0) return 1;
    ll rest = 1;
    while(n > 0){
        if(n%2 == 1) rest = rest * a % MOD;
        a = a*a % MOD;
        n /= 2;
    }
    return rest;
}

//inverse
ll INV(ll r){
    return power(r,MOD-2);
}


//combination
ll COM(ll n,ll r){
    ll den = 1,num = 1;
    for (ll i = 0; i < r; ++i)
    {
        den = den*(i+1)%MOD;
        num = num*(n-i)%MOD;
    }
    return num*INV(den)%MOD;
}

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    int S = power(2,n) - COM(n,a) - COM(n,b) -1;
    while(S < 0) S += MOD;
    cout << S << endl;
    return 0;
}

































// #include <iostream>
// #include <stdio.h>
// #include <math.h>
// #define MAX ll(1e8)

// using namespace std;

// // const ll MAX = 510000;
// const ll MOD = 1000000007;

// ll fac[MAX], finv[MAX], inv[MAX];

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

// // 二項係数計算
// ll 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 jou(ll N){
// //     ll A = 1;
// //     for (ll i = 0; i < N; ++i)
// //     {
// //         A = A * 2 % MOD;
// //     }
// //     return A;
// // }

// ll main() {
//     ll n,a,b;
//     cin >> n >> a >> b;

//     // 前処理
//     COMinit();
//     ll S = pow(2,n)-1-COM(n,a)-COM(n,b);
//     if(S >= 0){
//         cout << S << endl;
//     }else{
//         cout << MOD+S << endl;
//     }
//     // 計算例
//     // cout << COM(n, a) << endl;
//     // cout << COM(n, b) << endl;

//     return 0;
// }

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    }

    let mut deque = std::collections::VecDeque::new();
    for i in 0..n {
        if i % 2 == n % 2 {
            deque.push_back(a[i]);
        } else {
            deque.push_front(a[i]);
        }
    }
    let ret = deque.into_iter() .collect::<Vec<_>>();
    println!("{}", join(&ret, " "));
}

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if(max(A, C)>min(B, D)) cout << 0 << endl;
	else cout << min(B, D)-max(A, C) << endl; 
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
static const ll mod = 1000000007;
# define INF (1 << 29)
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

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

    ll dp[100100][13];

    dp[0][0] = 1;
    for(int i=0; i<s.length(); i++){
        if(s[i] == '?'){
            for(int k=0; k<=9; k++){
                for(int j=0; j<13; j++){
                    dp[i+1][(j*10 + k) % 13] += dp[i][j];
                    dp[i+1][(j*10 + k) % 13] %= mod;
                }
            }
        }
        else{
            int tmp_k = s[i] - '0';
            for(int j=0; j<13; j++){
                dp[i+1][(j*10 + tmp_k) % 13] = dp[i][j];
                dp[i+1][(j*10 + tmp_k) % 13] %= mod;
            }
        }
    }

    cout << dp[s.length()][5];
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	
	switch(n % 10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout << "hon" << endl;
			break;
		case 0:
		case 1:
		case 6:
		case 8: 
			cout << "pon" << endl;
			break;
		case 3:
			cout << "bon" << endl;
			break;
	} 
	return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        bool[] has = new bool[1000001];
        for (int i = 0; i < a.Length; i++)
        {
            if (a[i] == 1) continue;
            if (has[a[i]]) goto end;
            has[a[i]] = true;
        }

        foreach (var prime in Primes(1000001))
        {
            bool used = false;
            for (int i = prime; i < has.Length; i += prime)
            {
                if (!has[i]) continue;
                if (used) goto end;
                used = true;
            }
        }
        Console.WriteLine("pairwise coprime");
        return;
        end:;

        if (a.Aggregate(GCD) == 1)
        {
            Console.WriteLine("setwise coprime");
            return;
        }
        Console.WriteLine("not coprime");
    }


    public static IEnumerable<int> Primes(int n)
    {
        if (n < 2) yield break;
        yield return 2;
        ulong[] bitArray = new ulong[(n + 1) / 2 / 64 + 1];

        int[] smallPrimes = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61 };
        foreach (var prime in smallPrimes)
        {
            if (n < prime) yield break;
            yield return prime;

            ulong[] mask = new ulong[prime];
            for (int j = (prime - 3) >> 1; j < (prime << 6); j += prime)
                mask[j >> 6] |= 1UL << j;

            int maskInd = 0;
            for (int i = 0; i < bitArray.Length; i++)
            {
                bitArray[i] |= mask[maskInd];
                if (++maskInd >= prime) maskInd = 0;
            }
        }

        int[] deBruijnIndex = { 0, 1, 59, 2, 60, 40, 54, 3, 61, 32, 49, 41, 55, 19, 35, 4, 62, 52, 30, 33, 50, 12, 14, 42, 56, 16, 27, 20, 36, 23, 44, 5, 63, 58, 39, 53, 31, 48, 18, 34, 51, 29, 11, 13, 15, 26, 22, 43, 57, 38, 47, 17, 28, 10, 25, 21, 37, 46, 9, 24, 45, 8, 7, 6 };
        int maxInd = n / 2;
        for (int i = 0; i < bitArray.Length; i++)
        {
            for (ulong bit = ~bitArray[i]; bit != 0; bit &= bit - 1)
            {
                int index = i << 6 | deBruijnIndex[((bit & (~bit + 1)) * 0x03F566ED27179461UL) >> 58];
                int prime = (index << 1) + 3;
                if (n < prime) yield break;
                yield return prime;
                for (int ind = index; ind <= maxInd; ind += prime)
                    bitArray[ind >> 6] |= 1UL << ind;
            }
        }
    }

    static long GCD(long a, long b)
    {
        while (true)
        {
            if (b == 0) return a;
            a %= b;
            if (a == 0) return b;
            b %= a;
        }
    }
}


Measured memory_bytes: 108608
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int cnt1 = 0, cnt2 = 0;
    bool pass = false;
    for (int i = 0; i <s.size(); i++) {
        if (s[i] == 'a' && cnt1 < a + b) {
            pass = true;
            cnt1++;
        }
        else if (s[i] == 'b' && cnt1 < a + b && cnt2 < b) {
            pass = true;
            cnt1++;
            cnt2++;
        }
        else pass = false;

        if (pass) cout << "Yes\n";
        else cout << "No\n";
    }
}

Measured memory_bytes: 896