akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int T,card[9]; // T:dataset
int win();
bool is_all_good_set();
bool is_good_set(int a,int b,int c);
bool is_same_number(int a,int b,int c);
bool is_sequence(int a,int b,int c);

int main() {
  cin >> T;
  for (int t=0;t<T;++t) {
    for (int i=0;i<9;++i) {
      cin >> card[i];
    }
    string color;
    for (int i=0;i<9;++i) {
      cin >> color;
      if (color=="G") card[i] += 10;
      else if (color=="B") card[i] += 20;
    }
    cout << win() << endl;
  }
}

int win() {
  int flag = 0;
  sort(card,card+9);
  do {
    if (is_all_good_set()==1)
      flag = 1;
  } while (next_permutation(card,card+9));
  return flag;
}
  
bool is_all_good_set() {
  return is_good_set(card[0],card[1],card[2]) &&
    is_good_set(card[3],card[4],card[5]) &&
    is_good_set(card[6],card[7],card[8]);
}

bool is_good_set(int a,int b,int c) {
  return is_same_number(a,b,c) || is_sequence(a,b,c);
}

bool is_same_number(int a,int b,int c) {
  return a == b && b == c;
}

bool is_sequence(int a,int b,int c) {
  return a+2 == b+1 && b+1 == c;
}

Measured memory_bytes: 1224
N, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(N)]
used = [0]*N
global pattern
pattern = []
global ans
ans = float('inf')

def dfs(A):
    global pattern
    global ans
    if len(A) == N:
        pattern.append(A)
        ans = min(ans, MP(A))
        return
    
    for i in range(4):
        A.append(i)
        dfs(A)
        A.pop()

    return 

def MP(A):
    group1 = []
    group2 = []
    group3 = []
    for i in range(N):
        if A[i] == 1:
            group1 += [l[i]]
        elif A[i] == 2:
            group2 += [l[i]]
        elif A[i] == 3:
            group3 += [l[i]]
    if len(group1) == 0 or len(group2) == 0 or len(group3) == 0:
        return float('inf')

    return calc(group1, a)+calc(group2, b)+calc(group3, c)
    
def calc(group, length):
    res = float('inf')
    for i in range(2**len(group)):
        bag = []
        for j in range(len(group)):
            if (i>>j) & 1:
                bag += [group[j]]
        
        if len(bag) == 0:
            continue
        elif len(bag) == 1:
            res = min(res, abs(length - bag[0]))
        else:
            res = min(res, abs(length - sum(group)) + 10*(len(group)-1))
        
    return res

dfs([])
print(ans)


Measured memory_bytes: 82192
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
int x[MAX_N];
int d[MAX_N];

int gcd(int a, int b)
{
	if (b == 0) return a;
	else return gcd(b,a%b);
}

int main()
{
	int N,X;
	cin >> N >> X;
	for (int i = 0; i < N; ++i)
	{
		cin >> x[i];
	}
	x[N] = X;
	sort(x,x+N+1);
	for (int i = 0; i < N; ++i)
	{
		d[i] = x[i+1] - x[i];
	}
	int ans = gcd(d[0],d[1]);
	for (int i = 2; i < N+1; ++i)
	{
		ans = gcd(ans,d[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    string s;
    cin>>s;
    if(s[1]=='B')
        cout<<"ARC"<<endl;
    else
    {
        cout<<"ABC"<<endl;
    }
}
return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

ll digits(ll a){
    ll d{1};
    while (a > 9){
        a /= 10;
        d++;
    }
    return d;
}

ll F(ll a, ll b){
    return max(digits(a), digits(b));
}

int main() {
    ll N;
    cin >> N;
    ll minimum{numeric_limits<ll>::max()};
    for (auto &&i: irange(1LL, N+1)){
        if (i * i > N)break;
        else if (N % i == 0){
            ll j = N / i;
            minimum = min(minimum, F(i, j));
        }
    }
    cout << minimum;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
typedef long long ll;
#define rg register

template <typename _Tp> inline _Tp read(_Tp&x){
	char c11=getchar(),ob=0;x=0;
	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();
	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;
}

const int N=101000;
int a[N],vis[N],st[N];
ll b[N],p[N],k;
int n,m,tp;

void init();void work();void print();
int main(){init();work();print();return 0;}

void work(){
	int x;
	for(rg int i=1;i<=m;++i)read(x),swap(a[x],a[x+1]);
	for(rg int i=1;i<=n;++i)if(!vis[i]){
		vis[st[0]=x=i]=tp=1;
		while(!vis[a[x]])
			vis[st[tp++]=x=a[x]]=1;
		int e=k%tp;
		for(rg int j=0;j<tp;++j)
			b[st[j]]=p[st[j+e<tp?j+e:j+e-tp]];
	}
}

void print(){
	ll sm(0ll);
	for(rg int i=1;i<=n;++i)
		printf("%lld\n",sm+=b[i]);
}

void init(){
	read(n);
	for(rg int i=1;i<=n;++i)read(p[i]),a[i]=i;
	for(rg int i=n;i;--i)p[i]-=p[i-1];
	read(m),read(k);
}

Measured memory_bytes: 3968
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=4448283280358331064;

/*
int main(){
    int n;
    cin>>n;
    ll k;
    cin>>k;
    vector<ll> pos(0), neg(0);
    int zero=0;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        if(a>0) pos.push_back(a);
        if(a==0) zero++;
        if(a<0) neg.push_back(-a);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    ll ub=INF;
    ll lb=-INF;
    while(ub-lb>1){
        ll m=(ub+lb)/2;
        ll num=0;
        //cout<<m<<endl;
        if(m<=0){
            for(ll u:neg){
                num+=pos.end()-upper_bound(pos.begin(),pos.end(),-m/u);
            }
        }else{
            num+=neg.size()*pos.size();
            num+=zero*(neg.size()+pos.size());
            num+=zero*(zero-1)/2;
            for(int i=0;i<pos.size();i++){
                num+=lower_bound(pos.begin()+i, pos.end(), m/pos[i])-(pos.begin()+i);
            }
            for(int i=0;i<neg.size();i++){
                num+=lower_bound(neg.begin()+i, neg.end(), m/neg[i])-(neg.begin()+i);
            }
        }
        if(num<=k){
            lb=m;
        }else{
            ub=m;
        }
    }
    cout<<ub<<endl;
}

*/

int main(){
    int n;
    cin>>n;
    n%=10;
    if(n==2 || n==4 || n==5 || n==7 || n==9){
        cout<<"hon"<<endl;
    }else if(n==3){
        cout<<"bon"<<endl;
    }else{
        cout<<"pon"<<endl;
    }
}

Measured memory_bytes: 3040
#include <cstdio>
#include <vector>
using namespace std;

#define SIZE 50000

int main(){
	int n, res;
	bool prime[SIZE + 1];
	fill(prime, prime + SIZE + 1, true);
	
	prime[1] = false;
	for(int i = 2; i <= SIZE; i++){
		if(prime[i]){
			for(int j = i * 2; j <= SIZE; j += i){
				prime[j] = false;
			}
		}
	}
	
	while(true){
		scanf("%d", &n);
		if(n == 0) break;
		
		res = 0;
		for(int i = 1; i <= n / 2; i++){
			if(prime[i] && prime[n - i]) res++;
		}
		
		printf("%d\n", res);
	}
	
	return 0;
}

Measured memory_bytes: 1076
from collections import deque
s = deque(input().split())
q = int(input())
rev = False
for _ in range(q):
    qu = input()
    if qu == "1":
        rev = not rev
    else:
        _, f, c = qu.split()
        if (f != "1") == rev:
            s.appendleft(c)
        else:
            s.append(c)

s = "".join(s)
if rev:
    s = reversed(s)
print("".join(s))

Measured memory_bytes: 89560
N,Ma,Mb = map(int, input().split())
arr=[list(map(int,input().split())) for _ in range(N)]
INF = 5000
dp=[[[INF]*(10*N+1) for _ in range(10*N+1)] for _ in range(N+1)]
dp[0][0][0] = 0
for i in range(N):
    a,b,c=arr[i]
    for j in range(10*N+1):
        for k in range(10*N+1):
            if dp[i][j][k] == INF:
                continue
            dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])
            dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)

ans=INF
for i in range(1,10*N+1):
        if i*Ma>10*N or i*Mb>10*N:
            break
        ans = min(ans, dp[N][i*Ma][i*Mb])
if ans == INF:
    print(-1)
else:
    print(ans)

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

using namespace std;
//15min
const int N = 55;

const int mod = 1e9+7;

long long s;

long long l(long long    x){
    int cnt = 0;
    while(x){
        cnt++;
        x /= 10;
    }
    return cnt;
}

long long get(int msk){
    long long sum = 0;
    long long sofar = 0;


    long long idx = 0;
    long long tmp = s;
    long long ten = 1;
    //cout << msk << ": ";
    while(tmp){
        sum = (tmp % 10) * ten + sum;
        ten *= 10;
        if(msk & (1 << idx)){
            //cout << sum << " ";
            sofar += sum;
            sum = 0;
            ten = 1;
        }
        idx ++;
        tmp /= 10;
    }
    sofar += sum;
    //cout << sum << "\n";
    return sofar;
}

int main(){
    cin >> s;
    if(s <= 9){
        cout << s << "\n";
        return 0;
    }
    int lg10 = l(s) - 1;
    long long ans = s;
    for(int i = 1; i < (1 << lg10); i++){
        ans += get(i);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;


using namespace std;



void solve()
{
	int n;
	scanf("%d", &n);
	vector<int> x(n);
	int i;
	ll sum = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
		sum += x[i];
	}
	ll tmp0=sum / n;
	ll tmp1 = tmp0 + 1;

	ll sum0 = 0;
	for (i = 0; i < n; i++) {
		sum0 += (x[i] - tmp0)*(x[i] - tmp0);
	}
	ll sum1 = 0;
	for (i = 0; i < n; i++) {
		sum1 += (x[i] - tmp1)*(x[i] - tmp1);
	}
	printf("%lld\n", MIN(sum0, sum1));
    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int ans,a[1000001],n,k;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=0;i<k;i++)
		ans+=a[n-i];
	cout<<ans<<endl;
}

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

using namespace std;

long long gcd(long long a, long long b);

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

    vector<long long> a(n + 1, 0);
    for (long long i = 1; i <= n; ++i)
        cin >> a[i];

    vector<long long> l(n + 1, 0);
    for (long long i = 1; i <= n; ++i)
        l[i] = gcd(l[i - 1], a[i]);

    vector<long long> r(n + 2, 0);
    for (long long i = n; i > 0; --i)
        r[i] = gcd(r[i + 1], a[i]);

    vector<long long> m(n + 1, 0);
    for (long long i = 1; i <= n; ++i)
        m[i] = gcd(l[i - 1], r[i + 1]);

    long long ans = 0;
    for (long long i = 1; i <= n; ++i)
        ans = max(ans, m[i]);
    cout << ans << '\n';
}

long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define repx(i, a, b) for(int i = a; i < b; i++)
using LL = long long;
const LL MOD = 1e9 + 7;
const int LIMIT = 1e6 + 1;
LL FAC[LIMIT + 1];
LL INV[LIMIT + 1];

// Fermat's little theorem から, 大きな冪乗の計算を行う.
// @param a: べき乗したい正整数.
// @param b: 指数.
// @return:  べき乗した計算結果(mod版).
LL inverse(LL a, LL b){
    LL t = 1;
    while(b){
        if(b & 1) t = (t * a) % MOD;
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return t % MOD;
}

// 組み合わせ(nCk)計算用(mod版).
// ※配列FAC, INV は, 事前に計算済のものを使う.
// @param n: 対象となる要素の個数.
// @param k: 選択する要素の個数.
// @return: 組み合わせ(nCk)の計算結果.
LL combination(LL n, LL k){
    if(n < 0 || k < 0 || k > n) return 0;
    LL ret = FAC[n] * INV[k] % MOD * INV[n - k] % MOD;
    return ret;
}

int main(){
    
    // 1. 入力情報.
    LL X, Y;
    scanf("%lld %lld", &X, &Y);
    FAC[0] = 1;
    repx(i, 1, LIMIT) FAC[i] = (LL)i * FAC[i - 1] % MOD;
    rep(i, LIMIT)     INV[i] = inverse(FAC[i], MOD - 2) % MOD;
    
    // 2. ナイトの駒を移動.
    // 移動方法は, (1, 2) または (2, 1) を 選択できるので, それぞれの操作回数を計算.
    // X = 1 * op12 + 2 * op21, Y = 2 * op12 + 1 * op21
    // -> 
    // 1 * op12 = X - 2 * op21
    // 2 * op12 = Y - 1 * op21
    // -> 
    // op12 = (2 * Y - X) / 3
    // op21 = (2 * X - Y) / 3
    LL op12 = (2 * Y - X) / 3, op21 = (2 * X - Y) / 3;
    
    // 3. 移動できない場合.
    if(X != op12 + 2 * op21 || Y != 2 * op12 + op21){
        printf("%d\n", 0);
        return 0;
    }
    
    // 4. 移動させる方法が何通りあるか？
    LL ans = combination(op12 + op21, op12);
    
    // 5. 出力 ～ 後処理.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    string t;
    cin >> t;
    bool n, s, w, e;
    n = s = w = e = false;
    for (int i = 0; i < (int)t.size(); ++i) {
        if (t[i] == 'N') n = true;
        else if (t[i] == 'W') w = true;
        else if (t[i] == 'S') s = true;
        else e = true;
    }
    
    if ((n == s) && (w == e)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    vector<vector<int>> idx(3, vector<int>());
    for_(i,0,N) {
        if (S[i] == 'R') idx[0].push_back(i);
        if (S[i] == 'G') idx[1].push_back(i);
        if (S[i] == 'B') idx[2].push_back(i);
    }

    for_(i,0,3) sort(ALL(idx[i]));

    lint ans = 0;

    vector<int> order = {0,1,2};
    do {
        int r = order[0], g = order[1], b = order[2];
        for (int i : idx[r]) {
            int L = lower_bound(ALL(idx[g]), i) - idx[g].begin();
            int R = idx[b].end() - lower_bound(ALL(idx[b]), i + 1);
            lint add = L * R;

            for_(w,1,N) {
                int j = i - w;
                int k = i + w;
                if (j < 0 or k >= N) continue;
                if (binary_search(ALL(idx[g]), j) and
                    binary_search(ALL(idx[b]), k)) --add;
            }

            ans += add;
        }
    } while (next_permutation(ALL(order)));

    cout << ans << endl;
}

Measured memory_bytes: 3656
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
void mainmain(){
	int N,M,K,L;
	while(scanf("%d %d %d %d",&N,&M,&K,&L),N||M||K||L){
		vector<pair<int,string>> in1(N);
		rep(i,N){
			cin>>in1[i].S;
			scanf("%d",&in1[i].F);
			in1[i].F*=-1;
		}
		set<string> se;
		string tmps;
		rep(i,M){
			cin>>tmps;
			se.insert(tmps);
		}
		sort(ALL(in1));
		priority_queue<pii> pq1;
		priority_queue<pii> pq2;
		priority_queue<pii> pq3;
		rep(i,in1.size()){
			if(i<K){
				if(se.find(in1[i].S)!=se.end()){
					pq2.push(mkp(in1[i].F,-i));
				}
				else{
					pq1.push(mkp(in1[i].F,-i));
				}
			}
			else{
				if(se.find(in1[i].S)!=se.end()){
					pq3.push(mkp(-in1[i].F,-i));
				}
			}
		}
		while(1){
			if(pq3.empty()){
				break;
			}
			if(pq1.empty()){
				break;
			}
			pii top3=pq3.top();
			pii top1=pq1.top();
			pii top2;
			bool f2=!pq2.empty();
			if(f2) top2=pq2.top();
			pq3.pop();
			L-=-top1.F-top3.F;
			top3.F=-top1.F;
			if(in1[-top3.S].S>in1[-top1.S].S){
				top3.F++;
				L--;
			}
			if(L<0){
				break;
			}
			top3.F*=-1;
			if(!f2||top2.F<top1.F||(top2.F==top1.F&&in1[-top2.S].S<in1[-top1.S].S)){
				top1.F*=-1;
				pq1.pop();
				pq2.push(top3);
			}
			else{
				top2.F*=-1;
				pq3.push(top2);
				pq2.pop();
				pq2.push(top3);
			}
		}
		cout<<pq2.size()<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 17468
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


#include <iostream>
using namespace std;
/*
1≤k≤n≤10^7
p は素数 (上の実装ではさらに p>n を仮定している)
*/

const int MAX = 2000100;//階乗の配列数
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

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

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  if(a<n)return 0;
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  COMinit();
  ll ans=0;
  for(int x=r1; x<=r2; x++){
    ans+=COM((ll)(x+1+c2), (ll)c2)-COM((ll)(x+c1), (ll)(x+1));
    ans+=mod;
    ans%=mod;
  }
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 50480
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

const int AND[3][3]={{0,0,0},
                    {0,1,1},
                    {0,1,2}};

const int OR[3][3]={{0,1,2},
                    {1,1,2},
                    {2,2,2}};

const int NOT[3]={2,1,0};


string str;
int wp=-1;
int p,q,r;

int parse(){ 
  wp++;
  if(str[wp]=='0') return 0;
  else if(str[wp]=='1') return 1;
  else if(str[wp]=='2') return 2;
  else if(str[wp]=='-') return NOT[parse()];
  else if(str[wp]=='P') return p;
  else if(str[wp]=='Q') return q;
  else if(str[wp]=='R') return r;
  else if(str[wp]=='('){
    int ans,tmp = parse();     
    wp++;
    if(str[wp]=='+'){
      ans = OR[tmp][parse()]; 
    }else if(str[wp]=='*'){
      ans = AND[tmp][parse()];
    }
  
    wp++;
    return ans;
  }
  return 0;
}

int main(){

  while(1){
    cin >> str;
    if(str=="."){
      break;
    }

    int count=0;
    rep(i,3) rep(j,3) rep(k,3){
      p=i;q=j;r=k;
      //cout << i << j << k << endl;
      if(parse()==2) count++;
      wp=-1;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    string s; cin >> s;
    int n=s.size();
    const int p=2019;
        map<ll,ll> mp;
        mp[0]++;
        ll res=0;
        ll ans=0;
        ll k=1;
        for(int i=n-1;i>=0;i--){
            res+=(s[i]-'0')*k;
            res%=p;
            ans+=mp[res];
            mp[res]++;
            k*=10;  k%=p;
        }
        cout << ans << endl;
}


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

using namespace std;

int main ()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int maior, a1, a2;
    if (max(a, b) == a)
    {
        if (max(a, c) == a)
            maior = a, a1 = c, a2 = b;
        else
            maior = c, a1= a, a2 = b;
    } 
    else
    {
        if (max(b, c) == b)
            maior = b, a1 = a, a2 = c;
        else
            maior = c, a1 = a, a2 = b;
    }
    for (int i = 0; i < k; i++)
        maior *= 2;
    cout << maior+a1+a2 << endl;
    
}

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[n-i-1];
    rep(i,n-1){
        if(h[i] < h[i+1]) --h[i+1];
        if(h[i] < h[i+1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1e5+5;

vi v[N],par(N),sub(N);

int n;
int dist;

void dfs(int x,int p,int lev)
{
    if(x==n)
        dist=lev;

    par[x]=p;

    sub[x]=1;
    for(auto c:v[x])
    {
        if(c==p)
            continue;

        dfs(c,x,lev+1);
        sub[x]+=sub[c];
    }
}

void solve()
{
    cin>>n;

    int a,b;
    for(int i=1;i<n;++i)
    {
        cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }

    dfs(1,-1,0);

    int upar=(dist-1)/2;
    int x=n;
    for(int i=0;i<upar;++i)
        x=par[x];

    a=n-1-sub[x],b=sub[x]-1;

    //cout<<a<<" "<<b<<"\n";

    if(a>b)
        cout<<"Fennec";
    else
        cout<<"Snuke";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 15104
#include <stdio.h>

int main(void) {
	int a, b, c, count, i;
	scanf("%d %d %d", &a, &b, &c);
	for(i=a; a<=b; a++){
		if(c%a == 0)
			count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 2140
/*


*/

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

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

#define endl '\n'
#define ld long double
#define ll long long
#define PI acos(-1.0)
#define OO 1e17
#define EPS 1e-12
#define MLOG 20
#define MAX 2* 100 * 1000+5
const int mod = 1e9 + 7;
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }


void fast(){
#ifndef ONLINE_JUDGE
	freopen("E:\\Competitve\\solving\\input.txt", "r", stdin);
	freopen("E:\\Competitve\\solving\\output.txt", "w", stdout);
#endif
}
int n;
int a[1000 * 100 + 4];
int dp[100 * 1000 + 4];

int main(){
	//fast();

	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 1; i < n; i++){
		dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
		if (i >= 2)
			dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
	}
	cout << dp[n - 1];
	return 0;

}

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

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

    int n;
    cin >> n;

    cout << n*n*n << endl;

    return 0;
}

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

long long n, dp[100001], a[12]={1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		dp[i] = INT_MAX;
		for(int j = 0; j < 12; j++){
			if(i-a[j] >= 0) dp[i] = min(dp[i], dp[i-a[j]]+1);
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1024
S = input()
T = input()
N = len(S)
dictXY = {}
dictYX = {}
for i in range(N):
    X = S[i]
    Y = T[i]
    if X in list(dictXY.keys()):
        dictXY[X].append(Y)
    else:
        dictXY[X] = [Y]
    if Y in list(dictYX.keys()):
        dictYX[Y].append(X)
    else:
        dictYX[Y] = [X]

al=[chr(ord('a') + i) for i in range(26)]

flag = 0
for Z in al:
    if Z in list(dictXY.keys()):
        if len(set(dictXY[Z]))>1:
            flag = 1
    if Z in list(dictYX.keys()):
        if len(set(dictYX[Z]))>1:
            flag = 1
if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 78780
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
using namespace std;
int a[MAXN];
int ans[MAXN];
pair<pii,pii> ind[MAXN];

int main()
{
    int n;
    ni(n);
    for (int i = 0; i < (1 << n); i++)
        ni(a[i]);
    if (n <= 0)
    {
        for (int i = 0; i < (1 << n); i++)
            for (int j = i + 1; j < (1 << n); j++)
                ans[i | j] = max(ans[i | j], a[i] + a[j]);
        for (int i = 1; i < (1 << n); i++)
            pri(ans[i] = max(ans[i], ans[i - 1]));
        return 0;
    }
    else
    {
        for (int k = 0; k < (1 << n); k++)
        {
            ind[k].fi = {a[k], k};
            for (int i = 0; i < n; i++)
            {
                if (!(k & (1 << i)))
                    continue;
                int j = k ^ (1 << i);
                vii tmp = {ind[k].fi, ind[k].se, ind[j].fi, ind[j].se};
                for (int x = 0; x < 4; x++)
                    for (int y = x + 1; y < 4; y++)
                        if (tmp[x].se != tmp[y].se && tmp[x].fi + tmp[y].fi > ind[k].fi.fi + ind[k].se.fi)
                            ind[k] = {tmp[x], tmp[y]};
                if (j == 0)
                    break;
            }
        }
    }
    for (int i = 1; i < (1 << n); i++)
        ans[i] = max(ind[i].fi.fi + ind[i].se.fi, ans[i - 1]);
    for (int i = 1; i < (1 << n); i++)
        pri(ans[i]);
    return 0;
}


Measured memory_bytes: 17408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=510;
int mat[N][N];
int main(){
	int n=ni,m=ni,r=ni,c=ni;
	bool flag=false;
	if(m%c==0){
		swap(n,m),swap(r,c),flag=true;
	}
	if(m%c){
		puts("Yes");
	}else{
		puts("No");
		return 0;
	}
	int a=m/c+1,b=-a-1;
	memset(mat,0,sizeof(mat));
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j+=c){
			mat[i][j]=a,mat[i][j-1]=b;
		}
	}
	if(flag){
		for(int j=1;j<=m;j++){
			for(int i=1;i<=n;i++){
				printf("%d ",mat[i][j]);
			}
			putchar('\n');
		}
	}else{
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				printf("%d ",mat[i][j]);
			}
			putchar('\n');
		}
	}
	return 0;
}

Measured memory_bytes: 2304
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end
n,t = gi
a = gi
mn = a[0]
b = []
repl 1, n-1 do |i|
  mn = min mn,a[i-1]
  b << a[i] - mn
end
puts b.count b.max


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

using namespace std;

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


Measured memory_bytes: 256
//By: Luogu@rui_er(122461)
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;

int n, k, l = 1, r, ans;
int a[N];

bool f(int x) {
	int t = 0;
	for(int i=1;i<=n;i++) {
		if(a[i] % x == 0) {
			t += a[i] / x - 1;
		}
		else {
			t += a[i] / x;
		}
	}
	if(t > k) {
		return false;
	}
	else {
		return true;
	}
}

int main() {
	scanf("%d%d", &n, &k);
	for(int i=1;i<=n;i++) {
		scanf("%d", &a[i]);
		r = max(r, a[i]);
		ans = max(ans, a[i]);
	}
	while(l <= r) {
		int mid = (l + r) >> 1;
		if(f(mid)) {
			ans = mid;
			r = mid - 1;
		}
		else {
			l = mid + 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 4492
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}
/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*ここから*/
int main() {
    int N,L;
    cin >> N >> L;
    int R = N+L-1;
    long ans=0;
    if(L>0){
        for(int i=0;i<N;i++){
            ans += L+i;
        }
        cout << ans - L << endl;
    }
    if(L<=0&&R>=0){
        for(int i=0;i<N;i++){
            ans += L+i;
        }
        cout << ans << endl;
    }
    if(R<0){
        for(int i=0;i<N;i++){
            ans += L+i;
        }
        cout << ans-R << endl;
    }
}

Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <climits>

int main(void) {
    int n;
    scanf("%d", &n);
    long long s[n], sum = 0;
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        s[i] = sum + a;
        sum += a;
    }
    long long ans = LLONG_MAX;
    for (int i = 0; i < n - 1; i++) {
        ans = std::min(llabs(s[i] - (sum - s[i])), ans);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 5050;
const int MM = 210;
const int INF = 1e9;
int st[2*MN][MM];
ll w[MN][MM];
ll res[MN][MN];
ll cs[MN],pr[MN];
int n,m;
void build() {
	for(int i=0;i<m;i++) {
		for(int j=n-1;j>0;j--) {
			int a = st[j<<1][i],b = st[j<<1|1][i];
			if(w[a][i] > w[b][i]) {
				st[j][i] = a;
			} else {
				st[j][i] = b;
			}
		}
	}
}
int qu(int l, int r, int id) {
  	int ma = l;
	l += n;r += n;
	for(;l<r;l>>=1,r>>=1) {
		if(l&1) {
			int a = st[l++][id];
			if(w[a][id] > w[ma][id]) {
				ma = a;
			}
		}
		if(r&1) {
			int a = st[--r][id];
			if(w[a][id] > w[ma][id]) {
				ma = a;
			}
		}
	}
	return ma;
}
void get(int l, int r, int id) {
	if(l >= r) {return;}
	int val = qu(l,r,id);
	res[l][val] += w[val][id];
	res[val+1][val] -= w[val][id];
	res[l][r] -= w[val][id];
	res[val+1][r] += w[val][id];
	get(l,val,id);
	get(val+1,r,id);
}
ll resolve() {
	for(int j=0;j<n;j++) {
		for(int i=0;i<n;i++) {
			res[i+1][j] += res[i][j];
		}
	}
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			res[i][j+1] += res[i][j];
		}
	}
	ll ma = -INF;
	for(int i=0;i<n;i++) {
		for(int j=i;j<n;j++) {
			//cout << "ij " << i << " " << j << " = " << res[i][j] << "-" << pr[j]-pr[i] << '\n';
			res[i][j] -= pr[j]-pr[i];
			ma = max(ma,res[i][j]);
		}
	}
	return ma;
}
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	cin >> n >> m;
	memset(res,0,sizeof(res));
	pr[0] = 0;
	for(int i=0;i<n-1;i++) {
		cin >> cs[i];
		pr[i+1] = pr[i]+cs[i];
	}
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			cin >> w[i][j];
			st[i+n][j] = i;
		}
	}
	build();
	for(int i=0;i<m;i++) {
		get(0,n,i);
	}
	cout << resolve() << '\n';
}


Measured memory_bytes: 216064
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
vector<int> d;

int main(){
    int N;
    cin >> N;
    d.resize(N);
    rep(i,N) cin >> d[i];
    sort(d.begin(), d.end(), greater<int>());
    int tmp=d[0];
    int ans=1;
    for(int i=1; i<N; i++){
        if(tmp>d[i]){
            tmp=d[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

const int maxn=1e6+7;
int main(){
    int a,b,k;scanf("%d %d %d",&a,&b,&k);
    for(int i=a;i<min(b,a+k);i++) printf("%d\n",i);
    for(int i=max(min(b,a+k),b-k+1);i<=b;i++) printf("%d\n",i);
    return 0;
}


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

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class CAttackSurvival {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int N, K, Q;
        in>>N>>K>>Q;
        vc<int> cnt(N, 0);
        REP(i, Q){
            int a;
            in>>a;
            a--;
            cnt[a]++;
        }
        REP(i, N){
            if(K-Q+cnt[i]>0) out<<"Yes\n";
            else out<<"No\n";
        }
    }
};


int main() {
	CAttackSurvival solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

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

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


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  ll d = 10;
  if (n % 2) {
    cout << 0 << endl;
    return 0;
  }
  while (true) {
    if (n < d) break;
    ans += (n / d);
    d *= 5;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#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
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
// #define INT_MAX 1000000000 this is wrong as INT_MAX is already included in header<climits> and  2147483647  
// #define INT_MIN -1000000000
#define INF 1000000000
#define LL_MAX 1000000000000000000
#define LL_MIN -1000000000000000000
#define mod1 1000000007
#define ll long long 
#define ld long double
#define vi vector <int>
#define vvi vector <vector<int>>
#define vll vector<long long>
#define vvl vector <vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pair<int,int>>
#define pld pair<ld,ld>
#define vpll vector<pair<ll,ll>>
#define vpld vector<pair<ld,ld>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define fs(x) fixed<<setprecision(x)
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { 
	return a < b ? a = b, 1 : 0; } 
constexpr int pct(int x) { return __builtin_popcount(x); } 
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))

template<class T>
T binpow(T a, T b, T m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
template<class T>
T extended_gcd(T a, T b, T& x, T& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    T x1, y1;
    T d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

vector<int>par,r;
int find(int a){
    if(par[a]<0){
        return a;
    }
    return par[a]=find(par[a]);
}
void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a == b)
    	return;
    if(r[a]>r[b]){
        par[b]=a;
        r[a]+=r[b];
    }else{
        par[a]=b;
        r[b]+=r[a];
    }
}
int main(){
	int n,m;
    cin>>n>>m;
    par=vector<int>(n,-1);
    r=vector<int>(n,1);
    while(m--){
        int a,b;
        cin>>a>>b;
        --a,--b;
        unite(a,b);
    }
    int mx=0;
    for(int i=0;i<n;i++){
        mx=max(mx,r[i]);
    }
    cout<<mx;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

Measured memory_bytes: 4764
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Point
{
  public:
    Point(){}
    Point(int _x, int _y)
    { x = _x; y = _y; }
    int x, y;
    
    bool operator < (Point P){
        return x == P.x ? y < P.y : x < P.x;
    }
};

int main()
{
    int N; 
    cin >> N;
    vector<Point> Points;
    
    for(int i = 0; i < N; ++i)
    {
        int x, y; cin >> x >> y;
        Points.push_back(Point(x, y));
    }
    
    sort(Points.begin(), Points.end());
    
    for(int i = 0; i < N; ++i)
      cout << Points[i].x << " " << Points[i].y << endl;
    
    return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ cin>>vec[i];}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define S second
#define F first
const int  MOD = 1e9 + 7;
const int  N = 1e5 + 7;
ll  we[105] , v[105];


//  a d f j k  l  ;
int main(){
    ios::sync_with_stdio(0);  cin.tie(0);
    ll n , w , V = 0, MAX = 0;
    cin>>n>>w;
    for(ll i = 0 ; i < n ; i++){
        cin>>we[i]>>v[i];
        V += v[i]; 
        MAX += we[i];
    }
    vector<ll> dp;
    dp.resize(V + 1, MAX);
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = V; j >= v[i]; j--){
            dp[j] = min(dp[j], dp[j - v[i]] + we[i]);
        }
    }
    ll res = 0;
    for(ll i = 0; i <= V; i++) if(dp[i] <= w) res = i;
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)1e9+7) 
#define INF ((LL)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int N;
	cin >> N;
	vector<string> str(2);
	foreach(i, str)cin>>i;
	int i = 0;
	LL ans = 1;
	bool ver = false;
	while(i<N){
		if(i==0){
			if(str[0][0]==str[1][0]){
				ver = true;
				ans *= 3;
				++i;
			}else{
				ver = false;
				ans *= 6;
				i+=2;
			}
		}else{
			if(str[0][i]==str[1][i]){
				if(ver){
					ans *= 2;
				}
				++i;
				ver = true;
			}else{
				if(ver){
					ans *= 2;
				}else{
					ans *= 3;
				}
				i += 2;
				ver = false;
			}
		}
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  ll N;
  ll P=1;
  cin >> N;
  for(ll i=1;i<=N;++i){
    P = i*P%F;
  }
  cout << P << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include "string"

using namespace std;

typedef long long ll;

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

    int N;
    cin >> N;
    vector<string> A(N);
    vector<long> a(5);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        switch (A[i][0]) {
            case 'M':
                a[0]++;
                break;
            case 'A':
                a[1]++;
                break;
            case 'R':
                a[2]++;
                break;
            case 'C':
                a[3]++;
                break;
            case 'H':
                a[4]++;
                break;
        }

    }
    long ans = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = i+1; j <4; j++){
            for (int l = j+1; l < 5; l++){
                ans += a[i] * a[j] * a[l];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <cstring>
#pragma warning(disable:4996)
using namespace std;
#pragma warning(disable:4996)

int main()
{
	int n;
	scanf("%d", &n);
	int even = 0;
	int odd = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 0) even++;
		else
		{
			odd++;
		}
		

		
	}
	printf("%d", even*odd);
}

Measured memory_bytes: 128