akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;


template <typename T, typename U>
struct PrimalDual{
    struct Edge{
        int to, rev;
        U cap;
        T cost;
        Edge(int to, U cap, T cost, int rev) :
            to(to), rev(rev), cap(cap), cost(cost){}
    };
    vector<vector<Edge>> edges;
    T _inf;
    vector<T> potential, min_cost;
    vector<int> prev_v, prev_e;

    PrimalDual(int n) : edges(n), _inf(numeric_limits<T>::max()){}

    void add(int from, int to, U cap, T cost){
        edges[from].emplace_back(to, cap, cost, static_cast<int>(edges[to].size()));
        edges[to].emplace_back(from, 0, -cost, static_cast<int>(edges[from].size()) - 1);
    }

    T solve(int s, int t, U flow){
        int n = edges.size();
        T ret = 0;
        priority_queue<pair<T,int>, vector<pair<T,int>>, greater<pair<T,int>>> que;
        potential.assign(n, 0);
        prev_v.assign(n, -1);
        prev_e.assign(n, -1);
        while(flow > 0){
            min_cost.assign(n, _inf);
            que.emplace(0, s);
            min_cost[s] = 0;
            while(!que.empty()){
                T fl;
                int pos;
                tie(fl, pos) = que.top();
                que.pop();
                if(min_cost[pos] != fl)
                    continue;
                for(int i = 0; i < edges[pos].size(); ++i){
                    auto& ed = edges[pos][i];
                    T nex = fl + ed.cost + potential[pos] - potential[ed.to];
                    if(ed.cap > 0 && min_cost[ed.to] > nex){
                        min_cost[ed.to] = nex;
                        prev_v[ed.to] = pos;
                        prev_e[ed.to] = i;
                        que.emplace(min_cost[ed.to], ed.to);
                    }
                }
            }
            if(min_cost[t] == _inf)
                return -1;
            for(int i = 0; i < n; ++i)
                potential[i] += min_cost[i];
            T add_flow = flow;
            for(int x = t; x != s; x = prev_v[x])
                add_flow = min(add_flow, edges[prev_v[x]][prev_e[x]].cap);
            flow -= add_flow;
            ret += add_flow * potential[t];
            for(int x = t; x != s; x = prev_v[x]){
                auto& ed = edges[prev_v[x]][prev_e[x]];
                ed.cap -= add_flow;
                edges[x][ed.rev].cap += add_flow;
            }
        }
        return ret;
    }
};


signed main(){
    int n, m, f;
    cin >> n >> m >> f;
    PrimalDual<int,int> p(n);
    for(int i = 0; i < m; ++i){
        int u, v, c, d;
        cin >> u >> v >> c >> d;
        p.add(u, v, c, d);
    }
    cout << p.solve(0, n - 1, f) << endl;
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vvl vv(n,vl(3));
	vl ans(n);
	rep(i,n){
		rep(j,3)cin>>vv[i][j];
	}
	rep(i,3){
		map<int,int> s;
		rep(j,n)s[vv[j][i]]++;
		rep(j,n)if(s[vv[j][i]]==1)ans[j]+=vv[j][i];
	}
	rep(i,n)cout<<ans[i]<<endl;

}



Measured memory_bytes: 3148
n, m = gets.split(' ').map(&:to_i)
kss = []
m.times do |i|
  kss << ([i] + gets.split(' ').map(&:to_i))
end
ps = gets.split(' ').map(&:to_i)

patterns = []
(2 ** n).times do |i|
  patterns << i.to_s(2).rjust(n, '0').reverse
end

ok = 0
patterns.each do |pattern|
  result = kss.all? do |ks|
    on_count = 0
    ks[2..-1].each do |k|
      on_count += pattern[k-1].to_i
    end
    on_count % 2 == ps[ks[0]]
  end
  ok += 1 if result
end

print(ok)

Measured memory_bytes: 2044
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class CommonSubsequence {
        public static int MOD = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] s = new int[n];
            int[] t = new int[m];

            long[][] dp = new long[n + 1][m + 1];
            long[][] sum = new long[n + 1][m + 1];

            for (int i = 0; i < n; i++) {
                s[i] = in.nextInt();
            }
            for (int i = 0; i < m; i++) {
                t[i] = in.nextInt();
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (s[i] == t[j]) {
                        dp[i + 1][j + 1] = sum[i][j] + 1;
                        dp[i + 1][j + 1] %= MOD;
                    }
                    sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] + dp[i + 1][j + 1];
                    sum[i + 1][j + 1] %= MOD;
                    sum[i + 1][j + 1] = modSub(sum[i + 1][j + 1], sum[i][j], MOD);
                }
            }

            out.println((sum[n][m] + 1) % MOD);

        }

        static long modSub(long x, long n, long mod) {
            long v = x - n;
            if (v < 0) {
                v += mod;
            }
            return v % mod;
        }

    }
}



Measured memory_bytes: 104400
#include<bits/stdc++.h>
using namespace std ;
int x[100010] , y[100010] , t[100010] ;
int main(){
    int N ;
    cin >> N ;
    for( int i = 1 ; i <= N ; i++ )
        scanf( "%d%d%d" , &t[i] , &x[i] , &y[i] ) ;
    bool flag = true ;
    for( int i = 1 ; i <= N ; i++ ){
        int d = abs( x[i] - x[i - 1] ) + abs( y[i] - y[i - 1] ) ;
        int tt = t[i] - t[i - 1] ;
        if ( tt >= d && ( tt - d ) % 2 == 0 ) continue ;
        flag = false ;
    }
    if ( flag ) cout << "Yes" << endl ;
    else cout << "No" << endl ;
    return 0 ;
}

Measured memory_bytes: 1408
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int N, L;
  cin>>N>>L;
  vector<string> S(N);
  for(int i=0;i<N;i++)	cin>>S[i];
  sort(S.begin(), S.end());
  string ans = "";
  for(int i=0;i<N;i++)	ans+=S[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int MAX = 100005;
const int NIL = -1;


struct Node {
	int parent, left, right;
};
Node Tree[MAX];
int n;
//????????????
void PreorderTreeWalk(int u) {
	if (u == NIL)
		return;
	printf(" %d", u);
	PreorderTreeWalk(Tree[u].left);
	PreorderTreeWalk(Tree[u].right);
}
//????????????
void InorderTreeWalk(int u) {
	if (u == NIL)
		return;
	InorderTreeWalk(Tree[u].left);
	printf(" %d", u);
	InorderTreeWalk(Tree[u].right);
}
//????????????
void PostorderTreeWalk(int u) {
	if (u == NIL)
		return;
	PostorderTreeWalk(Tree[u].left);
	PostorderTreeWalk(Tree[u].right);
	printf(" %d", u);
}


int main() {
	int n;
	int u, l, r, root;
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++) {
		Tree[i].parent = Tree[i].left = Tree[i].right = NIL;
	}
	
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d", &u, &l, &r);
		Tree[u].left = l;
		Tree[u].right = r;
		Tree[l].parent = u;
		Tree[r].parent = u;
	}
	for (int i = 0; i < n; i++) {
		if (Tree[i].parent == NIL)
			root = i;
	}
	printf("Preorder\n");
	PreorderTreeWalk(root);
	printf("\nInorder\n");
	InorderTreeWalk(root);
	printf("\nPostorder\n");
	PostorderTreeWalk(root);
	printf("\n");
	return 0;
}

Measured memory_bytes: 3196
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

lst1 = []
lst2 = []
A1,B1 = map(int, input().split(" "))

A = factorization(A1)
B = factorization(B1)

for i in range(len(A)):
    lst1.append(A[i][0])

for i in range(len(B)):
    lst2.append(B[i][0])
# print(lst1)
# print(lst2)

lst1_set = set(lst1)
lst2_set = set(lst2)

result_set = lst1_set & lst2_set


# print(result_set)
if A1 == 0 or B1 == 0:
    print(0)
elif A1 == 1 and B1 == 1:
    print(1)
else:
    print(len(result_set) + 1)

Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}


vector<string> SS;

int main(){
    int n;
    cin >> n;
    string s[n];
    rep(i,n){
        cin >> s[i];
        SS.push_back(s[i]);
    }
    sort(SS.begin(),SS.end());
    cerr<<endl;
    /*
    rep(i,n){
        cerr<<SS[i]<<endl;
    }
    */
    ll k=0;
    string kk="-1";
    vector<pair<ll,string>> PP;
    rep(i,n){
        if(SS[i]==kk){
            k++;
            if(i==n-1){
                PP.push_back(mp(k,kk));
            }
        }else{
            PP.push_back(mp(k,kk));
            cerr<<k<<' '<<kk<<endl;
            k=1;
            kk=SS[i];
            if(i==n-1){
                PP.push_back(mp(k,kk));
            }
        }
    }
    sort(PP.begin(),PP.end(),greater<pair<ll,string>>());
    ll kkk=PP[0].first;
    cerr<<kkk<<endl;
    ll i=0;
    cerr<<endl;
    vector<string> SSS;
    while(PP[i].first==kkk){
        SSS.push_back(PP[i].second);
        i++;
    }
    rep(j,SSS.size()){
        cout<<SSS[SSS.size()-j-1]<<endl;
    }
    /*
    pair<int,string> p[n];
    rep(i,SS.size()){
        p[i]=pair(SS[i].second,SS[i].first);
        PP.push_back(p[i]);
    }
    PP.sort();
    int k=PP[0].first;
    int i=0;
    while(PP[i].first==k){
        cout<<PP[i].second<<endl;
        i++;
    }
    */
    return 0;
}



Measured memory_bytes: 23660
X,Y,A,B,C=map(int,input().split())
ls_a=sorted(list(map(int,input().split())))
ls_b=sorted(list(map(int,input().split())))
ls_c=sorted(list(map(int,input().split())))
ls_x=ls_a[A-X:A]
ls_y=ls_b[B-Y:B]
ls_c.reverse()

ans=sum(ls_x)+sum(ls_y)
a=b=c=0
for _ in range(min([X+Y,C])):
  if a==len(ls_x):
    m=min([ls_y[b],ls_c[c]])
    if m==ls_y[b]:
      ans+=(-ls_y[b]+ls_c[c])
      b+=1
      c+=1
    else:
      break
  elif b==len(ls_y):
    m=min([ls_x[a],ls_c[c]])
    if m==ls_x[a]:
      ans+=(-ls_x[a]+ls_c[c])
      a+=1
      c+=1
    else:
      break
  else:    
    m=min([ls_x[a],ls_y[b],ls_c[c]])
    if m==ls_x[a]:
      ans+=(-ls_x[a]+ls_c[c])
      a+=1
      c+=1
    elif m==ls_y[b]:
      ans+=(-ls_y[b]+ls_c[c])
      b+=1
      c+=1
    else:
      break
print(ans)

Measured memory_bytes: 106980
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int i1 = (a / d) + (a % d ? 1 : 0);
    int i2 = (c / b) + (c % b ? 1 : 0);
    if (i1 >= i2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    a.push_back('E');
    b.push_back('E');
    c.push_back('E');
    char tmp = 'A';
    vector<int> l(3, 0);
    while(l[0] < (int)a.size() && l[1] < (int)b.size() && l[2] < (int)c.size()){
        if(tmp == 'A'){
            if(a[l[0]] == 'a') tmp = 'A';
            if(a[l[0]] == 'b') tmp = 'B';
            if(a[l[0]] == 'c') tmp = 'C';
            l[0]++;
        }
        if(tmp == 'B'){
            if(b[l[1]] == 'a') tmp = 'A';
            if(b[l[1]] == 'b') tmp = 'B';
            if(b[l[1]] == 'c') tmp = 'C';
            l[1]++;
        }
        if(tmp == 'C'){
            if(c[l[2]] == 'a') tmp = 'A';
            if(c[l[2]] == 'b') tmp = 'B';
            if(c[l[2]] == 'c') tmp = 'C';
            l[2]++;
        }
    }
    cout << tmp << endl;
}

Measured memory_bytes: 3608
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000;
char cn[CM + 10], * ci = cn + 10, ct, c, * owa = cn + CM;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	swap(c, ci[8]);
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	swap(c, ci[8]);
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 10);
		ci -= CM;
		fread(cn + 10, 1, CM, stdin);
	}
	return tmp;
}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		for (int i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = f.C[i];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		for (int i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = f.C[i];
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

int B[200010];

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


	fread(ci, 1, CM, stdin);

	int N = getint();
	ll kotae = 1;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int i = 0;
	
	int amari = N % 10800;
	int shou = N / 10800;
	rep(j, shou) {
		rep(k, 10800) putint(kotae - B[A[i++]]);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[A[i++]]);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <stdlib.h>

int main ()
{
  int n,k,i,count=0;
  int *h;

  scanf("%d%d",&n,&k );

  h = calloc(n,sizeof(int));

  for(i=0; i<n; i++){
    scanf("%d", &h[i]);
      if(h[i] >= k)
        count++;
  }

  printf("%d", count);
  free(h);
  return 0;
}


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

int main(void)
{
	int x, y, z;
	int n;
	int r;
	int i;
	
	while (1){
		scanf("%d %d %d", &x, &y, &z);
		if (x == 0 && y == 0 && z == 0){
			break;
		}
		
		scanf("%d", &n);
		
		for (i = 0; i < n; i++){
			scanf("%d", &r);
			r *= 2;
			
			if ((sqrt(x * x + y * y) < r) || (sqrt(y * y + z * z) < r) || (sqrt(z * z + x * x) < r)){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int,int> P;

struct great{
  bool operator()(const P& x, const P& y) const {
  	if(x.first == y.first) return x.second < y.second;
    return x.first > y.first;
  }
};

int main(){
	while(1){
		vector<pair<int,int> > vec;
		int n,m,s;
		cin >> n >> m;
		if(n == 0 && m == 0) return 0;
		
		for(int i = 0;i < m;i++) vec.push_back(make_pair(0,i + 1));
		for(int i = 0;i < n;i++){
			for(int j = 0;j < m;j++) {
				cin >> s;
				if(s == 1) vec[j].first++;
			}
		}
		sort(vec.begin(),vec.end(),great());
		cout << vec[0].second;
		for(int i = 1;i < m;i++) cout << " " << vec[i].second;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A;
  1 <= N <= 10000;
  0 <= A <= 1000;
  cin >> N >> A;
 
  if (N / 500 == 0 || N % 500 <= A) {
    cout << "Yes" << endl;
  }
   else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 5100000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int prime[MAX];
bool isprime[MAX];

int sieve(int n){
	int p = 0;
	for(int i=0; i<=n; i++) isprime[i] = true;
	isprime[0] = isprime[1] = false;
	for(int i=2; i<=n; i++){
		if(isprime[i]){
			prime[p++] = i;
			for(int j=2*i; j<=n; j+=i) isprime[j] = false;
		}
	}
	return p;
}

int main(){
	sieve(2020202);
	while(1){
		ll a,d,n; cin >> a >> d >> n;
		if(!a && !d && !n) break;
		ll cnt = 0;
		ll ans;
		for(ll i=a;;i+=d){
			if(isprime[i]) cnt++;
			if(cnt == n){
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 5620
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] values = Stream.of(sc.nextLine().split("")).mapToInt(Integer::parseInt).toArray();

        long ret = 0;
        
        final int max = 1 << values.length - 1;
        for (int i = 0; i < max; i++) {
            int st = 0;
            for (int j = 0; j < values.length; j++) {
                if((i & (1 << j)) != 0){
                    ret += calculate(st, j, values);
                    st = j + 1;
                }
            }
            ret += calculate(st, values.length - 1, values);
        }
        System.out.println(ret);
    }

    private static long calculate(int s, int e, int[] values){
        //out.println(s+" "+e);
        long v = 0;
        for (int i = s; i <= e; i++) {
            v = v * 10 + values[i];
        }
        return v;
    }
}

Measured memory_bytes: 28756
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H=INT_MAX;
  int W=INT_MAX;
  while(H+W!=0){
    cin>>H>>W;
    if(H+W==0)break;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if(i%2==0&&j%2==0){
          cout<<'#';
        }else if(i%2==1&&j%2==0){
          cout<<'.';
        }else if(i%2==0&&j%2==1){
            cout<<'.';
        }else{
            cout<<'#';
        }
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 3088
n = int(input())
from collections import defaultdict
p = defaultdict(int)

def f(n):
    for i in range(2, int(n**0.5) + 1):
        x = 0
        while n%i == 0:
            n //= i
            x += 1
        if x:
            p[i] += x
    
    if n > 1:
        p[n] += 1

for i in range(2, n+1):
    f(i)

from functools import reduce
mod = 10**9+7
print(reduce(lambda x, y:x*(y+1), p.values(), 1)%mod)


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

using namespace std;

int main(){
    int n,a,b,c;
    for(;;){
        cin>>n;
        cin>>a;
        c=n*n;
        if(0<=n&&n<=100&&0<=a&&a<=c){
            b=c-a;
            cout<<b<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int x[110];
int n, ans = 0x3f3f3f3f, dis;

int main()
{
    read(n);
    for (int i = 1; i <= n; ++i)    read(x[i]);
    for (int i = 1; i <= 100; ++i)
    {
        dis = 0;
        for (int j = 1; j <= n; ++j)
            dis += (x[j] - i) * (x[j] - i);
        ans = std::min(ans, dis);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#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>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	map<int,int> ma;
	rep(i,n){
		int d;
		cin>>d;
		ma[d]++;
	}
	int m;
	cin>>m;
	rep(i,m){
		int t;
		cin>>t;
		if(ma[t]==0){
			cout<<"NO"<<endl;
			return;
		}
		ma[t]--;
	}
	cout<<"YES"<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

using namespace std;
#define sz(x) (int)((x).size())
#define forn(i,n) for (int i=0; i < n; i++)
#define forse(i,s,e) for (int i=s; i < e; i++)
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mp make_pair
#define fi first
#define se second
#define all(vec) vec.begin(), vec.end()
#define time() ((double)clock() / CLOCKS_PER_SEC)

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


void solve(){
	int k;cin >> k;
	string in;
	cin >> in;
	if(sz(in)<=k){
		cout << in;
		return;
	}else{
		forn(i,k) cout << in[i];
		cout << "...";
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	forn(c,T){
//		cout << "Case #" << c+1 << ": ";
		solve();
	}
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,w,i,j,a,b;scanf("%lld%lld",&n,&w);
  long long dp[n+1][100001] = {};fill(dp[0],dp[0]+100001,10000000000000);dp[0][0] = 0;
  for(i=0;i<n;i++){
    scanf("%lld%lld",&a,&b);
    for(j=0;j<b;j++) dp[i+1][j] = dp[i][j];
    for(j=b;j<=100000;j++) dp[i+1][j] = min(dp[i][j],dp[i][j-b]+a);
  }
  for(i=100000;i>=0;i--){
    if(dp[n][i]<=w){
      printf("%lld\n",i);return 0;
    }
  }
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	string S, T;
	cin >> S >> T;
	SORT(S);
	REVSORT(T);
	cout << ((S < T) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
def countNum(num):
	count = 0
	for x in range(0,num):
		count += int(inputSeats[x][1]) - int(inputSeats[x][0]) + 1		
	return count

inputSeats = [[]]
if __name__ == '__main__':
	inputNum = int(input())
	# print(type(inputNum))

	for x in range(0,inputNum):
		inputSeat = input()
		inputSeats.append(inputSeat.split())
		# print(inputSeats[x])

	inputSeats.pop(0)
	print(countNum(inputNum))	

Measured memory_bytes: 3316
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep2(i, N, M) for (ll i = N; i < M; i++)
#define pb push_back



typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef priority_queue<pll, vector<pll>, greater<pll>> greater_pq;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}
template<class T>
T getbit( T i) {
	return 1LL<<i;
}

ll sum(ll M, ll  i) {
	if (M < 0) {
		cout << "";
	};
	if (!((M >> i) % 2 )) {
		return M + (1LL << i);
	}
	else if(!atbit(M,i+1)){
		return sum(M,i+2) - getbit(i) + getbit(i+1);
	}
	else {
		return M - getbit(i)-getbit(i+1);
	}
}

int main() {
	ll N;
	cin >> N;
	vll v;
	rep(i, N) {
		ll cnt = 0;
		rep(j, N)if ((i+1)%(j+1) == 0) ++cnt;
		if (cnt == 8&& (i+1)%2==1) v.push_back(i+1);
	}
	 cout << v.size();
	return 0;
}



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

struct usedata{
	int in;
	int out;
	int pc;
};

int main(){
	int n, m;
	while(1){
		cin >> n >> m;
		if(n == 0 || m == 0) break;

		int r, q;
		cin >> r;

		vector<vector<usedata> > student(m);
		vector<vector<usedata> >::iterator stuite;
		vector<usedata>::iterator dataite;
		for(int i = 0; i < r; i++){
			int t, s, n1, m1;
			cin >> t >> n1 >> m1 >> s;
			//stuite = student.begin() + (m1-1);
			stuite = student.begin() + (m1-1);
			dataite = (*stuite).end() -1;
			if(s){
				usedata u;
				u.in = t;
				u.pc = n1;
				(*stuite).push_back(u);
			}else{
				while(1){
					if((*dataite).pc == n1){
						(*dataite).out = t;
						break;
					}else{
						dataite--;
					}
				}
			}
		}

		cin >> q;
		for(int i = 0; i < q; i++){
			int ts, te, m2;
			cin >> ts >> te >> m2;
			int qt = te - ts;
			vector<int> usetime(qt);
			vector<int>::iterator usetimeite = usetime.begin();
			while(usetimeite != usetime.end()){
				*usetimeite = 0;
				usetimeite++;
			}
			stuite = student.begin() + (m2-1);
			dataite = (*stuite).begin();
			while(dataite != (*stuite).end()){
				if(ts < (*dataite).out && (*dataite).in < te){
					int in1 = (*dataite).in;
					int out1 = (*dataite).out;
					if(ts > in1) in1 = ts;
					if(te < out1) out1 = te;
					in1 -= ts;
					out1 -= ts;
					usetimeite = usetime.begin() + in1;
					int j = 0;
					while(j < out1 - in1){
						*usetimeite = 1;
						*usetimeite++;
						j++;
					}

				}
				dataite++;
			}

			int ans = 0;
			usetimeite = usetime.begin();
			while(usetimeite != usetime.end()){
				if(*usetimeite) ans++;
				//cout << *usetimeite;
				usetimeite++;
			}

			cout << ans << endl;

		}
	}

	return 0;
}

Measured memory_bytes: 1500
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL X; cin >> X;
    int ans = 0;
    LL now = 100;
    while(now < X){
        now = LL(now * 1.01);
        ans++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define maxn 500010
#define mod 1000000007
int ans[maxn];
vector<int>b[maxn];
ll c[maxn];
bool cmp(ll p,ll q){
    return p>q;
}
ll sum=0;
int cnt=0;
void sol(int x,int f){
    ans[x]=c[cnt++];
    if(f!=0) sum+=ans[x];
    for(int i=0;i<b[x].size();i++){
        if(b[x][i]!=f){
            sol(b[x][i],x);
        }
    }
}
int main(){
    int n;
    scanf("%d",&n);
    int x,y;
    for(int i=0;i<n-1;i++){
        scanf("%d%d",&x,&y);
        b[x].push_back(y);
        b[y].push_back(x);
    }
    for(int i=0;i<n;i++) scanf("%lld",&c[i]);
    sort(c,c+n,cmp);
    sol(1,0);
    printf("%lld\n",sum);
    for(int i=1;i<=n;i++) printf("%lld ",ans[i]);
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    lint K, N;
    cin >> K >> N;
    vector<lint> A(N, 0);
    rep(i, N) cin >> A[i];
    lint ma = A[0] + (K - A[N - 1]);
    d(ma);
    rep(i, N - 1) { ma = max(ma, abs(A[i + 1] - A[i])); }
    cout << K - ma << endl;
    return 0;
}


Measured memory_bytes: 1792
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;

const int N=200;
int w[N];


int main(){	
	int n;cin>>n;
	For(i,0,n)cin>>w[i];
	int mx=INT_MAX;
	For(i,0,n-1){
		int sum1=0,sum2=0;
		For(j,0,i+1)sum1+=w[j];
		For(j,i+1,n)sum2+=w[j];
		mx=min(mx,abs(sum1-sum2));
	}
	cout<<mx<<endl;

	return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int i;
        for (i = 1; i <= N; i *= 2);
        System.out.println(i / 2);
    }
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    long long A,B,sub=0,num=0;
    set<long long>s;
    map<long long,long long>m;
    for(int i=0;i<N;i++){
        cin>>A>>B;
        m[A]+=B;
        s.insert(A);
    }
    for(auto itr=s.begin();true;itr++){
        if(m[*itr]+num>=M){
            sub+=*itr*(M-num);
            break;
        }
        sub+=*itr*m[*itr];
        num+=m[*itr];
    }
    cout<<sub<<endl;
}

Measured memory_bytes: 11136
#abc 166
#c
n,m = map(int, input().split())
h_list = list(map(int, input().split()))
e_list = [1]*n
for i in range(m):
    a,b = map(int, input().split())
    if h_list[a-1]  == h_list[b-1]:
        e_list[a-1] = 0
        e_list[b-1] =0
    elif h_list[a-1]  <  h_list[b-1]:
        e_list[a-1] = 0
    elif h_list[a-1]  > h_list[b-1]:
        e_list[b-1] =0

print(sum(e_list))
        

Measured memory_bytes: 20096
#include <iostream>
#include <math.h>

using namespace std;

int main() {
    int A,B,C;
    cin>>A >> B >> C;
    int sum=0;
    if(C-B>A){
        cout << 2*B+A+1 << endl;
    }else{
        cout << B+C << endl;
    } 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K, Q; cin >> N >> K >> Q;
    vec p(N, K - Q);
    vec A(Q); cin >> A;
    REP(i, Q) p[A[i] - 1]++;
    REP(i, N){
        Ans(p[i] > 0, "Yes", "No");
    }

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

using namespace std;

int main() {
    nl // youtu.be/QosiU0JR_h8  
    int n, k, p[1010];
    cin >> n >> k;
    for(int i=0; i<n; ++i) cin >> p[i];
    sort(p, p+n);
    int sum = 0;
    for(int i=0; i<k; ++i) sum += p[i];
    cout << sum;
    return 0;
}

Measured memory_bytes: 3588
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String s = sc.next();
		if(a < 3200) {
			s = "red";
		}
		
		System.out.println(s);
	}

}


Measured memory_bytes: 21200
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll query(string str){
	cout << "? " << str << endl;
	ll ret;cin >> ret;
	return ret;
}

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

	ll L = 128;
	string index = "";
	for(char c = 'a';c <= 'z';c++)index += c;
	for(char c = 'A';c <= 'Z';c++)index += c;
	for(char c = '0';c <= '9';c++)index += c;

	priority_queue<P, vector<P>, greater<> > pq;
	ll string_length = 0;
	REP(i, index.size()){
		ll num = L - query(string(L, index[i]));
		pq.push(MP(num, string(num, index[i])));
		string_length += num;
	}

	while(pq.size() > 1){
		auto a = pq.top();pq.pop();
		auto b = pq.top();pq.pop();

		string now = a.SE;
		ll pla = 0;
		ll cou = 0;

		while(cou < b.FI){
			string tmp = now;
			tmp.insert(pla, 1, b.SE[cou]);
			ll ret = query(tmp);
			if(ret == string_length - tmp.size()){
				now = tmp;
				cou++;
			}
			pla++;
		}
		pq.push(MP(now.size(), now));
	}

	cout << "! " << pq.top().SE << endl;
	return 0;
}


Measured memory_bytes: 3768
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
    }

    let ans = if a <= 9 && b <= 9 { a * b } else { -1 };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main() {
	int a, b ,c;
	cin >> a >> b >> c;
	int cnt = 0;
	if (a == b)cnt++;
	if (a == c)cnt++;
	if(b==c)cnt++;
	if (cnt == 1)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

void Main()
{
	int N;
	cin >> N;
	vector<double> A(N, 0.0);
	double denominator = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		denominator += 1 / A[i];
	}

	cout << setprecision(10) << 1 / denominator;
}
 
int main()
{
	Main();
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
string st;
int main()
{
	cin>>st;
	cout<<st[0]<<st.size()-2<<st[st.size()-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
A,B=map(int,input().split())
ABS=abs((A-B)/2)
if (A-B)%2==0:
    ans=[A-ABS,A+ABS,B-ABS,B+ABS]
    for k in ans:
        if abs(A-k)==abs(B-k):
            print(int(k))
            break
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 3060
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<stw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
#define M 1000000007

long Pow(long a,long n){
    long ret = 1;
    for(;n>0;n/=2,a=a*a%M){
        if(n%2==1){                 
            ret = ret * a % M;
        }
    }
    return ret;
}

long C(long n,long a){
    long X = 1,Y = 1;
    long ans;
    for(int i=1;i<=a;i++){
        X = X * (n - i + 1) % M;
        Y = Y * i % M;
    }
    ans = X * Pow(Y,M-2) % M;
    return ans;
}

int main(void){
    long n,a,b;cin>>n>>a>>b;
    long ans = Pow(2,n) - 1;
    ans = ans - C(n,a) - C(n,b);
    if(ans < 0){
        ans += 2*M;
        ans %= M;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace Ex160425_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);

            if(a < b) Console.WriteLine("a < b");
            if(a > b) Console.WriteLine("a > b");
            if(a == b) Console.WriteLine("a == b");
        }
    }
}

Measured memory_bytes: 8808
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  ull X, Y;
  cin >> X >> Y;
  int cnt = 0;
  while (X <= Y) {
    cnt++;
    X *= 2;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256