akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define all(a) a.begin(),a.end()
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18
# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

int main(){
    IOS;
    make(ll,k);
    make(string,s);
    if(s.size()<=k) cout<<s<<endl;
    else cout<<s.substr(0,k)<<"..."<<endl;


    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
 
const int inf=1<<16;
 
int mov[1<<16][110];
 
int n,m,k;
int d[20];
int v[110][110];
 
int dp[1<<16];
 
 
inline void calc(int p){
	int vec[18],vec2[18];
	int mat[18][18];
	rep(i,m+1) vec[i]=0;
	rep(i,m+1)rep(j,m+1) mat[i][j]=0;	
	rep(i,m){
		int to=v[d[i]][p];
		int in=m;
		rep(j,m) if(to==d[j]) in=j;
		mat[i][in]=1;
	}
	rep(i,m) vec[i]=1<<i,vec2[i]=0;
	rep(i,m) rep(j,m) if(mat[i][j]) vec2[i]|=vec[j];
	rep(mask,1<<m)rep(i,m) if(mask&vec2[i]) mov[mask][p]|=(1<<i);
	return ;
}
 
typedef pair<int,int> pii;
 
int main(void){
	cin >> n >> m >> k;
	rep(i,m) cin >> d[i],d[i]--;
	rep(i,n)rep(j,k) cin >> v[i][j],v[i][j]--;
	
	rep(i,k) calc(i);	
 
	rep(i,1<<m) dp[i]=inf;
	dp[(1<<m)-1]=0;
	queue<pii> q;
	q.push(make_pair(0,(1<<m)-1));	
	while(!q.empty()){
		pii cur=q.front();q.pop();
		// cerr  << cur.first << " " << cur.second << endl;
		rep(i,k) if(dp[mov[cur.second][i]]>cur.first+1){
			dp[mov[cur.second][i]]=cur.first+1;
			q.push(make_pair(cur.first+1,mov[cur.second][i]));
		}
	}
	//rep(mask,1<<m)rep(i,k) cerr << mov[mask][i] << endl;
	//rep(i,1<<m) cerr << dp[i] << endl;
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 31724
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        while (true) {
            int a = in.nextInt();
            String op = in.next();
            int b = in.nextInt();
            final int ans;
            if (op.equals("+")) {
                ans = a + b;
            } else if (op.equals("-")) {
                ans = a - b;
            } else if (op.equals("*")) {
                ans = a * b;
            } else if (op.equals("/")) {
                ans = a / b;
            } else {
                break;
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 26172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var X = int.Parse(input[0]);
        var N = int.Parse(input[1]);

        if(N == 0)
        {
            Console.WriteLine(X);
            return;
        }

        var p = new List<int>();
        var line = Console.ReadLine().Split(" ");
        for (int i = 0; i < N; i++)
        {
            p.Add(int.Parse(line[i]));
        };

        var list = new List<int>();
        for (int i = -1; i <= 101; i++)
        {
            list.Add(i);
        }

        foreach (var item in p)
        {
            list.Remove(item);
        }

        var count = list.Count;
        var minValue = int.MaxValue;
        var minIndex = 0;
        for (int i = 0; i < count; i++)
        {
            if (minValue > Math.Abs(list[i] - X))
            {
                minValue = Math.Abs(list[i] - X);
                minIndex = i;
            }

        }
        Console.WriteLine(list[minIndex]);
    }
}


Measured memory_bytes: 27884
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  ll n;
  cin >> n;
  if(n%2 != 0){
    cout << 0 << endl;
    return 0;
  }
  ll k = n/2;
  ll ans = 0;
  ll ff = 5;
  while(ff <= k){
    ans += k/ff;
    ff *= 5;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
h, w = map(int, input().split())
graph = []
for i in range(h):
    a = list(map(int, sys.stdin.readline().split()))
    graph.append(a)
for i in range(h):
    b = list(map(int, sys.stdin.readline().split()))
    for j in range(w):
        graph[i][j] = abs(graph[i][j] - b[j])
result = [[0]*w for _ in range(h)]
result[0][0] = 1 << graph[0][0]
def ts(a, b):
    result = 0
    for i in range(b+1):
        if (a >> i) & 1 > 0:
            result |= (1 << b) >> i
    return result
 
for i in range(1, h+w-1):
    for j in range(max(0, i-(w-1)), min(i+1, h)):
        ps = 0
        nt = graph[j][i-j]
        if j > 0:
            k= result[j-1][i-j]
            result[j][i-j] |= k << nt | k >> nt | ts(k, nt)
        if i-j > 0:
            k= result[j][i-j-1]
            result[j][i-j] |= k << nt | k >> nt | ts(k, nt)
ans = result[h-1][w-1]
ans = (-ans&ans).bit_length() - 1
print(ans)

Measured memory_bytes: 51548
// ABC047
// A - キャンディーと2人の子供 / Fighting over Candies
#include<bits/stdc++.h>

using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b==c || a+c==b || b+c==a) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
l = input()
mod = 10**9+7
n = len(l)
dp = [[0]*2 for _ in range(n+1)]
dp[0][0] = 1
for i in range(n):
    
    # a+b==0 (両方に0)
    if l[i]=='0':
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1]
    else:
        dp[i+1][1] = (dp[i][0]+dp[i][1]) % mod
    
    # a+b==1 (片方に0,片方に1)
    if l[i]=='0':
        dp[i+1][1] += dp[i][1]*2
        dp[i+1][1] %= mod
    else:
        dp[i+1][0] += dp[i][0]*2
        dp[i+1][1] += dp[i][1]*2
        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

ans = (dp[n][0]+dp[n][1])%mod
print(ans) 

Measured memory_bytes: 54236
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> vec;
    for (int i = 0; i < N; ++i)
    {
        int a;
        cin >> a;
        a -= i;
        vec.push_back(a);
    }
    sort(vec.begin(), vec.end());
    int m = vec[N / 2];
    long long d = 0;
    for (int i = 0; i < N; ++i) { d += abs(vec[i] - m); }
    cout << d << endl;

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string S;
	cin >> S;
	vector<int> A(2 * N + 1);
	vector<int> X(2 * N);
	S.insert(S.begin(), 'W');
	S.push_back('W');
	for (int i = 0; i < 2 * N + 1; i++) {
		if (S[i] == S[i + 1]) {
			A[i] = 0;
		}
		else {
			A[i] = 1;
		}
	//	cerr << A[i] << endl;
	}
	//cerr << endl;

	for (int i = 0; i < 2 * N; i++) {
		if (A[i] == 1) {
			X[i] = 1;
		}
		else {
			A[i + 1] ^= 1;
			X[i] = -1;
		}
		//cerr << X[i] << endl;
	}
	int res = 0;
	if (A.back() == 1) {
		res = 0;
	}
	else {
		int cnt = 0;
		res = 1;
		for (int i = 0; i < 2 * N; i++) {
			if (X[i] == 1) {
				cnt++;
			}
			else {
				res = (res * cnt) % MOD;
				cnt--;
			}
		}
		for (int i = 1; i <= N; i++) {
			res = (res * i) % MOD;
		}
		if (cnt != 0)res = 0;
	}
	
	cout << res << endl;
}

Measured memory_bytes: 3732
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    double r;
    cin >> r;
    printf("%.10f\n", r * 2 * M_PI);
}

Measured memory_bytes: 3804
from collections import Counter
from math import factorial
N = int(input())
S = []
for i in range(N):
    tmp = input()
    tmp = sorted(list(tmp))
    S.append("".join(tmp))

cnt = Counter(S)
ans = 0
for i in cnt:
    if cnt[i] > 1:
        ans += factorial(cnt[i]) // (factorial(cnt[i] - 2) * factorial(2))

print(ans)

Measured memory_bytes: 19760
#include <stdio.h>
int isPrime(int);
int main(){
  int n,x,i;
  int cnt = 0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isPrime(x))
      cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}
int isPrime(int x){
  int i=3;
  if(x==2)
    return 1;
  else if(x < 2 || x%2==0)
    return 0;
  while(i*i<=x){
    if(x%i == 0){
      return 0;
    }
    i=i+2;
  }
  return 1;
}



Measured memory_bytes: 2140
#include<cstdio>

#define gec     getchar
#define FILE(F) freopen(F".in","r",stdin),freopen(F".out","w",stdout)

typedef long long ll;
template<typename T>
inline void read(T &x)
{
	x=0;bool f=0; char c=gec();
	for(;c<'0'||c>'9';c=gec())f=(c=='-');
	for(;c>='0'&&c<='9';c=gec())x=x*10+c-'0';
	x=f?-x:x;
}
namespace IO
{
inline void fpr(char *c){fprintf(stderr,"%s\n",c);}
inline void fpr(int           x,char *c){fprintf(stderr,"[ %s ] : = %d   \n",c,x);}
inline void fpr(ll            x,char *c){fprintf(stderr,"[ %s ] : = %lld \n",c,x);}
inline void fpr(double        x,char *c){fprintf(stderr,"[ %s ] : = %.5lf\n",c,x);}
inline void fpr(long double   x,char *c){fprintf(stderr,"[ %s ] : = %.5Lf\n",c,x);} 
}using namespace IO;

const int N(51);
int n,P,a[N];
ll F[2],G[2];
int main()
{
	read(n);read(P);
	for(int i=1;i<=n;i++)read(a[i]);
	F[0]=1;
	for(int i=1;i<=n;i++)
	{
		G[0]=G[1]=0;
		if(a[i]&1)G[0]=F[1]+F[0],G[1]=F[1]+F[0];
		else      G[0]=F[0]+F[0],G[1]=F[1]+F[1];
		F[0]=G[0];	F[1]=G[1];
	}
	printf("%lld\n",F[P]);
	return 0;
}	

Measured memory_bytes: 128
import math
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=sum(b)-sum(a)
d=0
for i in range(n):
 if a[i]>b[i]:d+=a[i]-b[i]
 elif a[i]%2!=b[i]%2:d+=1
print("No"if c<d else"Yes")

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  long long int a[n];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int flag = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        a[i] /= 2;
        flag = 1;
      } else if (a[i] % 2 == 1) {
        flag = 0;
        cout << ans << endl;
        return 0;
      }
    }
    if (flag == 1) {
      ans++;
    }
  }

  return 0;
}


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

using namespace std;
using ll = long long;
#define M ll(1e9+7)

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	ll n, x; cin >> n;
	unordered_map<ll,int> f;
	for (int i = 0; i < n; i++) {
		cin >> x;
		f[x]++;
	}
	bool flag = true;
	for (ll i = n-1; i > 0; i -= 2) {
		if (f[i] != 2) flag = false;
	}
	if (n&1) {
		flag &= (f[0] == 1);
	}
	if (!flag) {
		cout << "0\n";
	} else {
		ll ans = 1;
		for (int i = 0; i < n/2; i++) {
			ans = (ans * 2) % M;
		}
		cout << ans << "\n";
	}
	return 0;
}

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

const int MAXN = 1e5+10;
struct node
{
    int t,x,y;
}ns[MAXN];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; ++i)
        scanf("%d %d %d",&ns[i].t,&ns[i].x,&ns[i].y);

    int st = 0,sx = 0,sy = 0,dt,dx,dy;
    for(int i = 0; i < n; ++i)
    {
        dt = ns[i].t - st;
        dx = abs(ns[i].x - sx);
        dy = abs(ns[i].y - sy);
        if(dt < dx+dy)
        {
            puts("No");
            return 0;
        }
        dt = dt - dx - dy;
        if(dt&1)
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 1408
x = int(input())
x_3zyoukon=x**(1/3)
x_5zyoukon=x**(1/5)

for a in range(int(x_3zyoukon+1)):
    for b in range(a):
        if a**5-b**5==x:
            print(str(a)+" "+str(b))
            exit()

for a in range(int(x_5zyoukon+1)):
    for b in range(-1,(-1)*int(x_5zyoukon+1),-1):
        if a**5-b**5==x:
            print(str(a)+" "+str(b))
            exit()

Measured memory_bytes: 66044
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
N = int(input())
S = list(map(str, input().split()))

for i in range(N) :
  if S[i] == "Y" :
    print ("Four")
    exit()

print ("Three")



Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N,M; cin >> N >> M;
	VV<int> G(N);
	rep(i,M){
		int x,y; cin >> x >> y;x--,y--;
		G[x].pb(y);
	}
	V<double> to(N);
	to[0] = 1;
	rep(i,N){
		for(int j: G[i]) to[j] += to[i]/G[i].size();
	}
	V<double> E(N);
	for(int i=N-2;i>=0;i--){
		for(int j: G[i]) E[i] += E[j]/G[i].size();
		E[i]++;
	}
	show(to);
	show(E);
	double res = E[0];
	rep(v,N) for(int u: G[v]){
		if(G[v].size() == 1) continue;
		double EE = 0;
		for(int j: G[v]) if(u != j) EE += E[j];
		EE /= G[v].size()-1;
		EE++;
		EE = E[0] + to[v]*(EE-E[v]);
		chmin(res,EE);
	}
	cout << res << endl;
}


Measured memory_bytes: 1408
N = int(input())
A = []
XY = []
honest_count = []

for i in range(N):
    a = int(input())
    A.append(a)
    inter = []
    for x in range(a):
        xy = list(map(int,input().split()))
        inter.append(xy)
    XY.append(inter)
    #print(XY)

for i in range(2**N):
    pt = [0]*N
    ck = 1
    for j in range(N):
        if (i>>j)&1:
            pt[N-j-1]=1
    for k in range(N):
        if pt[k] ==1:
            for l in range(A[k]):
                if XY[k][l][1] != pt[XY[k][l][0] -1]: # 正直者と仮定した人の証言に矛盾がないかをチェック。正しいと向けられた人の証言が自分に返ってこないか。
                    ck = 0
    if ck == 1:
        honest_count.append(sum(pt))
print(max(honest_count))


Measured memory_bytes: 3480
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

        signed main() {
    cout<<fixed<<setprecision(15);
    int n,r;
    cin>>n>>r;
    cout<<r+100*max(0ll,10ll-n);
   

    
      }

        


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)

int main() {
	double A;//時針
	double B;//分針
	double H;//時
	double M;//分
	cin >> A >> B >> H >> M;
	double angle =2*M_PI*( (M/720)+(H / 12) - (M / 60));
	double c = cos(angle);
	double C = A * A + B * B - 2 * A * B * c;
	double ans = sqrt(C);
	cout <<fixed<<setprecision(15)<<ans;
	return 0;
}

Measured memory_bytes: 4192
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+2;
const int mod=1e9+7;
int dp[N],c[N][N],ar[N],ndp[N];
void add(int &x,int y){
	x+=y;
	if(x>=mod){
		x-=mod;
	}
}
int mul(int x,int y){
	return (1ll*x*y)%mod;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,num;
	cin>>n>>num;
	for(i=1;i<=num;i++){
		cin>>ar[i];
	}
	c[0][0]=dp[0]=1;
	for(i=1;i<=n;i++){
		for(j=0;j<=i;j++){
			c[j][i]=c[j][i-1];
			if(j){
				add(c[j][i],c[j-1][i-1]);
			}
		}
	}
	for(i=1;i<=num;i++){
		for(k=n;k>-1;k--){
			for(l=min(ar[i],n-k);l>-1;l--){
				add(ndp[k+l],mul(mul(dp[k],c[l][n-k]),c[ar[i]-l][n-l]));
			}
		}
		for(j=0;j<=n;j++){
			dp[j]=ndp[j];
			ndp[j]=0;
		}
	}
	cout<<dp[n];
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n,u,r;
    cin >> n >> u >> r;
    u--;r--;
    Graph G(n);
    rep(i,n-1){
        int a,b;
        cin >> a >> b;a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> q;
    vi taka(n,-1);
    taka[u] = 0;
    q.push(u);
    while(q.size()){
        int v = q.front();
        q.pop();

        for(auto t : G[v]){
            if(taka[t]!=-1) continue;
            taka[t] = taka[v] + 1;
            q.push(t);
        }
    }
    q.push(r);
    vi aoki(n,-1);
    aoki[r] = 0;
    while(q.size()){
        int v = q.front();
        q.pop();

        for(auto t : G[v]){
            if(aoki[t]!=-1) continue;
            aoki[t] = aoki[v] + 1;
            q.push(t);
        }
    }
    int ans = -INF;
    rep(i,n) if(taka[i]<aoki[i] && ans<aoki[i]){
        //cout << i << endl;
        ans = aoki[i];
    }
    //rep(i,n) cout << i << " " << taka[i] << " " << aoki[i] << endl;
    cout << ans-1 << endl;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(1e5)+10;
int n,to[maxn],vis[maxn],in[maxn];
char s[maxn];
int cnt,ans[maxn];
vector<int> q1;
queue<int> q,q2;
vector<int> g[maxn];
struct node {
	int x,y,op,dis;
} b[maxn];
ll ksm(ll x,int y,int mod) {
	ll res=1;
	while (y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod; y>>=1;
	} return res;
}
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%s",s+1); n=strlen(s+1);
	for (int i=1;i<=n;i++)
		if (s[i]=='R') to[i]=i+1,in[i+1]++;
		else to[i]=i-1,in[i-1]++;
	for (int i=1;i<=n;i++)
		if (!in[i]) q.push(i);
	while (!q.empty()) {
		int u=q.front(); q.pop();
		int v=to[u]; q1.push_back(u);
		//printf(" %d\n",u);
		in[v]--;
		if (!in[v]) q.push(v);
	}
	for (int i=1;i<=n;i++)
		if (in[i]) q2.push(i),b[i].op=1;
		else b[i].op=0;
	while (!q2.empty()) {
		int u=q2.front(); q2.pop();
		if (vis[u]) continue;
		cnt++; int v=u;
		//printf("%d %d\n",u,cnt);
		while (1) {
			v=to[v]; vis[v]=1;
			//printf("%d\n",v);
			g[cnt].push_back(v);
			b[v].x=cnt; b[v].y=g[cnt].size()-1;
			if (v==u) break;
		}
	}
	reverse(q1.begin(),q1.end());
	for (int i=0;i<q1.size();i++) {
		int u=q1[i];
		int v=to[u];
		b[u].x=b[v].x,b[u].y=b[v].y;
		b[u].dis=b[v].dis+1;
	}
	for (int i=1;i<=n;i++) {
		int x=b[i].x,y=b[i].y,sz=g[x].size();
		int z=ksm(10,100,sz);
		y=y+z-b[i].dis; y%=sz;
		if (y<0) y+=sz; if (y>=sz) y-=sz;
		ans[g[x][y]]++;
		//printf("%d %d\n",i,g[x][y]);
	}
	for (int i=1;i<=n;i++) printf("%d ",ans[i]);
	printf("\n");
	return 0;
}

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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;

ll ans;
//ここから書き始める
int main()
{
	cout << setprecision(10);
	ll n; cin >> n;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];

	vector<ll> left(n+1,0), right(n+1,0);
	left[1]=v[0];	
	rep(i,n){
		left[i+1] = __gcd(left[i],v[i]);
	}
	right[n-2]=v[n-1];
	rep(i,n-2){
		right[n-3-i] = __gcd(right[n-2-i] ,v[n-2-i]);
	}

//	for(auto x : left){
//		cout << x << " ";
//	}
//	cout << endl;
//	for(auto x : right){
//		cout << x << " ";
//	}
//	cout << endl;

	ll ans = 1 ;
	rep(i,n){
		ans = max(ans,__gcd(left[i],right[i]));
	}
	cout << ans << endl;
	}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
long n,a,b,h[100000],i,ng=-1,m,ok=1e10,c;
int main(){
  for(cin>>n>>a>>b,a-=b;i<n;)cin>>h[i++];
  while(abs(ok-ng)>1){
    m=(ok+ng)/2;
    for(c=i=0;i<n;i++)if(h[i]>m*b)c+=(h[i]-m*b+a-1)/a;
    if(c<=m)ok=m;
    else ng=m;
  }
  cout<<ok<<endl;
}


Measured memory_bytes: 1024
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    char[] a=sc.next().toCharArray();
    char[] b=sc.next().toCharArray();

    StringBuilder ans=new StringBuilder();
    for(int i=0;i<b.length;i++) {
      ans.append(a[i]);
      ans.append(b[i]);

    }
    if(a.length!=b.length) {
      ans.append(a[a.length-1]);
    }
    System.out.println(ans.toString());
  }
}

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

int main() {
  
  string S;
  cin >> S;
  
  int hantei = 1;
  
  for ( int i = 0; i < S.size(); i ++){
    if ( ( i % 2 == 0 ) && ( S.at(i) == 'L' ) ){
      hantei = 0;
    }else if ( ( i % 2 == 1 ) && ( S.at(i) == 'R' ) ){
      hantei = 0;
    }
  }
  
  if ( hantei ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long int 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define from(i,n)       for(int i=0;i<(int)n;i++)
#define from_j(i,j,n)   for(int i=j;i<(int)n;i++)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 
int32_t main()
{
    c_p_c();
    int x; cin>>x;
    int flag=0;
    int a,b;
    for(int i=-1000;i<1001;i++){
        for(int j=-1000;j<1001;j++){
            int temp1=i*i*i*i*i;
            int temp2=j*j*j*j*j;
            int ans = temp1-temp2;
            if(ans==x){
                a=i;
                b=j;
                flag=1;
                break;
            }
        }
        if(flag)break;
    }
    cout<<a<<" "<<b; 
    return 0;
}

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

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

    bool flag = true;
    for(int i=0; i<N; i++){
        if(A[i]%2 == 0){
            if(A[i]%3 != 0 && A[i]%5 != 0){
                flag = false;
                break;
            }
        }
    }

    if(flag){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(a) cout << #a ": " << a << endl
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const int dx[] = {0,1,0,-1};//RDLU
const int dy[] = {1,0,-1,0};
const int inf = 0x3f3f3f3f;
int h, w, k;
struct node{
	int x, y, step;
	node(int x=0, int y=0, int step=0):x(x),y(y),step(step){}
	bool operator<(const node& rh)const{
		return step > rh.step;
	}
}s, t;
int bfs(vector<vector<char> >& mp, vector<vector<int> >& dis){
	priority_queue<node> q;
	dis[s.x][s.y] = 0;
	q.push(node(s.x, s.y, 0));
	while (!q.empty()){
		node u = q.top(); q.pop();
		//printf("%d %d %d\n", u.x, u.y, u.step);
		if (u.x == t.x && u.y == t.y) return dis[u.x][u.y];
		for (int i = 0; i < 4; ++i){
			for (int j = 1; j <= k; ++j){
				int tx = u.x+dx[i]*j;
				int ty = u.y+dy[i]*j;
				if (tx < 0 || tx >= h || ty < 0 || ty >= w || mp[tx][ty] == '@') break;
				if (dis[tx][ty] <= dis[u.x][u.y]) break;
				if (dis[tx][ty] > dis[u.x][u.y]+1){
					dis[tx][ty] = dis[u.x][u.y]+1;
					q.push(node(tx, ty, dis[tx][ty]));
				}
			}
		}
	}
	return -1;
}
int main(void){
    IOS;
  	cin >> h >> w >> k;
  	cin >> s.x >> s.y >> t.x >> t.y;
  	s.x--, s.y--, t.x--, t.y--;
  	vector<vector<char> > mp(h, vector<char>(w, '.'));
  	vector<vector<int> > dis(h, vector<int>(w, inf));
  	for (int i = 0; i < h; ++i){
  		for (int j = 0; j < w; ++j){
  			cin >> mp[i][j];
  		}
  	}
  	cout << bfs(mp, dis) << endl;
    return 0;
}


Measured memory_bytes: 11992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void xin(){
	#ifndef ONLINE_JUDGE 
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}
int f[100005];


int main()
{
  	xin();
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    
    int l,r,d;
    cin>>l>>r>>d;
    int a = r/d;
    int b = l/d;
    if(l%d == 0)
    {
    	b--;
    }
 	cout<<a-b<<endl;
 
 }

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


int main() {
  int N, M; cin >> N >> M;
  vi A(N); REP(i, N) cin >> A[i];
  vector<pii> pairs;
  REP(i, M) {
    int b, c;
    cin >> b >> c;
    pairs.emplace_back(b, c);
  }
  sort(A.begin(), A.end());
  sort(pairs.begin(), pairs.end(), [](pii a, pii b){ return a.second > b.second; });

  bool done = false;
  int i = 0;
  for (auto& pair: pairs) {
    int b, c;
    tie(b, c) = pair;
    REP(k, b) {
      if (i < N and c >= A[i]) {
        A[i] = c;
        i++;
      } else {
        done = true;
        break;
      }
    }
    if(done) break;
  }

  ll ans = accumulate(A.begin(), A.end(), 0LL);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  vector a(3,0);
  for(auto &i:a)cin>>i;
  sort(a.begin(),a.end());
  cout<<a.at(2)-a.at(0)<<endl;
  
  
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

int main() {

	int h, w;
	cin >> h >> w;

	vector<vector<char>> a(h);

	for (int i = 0; i < h; ++i)a[i].resize(w);

	for (int i = 0; i < h; ++i){
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	vector<vector<bool>> b(h);

	for (int i = 0; i < h; ++i)b[i].resize(w);

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; j++) {
			b[i][j]=false;
		}
	}

	for (int i = 0; i < h; ++i) {

		bool ok = true;

		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#')ok = false;
		}

		if (ok ==true) {
			for (int k = 0; k < w; k++) {
				b[i][k] = true;
			}
		}
	}

	for (int j = 0; j < w; ++j) {

		bool ok = true;

		for (int i = 0; i < h; i++) {
			if (a[i][j] == '#')ok = false;
		}

		if (ok == true) {
			for (int k = 0; k < h; k++) {
				b[k][j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		bool isNeedBR = false;
		for (int j = 0; j < w; j++) {
			if (b[i][j] == false) {
				cout << a[i][j];
				isNeedBR = true;
			}
		}
		if (isNeedBR) {
			cout << endl;
		}
		
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long n,i,r,j,k;
long a[101];
int main() {
    cin >> n;
    for(i = 0; i < n; i++) cin >> a[i];
    r = 0;
    for(i = 0; i < n; i++) {
        for(j = i+1; j < n; j++) {
            if(a[i] == a[j]) continue;
            for(k = j+1; k < n; k++) {
                if(a[i] == a[k]) continue;
                if(a[j] == a[k]) continue;
                if(a[i]+a[j] > a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]) r++;
            }
        }
    }
    cout << r;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
int main() {

	int N{}, t{};
	std::cin >> N >> t;
	auto cmin = 1001;
	for (int i{}; i < N; i++) {
		int ci{}, ti{};
		std::cin >> ci >> ti;
		if (ti <= t) 
			cmin = std::min(ci, cmin);
	}
	std::cout << ( cmin==1001?"TLE":std::to_string(cmin) ) << "\n";

	//std::cout << (N == 1 ? "Hello World" : std::to_string(a + b)) << "\n";
	return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)

#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	// ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}

const int maxn=2e5+100;
int head[maxn],lazy[maxn],v[maxn];
int size=0;
int n,q;

struct Edge
{
	int to;
	int next;
}e[maxn<<1];

inline void addedge(int u, int v)
{
	e[++size].to = v;
	e[size].next = head[u];
	head[u] = size;
}

void dfs(int u, int p)
{
	v[u] += lazy[u];
	for (int i = head[u]; i; i = e[i].next)
	{
		int to=e[i].to;
		if(to==p)continue;
		v[to]+=v[u];
		dfs(to,u);
	}
}

int main()
{
	int N, Q;

	cin >> N >> Q;

	rep(i, N-1)
	{
		int a, b;
		cin >> a >> b;
		addedge(a, b);
		addedge(b, a);
	}
	
	//cout << "test 1" << endl;

	rep(i, Q)
	{
		int p, x;
		cin >> p >> x;
		lazy[p] += x;
	}

	//cout << "test 2" << endl;

	dfs(1, 0);
	
	///cout << "test 3" << endl;

	rep(i, N)
	{
		cout << v[i+1] << " ";
	}
	

	return 0;
}


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

using namespace std;

int main(){
    int d;
    scanf("%d", &d);

    if(d <= 25){
        printf("Christmas");
    }

    if(d <= 24)
        printf(" Eve");

    if(d <= 23)
        printf(" Eve");

    if(d <= 22)
        printf(" Eve");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,k,ans=0;
typedef pair<int,int> P;
vector<P> v;
int rec(int x,int y,int z){//x=imo;y=men;z=mensuu
  int res=0,i,j;
  if(z==k) return m-x;
  for(i=y;i<n;i++){
    j=min(v[i].second,m-x);
    res=max(res,v[i].first*j+rec(x+j,i+1,z+1));
  }
  return res;
}
int main(){
  int i,j;
  cin>>n>>m>>k;
  v.resize(n);
  for(i=0;i<n;i++) cin>>v[i].first;
  for(i=0;i<n;i++) cin>>v[i].second;
  sort(v.begin(),v.end(),greater<P>());
  cout << rec(0,0,0) << endl;
  return 0;
}



Measured memory_bytes: 3100
N = int(input())
ratio = list(map(int, input().split()))

color = [0] * 8
supercoder = 0
ctn = 0

for i in range(N):
    if ratio[i] <= 399:
        color[0] += 1
    elif ratio[i] <= 799:
        color[1] += 1
    elif ratio[i] <= 1199:
        color[2] += 1
    elif ratio[i] <= 1599:
        color[3] += 1
    elif ratio[i] <= 1999:
        color[4] += 1
    elif ratio[i] <= 2399:
        color[5] += 1
    elif ratio[i] <= 2799:
        color[6] += 1
    elif ratio[i] <= 3199:
        color[7] += 1
    else:
        supercoder += 1

for i in range(8):
    if color[i] > 0:
        ctn += 1

if ctn == 0 and supercoder > 0:
    print(1,supercoder)

else:
    print (ctn,ctn + supercoder)


Measured memory_bytes: 3064
n, m = [int(_) for _ in input().split()]
b = [[int(_) for _ in input().split()] for __ in range(m)]
p = [int(_) for _ in input().split()]
ans = 0
for i in range(2**n):
    s = format(i, '0'+str(n)+'b')
    for j in range(m):
        on = 0
        for k in range(b[j][0]) : on += int(s[b[j][k+1]-1])
        on %= 2
        if p[j] != on : break
    else : ans += 1
print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

int main(){
long int N,K;
long int i=1,j,k,ans=0;

scanf("%ld %ld",&N,&K);

while(i<=N){
ans++;
i+=2;
}
if(ans>=K)
puts("YES");
else
puts("NO");

return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                \
    cerr << #v << ": ";             \
    REP(__i, (v).size())            \
        cerr << ((v)[__i]) << ", "; \
    cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main()
{
    int thermal;
    cin >> thermal;
    if (thermal >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3508
data = sorted([int(i) for i in input().split()])
print((data[2] * 2 - data[0] - data[1])//2) if data[0] % 2 == data[1] % 2 else print(((data[2] + 1) * 2 - data[0] - data[1] - 1)//2 + 1)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
using namespace std;
#define MAXN 1e5+1

int Q,l,r;
vector<bool> isP(MAXN,true);
vector<int> cnt(MAXN,0);
int main(){
  cin>>Q;
  isP[0]=isP[1]=false;
  for(int i=2;i*i<=1e5;i++)if(isP[i]){
    for(int j=i*2;j<=1e5;j+=i){
      isP[j]=false;
    }
  }
  for(int i=3;i<=1e5;i+=2){
    cnt[i]=cnt[i-2];
    if(isP[i]&&isP[(i+1)/2]) cnt[i]++;
  }
  for(int i=0;i<Q;i++){
    cin>>l>>r;
    if(l==1) cout<<cnt[r]<<endl;
    else cout<<cnt[r]-cnt[l-2]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1024
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> train = new LinkedList<>();
        while(sc.hasNext()){
            String str = sc.next();
            switch(str){
                case "0":
                    System.out.println(train.getLast());
                    train.removeLast();
                    break;
                default:
                    train.add(str);
                    break;
            }
        }
    }
}

Measured memory_bytes: 26172
package main

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

func main() {
	var sc = bufio.NewScanner(os.Stdin)	
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	
	if N < 1000 {
		fmt.Println("ABC")
	} else {
		fmt.Println("ABD")
	}
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
typedef long long int ll;
int main()
{
    ll k;
    cin>>k;
    ll t=0;
    ll n=0;
    while(t<1e7)
    {
        n=(n*10+7)%k;
        t++;
        if(n==0)
        {
            cout<<t<<endl;
            return 0;
        }


    }
    cout<<"-1"<<endl;
    return 0;
}

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

using namespace std;

using int64 = long long;

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

vector<vector<Edge>> ReadUndirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge(v1, v2));
    graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

struct FlowEdge {
  const int from, to;
  const int64 cap;  // Capacity
  FlowEdge(int from, int to, int64 cap) : from(from), to(to), cap(cap) {}
};

int64 MaxFlow(int n, const vector<FlowEdge>& edges, int s, int t) {
  int m = edges.size();
  
  vector<vector<tuple<FlowEdge, int>>> graph(n);
  vector<int64> res_caps(2 * m);  // Edge ID to residual capacity
  vector<int> to_reverse(2 * m, -1);  // Edge ID to the reverse edge ID
  for (int i = 0; i < m; i++) {
    const auto& edge = edges[i];
    graph[edge.from].push_back(make_tuple(edge, i));
    graph[edge.to].push_back(
        make_tuple(FlowEdge(edge.to, edge.from, 0), m + i));
    res_caps[i] = edge.cap;
    to_reverse[i] = m + i;
    to_reverse[m + i] = i;
  }

  int64 total = 0;
  while (true) {
    queue<int> q;
    vector<int> prevs(n, -1);
    vector<int> used_edges(n, -1);
    q.push(s);
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (const auto& edge_tuple : graph[v]) {
        FlowEdge edge = get<0>(edge_tuple);
        int edge_id = get<1>(edge_tuple);
        if (res_caps[edge_id] == 0 || prevs[edge.to] >= 0) continue;
        prevs[edge.to] = v;
        used_edges[edge.to] = edge_id;
        q.push(edge.to);
      }
    }

    if (prevs[t] == -1) return total;

    int cur = t;
    vector<int> path;
    while (cur != s) {
      path.push_back(used_edges[cur]);
      cur = prevs[cur];
    }

    int64 inc = INT64_MAX;
    for (int edge_id : path) {
      inc = min(inc, res_caps[edge_id]);
    }

    total += inc;

    for (int edge_id : path) {
      res_caps[edge_id] -= inc;
      res_caps[to_reverse[edge_id]] += inc;
    }
  }
}

bool Solve() {
  int n, m;
  cin >> n >> m;
  auto graph = ReadUndirectedGraph(n, m, true);

  for (int i = 0; i < n; i++) {
    if (graph[i].size() % 2 == 1) return false;
  }

  for (int i = 0; i < n; i++) {
    if (graph[i].size() >= 6) return true;
  }

  int d4_count = 0;
  for (int i = 0; i < n; i++) {
    if (graph[i].size() == 4) d4_count++;
  }

  if (d4_count <= 1) return false;
  if (d4_count >= 3) return true;

  vector<int> d4_vs;
  for (int i = 0; i < n; i++) {
    if (graph[i].size() == 4) d4_vs.push_back(i);
  }

  vector<FlowEdge> flow_edges;
  for (int i = 0; i < n; i++) {
    for (const auto& edge : graph[i]) {
      flow_edges.push_back(FlowEdge(edge.from, edge.to, 1));
    }
  }
  int flow = MaxFlow(n, flow_edges, d4_vs[0], d4_vs[1]);
  return flow == 2;
}

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

  if (Solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 28908
#include <stdio.h>;

int main() {
	int n;
	scanf("%d",&n);
	int ans[3];
	for (int i = 0; i < 3; i++) {
		if (n % 10 == 1) {
			ans[i] = 9;
		}
		else if (n % 10 == 9) {
			ans[i] = 1;
		}
		else {
			ans[i] = n % 10;
		}
		n=n / 10;
	}
	printf("%d", ans[0] + ans[1] * 10+ans[2]*100);
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int N; cin >> N;

	int a[100005];

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

	sort(a,a+N); reverse(a,a+N);

	int ans = 0;
	for (int i = 0;i < N;i++){
		if(i%2 == 0) ans += a[i];
		else ans -= a[i];
	}

	cout << ans << endl;

	return 0;

}


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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int getA(int n){
    if(n%(-2)==0) return 0;
    else return 1;
}

int getQ(int n){
    int a=getA(n);
    return (n-a)/(-2);
}


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

    int q=n;
    string res="";
    if(q==0) res = "0";
    while(q!=0){
        res += to_string(getA(q));
        q = getQ(q);
    }
    reverse(res.begin(),res.end());
    p(res)
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    for(int i=0;i<=a.size()-2;i++)cout<<a[i]<<b[i];
    cout<<a[a.size()-1];
    if(a.size()-b.size()==0)cout<<b[b.size()-1]<<endl;
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/agc032/tasks/agc032_a
# 条件を満たす中で数字の大きい方からgreedyに抜けばよい
# もしルールに従って数字が挿入されているならばそのような数字が必ず一つは存在する


N = int(input())
*B, = map(int, input().split())

ans = []
for _ in range(N):
    for i in range(len(B) - 1, -1, -1):
        if i + 1 == B[i]:
            ans.append(B[i])
            del B[i]
            break
    else:
        print(-1)  # 見つからなかったら
        exit()
print(*reversed(ans), sep='\n')


Measured memory_bytes: 3060
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    
    
    int n,k;
    cin>>n>>k;

    vector<int> data(n);

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

    int l=1,h=1e9;
    int mid;

    while(l<h){
        int sum=0;
        mid = (l+h)/2;

        for(int i=0;i<n;i++){
            sum=sum+(data[i]-1)/mid;
        }
        if(sum<=k)
            h=mid;
        else
            l=mid+1;
    }
    cout<<h<<endl;
}

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

int main(){
    int a,b,c,d;
    while(true){
        cin >> a >> b >> c >> d;
        if(a==0&&b==0&&c==0&&d==0)break;
        if(c==a/b&&a%b==0){
            cout << 0 << endl;
            continue;
        }
        int count=0;
        while(true){
            if(a/b<c){
                a+=d;
                count++;
            }
            else break;
        }
        cout << count << endl;
    }
}


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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

# define INF (int)10e9

int A,B,C;
int l[1000];

int dfs (int n,int depth,vector<int> sentaku){
    if(depth==n){
        int a=0,b=0,c=0;
        int num=0;
        for(int i=0;i<n;i++){
            int t=sentaku.at(i);
            if(t==0) a+=l[i];
            else if(t==1) b+=l[i];
            else if(t==2) c+=l[i];

            if(t!=3) num++;
        }
        if(a==0 || b==0 || c==0) return INF;
        else return abs(A-a) + abs(B-b) + abs(C-c) + (num-3)*10;
    }

    int res=INF;
    for(int i=0;i<4;i++){
        sentaku[depth]=i;
        res = min(res,dfs(n,depth+1,sentaku));
    }
    return res;
}

int main()
{

    int n;cin >> n >> A >> B >> C;

    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    p(dfs(n,0,v))
}

Measured memory_bytes: 256