akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

int main() {
        int n;
        scanf("%d", &n);
        int N = 2 * n - 1;
        vector<int> a(N);
        for (int i = 0; i < N; i ++) scanf("%d", &a[i]);
        int lb = 1, ub = N;
        while (ub - lb > 1) {
                int mid = (lb + ub) / 2;
                vector<int> b(N);
                for (int i = 0; i < N; i ++) b[i] = a[i] >= mid;
                int m = N / 2;
                if (b[m] == b[m + 1] || b[m] == b[m - 1]) {
                        if (b[m] == 1) {
                                lb = mid;
                        } else {
                                ub = mid;
                        }
                } else {
                        int left = m, right = m;
                        while (left > 0 && (b[left] ^ b[left - 1]) == 1) {
                                left --;
                        }
                        while (right < N && (b[right] ^ b[right + 1]) == 1) {
                                right ++;
                        }
                        if (m - left < right - m) {
                                if (b[left] == 1) {
                                        lb = mid;
                                } else {
                                        ub = mid;
                                }
                        } else {
                                if (b[right] == 1) {
                                        lb = mid;
                                } else {
                                        ub = mid;
                                }
                        }
                }
        }
        printf("%d\n", lb);
        return 0;
}



Measured memory_bytes: 1808
#include <stdio.h>

int main(){
	int n, i, a, b, sumA, sumB;
	while(1){
		scanf("%d", &n);
		if(n==0) break;
		sumA=sumB=0;
		for(i=0;i<n;++i){
			scanf("%d %d", &a, &b);
			if(a>b) sumA=sumA+a+b;
			else if(a<b) sumB=sumB+a+b;
			else{
				sumA=sumA+a;
				sumB=sumB+b;
			}
		}	
		printf("%d %d\n", sumA, sumB);
	}
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

class Main { 
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int count = 0;
        int borderline = 100000;
        
        boolean primes[] = new boolean [borderline];
        for(int n = 2; n < primes.length; n++){
            if(primes[n]) continue;
            for(int m = 2 * n; m < primes.length; m += n) {
                primes[m] = true;
            }
        }
        
        while (N != 0) {
            int num = in.nextInt();
            if       ((num >  borderline) && isPrime(num)) count++;
            else  if ((num <= borderline) && !primes[num]) count++;
            N--;
        }
        
        System.out.println(count);
    }
    
    public static boolean isPrime(int x) {
        if      (x == 2)     return true;
        else if (x % 2 == 0) return false;
        else {
            for (int i = 3; i * i <= x; i += 2) {
                if (x % i == 0) return false;
            }
            return true;
        }
    }
}

Measured memory_bytes: 29408
N,A,B = (int(x) for x in input().split())
S =  N % (A+B) - A
Acount = N % (A+B)
Ansn = int(N / (A + B)) * A
if S <= 0:
    print(Ansn + Acount)
else:
    print(Ansn + A)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
const ll MOD = 998244353;
const int MAXN = 2000005;
ll fac[MAXN], invfac[MAXN];
ll binom(ll a, ll b) {
	if (b < 0) return 0;
	if (b > a) return 0;
	return (((fac[a] * invfac[b]) % MOD) * invfac[a - b]) % MOD;
}
ll modex(ll a, ll p, ll m = MOD) {
	if (!p) return 1;
	if (p & 1) return a * modex(a, p - 1, m) % m;
	ll v = modex(a, p >> 1, m);
	return v * v % m;
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		fac[i] = fac[i - 1] * i % MOD;
	invfac[MAXN - 1] = modex(fac[MAXN - 1], MOD - 2);
	for (int i = MAXN - 2; i >= 0; --i)
		invfac[i] = invfac[i + 1] * (i + 1) % MOD;
	int n, m;
	scanf("%d%d", &n, &m);
	ll tot = m * 3;
	ll ans = 0;
	for (int odds = 0; odds <= min(m, n); ++odds) {
		ll rem = tot - odds;
		if (rem & 1) continue;
		rem /= 2;
		ll v = binom(rem + n - 1, n - 1);
		v -= (n - odds) * binom(rem - (m + 1) + n - 1, n - 1);
		v -= odds * binom(rem - m + n - 1, n - 1);
		v %= MOD;
		ans += v * binom(n, odds);
		ans %= MOD;
	}
	if (ans < 0) ans += MOD;
	printf("%lld\n", ans);
}


Measured memory_bytes: 31488
#include<stdio.h>

int judge(int);

int judge(int num)
{
  int i;

  if(num == 1)
    return 0;
  if(num == 2)
    return 1;
  if(num%2 == 0)
    return 0;

  for(i=3;i*i<=num;i+=2){
  if(num%i == 0)
    return 0;
    }
  return 1;
}

int main()
{
  int n,num,i,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&num);
    if(judge(num) == 1)
    count++;
  }

  printf("%d\n",count);
  
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

long long f(long long n)
{
    long long dst;
    if (n % 2 == 0)
    {
        long long divided2 = n / 2;
        dst = divided2 % 2;
        dst = dst xor n;
    }
    else
    {
        long long divided2 = (n + 1) / 2;
        dst = divided2 % 2;
    }
    return dst;
}

int main()
{
    long long A, B;
    cin >> A >> B;
    if (A == 0)
        A = 1;
    long long ans = f(A - 1) xor f(B);
    cout << ans << endl;
    return 0;
}

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

int a, b;
string s;

int main() {
    ios::sync_with_stdio(false);

    cin >> a >> b;
    cin >> s;
    
    if (s.length() != a+b+1) {
        cout << "No" << '\n';
        return 0;
    }
    if (s[a] == '-') {
        
        bool ans = true;
        for (int i = 0; i < a && ans != false; i++) {
            
            if (s[i] >= '0' && s[i] <= '9')
                ans = true;
            else
                ans = false;
        }
        
        for (int i = a+1; i < a+1+b && ans != false; i++) {
            if (s[i] >= '0' && s[i] <= '9')
                ans = true;
            else
                ans = false;
        }
        if (ans == false)
            cout << "No" << '\n';
        else
            cout << "Yes" << '\n';
        
        return 0;
        
        
    } else {
        cout << "No" << '\n';
        return 0;
        
    }
    return 0;
}



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() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0;
    ll sum = 0;
    ll XOR = 0;
    int l = 0, r = 0;
    for (; r < N; ++r) {
        sum += A[r];
        XOR ^= A[r];

        if (sum != XOR) {
            while (sum != XOR) {
                sum -= A[l];
                XOR ^= A[l];
                ++l;
            }
        }
        ans += r - l + 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4840
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#define maxn 200005
#define mid ((nl+nr)>>1)
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int n;
ll a[maxn],b[maxn];
int main()
{
	ll ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		ans+=(a[i]*b[i-1])%mod;
		ans%=mod;
		b[i]=(b[i-1]+a[i])%mod;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 6948
#include <stdio.h>

int main(void){
	int n, m, x, i, cost1, cost2;
	int a[100];

	scanf("%d %d %d", &n, &m, &x);

	for(i=0; i<m; i++){
		scanf("%d", &a[i]);
	}

	cost1 = 0;
	cost2 = 0;

	for(i=0; i<m; i++){
		if(a[i]<x){
			cost1++;
		}
		if(x<a[i]){
			cost2++;
		}
	}

	if(cost1<cost2){
		printf("%d\n", cost1);
	}else{
		printf("%d\n", cost2);
	}

	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int goal = max(a, max(b, c));
  int rem = 3 * goal - (a + b + c);
  if(rem % 2 == 1) rem += 3;
  cout << rem / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

int main(){
    ll N;
    cin >> N;
    string s;
    if(!N) s = "0";
    while(N != 0){
        if(N % 2){
            s.insert(0, "1");
            N--;
        }else{
            s.insert(0, "0");
        }
        N /= -2;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int[] guusuukou = new int[100001];
        int[] kisuukou = new int[100001];
        
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (i % 2 == 0) {
                guusuukou[array[i]] += 1;
            } else {
                kisuukou[array[i]] += 1;
            }
        }
        
        int guusuukouMode1 = 0;
        int guusuukouModeValue1 = 0;
        int guusuukouMode2 = 0;
        int guusuukouModeValue2 = 0;
        int kisuukouMode1 = 0;
        int kisuukouModeValue1 = 0;
        int kisuukouMode2 = 0;
        int kisuukouModeValue2 = 0;
        
        for (int i = 1; i < 100001; i++) {
            if (guusuukou[i] > guusuukouModeValue1) {
                guusuukouMode2 = guusuukouMode1;
                guusuukouModeValue2 = guusuukouModeValue1;
                guusuukouMode1 = i;
                guusuukouModeValue1 = guusuukou[i];
                
            } else if (guusuukou[i] > guusuukouModeValue2) {
                guusuukouMode2 = i;
                guusuukouModeValue2 = guusuukou[i];
            }
            
            if (kisuukou[i] > kisuukouModeValue1) {
                kisuukouMode2 = kisuukouMode1;
                kisuukouModeValue2 = kisuukouModeValue1;
                kisuukouMode1 = i;
                kisuukouModeValue1 = kisuukou[i];
                
            } else if (kisuukou[i] > kisuukouModeValue2) {
                kisuukouMode2 = i;
                kisuukouModeValue2 = kisuukou[i];
            }
        }
        
        int a;
        int b;
        
        if (guusuukouMode1 == kisuukouMode1) {
            if (guusuukouModeValue2 > kisuukouModeValue2) {
                a = guusuukouModeValue2;
                b = kisuukouModeValue1;
            } else {
                a = guusuukouModeValue1;
                b = kisuukouModeValue2;
            }
        } else {
            a = guusuukouModeValue1;
            b = kisuukouModeValue1;
        }
        
        int countToFix = n - a - b;
        System.out.println(countToFix);
        
    }
}


Measured memory_bytes: 50524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template <class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = INT_MAX;
const int MOD = 1000000007;

bool check(int n, int s, int c) {
    return to_string(n)[s-1] - '0' == c;
}

int main() {
    int N, M;
    cin >> N >> M;
    vi s(M), c(M);
    rep(i, M) cin >> s[i] >> c[i];
    int ans = -1;
    if (N==1) {
        FOR(i, 0, 9) {
            bool flag = true;
            rep(j, M) {
                if (!(check(i, s[j], c[j]))) flag = false;
            }
            if (flag) {
                ans = i;
                break;
            }
        }
    }
    if (N==2) {
        FOR(i, 10, 99) {
            bool flag = true;
            rep(j, M) {
                if (!(check(i, s[j], c[j]))) flag = false;
            }
            if (flag) {
                ans = i;
                break;
            }
        }
    }
    if (N==3) {
        FOR(i, 100, 999) {
            bool flag = true;
            rep(j, M) {
                if (!(check(i, s[j], c[j]))) flag = false;
            }
            if (flag) {
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9



int main() {
	ll x;
	cin >> x;
	ll ans = (x / 11) * 2;
	x = x % 11;
	if (x == 0) cout << ans << endl;
	else if (x <= 6) cout << ans + 1 << endl;
	else cout << ans + 2 << endl;


	return 0;
}

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

using namespace std;


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


Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans;
    ans = A * (N / (A+B)) + min(A, N % (A+B));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from itertools import permutations

def read_int_list():
    return list(map(int, input().split()))

 
def main():
    def floyd_warshall():
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    dd = d[i][k] + d[k][j]
                    if dd < d[i][j]:
                        d[i][j] = dd
 
    n, m, r = read_int_list()
    v = read_int_list()
    v = [x - 1 for x in v]
    d = [[float('inf')] * n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    for i in range(m):
        a, b, c = read_int_list()
        a -= 1
        b -= 1
        d[a][b] = c
        d[b][a] = c
    floyd_warshall()
    res = float('inf')
    for p in permutations(v):
        s = 0
        for i in range(r - 1):
            s += d[p[i]][p[i + 1]]
        if s < res:
            res = s
    print(res)
 
 
main()

Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll k;
  cin >> k;
  int u[k];
  mem(u);
  int x=7%k,ans=0;
  while(!u[x]) {
    ans++;
    u[x]=1;
    if(!x) break;
    x*=10;
    x+=7;
    x%=k;
  }
  if(u[0]) pr(ans);
  else pr(-1);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 7512
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n, sum=0;
	cin >> n;
	vector<int> l(2*n);
	rep(i, 2*n) cin >> l[i];
	
	sort(l.begin(), l.end());
	
	rep(i, n){
		sum += l[2*i];
	}
	
	cout << sum <<endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import product, permutations

INF=1145141919810

N,M,R=map(int,input().split())
r=map(int,input().split())

road=[[0 if x==y else INF for y in range(N+1)] for x in range(N+1)]

for _ in range(M):
	a,b,c=map(int,input().split())
	road[a][b] = road[b][a] = c

for k in range(N+1):
	for i in range(N+1):
		for j in range(N+1):
			road[i][j] = min(road[i][j], road[i][k] + road[k][j])

print(min(sum(road[p[i-1]][p[i]] for i in range(1, R)) for p in permutations(r)))


Measured memory_bytes: 48088
def main():
  while True:
    n = int(input())
    if not n:
      break
    ss = [s for s in input()[::-1]]
    for i in range(n):
      new = []
      ext = new.extend
      last = ss.pop()
      count = 1
      while ss:
        a = ss.pop()
        if a == last:
          count += 1
        else:
          ext([str(count),last])
          last = a
          count = 1
      ext([str(count), last])
      new = "".join(new)
      ss = [s for s in new[::-1]]
    print(new)

main()


Measured memory_bytes: 7516
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
#include <limits>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
const int MAX = 700000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans=modpow(2,n,MOD);
  ans--;
  COMinit();
  ll j=n;
  ll i=n;
  ll aaa=a;
  ll bbb=b;
  ll aa=1;
  ll bb=1;
  while(aaa){
    aa*=i;
    aa%=MOD;
    aaa--;
    i--;
  }
  while(bbb){
    bb*=j;
    bb%=MOD;
    bbb--;
    j--;
  }
  aa=aa*(finv[a])%MOD;
  bb=bb*finv[b]%MOD;
  ans=(ans-aa-bb)%MOD;
  if(ans<0){
    COUT(ans+MOD);
  }
  else{
    COUT(ans);
  }
}

Measured memory_bytes: 16640
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
const int MS=17;
int mem[101],wait[101],eatingtime[101],seat[MS],hantei[6];

int main(){
  for(int i=0;i<100;i++){
    mem[i]=2;
    if(i%5==1){
      mem[i]=5;
    }
  }
  for(int i=0;i<100;i++){
    eatingtime[i]=17*(i%2)+3*(i%3)+19;
  }
  int time=0,n=0;
  while(n<100){
    for(int j=0;j<MS;j++){
      if(seat[j]>0){seat[j]--;}
    }
    /*    if(time<100){
      cout<<time;
      for(int gi=0;gi<MS;gi++)
	{
	  printf(" %d",seat[gi]);
	  if(gi==MS-1){cout<<endl;
	  }
	}
	}*/
      while((time+1)>(n*5))
	{
	for(int j=0;j<MS-1;j++)
	  {
	    for(int seki=0;seki<2;seki++){
	      if(seat[j+seki]!=0){break;}
	      if(seki==1){hantei[2]=1;hantei[0]=j;j=MS;}
	    }
	  }
	for(int j=0;j<MS-4;j++)
	  {
	    for(int seki=0;seki<5;seki++){
	      if(seat[j+seki]!=0){break;}
	      if(seki==4){hantei[5]=1;hantei[3]=j;j=MS;}
	    }
	  }
	if(hantei[mem[n]]==1){
	  wait[n]=time-(n*5);
	  for(int ji=0;ji<mem[n];ji++){
	    seat[hantei[mem[n]-2]+ji]=eatingtime[n];
	  }
	  n++;
	}
	if(hantei[mem[n]]==0){break;}
	hantei[2]=0;
	hantei[5]=0;

	}
      time++;
  }
  int t;
  while(~scanf("%d",&t)){
    printf("%d\n",wait[t]);
  }
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
using namespace std;
const ll M = 1e9 + 7;
ll n,ans;
int myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}
void solve()
{
    ll n;
    cin>>n;
    ll arr[n],k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    k=arr[0];
    for(int i=1;i<n;i++)
    {
        k=myXOR(k,arr[i]);
    }
    for(int i=0;i<n;i++)
    {
        cout<<myXOR(k,arr[i])<<" ";
    }
}
int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 5076
N = int(input())
a=[]
for i in range(N):
  a.append(int(input()))

base=max(a)
maxkosu=a.count(base)
if maxkosu>1:
  for i in range(N):
    print(base)
else:
  maxidx=a.index(base)
  a[maxidx]=-1
  reigai=max(a)
  for i in range(N):
    if i==maxidx:
      print(reigai)
    else:
      print(base)

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

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

template<long long mod>
class modint{
private:
  long long num;
  long long extgcd(long long a, long long b, long long&x, long long&y)const {
    long long d = a;
    if(b != 0){d = extgcd(b, a%b, y, x);  y -= (a/b) * x;}
    else{x = 1; y = 0;}
    return d;
  }
  long long modinverse()const{
    long long x, y;
    extgcd(num, mod, x, y);
    return (mod + x%mod)%mod;
  }
public:
  modint():num(0){}
  modint(const long long x):num((x < 0?(x+mod):x)%mod ){}
  friend modint operator+(const modint&a, const modint&b)
  {    return modint(a.num + b.num);  }
  friend modint operator-(const modint&a, const modint&b)
  {    return modint(a.num - b.num);  }
  friend modint operator*(const modint&a, const modint&b)
  {    return modint(a.num * b.num);  }
  friend modint operator/(const modint&a, const modint&b)
  {    return modint(a*b.modinverse());  }
  modint& operator+=(const modint&b)
  {    return (*this) = (*this) + b;  }
  modint& operator-=(const modint&b)
  {    return (*this) = (*this) - b;  }
  modint& operator*=(const modint&b)
  {    return (*this) = (*this) * b;  }
  modint& operator/=(const modint&b)
  {    return (*this) = (*this) / b;  }
  modint& operator++()
  {    (*this)+=1; return (*this);  }
  modint& operator--()
  {    (*this)-=1; return (*this);  }
  modint operator++(int){
    modint tmp(*this);
    ++(*this);
    return tmp;
  }
  modint operator--(int){
    modint tmp(*this);
    --(*this);
    return tmp;
  }    
  friend ostream& operator<<(ostream&os, const modint&a){
    os << a.num;
    return os;
  }
  friend istream& operator>>(istream&is, modint&a){
    long long x; is >> x;
    a = x;
    return is;
  }
};


int main(){
  const ll mod = (1e+9) + 7;
  ll n; cin >> n;
  vector<modint<mod>> v(n); cin >> v;
  vector<modint<mod>> dif(n);
  for(ll i = 1; i < n; ++i){
    dif[i] = v[i] - v[i-1];
  }
  modint<mod> ans(0);
  vector<modint<mod>> kai(100010,1);
  for(ll i = 1; i < 100010; ++i){
    kai[i] = kai[i-1] * i;
  }
  vector<modint<mod>> sum(100010,0);
  for(ll i = 1; i < n; ++i){
    sum[i] = sum[i-1] * i + kai[i-1];
  }
  for(ll i = 1; i < n; ++i){
    ans += (sum[i] * dif[i]) * (kai[n-1]/kai[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
k = []
for i in range(3):
    x,y = map(int,input().split())
    k.append(x)
    k.append(y)
if k.count(1) == 1 and k.count(2) == 2 and k.count(3) == 2 and k.count(4) == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
*S, = sorted(set(input()))
for i, s in enumerate(S):
	lowest = ord(s) - 1
	if ord("a") <= lowest and chr(lowest) not in S:
		print(chr(lowest))
		break
else:
	if ord(S[-1]) < ord("z"):
		print(chr(ord(S[-1])+1))
	else:
		print("None")


Measured memory_bytes: 3188
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var N = Number(line[0]);
	var A = Number(line[1]);
	if(N%500 <= A) console.log('Yes');
	else console.log('No');
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
n = int(input())
cards = [[False for i in range(13)] for j in range(4)]
pattern = ['S','H','C','D']

for i in range(n):
    ch,rank = map(str,input().split())
    rank = int(rank)
    cards[pattern.index(ch)][rank-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i],j +1)


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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}
int a[14][14], c[14];
int main()
{
    int n, m, x, ans = 1e9;
    cin >> n >> m >> x;
    For(i, n)
    {
        cin >> c[i];
        For(j, m) cin >> a[i][j];
    }
    For(bit, (1 << n))
    {
        int dp[13] = {};
        int mini = 0;
        For(j, n)
        {
            if (bit & (1 << j))
            {
                mini += c[j];
                For(i, m) dp[i] += a[j][i];
            }
        }
        bool f = true;
        For(i, m)
        {
            if (dp[i] < x)
                f = false;
        }
        if (f)
            ans = min(ans, mini);
    }
    if (ans == 1e9)
        cout << -1 << endl;
    else
        cout << ans << "\n";
    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3788
#include <stdio.h>

int main(){
  int h, w, t2, t2_a, i, j, h_a, w_a, ans;

  while(1){
    scanf("%d %d", &h, &w);
    if( (h == 0)&&(w == 0)) break;

    t2 = h*h + w*w;

    h_a = w_a = 0;
    ans = 22500;
    for(i = 1; i <= 149; i++){
      for(j = i+1; j <= 150; j++){

        t2_a = i*i + j*j;

        if( t2 <= t2_a ){
          if(h == i && w == j ) continue;
          if(t2 == t2_a){
              if(h >= i) continue;
          }
          if(t2_a < ans){
            h_a = i;
            w_a = j;
            ans = t2_a;
          }
        }

      }
    }

    printf("%d %d\n", h_a, w_a);
  }


  return 0;

}



Measured memory_bytes: 2088
import java.util.Scanner;
class Main{
	public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		String pass = scan.nextLine();
		for(int i = 0; i < pass.length(); i++){
			char ch = pass.charAt(i);
			if((int)ch >= 96) ch -= 32;
			System.out.print(ch);
		}
		System.out.println();
	}
}

Measured memory_bytes: 17136
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MAX 605
using namespace std;
//char nc()
//{
//	static char buf[100000],*p1=buf,*p2=buf;
//	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
char nc(){return getchar();}
int read()
{
	int x=0,y=1;
	char c=nc();
	while(!isdigit(c))
	{
		if(c=='-')y=-1;
		c=nc();
	}
	while(isdigit(c))
	{
		x=(x<<1)+(x<<3)+(c^48);
		c=nc();
	}
	return x*y;
}
int n,d1,d2,col[MAX][MAX];
void dye(int d)
{
	int t=0;
	while(!(d%4)) d>>=2,t++;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(((d&1)&&(((i>>t)+(j>>t))&1))||(!(d&1)&&((i>>t)&1)))
				col[i][j]=1;
}
int main()
{
	n=read();d1=read();d2=read();
	int lim=n*n;n<<=1;
	dye(d1);dye(d2);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(!col[i][j])
			{
				lim--;
				printf("%d %d\n",i,j);
				if(!lim) return 0;
			}
	return 0;
}


Measured memory_bytes: 5188
#define _USE_MATH_DEFINES // M_PIなどの定義を使用するのに必要
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>

using namespace std;

struct IntComb {
  int64_t ai;
  int64_t bi;
  int64_t ci;
  int64_t di;
};

int main()
{
  string S;

  cin >> S;

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

  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  int TT = 1;
  // cin >> TT;
  while (TT--) {
    ll n;
    cin >> n;
    vector<ll> A(n);
    for (auto& aa : A) cin >> aa;
    ll money = 1000;
    for (int i = 1; i < n; ++i) {
      ll profit = A[i]-A[i-1];
      if (profit <= 0) continue;
      ll shares = money/A[i-1];
      money += shares*profit;
    }
    cout << money << endl;
  }
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <iostream>
using namespace std;
static const int MAX_N = 200000;

int maximum_profit(const int n, int *rate)
{
    int maxprofit = rate[1] - rate[0];
    int profit;

    /*
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n; j++) {
            profit = rate[j] - rate[i];
            if (profit > maxprofit) {
                maxprofit = profit;
            }
            printf("(%d, %d) %d max %d\n",i,j,profit,maxprofit);
        }
    }
    */
    int min = rate[0];
    int max = rate[1];
    for (int i = 0; i < n-1; i++) {
        if (rate[i] < min) {
            min = rate[i];
        }
        if (rate[i+1] - min > maxprofit) {
            maxprofit = rate[i+1] - min;
        }
    }

    return maxprofit;
}
int main(void) {

    /*
    int n1 = 7;
    int rate1[7] = {6, 5, 3, 1, 3, 4, 3};

    int n2 = 4;
    int rate2[4] = {5, 4, 3, 2};
    */

    int maxprof = 0;

    int n;
    int rate[MAX_N];

    /*
    n = n1;
    rate = rate1;
    maxprof = maximum_profit(n, rate);
    printf("1: maxprof : %d\n", maxprof);

    n = n2;
    rate = rate2;
    maxprof = maximum_profit(n, rate);
    printf("2: maxprof : %d\n", maxprof);
    */

    cin >> n;
    for (int i = 0; i < n; i++) cin >> rate[i];

    maxprof = maximum_profit(n, rate);

    cout << maxprof << endl;

    return 0;
}


Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
int check(int x) {
    int cnt=0;
    while(!(x&1)) {
        x/=2;
        cnt++;
    }
    return cnt;
}
int main(int argc,char const *argv[]) {
    int t;
    cin>>t;
    int mx=0,res=0;
    for(int i=1;i<=t;i++) {
        int ans=check(i);
        if(ans>mx) {
            mx=ans;
            res=i;
        }
    }
    if(res!=0) cout<<res<<endl;
    else cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int32_t main()
    {
        ll i,j,k,l,n,m,q,t,five=0,seven=0,a,b,c;
        cin>>a>>b>>c;
      if(a==5)
      {
      five++;
      }
      if(c==5)
      {
      five++;
      }
      if(b==5)
      {
      five++;
      }
       seven=3-five;
      if(five==2&&seven==1){
      cout<<"YES";
      }
      else
      {
      cout<< "NO";
      }

       return 0;
    }
// mene code me hag diya bohot baar please dont judge me from my code , I am a better coder than what it looks





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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 200005;

struct Node {
  int s, i;
  LL v;

  bool operator < (const Node &b) const {
    return v * b.s < b.v * s;
  }
} b[N];

int n, m, f[N], fat[N], ind[N], siz[N], par[N], val[N];
priority_queue <Node> q;
vector <int> adj[N];
LL ans;

inline int F(int x) {
  while (x != f[x]) {
    x = f[x] = f[f[x]];
  }
  return x;
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n);
  for (int i = 2, x; i <= n; ++i) {
    Read(par[i]), adj[par[i]].pb(i);
  }
  for (int i = 1; i <= n; ++i) {
    Read(val[i]);
  }
  par[1] = 0, adj[0].pb(1), val[0] = 1;
  for (int i = 0; i <= n; ++i) {
    if (val[i]) {
      queue <int> q;
      q.push(i);
      while (!q.empty()) {
        int x = q.front();
        q.pop();
        for (auto y : adj[x]) {
          if (!val[y]) {
            q.push(y), ++siz[ind[i]];
          } else {
            ind[y] = ++m, fat[m] = ind[i];
          }
        }
      }
    }
  }
  for (int i = 1; i <= m; ++i) {
    f[i] = i, b[i].i = i, b[i].s = 1, b[i].v = siz[i], q.push(b[i]);
  }
  b[0].s = 1;
  while (!q.empty()) {
    Node t = q.top();
    q.pop();
    if (t.s != b[t.i].s) {
      continue;
    }
    int p = F(fat[t.i]);
    ans += t.v * b[p].s, f[t.i] = p, b[p].s += b[t.i].s, b[p].v += b[t.i].v;
    if (p) {
      q.push(b[p]);
    }
  }
  printf("%lld\n", ans);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 24432
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)*}
    };
}

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

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!{
        a: u64,
        b: u64,
    }
   println!("{}", (a + b) % 24);
}


Measured memory_bytes: 4352
h1, m1, h2, m2, k = map(int, input().split())

if h1==h2:
    time = m2-m1
else:
    time = ((h2-1)-h1)*60
    time += (m2+60)-m1

if time < k:
    print(0)
else:
    print(time-k)


Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

  int ans = 0;
  repp(i, 22, D) {
    int ten = i / 10;
    int one = i % 10;
    if (one <= 1)
      continue;
    if (1 <= ten * one && ten * one <= M)
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define debug(x...) 
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
void print(){cout << endl;} void prints(){}
template<typename T=int> T get(){T x; cin >> x; return x;}
template<typename T> void get(T* x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T> void get(T& x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T, typename... A> void print(T x,A... r){cout << x << " ";print(r...);}
template<typename T, typename... A> void prints(T x,A... r){cout << x << " ";prints(r...);}
typedef long long int ll; typedef double db; typedef vector<ll> vi; typedef pair<ll, ll> pii;
#define int ll
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define clear(x) memset(x, 0, sizeof(x))
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int mod = 1e9+7;
const int N = 1e6+1;

int32_t main(){
	fast_io();

	int n, k; cin >> n >> k;
	vi a(n); get(a,n);

	vector<bool> dp(k+1);
	// dp[i] = true if player stating with i stones wins the game

	for (int i = 0; i < k+1; ++i) {
		for(auto x : a){
			if(i>=x and !dp[i-x]){
				dp[i] = 1;
			}
		}
	}
	debug(dp);

	print(dp[k] ? "First" : "Second");
	
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Lamps solver = new Lamps();
        solver.solve(1, in, out);
        out.close();
    }

    static class Lamps {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] arr = new int[N];
            for (int i = 0; i < N; i++) {
                arr[i] = in.nextInt();
            }
            for (int i = 0; i < K; i++) {
                int[] next = new int[N];
                for (int j = 0; j < N; j++) {
                    next[Math.max(0, j - arr[j])]++;
                    if (j + arr[j] + 1 < N) {
                        next[j + arr[j] + 1]--;
                    }
                }
                int min = next[0];
                for (int a = 1; a < N; a++) {
                    next[a] += next[a - 1];
                    min = Math.min(next[a], min);
                }
                arr = next.clone();
                if (min == N) {
                    break;
                }
            }
            for (int i = 0; i < N; i++) {
                out.println(arr[i]);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 57332
#include<iostream>

using namespace std;

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

    int a[N+1];
    for(int i=1;i<=N; i++){
        cin >> a[i];
    }
    
    int b[N+1];

    int temp;
    int M = 0;

    for(int i = N; i!=0; i--){
        b[i] = a[i];
        for(int j = N - N%i; j != i; j -= i){
            b[i] = (b[i] - b[j]) & 1;
        }
        if(b[i]) M++;
    }
    cout << M << endl;
    for(int i=1;i<=N;i++){
        if(b[i]) cout << i << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>
int main(void){
  int a;
  int b;
  int x=0;
  int y=0;
  scanf("%d %d",&a,&b);
  x=a*b;
  y=2*a+2*b;
  printf("%d %d\n",x,y);
  return 0;
}



Measured memory_bytes: 2036
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF LLONG_MAX / 2;
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;

const ll INF = LLONG_MAX;

#define ARRAY_MAX 100005
#define N_MAX 45
#define AB_MAX 15
#define INF 1e9

int dp[N_MAX][N_MAX * AB_MAX][N_MAX * AB_MAX];

int main(){

    int n,ma,mb;
    cin >> n >> ma >> mb;
    vector<int> a(n),b(n),c(n);
    REP(i,n){
        cin >> a[i] >> b[i] >> c[i];
    }

    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= N_MAX*AB_MAX;j++){
            for(int k = 0;k <= N_MAX*AB_MAX;k++){
                dp[i][j][k] = INF;
            }
        }
    }


    dp[0][0][0] = 0;
    
    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= N_MAX*AB_MAX;j++){
            for(int k = 0;k <= N_MAX*AB_MAX;k++){
                /*if(dp[i-1][j][k] == INF){
                    continue;
                }*/
                dp[i][j][k] = min(dp[i][j][k],dp[i-1][j][k]);
                dp[i][j+a[i-1]][k+b[i-1]] = min(dp[i][j+a[i-1]][k+b[i-1]],dp[i-1][j][k]+c[i-1]);
            }
        }
    }
    int ans = INF;

    for(int i = 1;i <= N_MAX*AB_MAX;i++){
        for(int j = 1;j <= N_MAX*AB_MAX;j++){
            if(i*mb == j*ma){
                ans = min(ans,dp[n][i][j]);
            }
        }
    }

    if(ans == INF){
        ans = -1;
    }
    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 73984
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
if(n>=1&&n<=100&&k>=1&&k<=pow(10,5)){
if(n*500>=k)
    cout<<"Yes"<<endl;
else if(n*500<k)
    cout<<"No"<<endl;}

return 0;}


Measured memory_bytes: 3532