akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define deb(x) cout<<#x<<" "<<x<<endl;
#define print(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
#define MOD 1000000007
#define finish return 0
#define all(x) x.begin(),x.end()
using namespace std;
using namespace __gnu_pbds; 
typedef long long int ll;
typedef tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<int D, typename T> struct Vec : public vector<Vec<D - 1, T>> { static_assert(D >= 1, "Vector dimension must be greater than zero!"); template<typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) { }}; template<typename T> struct Vec<1, T> : public vector<T> { Vec(int n = 0, T val = T()) : vector<T>(n, val) { } };
inline ll mod(ll x) { return (x%MOD + MOD)%MOD; }
ll gcd(ll a, ll b, ll &x, ll &y){if(a == 0){x = 0, y = 1; return b;} ll x1, y1;  ll d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}
ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; } 
ll power(ll x,ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res*x); y = y>>1; x = (x*x);   } return res; } 
ll mod(ll num, ll den){ return mod(mod(num) * power(den,MOD-2,MOD)); }
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans = 0;
    ans = min(k,a);
    k = max(k-ans,0ll);
   // deb(k);
    ll ans2 = 0;
    ans2 = min(k,b);
    k = max(k-ans2,0ll);
    //deb(k);
    ll ans3 = 0;
    ans3 = min(k,c);
 //   deb(k);
    k = max(k-ans3,0ll);

    cout<<ans-ans3<<endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	int i, j, k;
	char S[N];
	for (i = 0; i < N; i++) 
		scanf("%c", &S[i]);

	int yellow = 0;
	for (i = 0; i < N; i++) {
		if (S[i] == 'Y')
			yellow = 1;
	}

/*	if (yellow)
		printf("Four\n");
	else
		printf("Three\n");
*/
	printf(yellow ? "Four\n" : "Three\n");

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int d;
	while (cin >> d) {
		int sum = 0;
		for (int x = d; x < 600; x += d) {
			sum += d * x * x;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int wcount=0;
  int64_t count=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='W'){
      count+=i-wcount;
      wcount++;
  }
  }
  cout<<count;
}


Measured memory_bytes: 640
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int  ll;
typedef long double  ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
vv32 v;
vv64 dp;
ll dfs(int u,int c,int par){
	if(dp[u][c]!=-1) return dp[u][c];
	ll ansb=1,answ=1;
	forstl(it,v[u]){
		if(it==par) continue;
		ansb=(ansb*dfs(it,1,u))%MOD;
		answ=(answ*(dfs(it,0,u)+dfs(it,1,u)))%MOD;
	}
	dp[u][0]=ansb;
	dp[u][1]=answ;
	return dp[u][c];
}
int main(){
	fastio;
	cin>>n;
	v.assign(n,v32(0));
	dp.assign(n,v64(2,-1));
	forn(i,n-1){
		cin>>x>>y; --x,--y;
		v[x].pb(y);
		v[y].pb(x);
	}
	cout<<(dfs(0,0,0)+dfs(0,1,0))%MOD <<ln;
	return 0;
}

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

int main(){
	double a,b,c,d,e,f,y,x;
	
	while(cin>>a>>b>>c>>d>>e>>f){
	
	x = (e*c-b*f)/(a*e-d*b);
	y = (c*d-f*a)/(b*d-e*a);
	
	if(x == 0)
		x = 0;
	if(y == 0)
		y =0;
	
	printf("%.3f %.3f\n",x,y);
	}
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

template<typename T> inline constexpr auto square(T x) { return (x) * (x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int A, B;
	cin >> A >> B;

	int ans = A * B;

	if (A > 9 || B > 9) ans = -1;

	COL(ans);

	return 0;
}

Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18+5;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,m,ans=inf,y,cnt=0,c[15]={},a[15][15]={};
  cin >> n >> m >> y;
  for(int i=0; i<n; i++) {
    cin >> c[i];
    for(int j=0; j<m; j++) {
      cin >> a[i][j];
    }
  }
  int f;
  for(int i=0; i<(1<<n); i++) {
    cnt=0;
    int x[15]={};
    for(int j=0; j<n; j++) {
      if(i&(1<<j)) {
        cnt+=c[j];
        for(int k=0; k<m; k++) {
          x[k]+=a[j][k];
        }
      }
    }
    f=1;
    for(int j=0; j<m; j++) {
      if(x[j]<y) {
        f=0;
      }
    }
    if(f) {
      ans=min(ans,cnt);
    }
  }
  if(ans==inf) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

int main()
{
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i, n) {
		cin >> a[i];
	}
	sort(DWN(a));
	vector<ll> d;
	REP(i, n - 1) {
		if (a[i] == a[i + 1]){
			d.PB(a[i]);
			i++;
		}
		if (d.size() == 2) break;
	}
	if (d.size() < 2) cout << 0 << endl;
	else cout << d[0] * d[1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#! /usr/bin/env python3

def dropcell(h, w, rm):
    for i in range(w):
        y = 0
        for j in range(h):
            if rm[h-j-1][i] != 0:
                rm[h-y-1][i] = rm[h-j-1][i]
                y += 1
        for j in range(h-y):
            rm[h-y-j-1][i] = 0

def removecell(h, w, k, rm, a):
    p = 0
    for y in range(h):
        c, t = 1, 0
        for i in range(w+1):
            x = rm[y][i]
            if x > 0 and x == t:
                c += 1
            else:
                if c >= k:
                    for j in range(c):
                        rm[y][i-1-j] = 0
                    p += (t * c)
                t = x
                c = 1
    return p * (2**a)

def game(h, w, k, M, y, x):
    f, score, a = 1, 0, 0
    rm = [[j for j in i]for i in M[:y+1]]
    rm[y][x] = 0
    while f:
        dropcell(len(rm), w, rm)
        f = removecell(len(rm), w, k, rm, a)
        score += f
        a += 1
    return score

def main():
    H, W, K = map(int, input().split())
    M = [list(map(int, list(input())))+[0] for i in range(H)]
    ans = 0
    for j in range(W):
        t = 0
        for i in range(1, H):
            if M[i][j] != t:
                ans = max(ans, game(H, W, K, M, i, j))
                t = M[i][j]
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3192
import fractions

N = int(input())
A = [int(n) for n in input().split()]

def lcm(x, y):
  return x * y // fractions.gcd(x, y)

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))

Measured memory_bytes: 5348
a = int(input())
b = int(input())
c = int(input())
x = int(input())
z = 0
number = 0
for i in range(a+1):
    for g in range(b+1):
        for h in range(c+1):
            z = 500*i + 100*g + 50*h
            if x == z:
                number += 1

print(number)
                

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;++i){
        if(i%k==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
}

Measured memory_bytes: 3592
from heapq import *
Q, = map(int, input().split())
qs = []
c = 0
for i in range(Q):
    q = input().split()
    if len(q) == 1:
        c += 1
    else:
        a, b = int(q[1]), int(q[2])
        qs.append((a, b, c, i))
        c = 0
if c:
    qs.append((a, b, c, i))

R = [10**18]
L = [10**18]
ss = 0
for a, b, c, i in qs:
    xs = []
    if c:
        x = heappop(L)
        for _ in range(c):
            print(-x, ss)
        heappush(L, x)
    x = heappop(R)
    y = -heappop(L)
    if x < a:
        heappush(R, a)
        heappush(R, a)
        heappush(L, -x)
        heappush(L, -y)
        ss += a-x
    elif y > a:
        heappush(L, -a)
        heappush(L, -a)
        heappush(R, x)
        heappush(R, y)
        ss += y-a
    else:
        heappush(L, -a)
        heappush(R, a)
        heappush(L, -y)
        heappush(R, x)
    ss += b


Measured memory_bytes: 126040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<ll> H(N);
    for (auto &x : H) cin >> x;
    vector<int> V(N, 0);
    for (int i = 1; i < N; ++i) {
        if (H.at(i - 1) >= H.at(i)) {
            V.at(i) = V.at(i - 1) + 1;
        }
    }
    int ans = 0;
    for (auto &x : V) {
        ans = max(ans, x);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll = long long;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(nullptr);
    ll a, b;
    cin >> a >> b;
    set<ll> primeFactors;
    for (ll i = 2; i * i <= a; i++) {
        if (a % i == 0) {
            primeFactors.insert(i);
            while (a % i == 0) {
                a /= i;
            }
        }
    }
    if (a != 1) {
        primeFactors.insert(a);
    }
    vector<ll> res;
    for (ll i = 2; i * i <= b; i++) {
        if (b % i == 0) {
            if (primeFactors.count(i)) {
                res.push_back(i);
            }
            while (b % i == 0) {
                b /= i;
            }
        }
    }
    if (b != 1 && primeFactors.count(b)) {
        res.push_back(b);
    }
    cout << res.size() + 1;
    return 0;
}


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

A = list(range(1,N+1))

i = 1
while 3*i <= N:
    A[i * 3-1] = 0
    i += 1

i = 1
while 5*i <= N:
    A[i * 5-1] = 0
    i += 1

print(sum(A))

Measured memory_bytes: 72664
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) {
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for(v = 0; v < n; v++) {
    if(M[u][v] == 0) continue;
    if(color[v] == WHITE) {
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs() {
  int u;
  for(u = 0; u < n; u++) color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++) {
    if(color[u] == WHITE) dfs_visit(u);
  }

  for(u = 0; u < n; u++) {
    printf("%d %d %d\n", u + 1, d[u], f[u]);
  }

}

int main() {
  int u, v, k, i, j;

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    for(j = 0; j < n; j++) {
      M[i][j] = 0;
    }
  }

  for(i = 0; i < n; i++) {
    scanf("%d %d", &u, &k);
    u--;
    for(j = 0; j < k; j++) {
      scanf("%d", &v);
      M[u][--v] = 1;
    }
  }

  dfs();

  return 0;
}



Measured memory_bytes: 2116
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int h,w;
  cin>>h>>w;
  char a[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
    }
  }
  
  for(int i=0;i<h-1;i++){
    for(int j=0;j<w;j++){
      cout<<a[i][j];
    }
    cout<<endl;
    for(int j=0;j<w;j++){
      cout<<a[i][j];
    }
    cout<<endl;
  }
  int i=h-1;
  for(int j=0;j<w;j++){
      cout<<a[i][j];
  }
  cout<<endl;
  for(int j=0;j<w;j++){
    cout<<a[i][j];
  }
  
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    ll N, H;
    cin >> N >> H;
    vector<ll> a(N), b(N);
    rep(i, N) cin >> a[i] >> b[i];

    sort(a.begin(), a.end(), greater<ll>());
    sort(b.begin(), b.end(), greater<ll>());

    ll ans = 0;
    ll used = 0;
    while(a[0] < b[used] && 0 < H && used < N){
        H -= b[used];
        ans++;
        used++;
    }
    if(0 < H){
        ll tmp = H / a[0];
        if(H%a[0] != 0) tmp++;
        ans += tmp;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR for(int i=1; i<=n; ++i)

int main() {

    ll x, k, d;
    sc("%lld %lld %lld", &x, &k, &d);

    x = abs(x);

    ll a = ceil((double) x/d);

    if(k < a) {
        printf("%lld\n", x-(k*d));
        return 0;
    }

    ll b = x/d;

    ll y = abs( ((a*d) - ( ((k-a)%2) *d ) ));

    ll z = abs(((b*d) + ((k-b)%2)*d   ) );

    printf("%lld\n", min(abs(x-y), abs(x-z)));

}



Measured memory_bytes: 3868
import functools
import itertools
import math
import sys
import collections
import enum


def primefac(x):
    fac = []
    for i in range(2, int(math.sqrt(x)) + 1 + 1):
        if x % i != 0:
            continue
        ex = 0
        while x % i == 0:
            ex += 1
            x = x // i
        fac.append((i, ex))

    if x != 1:
        fac.append((x, 1))
    return fac


if __name__ == "__main__":
    N, P = [int(x) for x in input().split(" ")]
    fac = primefac(P)

    def f(x, y):
        return x[0] * y[0]

    ans = 1
    for val, ex in fac:
        if ex >= N:
            ans *= val ** (ex // N)
    print(ans)


Measured memory_bytes: 3684
#include<cstdio>
#include<cctype>
#include<cstring>
#include<set>
#include<queue>
#include<algorithm>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define reg register
typedef long long ll;
template<typename T>inline T read(){
    reg T x=0;reg short f=1;reg char c=getchar();
    for(;!isdigit(c);f=c=='-'?-1:1,c=getchar());
    for(;isdigit(c);x=x*10+(c^48),c=getchar());
    return x*f;
}
using namespace std;
const int inf=0x3f3f3f3f;
const int maxv=1e5+5;
const int maxe=2e5+5;
struct data{
	int dis,node;
	data(int dis=0,int node=0):dis(dis),node(node){}
	bool operator<(const data& a)const{return dis==a.dis?node<a.node:dis>a.dis;}
};
priority_queue<data>q;
set<int>comp[maxv];
bool vis[maxv];
struct edge{int t,nxt,cmp;}es[maxe<<1];
int h[maxv],cnt;
inline void ins(int s,int t,int id){es[++cnt]=(edge){t,h[s],id};h[s]=cnt;es[++cnt]=(edge){s,h[t],id};h[t]=cnt;}
int n,m,d[maxv];
int main(){
	n=read<int>();m=read<int>();
	for(reg int i=1,s,t,c;i<=m;i++)
		s=read<int>(),t=read<int>(),c=read<int>(),ins(s,t,c);
	memset(d,0x3f,sizeof(d));q.push(data(0,1));d[1]=0;
	while(!q.empty()){
		reg data v=q.top();q.pop();if(vis[v.node])continue;vis[v.node]=1;
		for(reg int i=h[v.node];i;i=es[i].nxt){
			if(vis[es[i].t])continue;
			reg int dis1=d[v.node]+(!comp[v.node].count(es[i].cmp));
			if(dis1==d[es[i].t])comp[es[i].t].insert(es[i].cmp);
			if(dis1<d[es[i].t]){
				d[es[i].t]=dis1;comp[es[i].t].clear();comp[es[i].t].insert(es[i].cmp);
				q.push(data(dis1,es[i].t));
			}
		}
	}
	printf("%d\n",d[n]==inf?-1:d[n]);
    return 0;
}

Measured memory_bytes: 20216
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <vector>

// constexpr std::int64_t INF = 1ull << 50;
constexpr int INF = 1 << 20;

auto main() -> int {
  int D;
  std::cin >> D;
  if (D <= 25) std::cout << "Christmas";
  if (D <= 24) std::cout << " Eve";
  if (D <= 23) std::cout << " Eve";
  if (D <= 22) std::cout << " Eve";
  std::cout << std::endl;
}


Measured memory_bytes: 256
import sys
f=lambda:map(int,sys.stdin.readline().split())
n,d,a=f()
lt=sorted(tuple(f()) for _ in range(n))
from collections import *
q=deque()
c=s=0
for x,h in lt:
  while q and q[0][0]<x: s+=q.popleft()[1]
  h-=s
  if h<1: continue 
  t=-h//a; c-=t; s-=t*a; q.append((x+d*2,t*a))
print(c)

Measured memory_bytes: 44628
program one_card_poker
  implicit none
  integer :: a, b, c(13)
  c = (/13,1,2,3,4,5,6,7,8,9,10,11,12/)
  read(*,*) a, b
  if (c(a).gt.c(b)) then
    write(*,'(a)') 'Alice'
  else if (c(a).lt.c(b)) then
    write(*,'(a)') 'Bob'
  else
    write(*,'(a)') 'Draw'
  end if
end program one_card_poker

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

string type[]={"root","internal node","leaf"};

struct routedTree{
    int me;
    vector<int> child;
    int info;
    int dep;
    int parent;
};
void calcDepth(vector<routedTree> &tree,int now,int parentDepth){
    tree[now].dep = parentDepth+1;
    for(int i = 0; i < tree[now].child.size();i++){
        calcDepth(tree,tree[now].child[i],tree[now].dep);
    }
    return;
}
bool cmp(const routedTree &a,const routedTree &b){
    return a.me < b.me;
}


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,tmp;
    cin >> n;
    vector<routedTree> tree(n);
    for(int i = 0; i < n;i++){
        cin >> tree[i].me;
        tree[i].parent = -1;
        tree[i].dep = 0;
        cin >> k;
        for(int l = 0; l < k;l++){
            cin >> tmp;
            tree[i].child.push_back(tmp);
        }
    }
    sort(ALL(tree),cmp);
    
    for(int i = 0; i < n;i++){
        if(tree[i].child.empty()){
            tree[i].info = 2;
        }else{
            tree[i].info = 1;
            for(int l = 0; l < tree[i].child.size();l++){
                tree[tree[i].child[l]].parent = tree[i].me;
            }
        }
    }
    for(int i = 0; i < n;i++){
        if(tree[i].parent == -1){
            tree[i].info = 0;
            calcDepth(tree,tree[i].me,-1);
        }
    }
    for(int i = 0; i < n;i++){
        cout << "node " <<  tree[i].me << ": parent = " << tree[i].parent << ", depth = " << tree[i].dep << ", " << type[tree[i].info] <<", [";
        for(int l = 0; l < tree[i].child.size();l++){
            cout << tree[i].child[l];
            if(l != tree[i].child.size()-1){
                cout << ", ";
            }
        }
        cout << "]" << endl;
    }
    

    return 0;
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

struct QuickFind {
    V<int> id;
    VV<int> groups;
    int gc;  // group count
    QuickFind(int n = 0) {
        id = V<int>(n);
        groups = VV<int>(n);
        for (int i = 0; i < n; i++) {
            id[i] = i;
            groups[i] = {i};
        }
        gc = n;
    }
    void merge(int a, int b) {
        if (same(a, b)) return;
        gc--;
        int x = id[a], y = id[b];
        if (groups[x].size() < groups[y].size()) swap(x, y);
        for (int j : groups[y]) {
            id[j] = x;
            groups[x].push_back(j);
        }
        groups[y].clear();
    }
    bool same(int a, int b) { return id[a] == id[b]; }
};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(20) << fixed;

    int h, w;
    cin >> h >> w;
    VV<bool> g(h, V<bool>(w));
    for (int i = 0; i < h; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < w; ++j) {
            g[i][j] = (s[j] == '#');
        }
    }
    QuickFind qf(h * w);
    auto id = [&](int i, int j) { return i * w + j; };
    for (int i = h-1; i >= 0; i--) {
        for (int j = w-1; j >= 0; j--) {
            if (i != h-1 && g[i+1][j] != g[i][j]) qf.merge(id(i, j), id(i + 1, j));
            if (j != w-1 && g[i][j+1] != g[i][j]) qf.merge(id(i, j), id(i, j + 1));
        }
    }
    ll ans = 0;
    for (auto v: qf.groups) {
        ll c0 = 0, c1 = 0;
        for (int d: v) {
            if (g[d / w][d % w] == true) c0++;
            else c1++;
        }
        ans += c0 * c1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  if (S[K-1]=='A')S[K-1]='a';
  if (S[K-1]=='B')S[K-1]='b';
  if (S[K-1]=='C')S[K-1]='c';

  cout << S;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();
        int ans = 0;
        for (int i = 0; i <= K; i++) {
            for (int j = 0; j <= K; j++) {
                if (i + j <= S && S - (i + j) <= K) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> pp;
    
    int z = 1, o = 1;
    for (int i = 0; i < n - 1; i++) {
        if (char(s[i]) == '0') {
            if (char(s[i + 1]) == '0') z++;
            else {
                pp.push_back(z);
                o = 1;
            }
        }
        else {
            if (char(s[i + 1]) == '0') {
                pp.push_back(o);
                z = 1;
            }
            else o++;
        }
    }
    if (char(s[n - 1]) == '0') pp.push_back(z);
    else pp.push_back(o);
    
    bool rev = false;
    if (char(s[0]) == '1') rev = true;
    
    int x = 0;
    if (rev) {
        if (pp.size() / 2 <= k) {
            int ans = 0;
            for (int i = 0; i < pp.size(); i++) ans += pp[i];
            cout << ans << endl;
            return 0;
        }
        
        for (int i = 0; i < 2 * k + 1; i++) x += pp[i];
        int mx = x, idx1 = 0, idx2 = 2 * k + 1;
        while (idx2 < pp.size()) {
            if (idx2 + 1 == pp.size()) break;
            x -= pp[idx1] + pp[idx1 + 1];
            idx1 += 2;
            x += pp[idx2] + pp[idx2 + 1];
            idx2 += 2;
            mx = max(x, mx);
        }
        if (pp.size() % 2 == 0) {
            int tp = 0;
            for (int i = 0; i < 2 * k; i++) {
                tp += pp[pp.size() - 1 - i];
            }
            mx = max(mx, tp);
        }
        cout << mx << endl;
    }
    else {
        if ((pp.size() + 1) / 2 <= k) {
            int ans = 0;
            for (int i = 0; i < pp.size(); i++) ans += pp[i];
            cout << ans << endl;
            return 0;
        }
        
        for (int i = 1; i < min(int(pp.size()), 2 * k + 2); i++) x += pp[i];
        int mx = x, idx1 = 1, idx2 = 2 * k + 2;
        while (idx2 < pp.size()) {
            if (idx2 + 1 == pp.size()) break;
            x -= pp[idx1] + pp[idx1 + 1];
            idx1 += 2;
            x += pp[idx2] + pp[idx2 + 1];
            idx2 += 2;
            mx = max(x, mx);
        }
        int tmp = 0;
        for (int i = 0; i < 2 * k; i++) tmp += pp[i];
        mx = max(mx, tmp);
        
        if (pp.size() % 2 == 1) {
            int tp = 0;
            for (int i = 0; i < 2 * k; i++) {
                tp += pp[pp.size() - 1 - i];
            }
            mx = max(mx, tp);
        }
        cout << mx << endl;
    }
    
    
}



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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> city(N,0);
  
  int road;
  for (int i=0; i<M*2; i++) {
    cin >> road;
    city.at(road-1)++;
  }
  
  for (int i=0; i<N; i++) {
    cout << city.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C)
    {
        if (A % 2 == 0)
        {
            cout << "-1" << endl;
        }else
        {
            cout << "0" << endl;
        }
        
        return 0;
    }
    long long int cnt = 0;
    int x, y, z;
    while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0)
    {
        x = A / 2;
        y = B / 2;
        z = C / 2;
        A = y + z;
        B = x + z;
        C = x + y;
        cnt += 1;
    }
    
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

bool integer[8000000];

int main(void){
    int n,m;
    while(true){
        cin>>m>>n;
        if(n==0){
            if(m==0){
                break;
            }
        }
        for(int i=m;i<8000000;i++){
            if(integer[i])continue;
            if(n==0){
                cout<<i<<endl;
                break;
            }
            integer[i]=true;
            int j=i;
            int num = 2;
            n--;
            while(num*j<8000000)integer[num*j]=true,num++;
        }
        for(int i=0;i<8000000;i++)integer[i]=false;
    }
    return 0;
}


Measured memory_bytes: 10888
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
long long ans,n,a[202020],b[202020];
long long ck(long long x)
{
	long long now=1<<(x+1),c[202020],cnt=0;
	for(int i=0;i<n;i++)
	{
		c[i]=b[i]%now;
	}
	sort(c,c+n);
	for(int i=0;i<n;i++)
	{
		long long all=a[i]%now,s=lower_bound(c,c+n,(1<<(x+1))-all)-1-lower_bound(c,c+n,(1<<x)-all)+lower_bound(c,c+n,(1<<(x+2))-all)-1-lower_bound(c,c+n,(1<<(x+1))+(1<<x)-all);
		cnt+=s;
	}
	return cnt&1;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
	}
	for(int i=0;i<=28;i++)
	{
        if(ck(i))
        {
        	ans+=(1<<i);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

ll dp[55][5000];
int n, a, arr[55], sum;
ll ans;

int main(){
    ios::sync_with_stdio(0);
    clean(dp,0);
    cin >> n >> a;
    sum = 0;
    forn(i,n){
        cin >> arr[i];
        arr[i] = (a-arr[i]);
    }

    sum = a*n+1;

    dp[0][2500]=1;
    dp[0][arr[0]+2500]+=1;
    forr(i,1,n){
        for(int j = 0; j < 5000; j++){
            if (j-arr[i] < 0 || j-arr[i] >= 5000)
                dp[i][j] = dp[i - 1][j];
            else
                dp[i][j] = ( dp[i-1][j-arr[i]] + dp[i-1][j] );
        }
    }

    ans =dp[n-1][2500]-1;

    /*forr(i,0,n){
        forr(j,2480,2521){
            cout << dp[i][j] << " ";
        }
        cout << "\n";
    }*/

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2432
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = min(b, d) - max(a, c);
    if (ans > 0)
    {
        cout << ans << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng {
    using namespace boost;
    using namespace boost::range;
    using namespace boost::adaptors;
}

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    for (ll i = k; i <= n + 1; i++) {
        ll x = i * n - i * (i - 1) + 1;
        ans = (ans + x) % 1000000007;
        TRACE(i, x, ans);
    }
    cout << ans << nl;
}


Measured memory_bytes: 3652
N=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))

def number(A):
  s=[0]*N
  s[0]=1
  for n in range(1,N):
    s[n]=s[n-1]*(n)
  s[0]=0
  s.reverse()
  t=[i for i in range(N+1)]
  count=0
  for i in range(N):
    count+=s[i]*(t.index(A[i])-1)
    t.pop(t.index(A[i]))
  return count
print(abs(number(q)-number(p)))   

Measured memory_bytes: 3064
#include <iostream>
#include<string.h>
using namespace std;
int main()
{
  int k,i=0,n;
  char str[103],substr[103],s[] = "...";
  cin>>k;
  cin>>str;
   n = strlen(str);
  if(k>=n)
  {
     cout<<str;
  }
  else
  {
    while(str[i]!='\0'&&i<k)
    {
      for(;i<k;i++)
    {
      substr[i] = str[i];
    }
      substr[i] = '\0';
    }
   cout<<strcat(substr,s);
  }
  return 0;
}


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

a = [0] + [int(i) for i in input().split()]
b = [0 for i in range(n+1)] 
ans = []

for i in range(n, 0, -1):
    s = 0
    for j in range(i*2, n+1, i):
        s ^= b[j]
    if s != a[i]:
        b[i] = 1
        ans.append(i)
print(len(ans))
print(' '.join(map(str, ans)))

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

int main()
{
 int a,b,c,d; cin >> a >> b >> c >> d;
 int cnt=0;
 while(1){
   if(cnt%2==0){
     c-=b;
     if(c<=0){
       cout << "Yes" << endl;
       break;
     }
   }
   else{
     a-=d;
     if(a<=0){
       cout << "No" << endl;
       break;
     }
   }
   cnt+=1;
 }
 return 0;
}

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

const int mod = 998244353; // assert mod is prime

template<int M>
struct Mint{
	int x;
	Mint() : x(0){}
	Mint(int y) : x(y >= 0 ? y % M : M - (-y) % M){}
	Mint &operator += (const Mint &rhs){ if((x += rhs.x) >= M) x -= M; return *this; }
	Mint &operator -= (const Mint &rhs){ if((x += M - rhs.x) >= M) x -= M; return *this; }
	Mint &operator *= (const Mint &rhs){ x = 1LL * x*rhs.x % M; return *this; }
	Mint &operator /= (const Mint &rhs){ x = (1LL * x*rhs.inv().x) % M; return *this; }
	Mint operator - () const{ return Mint(-x); }
	Mint operator + (const Mint &rhs) const{ return Mint(*this) += rhs; }
	Mint operator - (const Mint &rhs) const{ return Mint(*this) -= rhs; }
	Mint operator * (const Mint &rhs) const{ return Mint(*this) *= rhs; }
	Mint operator / (const Mint &rhs) const{ return Mint(*this) /= rhs; }
	bool operator < (const Mint &rhs) const{ return x < rhs.x; }
	Mint inv() const{
		signed a = x, b = M, u = 1, v = 0, t;
		while(b){ t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
		return Mint(u);
	}
	Mint pow(long long t) const{
		Mint e = *this, res = 1;
		for(; t; e *= e, t >>= 1) if(t & 1) res *= e;
		return res;
	}
};
template <int M>
ostream &operator << (ostream &os, const Mint<M> &rhs){
	return os << rhs.x;
}
template <int M>
istream &operator >> (istream &is, Mint<M> &rhs){
	long long s; is >> s; rhs = Mint<M>(s); return is;
};

using mint = Mint<mod>;

ll modpow(ll x, ll y, ll m){
	if(y == 0) return 1;
	ll res = modpow(x, y / 2, m);
	return res * res % m * (y & 1 ? x : 1) % m;
}

ll modinv(ll x, ll m){
	return modpow(x, m - 2, m);
}

// nHrのために2n分確保！
struct Comb{
	int sz;
	vector<mint> mfact, mfinv;
	Comb(int N) : sz(min(N, int(mod) - 1)), mfact(sz + 1), mfinv(sz + 1){
		for(int i = 0; i <= sz; i++) mfact[i] = (i == 0 ? 1 : mfact[i - 1] * i);
		mfinv[sz] = mfact[sz].inv();
		for(int i = sz; i >= 1; i--) mfinv[i - 1] = mfinv[i] * i;
	}
	mint fact(int n, int& e){ // e に p の指数が入る
							  // Wilson の定理
		e = 0;
		if(n <= sz) return mfact[n];
		mint res = fact(n / mod, e);
		e += n / mod;
		if(n / mod % 2 != 0) return -res * mfact[n % mod];
		return res * mfact[n % mod];
	}
	mint nPr(int n, int r){
		int e; return fact(n, e) / fact(n - r, e);
	}
	mint nCr(int n, int r){
		// Lucus の定理
		assert(n <= sz);
		if(n >= mod) return nCr(n%mod, r%mod) * nCr(n / mod, r / mod);
		return r > n ? 0 : mfact[n] * mfinv[n - r] * mfinv[r];
	}
	mint nHr(int n, int r){
		return r == 0 ? 1 : nCr(n + r - 1, r);
	}
};

const ll MOD = 998244353;

Comb C(1000000);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	ll N, A, B, K;
	cin >> N >> A >> B >> K;

	mint ans = 0;
	for(int i = 0; i <= N; i++){
		ll rem = K - A * i;
		if(rem < 0 || rem % B) continue;

		mint anum = C.nCr(N, i);
		mint bnum = C.nCr(N, rem / B);
		ans += anum * bnum;
	}

	cout << ans << endl;
}


Measured memory_bytes: 8064
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:usize,
    b:[(String,usize);a],
    m:String,
    }
    let mut x=0;
    let mut z=0;
    for i in 0..a {
        if x==1{
            z+=b[i].1
        }
        if b[i].0==m {x=1;}
    }
    println!("{}",z)
}

Measured memory_bytes: 2144
n = int(input())
A = list(map(int,input().split()))

maxA = max(A)
ans = 0
flag = [0]*(maxA+1)

# print(flag)
for a in A:
    for ax in range(a,maxA+1,a):
        flag[ax] +=1

# print(flag)
for a in set(A):
    if flag[a] == 1:
        ans += 1
print(ans)


Measured memory_bytes: 39252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    int n; cin >> n;
    vel a(n); rep(i,n) cin >> a[i];

    deque<ll> de;

    if(n%2 == 1){
        rep(i,n) {
            if(i%2 == 1) de.pub(a[i]);
            else de.puf(a[i]); 
        }
    }
    else{
        rep(i,n) {
            if(i%2 == 1) de.puf(a[i]);
            else de.pub(a[i]); 
        }
    }

    rep(i,n) {
        if(i != n-1) cout << de[i] << " ";
        else cout << de[i] << endl;
    }
    return 0;

}

Measured memory_bytes: 5376
#include <iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i) 

bool f(int x) {
	int keta=0;
	while (x) {
		keta++;
		x /= 10;
	}
	return keta % 2 == 1;
}

int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 0; i <= N;i++) {
		if (f(i))ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;


int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    char s[h+5][w+5];
    int i;
    for(i=0;i<=h-1;i++)scanf("%s",s[i]);
    int j;
    for(i=0;i<=h-1;i++){
        for(j=0;j<=w-1;j++){
            if(s[i][j]=='.'){
                int n=0;
                if(s[i-1][j-1]=='#')n++;
                if(s[i-1][j]=='#')n++;
                if(s[i-1][j+1]=='#')n++;
                if(s[i][j-1]=='#')n++;
                if(s[i][j+1]=='#')n++;
                if(s[i+1][j-1]=='#')n++;
                if(s[i+1][j]=='#')n++;
                if(s[i+1][j+1]=='#')n++;
                printf("%d",n);
            }
            else printf("#");
        }
        printf("\n");
    }
    
    return 0;
}

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

int main(){

  int a;
  int b;
  int c;

  cin >> a;
  cin >> b;
  cin >> c;

  if(a < b && b < c){

    cout << "Yes" << endl;

  }else{

    cout << "No" << endl;

  }

  return 0;

}



Measured memory_bytes: 3080
import copy
alpha=list("abcdefghijklmnopqrstuvwxyz")
alpha_dict={a:i for i,a in enumerate(alpha)}
alpha = set(alpha)

string = input()

can_use_str = alpha - set(list(string))

if string == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)

elif len(can_use_str)==0:
    k = 0
    for i in reversed(range(25)):
        if string[i] < string[i + 1]:
            k = i
            break
    last = sorted(string[k:])
    for i in last:
        if string[k] < i:
            print(string[:k] + i)
            break

else:
    string+=sorted(list(can_use_str))[0]
    print(string)

Measured memory_bytes: 3444
/*==============================================*\
ID:          shahidul_brur

Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh

 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = 3002;
const int LOGN = 20;
int dp[maxn][maxn];

void LCS(string X, string Y)
{
    int m = X.length(), n = Y.length();
    
    for (int i=0; i<=m; i++)
    {
        for (int j=0; j<=n; j++)
        {
            if (i == 0 || j == 0) 
                dp[i][j] = 0;
            else if(X[i-1] == Y[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else  
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
}
string ans, s, t;
int n, m;
void buildSub(int i, int j)
{
    if(i==0 || j==0) return;
    if(s[i-1]==t[j-1]){
        ans+=s[i-1];
        buildSub(i-1, j-1);
    }
    else if(dp[i-1][j]>dp[i][j-1]){
        //ans+=s[i-1];
        buildSub(i-1, j);
    }
    else
    {
        //ans+=t[j-1];
        buildSub(i, j-1);
    }
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin>>s>>t;
    n = s.size();
    m = t.size();
    LCS(s,t);
    buildSub(n,m);
    reverse(all(ans));
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

void max_div(ll n);
bool isPrime(ll n);
ll ans, N;

int main(){
    ll p; cin >> N >> p;
    ans = 1;
    if(N == 1){cout << p << endl; return 0;}
    if(isPrime(p)){
        cout << 1 << endl; return 0;
    }
    max_div(p);
    cout << ans << endl;
    return 0;
}

void max_div(ll n){
    int i = 2;
    ll c = 0;
    while(n > 1){
        if(n%i == 0){
            c++; n/=i;
        }else{
            if(c/N >= 1) ans *= pow(i, c/N);
            if(c > 0){
                if(isPrime(n)){ c = 0; break;}
            }
            i++;
            c = 0;
        }
    }
    if(c/N >= 1) ans *= pow(i, c/N);
}

bool isPrime(ll n){
    if(n < 2) return false;
    if(n == 2) return true;
    if(n%2 == 0) return false;
    for(int i = 3; i <= sqrt(n); i+=2){
        if(n%i == 0) return false;
    }
    return true;   
}

Measured memory_bytes: 256