akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};


int main(){
	init();
	ll N,M;cin>>N>>M;
	vector<ll>A(N);
	vector<pair<ll,ll>>v;
	for(int i=0;i<N;i++){
		cin>>A[i];
		v.push_back(make_pair(A[i],1));
	}
	for(int i=0;i<M;i++){
		ll b,c;cin>>b>>c;
		v.push_back(make_pair(c,b));
	}
	sort(v.begin(),v.end(),greater<>());
	ll num=N;
	ll ans=0;
	for(int i=0;i<v.size();i++){
		//cout<<v[i].first<<endl;
		if(num<=0)break;
		ans+=(v[i].first*min(num,v[i].second));
		num-=v[i].second;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 7280
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main() {
	int N;
	cin >> N;
	string a[100010], s[4] = {"AC","WA","TLE","RE"};
	int count[4] = { 0 };
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] == "AC") {
			count[0]++;
		}
		else if (a[i] == "WA") {
			count[1]++;
		}
		else if (a[i] == "TLE") {
			count[2]++;
		}
		else {
			count[3]++;
		}
	}
	for (int i = 0; i < 4; i++) {
		cout << s[i] << " x " << count[i] << endl;
	}
}

Measured memory_bytes: 5496
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
	int B = sc.nextInt();
	int C = sc.nextInt();
	int D = sc.nextInt();
	if(B - C <= 0 || D - A <= 0){
		System.out.println(0);
	}else{
		System.out.println(Math.min(B,D) - Math.max(A,C));
	}
	}
}


Measured memory_bytes: 21972
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<deque>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
#define M 1000000007
int n, m;
int si, sj;
int ei, ej;
char a[1009][1009];
int d[1009][1009];
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		lld res = 0;
		scanf("%d %d", &n, &m);
		scanf("%d %d", &si, &sj);
		si--; sj--;
		scanf("%d %d", &ei, &ej);
		ei--; ej--;
		for (i = 0; i < n; i++) {
			scanf("%s", a[i]);
			for (j = 0; j < m; j++) {
				d[i][j] = -1;
			}
		}
		d[si][sj] = 0;
		deque<pii> que[2];
		int cur = 0;
		int nxt = 1;
		que[0].push_back(pii(si, sj));
		d[si][sj] = 0;
		int dx[4] = { 0,1,0,-1 };
		int dy[4] = { 1,0,-1,0 };
		int dist = 0;
		while (1) {
			if (que[cur].empty())break;
			while (!que[cur].empty()) {
				pii qq = que[cur].front();
				que[cur].pop_front();
				int qi = qq.first;
				int qj = qq.second;
				if (d[qi][qj] < dist)continue;
				for (k = 0; k < 4; k++) {
					int ti = qi + dx[k];
					int tj = qj + dy[k];
					if (ti >= 0 && ti < n && tj >= 0 && tj < m)
					if (a[ti][tj] == '.' && (d[ti][tj] == -1 || d[ti][tj] > d[qi][qj])) {
						d[ti][tj] = d[qi][qj];
						que[cur].push_front(pii(ti, tj));
					}
				}
				for (int di = -2; di <= 2; di++) {
					for (int dj = -2; dj <= 2; dj++) {
						int ti = qi + di;
						int tj = qj + dj;
						if(ti>=0 && ti<n && tj>=0 && tj<m)
						if (a[ti][tj] == '.' && d[ti][tj] == -1) {
							d[ti][tj] = d[qi][qj] + 1;
							que[nxt].push_front(pii(ti, tj));
						}
					}
				}
			}
			cur ^= 1;
			nxt ^= 1;
			dist++;
		}
		printf("%d\n", d[ei][ej]);
	}
	return 0;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    map<char, char> r;
    map<char, char> r2;

    for (int i = 0; i < s.size(); i++)
    {
        if (r.count(s[i]))
        {
            if (r[s[i]] != t[i])
            {
                cout << "No" << endl;
                return 0;
            }
        }
        if (r2.count(t[i]))
        {
            if (r2[t[i]] != s[i])
            {
                cout << "No" << endl;
                return 0;
            }
        }
        r[s[i]] = t[i];
        r2[t[i]] = s[i];
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include    <iostream>
#include    <cstdio>
#include    <string>
#include    <map>

using namespace std;

int main() {
    map<string, int> blood;
    int id;
    char _t[2];
    string type;

    while(~scanf("%d,%s", &id, _t)) {
        type = _t;
        blood[type]++;
    }
    cout << blood["A"] << endl;
    cout << blood["B"] << endl;
    cout << blood["AB"] << endl;
    cout << blood["O"] << endl;

    return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

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


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< vector< pair< int, int > > > tap(N);
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    while(a--) {
      int x, y;
      cin >> x >> y;
      --x;
      tap[i].emplace_back(x, y);
    }
  }
  int ret = 0;
  for(int i = 1; i < (1 << N); i++) {
    bool ok = true;

    vector< int > nani(N, -1);
    for(int j = 0; j < N; j++) {
      if((i >> j) & 1) nani[j] = 1;
      else nani[j] = 0;
    }
    for(int j = 0; j < N; j++) {
      if((i >> j) & 1) {
        for(auto &p : tap[j]) {
          ok &= nani[p.first] == p.second;
        }
      }
    }
    if(ok) {
      chmax(ret, __builtin_popcount(i));
    }
  }
  cout << ret << endl;
}





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

ll dp[3300][3300];


int main(){
  int N;
  cin>>N;
  ll a[N];
  rep(i,N) cin>>a[i];


  for (int width = 1; width<=N; width++){
    for(int i = 0; i + width <= N; i++){
        int r=i+width;
        if(width % 2 == N%2){
          dp[i][r] = max(dp[i+1][r] + a[i],dp[i][r-1] + a[r-1]);
        }else{
          dp[i][r] = min(dp[i+1][r] - a[i], dp[i][r-1] - a[r-1]);
        }
    }
  }

cout<< dp[0][N];

}


Measured memory_bytes: 78080
#include<iostream>

using namespace std;

int main(){
  int a, b;
  string op;
  cin >> a >> op >> b; 
  while (op != "?"){
    if (op == "+"){
      cout << a + b << endl;
    } else if (op == "-"){
      cout << a - b << endl;
    } else if (op == "*"){
      cout << a * b << endl;
    } else {
      cout << a / b << endl;
    }
   cin >> a >> op >> b; 
  }
 return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int x[1000],y[1000];
bool hv[1010][1010];
int ansx[100000],ansy[100000],all=0;
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n==-1)
	{
		cout<<-1<<endl;
		return 0;
	}
	if(n%2==0)
	{
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
			{
				if(j==n-i+1)continue;
				all++,ansx[all]=i,ansy[all]=j;
			}
	}
	if(n%4==1)
	{
		for(int i=1;i<n;i++)
			all++,ansx[all]=i,ansy[all]=n;
		for(int i=1;i<=n;i++)hv[i][i]=true;
		for(int i=1;i<=(n-1)/2;i++)
		{
			int a=i,c=n-i;
			for(int j=1;j<n;j++)
				if(j!=c&&!hv[a][j]&&!hv[j][a])all++,ansx[all]=a,ansy[all]=j,hv[a][j]=hv[j][a]=true;
			for(int j=1;j<n;j++)
				if(j!=a&&!hv[c][j]&&!hv[j][c])all++,ansx[all]=c,ansy[all]=j,hv[c][j]=hv[j][c]=true;
		}
	}
	if(n%4==3)
	{
		int cnt=0;
		for(int i=1;i<=(n-3)/2;i+=2)
			x[++cnt]=i,y[cnt]=i+1,x[++cnt]=n-3-i+1,y[cnt]=n-3-i;
		for(int i=1;i<=cnt;i++)
			x[i]+=3,y[i]+=3;
		int cnt2=cnt;
		x[++cnt]=1,x[++cnt]=2;
		y[++cnt2]=3;
		for(int i=1;i<=cnt;i++)
			for(int j=1;j<=cnt2;j++)
				all++,ansx[all]=x[i],ansy[all]=y[j];
	}
	cout<<all<<endl;
	for(int i=1;i<=all;i++)
		cout<<ansx[i]<<" "<<ansy[i]<<endl;
	return 0; 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, i, j, k;
    cin >> n;
    long long dp[n][n] = {0}, a[n];
    cin >> a[0];
    for(i = 1; i < n; ++i) {
        cin >> a[i];
        a[i] += a[i-1];
    }
    for(j = 1; j < n; ++j)
        for(i = 0; i < n-j; ++i) {
            dp[i][i+j] = 1e17;
            for(k = i; k < i+j; ++k)
                dp[i][i+j] = min(dp[i][i+j], dp[i][k] + dp[k+1][i+j] + a[i+j] - (i>0 ? a[i-1] : 0));
        }
    cout << dp[0][n-1];
    return 0;
}

Measured memory_bytes: 4820
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

S, W = LI()

if S > W:
    print("safe")
else:
    print("unsafe")

Measured memory_bytes: 71684
x, y,z,K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

result = []
for i,a in enumerate(A):
    for j,b in enumerate(B):
        if (i + 1) * (j + 1) > K:
            break
        for k,c in enumerate(C):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            else:
                result.append(a + b + c)

result.sort(reverse=True)
for i, r in enumerate(result):
    print(r)
    if i == K -1 :
        break

Measured memory_bytes: 8708
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

typedef struct p{ll x,y;}P;
int psort(const void*a,const void*b){
	P*p=(P*)a,*q=(P*)b;
	if((*p).x<(*q).x)return -1;
	if((*p).x>(*q).x)return  1;
	if((*p).y>(*q).y)return -1;
	if((*p).y<(*q).y)return  1;
	return 0;
}

P a[200010];

//int PQhikaku(int i,int j);//jの方が優先度が高いならtrueを返す
int PQhikaku(ll*heap,int i,int j){return a[heap[i]].y>a[heap[j]].y;}
void heap_utod(ll*heap,int n){
	if(2*n>heap[0])return;
	int rflag=(2*n+1<=heap[0])&&(PQhikaku(heap,2*n,2*n+1));
	if(PQhikaku(heap,n,2*n+rflag)){
		ll temp=heap[2*n+rflag];
		heap[2*n+rflag]=heap[n];
		heap[n]=temp;
		heap_utod(heap,2*n+rflag);
	}
}
void heap_dtou(ll*heap,int n){
	if(n==1||PQhikaku(heap,n,n/2))return;
	ll temp=heap[n];
	heap[n]=heap[n/2];
	heap[n/2]=temp;
	heap_dtou(heap,n/2);
}
ll PQpop(ll*heap){
	if(heap[0]==0)return -1;
	ll rr=heap[1];
	heap[1]=heap[heap[0]--];
	heap_utod(heap,1);
	return rr;
}
void PQpush(ll*heap,ll n){
	heap[++heap[0]]=n;
	heap_dtou(heap,heap[0]);
}

ll h[200010];
int n;
int k[200010],l[200010],r[200010];
void solve(){
	scanf("%d",&n);
	rep(i,0,n)scanf("%d%d%d",k+i,l+i,r+i);
	ll ans=0;
	//l>r
	int cnt=0;
	h[0]=0;
	rep(i,0,n)if(l[i]>r[i]){
		a[cnt].x=k[i];
		a[cnt].y=l[i]-r[i];
		cnt++;
		ans+=r[i];
	}
	qsort(a,cnt,sizeof(P),psort);
	int in=0;
	rep(i,0,cnt){
		if(a[i].x>=in+1){
			ans+=a[i].y;
			PQpush(h,i);
			in++;
		}else{
			int t=PQpop(h);
			if(t!=-1){
				if(a[t].y<a[i].y){
					ans-=a[t].y;
					ans+=a[i].y;
					PQpush(h,i);
				}else{
					PQpush(h,t);
				}
			}
		}
	}
	//l<r
	cnt=0;
	h[0]=0;
	rep(i,0,n)if(l[i]<r[i]){
		a[cnt].x=n-k[i];
		a[cnt].y=r[i]-l[i];
		cnt++;
		ans+=l[i];
	}
	qsort(a,cnt,sizeof(P),psort);
	in=0;
	rep(i,0,cnt){
		if(a[i].x>=in+1){
			ans+=a[i].y;
			PQpush(h,i);
			in++;
		}else{
			int t=PQpop(h);
			if(t!=-1){
				if(a[t].y<a[i].y){
					ans-=a[t].y;
					ans+=a[i].y;
					PQpush(h,i);
				}else{
					PQpush(h,t);
				}
			}
		}
	}
	//l==r
	rep(i,0,n)if(l[i]==r[i])ans+=l[i];
	printf("%lld\n",ans);
}


int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		solve();
	}
}

Measured memory_bytes: 7948
import java.util.*;
public class Main{
   public static void main(String[]args){

      Scanner sc = new Scanner(System.in);
      int S = sc.nextInt();

      int h = S/3600;
      int m = S%3600/60;
      int s = S%3600%60;

      System.out.println(h+":"+m+":"+s);

   }
}

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

const int ZERO=8000;
string s;
int x,y;

int main(){
  string s;
  cin>>s;
  int x,y;
  cin>>x>>y;
  int n=s.length();
  vector<vector<int> > v(2);
  int turn=0,cnt=0;
  for(int i=0;i<n;i++){
    if(s[i]=='T'){
      if(turn==0){
        cnt=0;
        turn++;
        continue;
      }
      if(cnt!=0) v[turn%2].push_back(cnt);
      cnt=0;
      turn++;
    }else{
      cnt++;
    }
  }
  if(cnt!=0&&turn!=0) v[turn%2].push_back(cnt);
  int dpx[v[0].size()+1][16010]={};
  int dpy[v[1].size()+1][16010]={};
  cnt=0;
  for(int i=0;i<n;i++){
    if(s[i]=='T') break;
    else cnt++;
  }
  dpx[0][ZERO+cnt]=1;
  for(int i=0;i<v[0].size();i++){
    for(int j=0;j<=16000;j++){
      if(j-v[0][i]>=0) dpx[i+1][j]=dpx[i][j-v[0][i]];
      if(j+v[0][i]<=16000) dpx[i+1][j]=dpx[i+1][j]+dpx[i][j+v[0][i]];
    }
  }
  dpy[0][ZERO]=1;
  for(int i=0;i<v[1].size();i++){
    for(int j=0;j<=16000;j++){
      if(j-v[1][i]>=0) dpy[i+1][j]=dpy[i][j-v[1][i]];
      if(j+v[1][i]<=16000) dpy[i+1][j]=dpy[i+1][j]+dpy[i][j+v[1][i]];
    }
  }
  if((dpx[v[0].size()][ZERO+x]!=0)&&(dpy[v[1].size()][ZERO+y]!=0)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 250496
#include<iostream>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int n, m;
    cin >> n >> m;
    string a[n];
    string b[m];
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    rep(i, n)rep(j, n){
        if (n - i < m || n - j < m){
            continue;
        }
        bool flag = true;
        rep(k, m)rep(l, m){
            if (a[i+k][j+l] != b[k][l]){
                flag = false;
                break;
            }
        }
        if (flag){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

//const double EPS 1e-10;
int a[20][20];
int main()
{
    int n,d;
    double EPS=1e-10;
    cin >> n >> d;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<d;j++)
        {
            cin >> a[i][j];
        }
    }

    int sum=0;
    for(int k=0;k<n;k++)
    {

    for(int i=k+1;i<n;i++)
    {
        double ans=0;
        for(int j=0;j<d;j++)
        {
            ans+=(a[i][j]-a[k][j])*(a[i][j]-a[k][j]);
        }
        double ans1=sqrt(ans);
        if(ans1-floor(ans1)<EPS)
           sum++;
    }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
 using namespace std;
 int main() {
    float m,count=0,sum=0,x;
    int n,i;
    cin>>n>>m;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    x=sum*(1/(4*m));
   // cout<<x<<" ";
    for(i=0;i<n;i++)
    {
        if(a[i]>=x)
        {
            count++;
        }
    }
    //cout<<count;
    if(count>=m)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }


 }



Measured memory_bytes: 3112
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.sql.Array;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }


    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n,k,q;
            n=in.nextInt();
            k=in.nextInt();
            q=in.nextInt();
            int[] correct = new int[n+1];
            for (int i = 0; i <q ; i++) {
                correct[in.nextInt()]++;
            }
            for (int i = 1; i <=n ; i++) {
                if (k-(q-correct[i]) > 0) System.out.println("Yes");
                else System.out.println("No");
            }


        }



    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    cout<<std::fixed<<std::setprecision(10);

    int N; cin >> N;
    if (N==1) {
        cout << "Hello World" << endl;
    } else if (N==2) {
        int A,B; cin >> A >> B;
        cout << A+B << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a[5];
	int k;

	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;

	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			if (k < a[j] - a[i]) {
				cout << ":(" << endl;
				return 0;
			}
		}
	}

	cout << "Yay!" << endl;
}

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

using namespace std;

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

		int ans = S.size();

		for ( int i = 0; i < 2; i++ ) {
				int cnt = 0;
				for ( int j = 0; j < S.size(); j++ ) {
						if ( j % 2 == 0 && S[j] != (char) (i + '0')) cnt++;
						if ( j % 2 == 1 && S[j] == (char) (i + '0')) cnt++;
				}
				ans = min(ans, cnt);
		}

		cout << ans << endl;

		return 0;
}


Measured memory_bytes: 512
n = int(input())
A = []
B = []
for _ in range(n):
    v1, v2 = list(map(int, input().split(' ')))
    A.append(v1)
    B.append(v2)

A.sort()
B.sort()

if n % 2:
    print(B[n//2] - A[n//2] + 1)
else:
    print((B[n//2]+B[n//2-1]) - (A[n//2]+A[n//2-1]) + 1)

Measured memory_bytes: 25424
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

const string YES = "Yes";
const string NO = "No";

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

  ll maxr, maxg, a, b, c, ans;
  cin >> maxr >> maxg >> a >> b >> c;
  int r[100000 + 3], g[100000 + 3], n[100000 + 3];

  rep(i, a) cin >> r[i];
  rep(i, b) cin >> g[i];
  rep(i, c) cin >> n[i];

  sort(r,r+a, greater<ll>());
  sort(g,g+b, greater<ll>());
  sort(n,n+c, greater<ll>());

  vector<int> v;
  rep(i, maxr) v.push_back(r[i]);
  rep(i, maxg) v.push_back(g[i]);
  rep(i, min(maxr+maxg,c)) v.push_back(n[i]);

  sort(range(v), greater<ll>());
  rep(i, maxr + maxg) ans += v[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        System.out.println((int) Math.ceil((double) (n - k) / (k - 1) + 1));
    }

}


Measured memory_bytes: 51176
#-*-coding:utf-8-*-

def main():
    n = int(input())
    arrys = [tuple(map(int, input().split())) for _ in range(n)]
    for i in range(101):
        for j in range(101):
            for arry in arrys:
                x_tmp, y_tmp, h_tmp = arry
                if h_tmp != 0:
                    break
            H = h_tmp + abs(x_tmp - i) + abs(y_tmp - j)
            flag = 1
            for arry in arrys:
                x_t, y_t, h_t = arry
                if h_t == max(H - abs(x_t - i) - abs(y_t - j), 0):
                    flag *= 1
                else:
                    flag *= 0
            if flag == 1:
                print(i, j, H)
                exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int b[m], a[n][m];
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    long long here = 0;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      here += 1ll * a[i][j] * b[j];
    }
    if (here + c > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> board(n);
  for (int i = 0; i < n; ++i) {
    cin >> board[i];
  }
  vector<vector<vector<int>>> dp(n, vector<vector<int>>(n, vector<int>(m)));
  for (int l = n - 1; ~l; --l) {
    for (int r = l; r < n; ++r) {
      for (int h = m - 1; ~h; --h) {
        if (l == r || (board[l][h] == board[l + 1][h] && dp[l + 1][r][h] > h)) {
          if (h + 1 < m && board[l][h] == board[l][h + 1]) {
            dp[l][r][h] = dp[l][r][h + 1];
          } else {
            dp[l][r][h] = h + 1;
          }
        } else {
          dp[l][r][h] = h;
        }
      }
    }
  }
  int ans = 0;
  while (dp[0][n - 1][0] < m) {
    vector<vector<vector<int>>> new_dp(n, vector<vector<int>>(n, vector<int>(m)));
    for (int l = n - 1; ~l; --l) {
      for (int r = l; r < n; ++r) {
        for (int h = m - 1; ~h; --h) {
          new_dp[l][r][h] = dp[l][r][h] < m ? dp[l][r][dp[l][r][h]] : m;
          if (l < r) {
            int low = l, high = r - 1;
            while (low <= high) {
              int mid = (low + high) >> 1;
              new_dp[l][r][h] = max(new_dp[l][r][h], min(dp[l][mid][h], dp[mid + 1][r][h]));
              if (dp[l][mid][h] > dp[mid + 1][r][h]) {
                low = mid + 1;
              } else {
                high = mid - 1;
              }
            }
          }
        }
      }
    }
    swap(dp, new_dp);
    ans++;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 54476
import java.util.*;

public class Main {

    private int A;
    private int B;
    private int C;
    private int D;

    public void inputData() {
        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        D = sc.nextInt();
    }

    public void printAnswer() {
        int num1 = Math.min(A, B);
        int num2 = Math.min(C, D);
        System.out.println(num1 + num2);
    }

    public void run() {
        inputData();
        printAnswer();
    }

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

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 200001;
const int MOD = 1000000007;
//
int 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;
    }
}

// 二項係数計算
int 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;
}
int modpow(int a, int n, int mod) {
    int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
        signed main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))cout<<"Yes";
    else cout<<"No";
      }

        


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef vector<int> vi;

#define mp make_pair
#define pb push_back

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
 
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
 
const int MOD = 1000000007;
double PI = 4*atan(1);

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll A,B,C; cin >> A >> B >> C;
	vector<ll> x;
	if (((A%2) + (B%2) + (C%2)) < 3) cout << 0;
	else {
		x.pb(A); x.pb(B); x.pb(C);
		sort(x.begin(),x.end());
		cout << x[0]*x[1];
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int p[9][9];

int he(int, int);
int le(int, int);
int sq(int, int);

int main() {

	int n;

	cin >> n;
	for(int c=0; c<n; c++) {
		if(c) {
			cout << endl;
		}
		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				cin >> p[i][j];
			}
		}
							
		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				cout << ((he(i, j)||le(i, j)||sq(i, j)) ? "*" : " ") << p[i][j];
			}
			cout << endl;
		}
	}

	return 0;

}


int he(int i, int j) {

	int f=0;

	for(int k=0; k<9; k++) {
		if(p[i][j]==p[k][j]&&!(i==k)) {
			f++;
		}
	}
	return (f ? 1 : 0);

}


int le(int i, int j) {

	int f=0;

	for(int l=0; l<9; l++) {
		if(p[i][j]==p[i][l]&&!(j==l)) {
			f++;
		}
	}
	return (f ? 1 : 0);

}


int sq(int i, int j) {

	int f=0, x=(i/3)*3, y=(j/3)*3;

	for(int k=x; k<x+3; k++) {
		for(int l=y; l<y+3; l++) {
			if(p[i][j]==p[k][l]&&!(i==k&&j==l)) {
				f++;
			}
		}
	}
	return (f ? 1 : 0);

}

Measured memory_bytes: 0
sx, sy, tx, ty = map(int, raw_input().split())
print ("R" * (tx-sx)) + ("U" * (ty - sy)) + ("L" * (tx-sx)) + ("D" * (ty - sy)) + "D" + ("R" * (tx-sx+1)) + ("U" * (ty - sy+1)) + "LU" + ("L" * (tx-sx+1)) + ("D" * (ty - sy+1)) + "R"

Measured memory_bytes: 2568
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    string s;
    cin >> s;

    int ans = 0;
    rep(i, s.size()) {
        if(s[i] == '1') {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
def input():
    return stdin.readline().strip()

n, a, b = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))

# binary search
sum_h = sum(h)

left = sum_h // (a + b*(n-1))
right = min([sum_h//a + n, max(h)//b + 1])

while left < right:
    center = (left + right) // 2

    base = center * b
    num = 0
    for i in h:
        i -= base
        if i > 0:
            num += (i - 1) // (a - b) + 1

    if num <= center:
        right = center
    else:
        left = center + 1

print(left)

Measured memory_bytes: 77140
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}

int main() {
  int n; cin>>n;
  ll a[n]; for(int i=0;i<n;i++) cin>>a[i];
  int an=1, nw=a[0], up=0;
  for(int i=1;i<n;i++) {
    if (up == 0) {
      if (nw < a[i]) {
        nw = a[i]; up = 1;
      } else if (nw > a[i]) {
        nw = a[i]; up = -1;
      }
    } else if (up == 1) {
      if (nw <= a[i]) nw = a[i];
      else an++,up=0,nw=a[i];
    } else {
      if (nw >= a[i]) nw=a[i];
      else an++,up=0,nw=a[i];
    }
  }
  cout<<an<<endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String input = br.readLine();
//		String[] tmpArray = input.split(" ");
//		int n = Integer.parseInt(tmpArray[0]);
//		int a = Integer.parseInt(tmpArray[1]);
//		int b = Integer.parseInt(tmpArray[2]);
		int n = Integer.parseInt(input);
		
		System.out.println((24-n)+24);
	}

}


Measured memory_bytes: 20948
/*
Problem :
Algorithm :
Status :
*/
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define DEBUG printf("Passing Line %d in Function [%s].\n",__LINE__,__FUNCTION__);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const ll INF = 1e18;

int T;
ll A,B,C,D,N;
map<ll,ll> mp;

ll Solve(ll x){
    if(!x)
        return 0;
    if(x == 1)
        return D;
    if(mp.find(x) != mp.end())
        return mp[x];
    ll res = INF;
    if(x < res / D)
        res = x * D;
    res = min(res,x % 2 * D + Solve(x / 2) + A);
    res = min(res,(2 - x % 2) * D + Solve((x + 1) / 2) + A);
    res = min(res,x % 3 * D + Solve(x / 3) + B);
    res = min(res,(3 - x % 3) * D + Solve((x + 2) / 3) + B);
    res = min(res,x % 5 * D + Solve(x / 5) + C);
    res = min(res,(5 - x % 5) * D + Solve((x + 4) / 5) + C);
    mp[x] = res;
    return res;
}

int main(){
    // freopen("data.in","r",stdin);
    // freopen("data.out","w",stdout);
    scanf("%d",&T);
    while(T--){
        scanf("%lld",&N);
        scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
        mp.clear();
        printf("%lld\n",Solve(N));
    }
    return 0;
}

Measured memory_bytes: 4576
//Keep working hard :)
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long

const int N = 1e5+5;
int a[N];

void fileIO()
{
        #ifndef ONLINE_JUDGE
        freopen("int.txt","r",stdin);
        freopen("out.txt","w",stdout);
        #endif
}
int main()
{
	IOS;
       // fileIO();
        multimap<pair<string,int>,int> mp;
        int n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
                string s;
                int dat;
                cin >> s >> dat;
                pair<pair<string,int>,int> p = {{s,100-dat},i+1};
                mp.insert(p);
        }
        int j = 1;
        for (auto itr = mp.begin(); itr != mp.end(); itr++)
        {
                cout << itr->second<<"\n";
        }
	return 0;
}


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

int main(){
  int H,W;
  cin>>H>>W;
  string S="##";
  
  for(int i=0;i<W;i++)
    S+='#';
  
    cout<<S<<endl;
  
  for(int i=0;i<H;i++){
    vector<string> vec(H);
    cin>>vec.at(i);
    cout<<'#'+vec.at(i)+'#'<<endl;
  }
  cout<<S<<endl;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
w = [0] * N
v = [0] * N

for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0] * (100001) for i in range(N + 1)]
for i in range(1, 100001):
    dp[0][i] = 10 ** 20

for j in range(N):
    for i in range(1, 100001):
        if v[j] > i:
            dp[j + 1][i] = dp[j][i]
        else:
            dp[j + 1][i] = min(dp[j][i], dp[j][i - v[j]] + w[j])

ans = 0
for i in range(100000, -1, -1):
    if dp[N][i] <= W:
        ans = i
        break

print(ans)

Measured memory_bytes: 184944
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		int A[]=new int[N];
		for(int i=0;i<N;i++)A[i]=in.nextInt();
		Arrays.sort(A);
		if(A[0]!=0&&N%2==1){
			System.out.println(0);
			System.exit(0);
		}
		for(int i=N-1;i>0;i-=2){
			if(A[i]!=A[i-1]){
				System.out.println(0);
				System.exit(0);
			}
		}
		long ans=1;
		for(int i=0; i<N/2; i++)ans = 2*ans%1000000007;
		System.out.println(ans);

		in.close();
	}

}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

struct Mystruct
{
    long long atack;
    long long mp;
    double cost;

    Mystruct(long long input_a, long long input_b)
    {
        atack = input_a;
        mp = input_b;
        cost = input_a * 1.0 / input_b;
    }
    bool operator<(const Mystruct &another) const
    {
        if (cost == another.cost)
        {
            return mp < another.mp;
        }
        return cost < another.cost; //年齢を比較
    };
};

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

    VI v(n);

    REP(i,n){
        cin>>v[i];
    }

    SORT(v);
    UNIQUE(v);

    if(v.size() == n){
        ANS("YES");
    }
    else{
        ANS("NO");
    }
    return 0;
}


Measured memory_bytes: 1024
from collections import deque
N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()

que = deque([])
ans = 0
total = 0

for i in range(N):
    x, h = XH[i]
    if h <= 0:
        continue
    while que and XH[i][0] > que[0][0]:
        _, tmp = que.popleft()
        total -= tmp

    h -= total
    if h > 0:
        atk = (h + A - 1) // A
        damage = atk * A
        ans += atk
        total += damage
        que.append((x+2*D, damage))

print(ans)


Measured memory_bytes: 66368
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a1.extend(a2)
a3 = list(map(int, input().split()))
a1.extend(a3)

n = int(input())

b = [int(input()) for _ in range(n)]

l = []
for x in a1:
    if x in b:
        l.append('o')
    else:
        l.append('x')

if l[0] == l[1] == l[2] == 'o' or l[3] == l[4] == l[5] == 'o' or l[6] == l[7] == l[8] == 'o' or l[0] == l[3] == l[6] == 'o' or l[1] == l[4] == l[7] == 'o' or l[2] == l[5] == l[8] == 'o' or l[0] == l[4] == l[8] == 'o' or l[2] == l[4] == l[6] == 'o' :
    print('Yes')
else:
    print('No')

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

typedef struct xy{
  double x,y;
}XY;

void Koch(int n,XY a,XY b){
  if(n == 0) return;
  XY s,t,u;
  double th = M_PI*60.0/180.0;

  s.x = (2.0*a.x + 1.0*b.x)/3.0;
  s.y = (2.0*a.y + 1.0*b.y)/3.0;
  t.x = (1.0*a.x + 2.0*b.x)/3.0;
  t.y = (1.0*a.y + 2.0*b.y)/3.0;
  u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
  u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

  Koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  Koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  Koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  Koch(n-1,t,b);
}
  
int main()
{
  int n;
  XY a,b;
  
  scanf("%d",&n);
  
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;
  
  printf("%.8f %.8f\n",a.x,a.y);
  Koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



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

using ll = long long;
using ld = long double;
const ld PI = 3.14159265358979323846264338327950L;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int tc = 1;
    // cin >> tc;
    while(tc--) {
        int a, b, h, m;
        cin >> a >> b >> h >> m;
        
        ld ah = (ld) (h + (ld) m / 60.0) / 12.0;
        ld am = (ld) m / 60.0;
        ld theta = 2 * PI * abs(ah - am);
        ld cos_theta = cos(theta);
        
        ld res = sqrt(a*a + b*b - 2*a*b*cos_theta);
        cout << fixed << setprecision(16) << res << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4104
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint A, B;
    cin >> A >> B;
    A += (A == 1 ? 13 : 0);
    B += (B == 1 ? 13 : 0);
    string res;
    if (A == B) res = "Draw";
    else if (A > B) res = "Alice";
    else res = "Bob";
    cout << res << "\n";
}

Measured memory_bytes: 256
N, Q = map(int, input().split())

edge = [[] for _ in range(N)]
counter = [0 for _ in range(N + 1)]

for _ in range(N - 1):
    a, b = map(int, input().split())
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)

for _ in range(Q):
    p, x = map(int, input().split())
    counter[p - 1] += x

stack = [(0, -1)]
while stack:
    s, parent = stack.pop()
    counter[s] += counter[parent]
    for n in edge[s]:
        if n == parent:
            continue
        stack.append((n, s))

ans = " ".join(map(str, counter[:N]))
print(ans)


Measured memory_bytes: 131112
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<int> Ns,Sorted;
	Ns.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> Ns[i];
	}
	Sorted = Ns;
	sort(Sorted.begin(), Sorted.end());
	int Mid_Up = Sorted[N / 2 - 1];
	int	Mid_Down = Sorted[N / 2];
	int Mid = 0;
	for (int i = 0; i < N; i++) {
		if (Ns[i] <= Mid_Up) {
			Mid = Mid_Down;
		} else {
			Mid = Mid_Up;
		}
		cout << Mid << endl;
	}
}


Measured memory_bytes: 3712
A, B, H, M = gets.split.map(&:to_i)

h = H * 30 + M / 60.0 * 30
m = M * 6
degree = (h - m).abs
degree = [degree, 360 - degree].min

puts Math.sqrt(A**2 + B**2 - 2*A*B*Math.cos(degree.to_f * Math::PI / 180.0))


Measured memory_bytes: 14696
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};

int n, k, s;

int rec(int i, int prev, int sum) {
	if (sum > s) return 0;
	
	if (i == k) {
		if (sum == s) return 1;
		return 0;
	}
	
	int res = 0;
	
	for_(j,prev + 1, n + 1) {
		res += rec(i + 1, j, sum + j);
	}
	
	return res;
}

void solve() {
	cout << rec(0, 0, 0) << endl;
}

int main() {
	while (cin >> n >> k >> s, n) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 
 int main(void){
     string N;
     int count=0;
     cin >> N;
    for(int i=0; i<4; i++){
        if(N[i]=='2'){
            count+=1;
        }
    }cout << count << endl;
 }

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <stack>
#include <string>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

int main(){
  string s;

  cin >> s;

  int g = 0, p = 0;

  REP(i, 0, s.size()){
    if(s[i] == 'g'){
      g++;
    } else {
      p++;
    }
  }

  cout << (g - p) / 2 << endl;

  return 0;
}


Measured memory_bytes: 512