akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string.h>
#define ll long long
using namespace std;

int a[105];
int main()
{
    int n,x;
    scanf("%d",&n);

    for (int i=1;i<=n;i++)
    {
        scanf("%d",&x);

        int cnt=0;
        while (x % 2 == 0)
        {
            cnt++;
            x/=2;
        }

        a[ min(cnt,2) ] ++;
    }

    int need = a[0];
    if (a[1]) need++;

     if ( a[2]+1 >= need )
        printf("Yes\n");
     else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main()
{
    int n, s, count;
    int a, b, c, d, e, f, g, h, i;
    
    while(1){
        scanf("%d %d", &n, &s);
        if (n == 0 && s == 0) break;
        count = 0;
        
        if (n == 1){
            for (a = 0; a <= 9; a++) if (a == s) count++;
        }
        
        if (n == 2)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++) if (a + b == s) count++;
   
        if (n == 3)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++) if (a + b + c == s) count++;
                    
        if (n == 4)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++) if (a + b + c + d == s) count++;
        
        if (n == 5)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++)
                            for (e = d + 1; e <= 9; e++) if (a + b + c + d + e == s) count++;
        
        if (n == 6)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++)
                            for (e = d + 1; e <= 9; e++)
                                for (f = e + 1; f <= 9; f++) if (a + b + c + d + e + f == s) count++;
        
        if (n == 7)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++)
                            for (e = d + 1; e <= 9; e++)
                                for (f = e + 1; f <= 9; f++)
                                    for (g = f + 1; g <= 9; g++) if (a + b + c + d + e + f + g == s) count++;
        
        if (n == 8)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++)
                            for (e = d + 1; e <= 9; e++)
                                for (f = e + 1; f <= 9; f++)
                                    for (g = f + 1; g <= 9; g++)
                                        for (h = g + 1; h <= 9; h++) if (a + b + c + d + e + f + g + h == s) count++;
        
        if (n == 9)
            for (a = 0; a <= 9; a++)
                for (b = a + 1; b <= 9; b++)
                    for (c = b + 1; c <= 9; c++)
                        for (d = c + 1; d <= 9; d++)
                            for (e = d + 1; e <= 9; e++)
                                for (f = e + 1; f <= 9; f++)
                                    for (g = f + 1; g <= 9; g++)
                                        for (h = g + 1; h <= 9; h++)
                                            for (i = h + 1; i <= 9; i++) if (a + b + c + d + e + f + g + h + i == s) count++;
         
         printf("%d\n", count);
     }
     return 0;
}

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


int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n){
        cin >> d[i];
    }
    int umasa = 0;
    rep(i, n){
        for (int j = i+1; j < n; j++){
            umasa += d[i] * d[j];    
        }
    }
    cout << umasa << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 2666,inf=0x3f3f3f3f;
int n,res=inf;char S[N];Vi e[N];
int mn[N],mx[N],cnt[N];
void dfs(int u, int fa){
	mn[u]=mx[u]=0;cnt[u]=S[u]=='1';int p=-1;
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa){
		dfs(e[u][i],u),mx[u]+=mx[e[u][i]]+cnt[e[u][i]],cnt[u]+=cnt[e[u][i]];
		if(p==-1||mx[e[u][i]]+cnt[e[u][i]]>mx[e[u][p]]+cnt[e[u][p]])p=i;
	}
	if(p==-1)return;
	if(mn[e[u][p]]+cnt[e[u][p]]>mx[u]-(mx[e[u][p]]+cnt[e[u][p]]))
		mn[u]=mn[e[u][p]]+cnt[e[u][p]]-(mx[u]-(mx[e[u][p]]+cnt[e[u][p]]));
	else mn[u]=mx[u]&1;
}
int main() {
	read(n);scanf("%s",S+1);
	rep(i,1,n-1){
		int u,v;read(u);read(v);
		e[u].pb(v);e[v].pb(u);
	}
	rep(rt,1,n){
		dfs(rt,0);
	//	cerr<<rt<<' '<<mn[rt]<<' '<<mx[rt]<<endl;
		if(mn[rt]==0)umin(res,mx[rt]/2);
	}
	cout<<(res==inf?-1:res);
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a!=b && a!=c){
    cout<<a;
   }
   else if(b!=a && b!=c){
    cout<<b;
   }
   else if(c!=a && c!=b){
    cout<<c;
   }
    return 0;
}



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

int main() {
  string w;
  cin >> w;
  
  map<char, int> count_w;
  for (int i = 0; i < w.size(); i++) {
    count_w[w.at(i)]++;
  }
  
  bool answer = true;
  for (pair<char, int> p : count_w) {
    if (p.second % 2) {
      answer = false;
      break;
    }
  }
  
  if (answer) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def count(b, c, d):
    return b - b//c - b//d + b//(c * d // gcd(c, d))

print(count(b, c, d) - count(a-1, c, d))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] a = sc.next().toCharArray();
		int result = 0;
		for (char c : a) {
			if(c == '1') result++;
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,m; cin>>n>>m;
    pair<int,pair<int,int>> state[m];
    rep(i,m){
        cin>>state[i].second.first>>state[i].first;
        state[i].second.second=i;
    }
    sort(state,state+m);
    int cnt[n+1]={};
    pair<int,int> ans[m];
    rep(i,m){
        int pre=state[i].second.first,num=state[i].second.second;
        ans[num]={pre,++cnt[pre]};
    }
    rep(i,m){
        printf("%06d%06d\n",ans[i].first,ans[i].second);
    }
    return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=1e5+5;
#define ll long long
#define inf 0x3f3f3f3f
#define mem(x) memset(x,0,sizeof(x))
#define sca(x) scanf("%d",&x)
#define scall(x) scanf("%lld",&x)
#define eps 1e-6
int main()
{
	ll n;scall(n);
	stack<char>s;
	while(n)
	{
		n--;
		int temp=n%26;
		if(temp<0)
		temp+=26;
		s.push(temp+'a');
		n/=26;
	}
	while(!s.empty())
	{
		cout<<s.top();
		s.pop();
	}
	cout<<endl;
 } 

Measured memory_bytes: 3720
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		scan.close();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 3; i < 55555; i++) {
			if(isCheck(i)) {
				list.add(i);
			}
		}

//		ArrayList<Integer> ans = new ArrayList<Integer>();
//		ans.add(2);
		int []k = new int[N];
		k[0] = 2;
		int cnt = 0;
		for(int i = 0; i < list.size(); i++) {
			int a = list.get(i);
			if(a % 5 == 1) {
				cnt++;
				k[cnt] = a;
			}
			if(cnt == N - 1) {
				break;
			}
		}
		for(int i = 0; i < N; i++) {
			if(i != 4) {
				System.out.print(k[i] + " ");
			}else {
				System.out.println(k[i]);
			}

		}

	}
	public static boolean isCheck(int n) {
		for(int i = 2; i < n; i++) {
			if(n % i == 0) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 23892
#include<cstring>
#include<cstdio>
#include<iostream>

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

using namespace std;


int main(){
	char a[100];

	while(NULL!=fgets( a, 80, stdin)){
		int n=strlen(a);

		while(NULL==strstr(a,"the")&&NULL==strstr(a,"this")&&NULL==strstr(a,"that")){
			REP(n){
				if('a'<=a[i] && a[i]<'z')	a[i]++;
				else if('z'==a[i]) a[i]='a';
			}
		}

	printf("%s",a);
	}

	return 0;
}

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


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  vector<int> num(N);
  vector<bool> possible(N);
  possible.at(0) = true;
  for (int i = 0; i < N; i++) num.at(i) = 1;
  for (int i = 0; i < M; i++) {
    int x, y; cin >> x >> y; x--; y--;
    if (num.at(x) == 0) assert(false);
    if (possible.at(x)) {
      possible.at(y) = true;
    }
    if (num.at(x) == 1) {
      possible.at(x) = false;
    }
    num.at(x)--;
    num.at(y)++;
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) if (possible.at(i)) cnt++;
  cout << cnt << endl;

  return 0;
}



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

char a[102][102];
int h,w,ans;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
const char c[] = {'#','*','@'};

void dfs(int i,int j,int k)
{
    a[i][j]='.';
    for(int di=0;di<4;di++){
        int x=i+dx[di],y=j+dy[di];
        if(a[x][y]==c[k]) dfs(x,y,k);
    }
}

int main()
{
    //mine
    ios::sync_with_stdio(false);
    while(cin>>h>>w&&h){
        for(int i=0;i<=w+1;i++) a[0][i]=a[h+1][i]='.';
        for(int i=0;i<=h+1;i++) a[i][0]=a[i][w+1]='.';
        for(int i=1;i<=h;i++)
            for(int j=1;j<=w;j++)
                cin>>a[i][j];
        ans=0;
        for(int i=0;i<3;i++)
            for(int j=1;j<=h;j++)
                for(int k=1;k<=w;k++)
                    if(a[j][k]==c[i]) {dfs(j,k,i);ans++;}
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, d;
   cin >> n >> d;
   cout << (n + 2 * d) / (2 * d + 1) << endl;
   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b;
	char s;
	scanf("%d\n",&a);
	scanf("%c",&s);
	scanf("%d",&b);
	if(s=='+')
	  printf("%d\n",a+b);
	else
	  printf("%d\n",a-b);
	return 0;
}



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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node *Node;

void insert(int);
 int find(int);
void inParse(Node);
void preParse(Node);

Node root;

int main(){

   int i;
   int n;
   int key;
   int judge;
  char str[7];

  scanf("%d",&n);

  for(i=0;i<n;i++){
  scanf("%s",str);
  if(strcmp(str,"insert")==0){
    scanf("%d",&key);
    insert(key);
  }
  
  if(strcmp(str,"find")==0){
    scanf("%d",&key);
    judge = find(key);
    if(judge==1) printf("yes\n");
    else printf("no\n");
  }
  
  else if(strcmp(str,"print")==0){
     inParse(root);
     printf("\n");
     preParse(root);
     printf("\n");
   }
  }

  return 0;
}

void insert(int k){

  Node x = root;
  Node y = NULL;
  Node z;

  z = malloc(sizeof(struct node));

  z->left  = NULL;
  z->right = NULL;
  z->key = k;

  while(x!=NULL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
    z->parent = y;
  }
  if(y==NULL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

int find(int k){
  
  Node x = root;
  while(x!=NULL){
   if(k == x->key) return 1;
  else{
    if(k < x->key) x = x->left;
    else x = x->right;
   }
  }
  return -1;
}
void inParse(Node n){
  if(n==NULL) return;  
  inParse(n->left);
  printf(" %d",n->key);
  inParse(n->right);
}


void preParse(Node n){
  if(n==NULL) return;
  printf(" %d",n->key);
  preParse(n->left);
  preParse(n->right);
}

Measured memory_bytes: 19364
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 2018-7-15 15:12:00
# Powered by Visual Studio Code
#

n = gets.to_i
a = gets.chomp.split(" ").map{|i| i.to_i}

ary = []
while !a.empty?
  sep = false
  for i in 0...a.size()
    if a[i] != a[i+1]
      ary << a[0..i]
      a = a[i+1..-1]
      sep = true
      break
    end
  end
  if !sep
    ary << a
    a = []
  end
end

# p ary

ans = 0

ary.each{|it|
  ans += it.size / 2
}

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    long long N;
    cin >> N;
    vector<long long> X(N);
    for(int i = 0; i < N; i++)cin >> X[i];
    vector<long long> y = X;
    sort(y.begin(), y.end());
    int ind = (N - 1) / 2;
    for(int i = 0; i < N; i++){
        if(X[i] <= y[ind]){
            cout << y[ind + 1] << endl;
        }
        else cout << y[ind] << endl;
    }
}

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

int main(){
  ll k=100;
  ll ans = 0;
  ll x;
  cin >> x ;
  while(k < x){
    k = k*1.01;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void)
{
  int i,d,n;
  d=100000;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    d+=d*5/100;
    if(d%1000)
      d=d-(d%1000)+1000;
  }
  printf("%d\n",d);
  return 0;
}

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

int main()
{
    string s;

    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }

const int mod = 998244353;

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	vector<pair<int,int>> in(k);
	for(pair<int,int>& p : in) {
		scanf("%d%d", &p.first, &p.second);
	}
	vector<int> dp(n), pref(n);
	dp[0] = pref[0] = 1;
	for(int i = 1; i < n; ++i) {
		for(pair<int,int> p : in) {
			int L = max(0, i - p.second);
			int R = i - p.first;
			if(L <= R) {
				// dp[i] += pref[R] - pref[L-1];
				dp[i] += pref[R];
				if(L >= 1) dp[i] -= pref[L-1];
				dp[i] %= mod;
				if(dp[i] < 0) dp[i] += mod;
				// for(int j = L; j <= R; ++j) {
					// dp[i] += dp[j];
				// }
			}
		}
		pref[i] = (pref[i-1] + dp[i]) % mod;
	}
	printf("%d\n", dp[n-1]);
}


Measured memory_bytes: 4804
D, N = map(int, input().split())
if N != 100:
  if D == 0:
    print(N)
  elif D == 1:
    x = [100 * i for i in range(1, 101)]
    print(x[N-1])
  elif D == 2:
    x = [10000 * i for i in range(1, 101)]
    print(x[N-1])
else:
  if D == 0:
    print(101)
  elif D == 1:
    x = [100 * i for i in range(1, 101)]
    print(x[N-1]+100)
  elif D == 2:
    x = [10000 * i for i in range(1, 101)]
    print(x[N-1]+10000)

Measured memory_bytes: 9216
from sys import stdin
from itertools import permutations
n = int(stdin.readline().rstrip())
ps = tuple(map(int, stdin.readline().rstrip().split()))
qs = tuple(map(int, stdin.readline().rstrip().split()))
a = 0
b = 0
per = permutations([i for i in range(1, n + 1)])
for i, v in enumerate(per):
    if ps == v:
        a = i
    if qs == v:
        b = i

print(abs(a-b))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
string s[100];
int main ()
{
    int n,l;
    cin>>n>>l;
    for (int i = 0; i < n; ++i)
        cin>>s[i];
    sort (s,s+n);
    for (int i = 0; i < n; ++i)
        cout<<s[i];
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int H, W, D;
	cin >> H >> W >> D;
	vector<int> Vi(H * W);
	vector<int> Vj(H * W);
	vector<int> cum(H * W, 0);

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			int tmp;
			cin >> tmp;
			tmp--;
			Vi[tmp] = i;
			Vj[tmp] = j;
		}
	}

	for (int i = 0; i + D < H * W; i++)
	{
		cum[i + D] = cum[i] + abs(Vi[i] - Vi[i + D]) + abs(Vj[i] - Vj[i + D]);
	}

	int Q;
	cin >> Q;

	for (int i = 0; i < Q; i++)
	{
		int left, right;
		cin >> left >> right;
		left--;
		right--;
		cout << cum[right] - cum[left] << endl;
	}
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static final int INF = Integer.MAX_VALUE;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] arr = new int[n];
		
		for(int i = 0 ; i < n ; ++i) {
			arr[i] = scan.nextInt();
		}
		
		int[] dp = new int[n];
		Arrays.fill(dp, INF);
		dp[0] = 0;
		dp[1] = Math.abs(arr[1] - arr[0]);
		for(int i = 2 ; i < n ; ++i) {
			dp[i] = Math.min(Math.abs(arr[i] - arr[i-1]) + dp[i-1], Math.abs(arr[i] - arr[i-2]) + dp[i-2]);
		}
		System.out.println(dp[n-1]);
	}
}


Measured memory_bytes: 51008
package main

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

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var N, A, B, sum, fsum int
	var S string
	fmt.Scan(&N, &A, &B)
	fmt.Scan(&S)
	for i := 0; i < N; i++ {
		if sum < A+B {
			if S[i] == 'a' {
				sum++
				fmt.Fprintln(wtr, "Yes")
				continue
			} else if S[i] == 'b' && fsum < B {
				fmt.Fprintln(wtr, "Yes")
				fsum++
				sum++
				continue
			}
		}
		fmt.Fprintln(wtr, "No")
	}

	_ = wtr.Flush()
}


Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        long S = nl();
        long X2 = 1000_000_000L;
        long Y3 = S/X2;
        long X3 = S%X2;
        if(Y3==X2){
            Y3 = Y3;
            X3 = 0;
        }else{
            X3 = X2 - X3;
            Y3 = Y3 + 1;
        }
        out.println(String.format("%d %d %d %d %d %d", 0, 0, X2, 1, X3, Y3));
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

int dp[1000000];
int a[1000000];

int solve(int i, int n)
{
    if(i==n) return 0;
    if(dp[i]!=-1) return dp[i];

    int ans = abs(a[i]-a[i+1]) + solve(i+1,n);
    if(i+2<=n)
        ans = min(ans, abs(a[i]-a[i+2]) + solve(i+2,n));
    return dp[i] = ans;
}

int main()
{
    FIO;
    int n;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    for (int i = 1; i <= n; i++)
        cin >> a[i];

    cout << solve(1, n) << endl;
    return 0;
}


Measured memory_bytes: 14168
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define exit return 0;
using namespace std;
const int N=500000;
bool prime[N];
void sieve(){
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<100000000; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<100000; i += p)
                prime[i] = false;
        }
    }
}
int nxt(){int x;cin >> x;return x;}
int32_t main(){
    base
    int n=nxt();
    for(int i=-200;i<=200;i++){
        for(int j=-200;j<=200;j++){
            auto two=(j*j*j*j*j),one=(i*i*i*i*i);
            if(one-two==n){
                cout<<i<<" "<<j<<endl;
                exit
            }
        }
    }
    exit
}


Measured memory_bytes: 3648
import collections
s = input()
ls = len(s)
c = collections.Counter(s)
mi = ls
valuePlaces = []
for v,k in c.items():
    co = 0
    valuePlaces.clear()
    for i in range(ls):
        if s[i] == v:
            valuePlaces.append(i)
    ushiro = ls-valuePlaces[-1]-1
    #print(ushiro,v)
    maxLen = 0
    len_vp = len(valuePlaces)
    #print(len_vp)
    for i in range(len_vp):
        start = valuePlaces[i]
        if i == 0:
            goal = -1
        else:
            goal = valuePlaces[i-1]
        maxLen = max(start-goal-1,maxLen)
    mi = min (mi,max(maxLen,ushiro))
print(mi)





Measured memory_bytes: 67856
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X;
  cin>>N>>M>>X;
  vector<int>A(M);
  vector<int>B(N+1,0);
  for(int i=0;i<M;i++){
    cin>>A.at(i);
    B.at(A.at(i))=1;
  }
  int C=0;
  int D=0;
  for(int i=0;i<X;i++){
    C=C+B.at(i);
  }
  for(int i=X+1;i<N+1;i++){
    D=D+B.at(i);
  }
  cout<<min(C,D)<<endl;
}
    
  

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import collections
input = sys.stdin.readline
def ii(): return int(input().rstrip())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input().rstrip())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    n = ii()
    g = [[] for i in range(n)]
    edge = collections.namedtuple('edge', ['src', 'to', 'info'])
    for i in range(n - 1):
        a, b = mi()
        g[a - 1].append(edge(a - 1, b - 1, i))
        g[b - 1].append(edge(a - 1, b - 1, i))
    color = max(*map(len, g))
    print(color)
    q = collections.deque()
    ans = [-1 for i in range(n - 1)]
    idx = 0
    q.append((0, 0))
    while len(q):
        t, idx = q.popleft()
        for e in g[t]:
            if ans[e.info] != -1:
                continue
            idx += 1
            ans[e.info] = idx
            q.append((e.to, idx))
    print(*map(lambda x: x % color + 1, ans), sep="\n")
    return


if __name__ == '__main__':
    main()


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


using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define endl "\n"

const ll maxn=19;

const ll maxx=1e13;
const ll mod=1000000007;
const ll mod1=998244353;
 ll cost[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
    //   freopen("GREEDY.INP", "r", stdin);
    //  freopen("GREEDY.OUT", "w", stdout);
    string s;
     cin>>s;
     if (s=="ARC")
     {
         cout <<"ABC";
     }
     else
     {
         cout <<"ARC";
     }
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include<time.h>

int main(void){
	int a,b,i,ans=0;
	scanf("%d",&a);
	scanf("%d",&b);
	for(i=0;i<=1;i++){
		if(a>=b){
			ans+=a;
			a--;

		}
		else{
			ans+=b;
			b--;

		}
	}
	printf("%d",ans);
	return 0;

}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, K; cin >> N >> K;
    vector<int> h(N);
    int cnt = 0;
    for(int i=0; i<N; i++) {
        cin >> h.at(i);
        if(h.at(i) >= K) cnt++;
    }
    cout << cnt << endl;
    

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string a;
string b;
int main()
{
	cin >> a;
	b = a;	
	reverse(a.begin(), a.end());
	for(int i = 0; i < a.size(); ++i)
	{
		if(a[i] == 'b') a[i] = 'd';
		else if(a[i] == 'd') a[i] = 'b';
		else if(a[i] == 'p') a[i] = 'q';
		else if(a[i] == 'q') a[i] = 'p';
	}
	if(a == b) puts("Yes");
	else puts("No");
}


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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    int absmax = 0;
    int absmax_index = -1;
    for(int i=0; i<N; i++){
        std::cin >> A[i];
        int abs = std::abs(A[i]);
        if(absmax < abs){
            absmax = abs;
            absmax_index = i;
        }
    }
    
    if(absmax_index == -1){
        std::cout << 0 << std::endl;
        return 0;
    }else{
        std::cout << 2*N << std::endl;
    }
    
    if(A[absmax_index] > 0){
        std::cout << absmax_index+1 << " " << N << std::endl;
        std::cout << absmax_index+1 << " " << N << std::endl;
        for(int i=0; i<N-1; i++){
            std::cout << N << " " << i+1 << std::endl;
            std::cout << N << " " << N << std::endl;
        }
    }else{
        std::cout << absmax_index+1 << " " << 1 << std::endl;
        std::cout << absmax_index+1 << " " << 1 << std::endl;
        for(int i=N-1; i>=1; i--){
            std::cout << 1 << " " << i+1 << std::endl;
            std::cout << 1 << " " << 1 << std::endl;
        }
    }
    
    //if(A[absmax_index] > 0){
    //    A[N-1] += 2 * A[absmax_index];
    //    for(int i=1; i<N; i++){
    //        A[i] += A[N-1];
    //        A[N-1] += A[N-1];
    //    }
    //}else{
    //    A[0] += 2 * A[absmax_index];
    //    for(int i=N-2; i>=0; i--){
    //        A[i] += A[0];
    //        A[0] += A[0];
    //    }
    //}
    //
    //for(int i=0; i<N; i++){
    //    std::cout << A[i] << std::endl;
    //}
    
    
    return 0;
    
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 
const int SEARCH_MAX = 6e3;

int main() {
  long long int A, B, C, D, E;
  cin >> A >> B >> C >> D;
  E = C * D / __gcd(C, D);
  long long int sum, cnt, A1, A2, A3, B1, B2, B3, ans;
  sum = B - A + 1;
  (A % C == 0) ? A1 = A / C - 1 : A1 = A / C;
  (A % D == 0) ? A2 = A / D - 1 : A2 = A / D;
  (A % E == 0) ? A3 = A / E - 1 : A3 = A / E;
  B1 = B / C;
  B2 = B / D;
  B3 = B / E;
  cnt = B1-A1+B2-A2-(B3-A3);
  ans = sum - cnt;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_V = 310;

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

    vvl dist(MAX_V, vl(MAX_V));  // dist[v][u] : 頂点vと頂点uの最短距離
    rep(v, n) {
        rep(u, n) {
            if(v != u) {
                dist[v][u] = INF;
            }
        }
    }

    vvl a(n, vl(n));
    rep(i, n) {
        rep(j, n) {
            cin >> a[i][j];
            if(dist[i][j] > a[i][j]) {
                dist[i][j] = dist[j][i] = a[i][j];
            }
        }
    }
    
    // ワーシャルフロイド法。計算量はO(V^3)
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    ll ans = 0;
    exrep(v, 0, n-2) {
        exrep(u, v+1, n-1) {
            if(dist[v][u] < a[v][u]) {
                out(-1);
                re0;
            }
            bool ok = true;
            rep(w, n) {
                if(w == v || w == u) {
                    continue;
                }
                if(dist[v][w] + dist[w][u] == dist[v][u]) {
                    ok = false;
                }
            }
            if(ok) {
                ans += dist[v][u];
            }
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 1664
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

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

	int n,a[200010];
	ll s[200010], ans;
	scanf("%d", &n);
	REP(i,n)scanf("%d", &a[i]);
	
	s[0] = 0;
	for (int i = 1; i <= n;i++) {
		s[i] = s[i - 1] + a[i-1];
	}
	ans = abs(s[n] - s[1] - s[1]);
	for (int i = 2; i < n; i++) {
		ans = min(ans, abs(s[n]-s[i]-s[i]));
	}

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


Measured memory_bytes: 2560
import sys, math
from collections import defaultdict
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
H = rl()

last = H.pop()
while H:
	h = H.pop()
	if h > last+1:
		print('No')
		exit()
	elif h > last:
		h -= 1
	last = h
print('Yes')


Measured memory_bytes: 87816
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() 
{
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++){
            for(ll k=j+1;k<n;k++){
                if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[i]!=arr[k])
                if(arr[i]+arr[j]>arr[k]){
                   //cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
    
	return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  cin>>a>>b;
  int g=0;
  for(int i=a;i<=b;i++){
  string c=to_string(i);
    string d=c;
    reverse(all(d));
    if(c==d)
      g++;
  }
  out(g);
}

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

using namespace std;

typedef long long int ll;

const int N = (int) 1e5 + 10;

// y = mx + b
struct Line {
    ll m, b;
    Line(ll x, ll y) {
        m = x, b = y;
    }
    ll calc(ll x) {
        return m * x + b;
    }
    double inter(const Line &o) {
        //m1x + b1 = m2x + b2
        //(m1 - m2)x = b2 - b1
        return 1.0 * (o.b - b) / (m - o.m);
    }
};

ll sq(ll x) { return x * x; }

void solve() {
    int n; ll c;
    cin >> n >> c;
    vector<ll> h(n), dp(n);
    for(int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<Line> hull;
    //cost = (hi - hj) ^ 2 + C
    // = hi^2 + hj^2 - 2*hi*hj + C
    hull.emplace_back(-2 * h[0], sq(h[0]));
    int ptr = 0;
    for(int i = 1; i < n; ++i) {
        if(ptr >= hull.size()) ptr = hull.size() - 1;
        while(ptr + 1 < hull.size() && hull[ptr].calc(h[i]) >= hull[ptr + 1].calc(h[i])) {
            ++ptr;
        }
        ll cost = hull[ptr].calc(h[i]) + sq(h[i]) + c;
        Line cur(-2 * h[i], cost + sq(h[i]));
        while(hull.size() >= 2) {
            Line &l = hull.end()[-2], &r = hull.end()[-1];
            double lx = l.inter(r), rx = l.inter(cur);
            if(rx <= lx) hull.pop_back();
            else break;
        }
        hull.push_back(cur);
        dp[i] = cost;
    }
    cout << dp.back() << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    solve();
    return 0;
}

Measured memory_bytes: 9584
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a, bool g){
	if(g){
		if(a[index]<key){
			return true;
		}
	}
	else{
		if(a[index]>key){
			return true;
		}
	}
	return false;
}

ll bin_search(ll key, vector<ll> &a, bool g){
	
	ll l=-1;
	ll r=a.size();

	if(g){
		l=a.size();
		r=-1;
	}

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a, g)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

int main(){

	ll n,k;
	cin>>n>>k;

	ll one=0;
	ll ans=0;

	vector<ll> a(n,0);
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}


	ans=(n-1)/(k-1);

	if((n-1)%(k-1)!=0){
		ans++;
	}

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


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
    int n, b, f, r, v, i, x, y = 0, z, w, B1[4][11]={}, B2[4][11]={}, B3[4][11]={}, B4[4][11]={};

    scanf("%d",&n);
    for( i = 0; i < n; i++ ){
        scanf("%d%d%d%d",&b,&f,&r,&v);
        if( b == 1){
            if( B1[f][r] != 0 ){
                B1[f][r] += v;
                continue;
            }
            B1[f][r] = v;
        }else if( b == 2 ){
            if( B2[f][r] != 0 ){
                B2[f][r] += v;
                continue;
            }
            B2[f][r] = v;
        }else if( b == 3 ){
            if( B3[f][r] != 0 ){
                B3[f][r] += v;
                continue;
            }
            B3[f][r] = v;
        }else{
            if( B4[f][r] != 0 ){
                B4[f][r] += v;
                continue;
            }
            B4[f][r] = v;
        }
    }
    for( i = 0; i < 4; i++ ){
        for( w = 0; w < 3; w++ ){
            for( x = 0; x < 10; x++ ){
              if( i == 0 ){
                    printf(" %d",B1[w+1][x+1]);
                    if( x == 9 ){
                        printf("\n");
                    }
                }else if( i == 1 ){
                    if( y == 0 ){
                        for( z = 0;z < 20; z++){
                            printf("#");
                            if( z == 19 ){
                                printf("\n");
                            }
                        }
                        y = 1;
                    }
                    printf(" %d",B2[w+1][x+1]);
                    if( x == 9 ){
                        printf("\n");
                        if( w == 2 ){
                            y = 0;
                        }
                    }
                }else if( i == 2 ){
                    if( y == 0 ){
                        for( z = 0;z < 20; z++){
                            printf("#");
                            if( z == 19 ){
                                printf("\n");
                            }
                        }
                        y = 1;
                    }
                    printf(" %d",B3[w+1][x+1]);
                    if( x == 9 ){
                        printf("\n");
                        if( w == 2 ){
                            y = 0;
                        }
                    }
                }else if( i == 3 ){
                    if( y == 0 ){
                       for( z = 0;z < 20; z++){
                            printf("#");
                            if( z == 19 ){
                                printf("\n");
                            }
                        }
                        y = 1;
                    }
                        printf(" %d",B4[w+1][x+1]);
                        if( x == 9 ){
                            printf("\n");
                        }
                }
            }
       }
    }
    return 0;
}

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

int main(){
 int n;
 cin>>n;
 vector<int> x(n);
 for(int i=0; i<n; i++)cin>>x[i];
 vector<int> x2(x);
 sort(x2.begin(), x2.end());
 for(int i=0; i<n; i++){
  if(x[i]<=x2[n/2-1])cout<<x2[n/2]<<endl;
  else cout<<x2[n/2-1]<<endl;
 }
}


Measured memory_bytes: 3712
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fixed cout.setf(ios::fixed);
#define rep1    for( i=0; i<n; i++)
#define Precise cout.precision(7);
using namespace std;

int main()
{
    ll a,b,c;
    ll x,y,z;
    cin>>a>>b>>c;
    x=c-a-b;
    y=4*a*b;
    bool ok=x>0&&y<x*x;
    if(ok)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;

    return 0;
}





Measured memory_bytes: 3588
import math
 
A = 1
N = int(input())
array = input().split()
flag = True
for i in range(N):
	A = (A * int(array[i]))
	if A > math.pow(10,18):
		flag = False
		break

if flag:
  print(A)
else:
  if '0' in array:
    print(0)
  else:
    print(-1)

Measured memory_bytes: 19828
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int N,H,W;
    int A[1040],B[1040];
    cin >> N >> H >> W;
    REP(i,N){cin >> A[i] >> B[i];}
    int Ans=0;
    REP(i,N){
        if(A[i]>=H&&B[i]>=W){
            Ans++;
        }
    }
    cout << Ans << endl;
    
    return 0;
}

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

using namespace std;

int main() {
    int N, i = 1, answer = 0;
    cin >> N;
    while(N > 0){
        answer = N * i;
        if(answer % 2 == 0) break;
        i++;
    }
    cout << answer << endl;
}


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

int main(){

	int k, ans = 0, num = 0;
	cin >> k;

	vector<int>  v(k,0);

	do{
		num = num*10 + 7;
		num = num%k;
		ans++;
				
		if (v[num])
		{
			cout << -1 << "\n";
			return 0;
		}
		else v[num] = 1;
	} while (num);

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

Measured memory_bytes: 7224
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    int ans = 1;
    if (H[0] <= H[1]) {
        ++ans;
    }
    for (int i=2; i<N; ++i) {
        //if ((H[0] <= H[i]) && (H[1] <= H[i]) && (H[i-1] <= H[i])) {
        bool ok = true;
        for (int j=0; j<i; ++j) {
            if (H[j] <= H[i]) {
                continue;
            } else {
                ok = false;
            }
        }
        if (ok) {
            ++ans;
        }
    }
    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 2e9
#define IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

int main()
{
	int N;
	llong K;
	cin >> N >> K;

	int A[N];
	REP(idx, N) {
		cin >> A[idx];
	}

	llong cnt = 0;
	llong sum = 0;
	llong numP, numN;

	REP(idx, N) {
		numP = 0;
		numN = 0;
		REP(inIdx, N) {
			if (idx > inIdx) {
				// 基準より前
				if (A[idx] > A[inIdx]) {
					++numP;
				}
			} else if (idx < inIdx) {
				// 基準より後
				if (A[idx] > A[inIdx]) {
					++numN;
				}
			}
		}
		if (K % 2 == 0) {
			// Kが偶数
			// 前たす
			sum = (K/2) * (K-1) % IMAX * numP % IMAX;
			cnt += sum;
			// 後ろたす
			sum = (K+1) * (K/2) % IMAX * numN % IMAX;
			cnt += sum;
		} else {
			// Kが奇数
			// 前たす
			sum = K * ((K-1)/2) % IMAX * numP % IMAX;
			cnt += sum;
			// 後ろたす
			sum = ((K+1)/2) * K % IMAX * numN % IMAX;
			cnt += sum;
		}

		// あまり
		if (cnt >= IMAX) {
			cnt = cnt % IMAX;
		}
	}

	cout << cnt << endl;

	return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int>flag(N+1, 0);
    vector<int>pen(N+1, 0);
    for (int i = 0; i < M; ++i) {
        int p; string S;
        cin >> p >> S;
        if (flag[p] == 0) {
            if (S == "AC") {
                flag[p] = 1;
            } else {
                pen[p]++;
            }
        }
    }
    int ans = 0;
    int pena = 0;
    for (int i = 1; i <= N; ++i) {
        if (flag[i] == 0) continue;
        ans += flag[i];
        pena += pen[i];
    }
    cout << ans << " " << pena << "\n";
    return 0;
}

Measured memory_bytes: 1024