akhauriyash/Code-Regression huggingface dataset:
#define FASTIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//#define BZ
//#define PBDS
//#define POINT

#ifndef BZ
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("no-stack-protector")
#pragma GCC target ("tune=native")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize ("conserve-stack")
//#pragma GCC optimize ("no-stack-limit")
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
//using xll = __int128_t;
using str = string;
using pll = pair<ll, ll>;

#ifdef POINT
using point = complex<ll>;
#define x real
#define y imag
#endif

#ifdef PBDS
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//using namespace __gnu_pbds::detail;
template <class T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif

#define INF 0x7fffffffffffffffLL
#define BASE 1000000007LL // 3 * 10**9 + 19 // 998244353 - rev == pow(n + m, BASE - 2)
#define MAX(type) std::numeric_limits<type>::max()
#define MIN(type) std::numeric_limits<type>::min()

#define LOG(v) cout << #v << " " << v << "\n";

#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define forEach(c) for (auto &it : c)
#define loop while (true)
#define mp make_pair
#define mt make_tuple

template <class T>
void chMax(T &a, T b) {
	if (a < b) a = b;
}

template <class T>
void chMin(T &a, T b) {
	if (b < a) a = b;
}

inline ll divUp(ll a, ll b) {
	return (a + b - 1)/b;
}

void solve() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22) cout << "bust\n";
	else cout << "win\n";
}

//#define LOCAL

int main() {
	FASTIO
#ifdef LOCAL
	auto start = std::chrono::system_clock::now();
#endif
	solve();
#ifdef LOCAL
	auto end = std::chrono::system_clock::now();
	std::chrono::duration<ld> elapsed_seconds = end - start;
	cerr << "\ntime: " << elapsed_seconds.count() << " s\n";
#endif
	return 0;
}


Measured memory_bytes: 256
n = int(input())
h = input().split()
H = []
i = 0
while(i < n):
    H.append(int(h[i]))
    i+=1
#print(H)

i = 0
high = 0
num = 0
while(i < n):
    if(H[i] >= high):
        num += 1
    if(high < H[i]):
        high = H[i]
    i += 1

print(num)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

#define sid 200500
#define ri register int

int n, cnp, id = 1;
int a[sid];
char s[sid];

inline void GZ(int o, int val, int who) {
    if(who == 0) return;
    for(ri i = 1; i <= val - a[who] - 1; i ++)
    printf("%d %d\n", o, ++ id);
    printf("%d %d\n", o, ++ id);
    GZ(id, a[who], who - 1);
}

int main() {
    scanf("%s", s + 1);
    n = strlen(s + 1);

    int flag = 0;
    if(s[1] == '0' || s[n] == '1') flag = 1;
    for(ri i = 1; i <= n - 1; i ++)
    if(s[i] != s[n - i]) flag = 1;
    if(flag) { printf("-1"); return 0; }
    
    for(ri i = 1; i <= n; i ++)
    if(s[i] == '1') a[++ cnp] = i;

    GZ(1, n, cnp);

    return 0;
}

Measured memory_bytes: 1920
//code by parshuram_84
#include <bits/stdc++.h>
#define mod 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
typedef std::numeric_limits< double > dbl;
using namespace std;

ll power(ll a,ll b)
{
	ll z=1,p=2019;
	while(b>0)
	{
		if(b&1) z=(z*a)%p;
		a=(a*a)%p;
		b=b>>1;
	}
	return z;
}

int main() {
	IOS;
	string s;
	ll n,x=0;
	cin>>s;
	n=s.length();
	ll i,t[n+1]={0},y=0,z=0,q[2019]={0};
	q[0]=1;
	for(i=n-1;i>=0;i--)
	{
		z=s[i]-'0';
		t[i]=t[i+1]+(power(10,n-1-i)*z);
		t[i]=t[i]%2019;
		q[t[i]]++;
	}
	for(i=0;i<2019;i++)
	{
		x+=(q[i]*(q[i]-1))/2;
	}
	cout<<x;
	return 0;
}

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

class Sai {
    vector<int> m_s;
public:
    Sai(vector<int> s) {
        m_s = vector<int>(6);
        rep(i, 6) {
            m_s.at(i) = s.at(i);
        }
    }
    void move(char ch) {
        switch(ch) {
        case 'E':
            swap(m_s.at(0), m_s.at(3));
            swap(m_s.at(2), m_s.at(3));
            swap(m_s.at(3), m_s.at(5));
            break;
        case 'N':
            swap(m_s.at(0), m_s.at(1));
            swap(m_s.at(4), m_s.at(1));
            swap(m_s.at(5), m_s.at(1));
            break;
        case 'S':
            swap(m_s.at(0), m_s.at(4));
            swap(m_s.at(1), m_s.at(4));
            swap(m_s.at(5), m_s.at(4));
            break;
        case 'W':
            swap(m_s.at(0), m_s.at(2));
            swap(m_s.at(3), m_s.at(2));
            swap(m_s.at(5), m_s.at(2));
            break;
        default:
            assert(false);
        }
    }
    int top(void) {
        return m_s.at(0);
    }
    int right(void) {
        return m_s.at(2);
    }
    void set_top_and_before(int top, int before) {
        for (int h=0; h < 4; h++) {
        for (int i=0; i < 4; i++) {
            move('S');
            //cout << "before:" << m_s.at(1) << endl;
            if (m_s.at(1) != before) continue;
            for (int j = 0; j < 4; j++) {
                move('E');
                //cout << "top:" << m_s.at(0) << endl;
                if (m_s.at(0) == top) return;
            }
        }
        move('E');
        }
        assert(false);
    }
};

int main() {
    vector<int> n(6);
    rep(i, 6) cin >> n.at(i);
    Sai sai(n);
    int ns; cin >> ns;
    vector<pair<int, int>> q(ns);
    rep(i, ns) cin >> q.at(i).first >> q.at(i).second;

    rep(i, ns) {
        sai.set_top_and_before(q.at(i).first, q.at(i).second);
        cout << sai.right() << endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, x;
vector <ll> a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> x;
        a.push_back(x);
        int sz = a.size();
        while(sz >= 3 && a[sz - 2] >= a[sz - 1] && a[sz - 2] >= a[sz - 3]){
            ll c = a[sz - 3] - a[sz - 2] + a[sz - 1];
            a.pop_back();
            a.pop_back();
            a.pop_back();
            a.push_back(c);
            sz -= 2;
        }
    }
    int l = 0, r = a.size() - 1;
    ll ans = 0;
    int z = 1;
    while(l <= r){
        if(a[l] >= a[r]){
            ans += a[l] * z;
            l++;
        }
        else{
            ans += a[r] * z;
            r--;
        }
        z *= -1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())
d = abs(b-a)
s = v-w
#print(d,s)
if a == b:print("YES")
elif (s*t != 0) and d <= (s*t):print("YES")
else:print("NO")

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll t=1;
	// cin>>t;

	while(t--){
		ll n;
		cin>>n;

		ll x,y;
		ll Mp = -1e18,mp = 1e18,Mm = -1e18, mm =1e18;
		ll ans = -1e18;
		while(n--){
			cin>>x>>y;
			Mp = max(Mp , x + y);
			mp = min(mp , x + y);
			Mm = max(Mm, x - y);
			mm = min(mm, x-y);
			ans = max( {ans , Mp-mp, Mm- mm });
		}

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

	return 0;
}	


Measured memory_bytes: 3608
main :: IO ()

main = do
    [a, b] <- map (read :: String -> Int) . words <$> getLine
    ans (isOdd a) (isOdd b) 

isOdd :: Int -> Bool
isOdd n = (n `mod` 2 == 1)

ans :: Bool -> Bool -> IO ()
ans True True = putStrLn("Yes")
ans _    _    = putStrLn("No")

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

int main(){
  string s, t;
  cin >> s >> t; 
  int count = 0;
  rep(i,s.size()){
    if(s[i] != t[i]) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3892
A, B, C, X, Y = map(int,input().split())

def best_pizza_cost(ln, hn):
    if ln == X: lp = A
    else: lp = B

    if hn == Y: hp = B
    else: hp = A

    fnp = lp * ln + hp * ln
    fhp = C * ln * 2

    left = hn-ln
    snp = hp * left
    shp = C * left * 2
    #print(fnp, fhp, snp, shp)
    return min(fnp, fhp) + min(snp, shp)

print(best_pizza_cost(min(X, Y), max(X, Y)))

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

int main()
{
    ll X, K, D;
    cin >> X >> K >> D;

    X = abs(X);

    ll ans =  X;
    if (X /D > K) {
        ans = X - D * K;
    } else {
        ll e = X/D;
        K -= e;
        X -= e*D;
        if (K%2 == 1) {
            X = abs(X-D);
        }
        ans = X;
    }

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

Measured memory_bytes: 3644
#include <bits/stdc++.h>     
using namespace std;
int main() 
{
    int N,i,count=0;
    cin>>N;
    int p[N];
    for(i=1;i<=N;i++)
    {
        cin>>p[i];
    }
    for(i=1;i<=N;i++)
    {
        if(i!=p[i])
        {
                count++;
        }
    }
    if(count==0 || count==2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
            cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    ll a,b,c,d;cin>>a>>b>>c>>d;
    if(a!=c)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DBG(x) cerr << #x << " = " << x << endl

using namespace std;
typedef long long LL;

const double eps = 1e-6;

struct Gauss {
    static const int MAXN = 16;
    double a[MAXN][MAXN], x[MAXN]; //方程的左?的矩?和等式右?的?，求解之前x保存b向量，求解之后x存的就是?果
    int equ, var; //方程数和未知数个数
    void init(int equ, int var) {
        this->equ = equ;
        this->var = var;
        memset(x, 0, sizeof(x));
        memset(a, 0, sizeof(a));
    }
    bool gauss() {
        int i, j, k, col, max_r;
        for(k =0, col = 0; k < equ && col < var; ++k, ++col) {
            max_r = k;
            for(i = k + 1; i < equ; ++i) if(fabs(a[i][col]) > fabs(a[max_r][col])) max_r = i;
            if(fabs(a[max_r][col]) < eps) return false;
            if(k != max_r) {
                for(j = col; j < var; ++j) swap(a[k][j], a[max_r][j]);
                swap(x[k], x[max_r]);
            }
            x[k] /= a[k][col];
            for(j =col + 1; j < var; ++j) a[k][j] /= a[k][col];
            a[k][col] = 1;
            for(i = 0; i < equ; ++i)
                if(i != k) {
                    x[i] -= x[k] * a[i][k];
                    for(j = col+1; j < var; ++j) a[i][j] -= a[k][j] * a[i][col];
                    a[i][col] = 0;
                }
        }
        return true;
    }
} gauss;
vector<int> G[16];
double E[1 << 10][16];

int main(int argc, char **argv) {
//    freopen("C.in", "r", stdin);
    int n, m;
    while(~scanf("%d%d", &n, &m)) {
        for(int i = 0; i <= n; ++i) G[i].clear();
        while(m--) {
            int u, v;
            scanf("%d%d", &u, &v);
            --u; --v;
            G[u].push_back(v);
            G[v].push_back(u);
        }
        int tot = 1 << n;
        memset(E, 0, sizeof(E));
        for(int st = tot - 2; st >= 1; --st) {
            gauss.init(n, n);
            for(int i = 0; i < n; ++i) gauss.x[i] = 1;
            for(int i = 0; i < n; ++i) {
                gauss.a[i][i] = 1;
                for(auto j : G[i]) if(st & (1 << j)) gauss.a[i][j] -= 1.0 / G[i].size();
                    else gauss.x[i] += E[st | (1 << j)][j] / G[i].size();
            }
            gauss.gauss();
            for(int i = 0; i < n; ++i) E[st][i] = gauss.x[i];
        }
        printf("%.6f\n", E[1][0]);
    }
    return 0;
}

/**
3 2
1 2
2 3

*/

/**
10 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
*/

Measured memory_bytes: 3432
k = int(input())
s = input()
MOD = 10**9+7

class Facts():
   # O(max_num)
   def __init__(self, max_num=10**5, p=10**9+7):
      self.p = p
      self.max_num = max_num
      self.fact = [1] * (self.max_num + 1)
      self.rev = [1] * (self.max_num + 1)
      for i in range(1, self.max_num + 1):
         self.fact[i] = (self.fact[i-1] * i) % self.p
      self.rev[self.max_num] = self.mod_pow(self.fact[self.max_num], self.p-2)
      for i in range(self.max_num-1, 0, -1):
         self.rev[i] = self.rev[i+1] * (i + 1) % self.p

   def comb(self, n, k):
      if n < 0 or k < 0 or n < k:
         return 0
      if n == 0 or k == 0:
         return 1
      res = ((self.fact[n] * self.rev[k] % self.p) * self.rev[n - k]) % self.p
      return res

   def comb_base(self, n, k):
      if n < 0 or k < 0 or n < k:
         return 0
      if n == 0 or k == 0:
         return 1
      a, b = 1, 1
      for i in range(k):
         a *= (n-i)
         a %= MOD
      for i in range(k):
         b *= (k-i)
         b %= MOD
      return (a*self.mod_pow(b, self.p-2)) % self.p

   def perm(self, n, k):
      if n < 0 or k < 0 or n < k:
         return 0
      if n == 0 or k == 0:
         return 1
      a = self.fact[n]
      b = self.fact[n-k]
      return (a * self.mod_pow(b, self.p-2)) % self.p

   def mod_pow(self, a, b):
      ans = 1
      while b > 0:
         if b & 1:
            ans = ans * a % self.p
         a = a * a % self.p; b >>= 1
      return ans

r26 = [1 for _ in range(k + 1)]
r25 = [1 for _ in range(k + 1)]
for i in range(1, k+1):
   r26[i] = (r26[i-1] * 26) % MOD
   r25[i] = (r25[i-1] * 25) % MOD
facts = Facts(max_num=len(s)+k+1, p=MOD)

total = len(s) + k
ans = 0
for s_n in range(len(s), total+1):
   d = total - s_n
   ans += facts.comb(total - d - 1, len(s) - 1) * r25[k-d] * r26[d]
   ans %= MOD

print(ans)


Measured memory_bytes: 166360
use std::collections::HashMap;

fn readone() -> i64 {
    let reader = std::io::stdin();
    let mut line = String::new();
    let _l = reader.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
    let n: i64 = vec[0].parse().unwrap();
    return n;
}
fn readstring() -> String {
    let reader = std::io::stdin();
    let mut line = String::new();
    let _l = reader.read_line(&mut line);
    while line.ends_with('\n') || line.ends_with('\r') {
    line.pop();
    }
    return line;
}
fn main() {
    let n = readone();
    let mut t = HashMap::new();
    for _i in 0 .. n {
        let x = readstring();
        t.insert(x, true);
    }
    let m = readone();
    let mut f : bool = false;
    for _i in 0 .. m {
        let x = readstring();
        if t.contains_key(&x){
            f = !f;
            if f {println!("Opened by {}", x);}
            else {println!("Closed by {}", x);}
        } else {
            println!("Unknown {}", x);
        }
    }
}



Measured memory_bytes: 1112
#include <stdio.h>
int main()
{
    int A,B,k,p,d;
scanf("%d%d",&A,&B);
k=A+B;
p=A-B;
d=A*B;
if(k>=p&&k>=d) {
        printf("%d\n",k);
}
else if(p>=k&&p>=d){
    printf("%d\n",p);
}
else{
    printf("%d\n",d);
}
return 0;
}

Measured memory_bytes: 128
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
b=[]
for i in range(n+1):
    b.append(abs(a[i+1]-a[i]))
temp=sum(b)

for j in range(n):
    ans=temp-b[j]-b[j+1]+abs(a[j+2]-a[j])
    print(ans)


Measured memory_bytes: 20564
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
//#define MOD 1000000007LL
#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    lint n,k;
    cin>>n>>k;
    cout<<2*k-n<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
cost = (a[0] == 0)
c = a[0] + (a[0] == 0)
for i in a[1:]:
  if c > 0:
    if c + i >= 0:
      cost += c + i + 1
      c = -1
    else:
      c += i
  else:
    if c + i <= 0:
      cost += 1 - c - i
      c = 1
    else:
      c += i
tmp = cost
cost = 0
if a[0] >= 0:
  cost = a[0] + 1
  c = -1
else:
  cost = -a[0] + 1
  c = 1
for i in a[1:]:
  if c > 0:
    if c + i >= 0:
      cost += c + i + 1
      c = -1
    else:
      c += i
  else:
    if c + i <= 0:
      cost += 1 - c - i
      c = 1
    else:
      c += i
print(int(min(tmp, cost)))


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

#define MAX  100005

int main() {
    int N, a;
    int A[MAX];
    int ans = 0;
    scanf("%d", &N);
    for (int i = 0; i < MAX; i++) A[i] = 0;

    for (int i = 0; i < N; i++) {
        scanf("%d", &a);
        A[a]++;
    }

    int b = 0;
    for (int i = 1; i < MAX; i++) {
        ans += A[i] % 2;
        if (A[i] % 2 == 0 && A[i] != 0) {
            b++;
        }
    }

    ans += (b / 2) * 2;

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

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,k,q;
  cin >> n >> k >> q;
  vll a(q), p(n,k);

  REP(i, q)
    cin >> a[i];

  REP(i, q){
    a[i]--;
    p[a[i]]++;
  }

  REP(i, n){
    if(p[i]-q > 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  

  
}


Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int a[]=new int[n];//パイプ
			int b[]=new int[n-1];//ジョイント
			int j[]=new int[n-1];
			long ans=0;
			long sum=0;
			for(int i=0;i<n;i++)
			{
				a[i]=in.nextInt();
				sum+=a[i];
			}
			for(int i=0;i<n-1;i++)
				b[i]=in.nextInt();
			Arrays.sort(b);
			for(int i=0;i<n-1;i++)//ジョイントを降順にソート
				j[i]=b[n-2-i];
			
			//給料=max(パイプの本数*パイプの長さの総和)
			 ans=n*sum;
			for(int i=0,k=n-1;k>=1;k--)//iジョイントインデックス kはパイプ数
			{
				sum+=j[i];
				i++;
				ans=Math.max(ans,k*sum);
			}
			System.out.println(ans);
		}
	}
	public static void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 161264
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main() {
	ll n;
	cin >> n;
	vl g(n);
	rep(i, n) {
		ll a, k;
		cin >> a >> k;
		while (true) {
			if (a < k) {
				g[i] = 0;
				break;
			}
			if (a%k == 0) {
				g[i] = a / k;
				break;
			}
			ll dif = a / k + 1;
			ll over = a%k;
			if (over%dif == 0) {
				a -= dif*(over / dif);
			}
			else {
				a -= dif*(over / dif + 1);
			}
		}
	}
	ll x = 0;
	rep(i, n) {
		//cout << g[i] << endl;
		x ^= g[i];
	}
	if (x) {
		cout << "Takahashi" << endl;
	}
	else {
		cout << "Aoki" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a[3],max,k;
	cin >> a[0] >> a[1] >> a[2];
	cin >> k;
	for(int x = 0;x < k;x++){
		max = 0;
		for(int i = 1;i < 3;i++)
			if(a[max] < a[i])
				max = i;
		a[max] *= 2;
	}
	cout << a[0]+a[1]+a[2];
}

Measured memory_bytes: 256
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
//DEBUG 
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define all(v) (v).begin(), (v).end()
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 998244353;
int t,n,m,k,x,y;
 
 
int32_t main()
{
    IOS;
    cin>>k>>x>>y;
    int a=x/k;
    int b=y/k;
    if(a==b && a*k<x && b*k<y){
      cout<<"NG"<<ln;
    }
    else cout<<"OK"<<ln;
}


Measured memory_bytes: 3600
n=int(input())
l=[int(i) for i in input().split()]
num=0
for i in l:
    if i<0:
        num+=1
res=0
for i in l:
    if i>0:
        res+=i
    else:
        res+=-1*i
p=10**10
for i in l:
    p=min(abs(i),p)
if num%2==0:
    A=True
else:
    A=False

if A:
    print(res)
else:
    print(res-2*p)

Measured memory_bytes: 14412
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::min;
fn main() {
    input!{
        n: usize,
        b: [i32; n - 1],
    }
    println!("{}", {
        let mut ans = b[0] + b[n - 2];
        for i in 1..n - 1 {
            ans += min(b[i], b[i - 1]);
        }
        ans
    });
}


Measured memory_bytes: 4352
#!/usr/bin/env python
def factorization(n):
    ret = []
    tmp = n
    for i in range(2, int(n ** 0.5 + 1)):
        cnt = 0
        if tmp % i == 0:
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            ret.append([i, cnt])

    if tmp != 1:
        ret.append([tmp, 1])
    if ret == []:
        ret.append[n, 1]

    return ret


def main():
    n = int(input())

    if n == 1:
        print(0)
    else:
        f_list = factorization(n)
        p_list = []
        for f in f_list:
            p_list.append(f[1])

        cnt = 0
        for p in p_list:
            i = 1
            while p > 0:
                if p - i >= 0:
                    cnt += 1
                p -= i
                i += 1

        print(cnt)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9496
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,ans=1;
  bool t=true;
  cin >> n;
  int64_t a[n];
  for(int64_t i=0;i<n;i++){
    cin >> a[i];
    if(a[i]==0){
      cout << 0 << endl;
      t=false;
      break;
    }
  }    
  if(t){
    for(int64_t i=0;i<n;i++){
      if(a[i]>1000000000000000000/ans){
        cout << -1 << endl;
        t=false;
        break;
      }
    ans*=a[i];
    }
  }
    
  if(t)cout << ans << endl;
}
    
    


Measured memory_bytes: 4344
n, m, v, pp = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort_by {|e| -e}
a << a[-1] - m - 1

l = 0
r = n
loop do
    break if l == r
    i = (l + r) / 2

    if i < pp
        l = i + 1
    elsif a[i] + m < a[pp-1]
        r = i
    else
        s = m * (pp-1) + m * (n-i)
        (pp-1).upto(i-1) do |j|
            s += [a[i] + m - a[j], m].min
            break if s >= m * v
        end

        s < m * v ? r = i : l = i + 1
    end
end

puts l

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int dp[2][200];
vector<int> day[220];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,D;
  cin >> N >> D;
  vector<int> d(N),a(D),b(D),c(D);
  rep(i,N){
    cin >> d[i];
  }
  rep(i,D){
    cin >> a[i] >> b[i] >> c[i];
  }
  rep(j,N){
    int u = 0;
    rep(i,D){
      if(a[i] <= d[j] && d[j] <= b[i]){
        ++u;
        day[j].pb(c[i]);
//         debug(day[j].size());
      }
    }
    sort(all(day[j]));
  }
//   rep(j,N){
//     rep(i,day[j].size()){
//       cout << day[j][i] << " " ;
//     }
//     cout << endl;
//   }
  int ans = 0;
  REP(i,0,N-1){
    int lm = 0,hm = 0;
    // ???????????????????????????
    int a,b,c,d;
    lm = abs(day[i][0]-day[i+1][0]);
    a = dp[0][i] + lm;
    //????????????????????§??????
    lm = abs(day[i][0]-day[i+1][day[i+1].size()-1]);
    b = dp[0][i]+ lm;
    //?????§?????????????????????
    hm = abs(day[i][day[i].size()-1]-day[i+1][0]);
    c = dp[1][i] + hm;
    //?????§?????????????????????
    hm = abs(day[i][day[i].size()-1]-day[i+1][day[i+1].size()-1]) ;
    d = dp[1][i] +hm;
    dp[0][i+1] = max(a,c);
    dp[1][i+1] = max(b,d);
  }
  cout << max(dp[0][N-1],dp[1][N-1]) << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    cout << fixed << setprecision(10);
    if(n == 1)cout << 1.00000000000 << endl;
    else if(n % 2 == 0)cout << 0.500000000 << endl;
    else {
        double x = n;
        cout << (n/2+1)/x << endl;
    }
}

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

#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define For(i, a, b) for(long long int i = (a); i <= (b); i++)
#define Forr(i, a, b) for(long long int i = (a); i >= (b); i--)
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
const int MOD=1e9+7;
const ll dx[4]={-1, 0, 1, 0} , dy[4]={0, 1, 0, -1};
const ll dxx[8]={-1, -1, 0, 1, 1, 1, 0, -1} , dyy[8]={0, 1, 1, 1, 0, -1, -1, -1};


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;cin>>n;
	vt<int>a(n),b(n);
	FOR(n)cin>>a[i];
	FOR(n)cin>>b[i];
	reverse(all(b));
	vt<int>visited(n),eq,avail;
	int k=-1,can=0,want=0;
	FOR(n){
		if(a[i]==b[i]){
			eq.pb(i);
			k=a[i];
			visited[i]=1;
			want++;
		}
	}
	FOR(n){
		if(!visited[i]){
			if(a[i]!=k&&b[i]!=k){
				avail.pb(i);
				can++;
			}
		}
	}
	if(can>=want){
		FOR(sz(eq))
			swap(b[avail[i]],b[eq[i]]);
		cout<<"Yes\n";
		FOR(n)
			cout<<b[i]<<' ';
		cout<<'\n';
	}
	else cout<<"No\n";
	return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
auto &errStream = cerr;
#ifdef LOCAL
#define cerr (cerr << "-- line " << __LINE__ << " -- ")
#else
class CerrDummy {
} cerrDummy;
template <class T> CerrDummy &operator<<(CerrDummy &cd, const T &) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy &operator<<(CerrDummy &cd,
                      basic_ostream<charTDummy, traitsDummy> &(
                          basic_ostream<charTDummy, traitsDummy> &)) {
  return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr << "reached" << endl
#define DMP(x) cerr << #x << ":" << x << endl
#define ZERO(x) memset(x, 0, sizeof(x))
#define ONE(x) memset(x, -1, sizeof(x))

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("¥n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

#define CAPITAL
void Yes(bool ex = true) {
#ifdef CAPITAL
  cout << "YES" << endl;
#else
  cout << "Yes" << endl;
#endif
  if (ex)
    exit(0);
}
void No(bool ex = true) {
#ifdef CAPITAL
  cout << "NO" << endl;
#else
  cout << "No" << endl;
#endif
  if (ex)
    exit(0);
}

const ll infLL = LLONG_MAX / 3;

#ifdef int
const int inf = infLL;
#else
const int inf = INT_MAX / 2 - 100;
#endif

signed main() {
  int ab = read(), bc = read(), ca = read(), ans;

  ans = (ab * bc) / 2;

  print(ans, 0);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	string inp, w;
	stack<double> si;
	double a, b;
	
	while (getline(cin, inp))
	{
		stringstream ss(inp);
		while (ss >> w)
		{
			if (w == "+")
			{
				a = si.top(); si.pop();
				b = si.top(); si.pop();
				si.push(a + b);
			} else if (w == "-") {
				a = si.top(); si.pop();
				b = si.top(); si.pop();
				si.push(b - a);
			} else if (w == "*") {
				a = si.top(); si.pop();
				b = si.top(); si.pop();
				si.push(a * b);
			} else if (w == "/") {
				a = si.top(); si.pop();
				b = si.top(); si.pop();
				si.push(b / a);
			} else {
				si.push(atoi(w.c_str()));
			}
		}
		cout << fixed << setprecision(6);
		cout << si.top() << endl;
	}
	
	return 0;
}


void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}

Measured memory_bytes: 1280
void main(){
	long n, y;
	readf("%d %d", &n, &y);
	bool is_exist = false;
	foreach(i; 0..n+1){
		foreach(j; 0..n+1){
			if(i+j>n)break;
			if(10000*i + 5000*j +1000*(n-i-j) == y ){
				writefln("%d %d %d", i, j, n-i-j);
				return;
			}
		}
	}
	writeln("-1 -1 -1");
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2808
#include<bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

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

    set<int> myst;
    map<int, int> mymp;
    vector<int> myvs;
    for(int i = 0; i < n; i++) {
        cin >> value;
        myvs.push_back(value);
        myst.insert(value);
        mymp[value]++;
    }
    
    ll total = 0;
    for(int node : myst) {
        total += (ll)mymp[node]*(ll)(mymp[node]-1)/2;
    }

    for(int i = 0; i < len(myvs); i++) {
        ll ans = total;
        ans -= mymp[myvs[i]]*(mymp[myvs[i]]-1)/2;
        ans += (mymp[myvs[i]]-1)*(mymp[myvs[i]]-2)/2;

        cout << ans << '\n';
    }

    return 0;
}

Measured memory_bytes: 14196
N,A,B = [int(i) for i in input().split()]
S = input().strip()

qualifying = ['No' for _ in range(N)]
qualifying_total = 0
rank_oversea = 1

for i,h in enumerate(S):
  if h == 'a':
    if qualifying_total < A+B:
      qualifying[i] = 'Yes'
      qualifying_total += 1
  elif h == 'b':
    if qualifying_total < A+B and rank_oversea <= B:
      qualifying[i] = 'Yes'
      qualifying_total += 1
      rank_oversea += 1
ans = '\n'.join(qualifying)
print(ans)

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

void solve()
{
	string s, t;
	cin >> s >> t;
	
	if(s.length()>=1 && s.length()<=10 && t.length() == s.length()+1 && t.substr(0, s.length()) == s)
	{
		cout << "Yes" << "\n";
	}
	else
	{
		cout << "No" << "\n";
	}
	
}

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


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;




int n;
string s;
long r,g,b;
long long res;
  
int main() {



  cin >>n>> s;

  
  for(char c : s){
    switch(c){
    case 'R': r++;break;
    case 'G': g++;break;
    case 'B': b++;break;
    }
  }

  res = r*g*b;

  
  for(int i=0 ; i<n ; i++){
    for(int j=i+1 ; j<n ; j++){
      
      int k = 2*j-i;   
      if((s[i]^s[j]^s[k]) == ('R'^'G'^'B'))
	res--;
      
   
    }
  }

  cout << res << endl;
  
  return 0;
}



Measured memory_bytes: 3648
let input = "3000";

function main(input){
  input = input.trim();
  let simo3;
  if(input.length>3){
    simo3 = parseInt(input.substr(input.length-3));
  }else{
    simo3 = parseInt(input);
  }
  if(simo3===0){simo3=1000;}
  console.log(1000-simo3);
}//main(input);

main(require("fs").readFileSync("/dev/stdin","utf8"));


Measured memory_bytes: 29644
#include <stdio.h>

int A[1000000], n;

/* 二分探索 */
int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while(left < right) {
    mid = (left + right) / 2;
    if(key == A[mid]) return 1; /* keyを発見 */
    if(key > A[mid]) left = mid + 1; /* 後半を探索 */
    else if(key < A[mid]) right = mid; /* 前半を探索 */
  }
  return 0;
}

int main(void) {
  int i, q, k, sum = 0;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&k);
    if(binarySearch(k))
      sum++;
  }
  printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 2184
N = int(input())

def is_buyable():
  output = 0
  for a in range(int(100/4)+1):
    for b in range(int(100/7)+1):
      total = 4*a + 7*b
      if total == N:
        return True

if is_buyable():
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
   string s; int i,t, k;
   cin>>k>>s;
   if(k==0) cout<<s;
   else
   {
       for(i=0;i<s.size();i++)
       {
           if( (char) s[i]+k <='Z')
           {
               s[i]=s[i]+k;
           }
           else
           {
              t=64 + (k-( 'Z'-s[i]));
               s[i]=  (char)t;
           }
       }
       cout<<s<<endl;
   }

}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define rep(i,n,m) for(int i=n; i<=m; i++)
#define per(i,n,m) for(int i=n; i>=m; i--)
#define print(x) printf("%d ", x);
#define println(x) printf("%d\n", x);
#define printarray(a,n) for(int i=0; i<n-1; i++){printf("%d ", a[i]);} printf("%d\n", a[n-1]);
#define scan(x) scanf("%d", &x);
#define scanarray(a,n) for(int i=0; i<n; i++){scanf("%d", &a[i]);}
#define scans(str) scanf("%s",str);

typedef struct myNode{
    int val;
    myNode *next = NULL;
	myNode *prev = NULL;
}Node;

Node* create(int val) {
	Node *new_node = new Node;
  	if (new_node == NULL) {
    	//fprintf(stderr, "create error\n");
    	exit(1);
  	}
  	new_node->val = val;
  	new_node->next = NULL;
	new_node->prev = NULL;
  	return new_node;
}

void remove(Node *p) {
	Node *next = p->next;
	if(next == NULL) {
		fprintf(stderr, "remove error1\n");
    	exit(1);
	}
	
	Node *prev = p->prev;
	if(prev == NULL) {
		fprintf(stderr, "remove error2\n");
    	exit(1);
	}
	
	prev->next = p->next;
	next->prev = p->prev;
	delete p;
	p = NULL;
}

void insert(Node* head, int val){
	Node *next = head->next;
	Node *new_node = create(val);
	new_node->next = head->next;
	new_node->prev = head;
	next->prev = new_node;
	head->next = new_node;
	
}

Node* find(Node* head, int val) {
	Node *i = NULL;
	for( i = head; i->next != NULL; i = i->next) {
		if(i->val == val) {
			return i;
		}
	}
	
	return NULL;
}

void deleteNode(Node* head_p)
{
  Node *p = head_p->next;
  while ( p!=NULL ) {
    Node *next = p->next; 
    delete p;
    p = next;
  }
  head_p->next = NULL;
}

void printList(Node *head)
/* リストの内容を表示する */
{
	Node* i = NULL;
	for(i = head; i->next->next->next != NULL; i=i->next) {
		printf("%d ", i->next->val);
	}
	printf("%d\n", i->next->val);
}

void deleteFirst(Node *n) {
	remove(n->next);
}

void deleteLast(Node *n) {
	remove(n->prev);
}



int main() {
	Node *head = create(-1);
	Node *tail = create(-1);
	head->next = tail;
	tail->prev = head;
	
	int n;
	scan(n);
	rep(i,0,n-1) {
		
		char str[16];
		scans(str);
		int key;
		
		
		if(strcmp(str,"insert") == 0) {
			scan(key);
    		insert(head,key);
		}
		if(strcmp(str,"delete") == 0){
			scan(key);
			Node* tmp;
			tmp = find(head,key);
			if(tmp == NULL) ;
			else remove(tmp);
		}
		if(strcmp(str,"deleteFirst") == 0) {
			deleteFirst(head);
		}
		if(strcmp(str,"deleteLast") == 0) {
			deleteLast(tail);
		}
		//printList(head);
  	}
	printList(head);
	
  	//deleteNode(head);
	//free(head);
    
    return 0;
}



Measured memory_bytes: 34352
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    string S;
    cin >> N >> S;

    ll ans = 0;
    REP(i, N) {
        set<char> a, b;

        REP(j, i) {
            a.insert(S[j]);
        }

        FOR(j, i, N) {
            b.insert(S[j]);
        }

        if (a.size() > b.size()) swap(a, b);

        ll cnt = 0;
        for(auto x: b) {
            cnt += int(a.count(x) > 0);
        }

        ans = max(cnt, ans);
    }

    print(ans);
    
}


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

using namespace std;

#define ll long long

vector<ll> res; vector<ll> ser;
void divisor(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			res.push_back(i); if (i != n / i) res.push_back(n / i);
		}
	}
	if (n != 1){ 
	    res.push_back(n); 
	}
}
void asd(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ser.push_back(i); 
			if (i != n / i){
			    ser.push_back(n / i);
			}
		}
	}
	if (n != 1) { 
	    ser.push_back(n);
	}
}
int main() {
	ll n, ans=0; 
	cin>>n; 
	divisor(n); 
	asd(n-1);
	for(ll h=0;h<res.size();h++){
		ll a=n;
		while(a%res[h]==0){
		    a/=res[h]; 
		}
		if((a-1)%res[h]==0){ 
		    ans++; 
		}
	}
	for(int h=0;h<ser.size();h++){
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int key(int string);
int  main(void) {
    char string[32];
    int i,hand,count;
    while (1) {
        scanf("%s\n",string);
        if (string[0]=='#') break;
        for (i=0; i<strlen(string); i++) {
            if (i==0) {
                hand=key(string[i]);
                count=0;
            } else if ((hand==0&&key(string[i])==1)||(hand==1&&key(string[i])==0)) {
                count++;
                hand=key(string[i]);
            }
        }
        printf("%d\n",count);
    }
    return 0;
}

int key(int string) {
    if (string=='y'||string=='u'||string=='i'||string=='o'||string=='p'||string=='h'||string=='j'||string=='k'||string=='l'||string=='n'||string=='m') {
        return 1;
    } else {
        return 0;
    }
}

Measured memory_bytes: 544