akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define int long long

using namespace std;

const int MOD = 1000000007;

int modpow(int a, int n) {
    if(n == 0){
        return 1;
    }else if(n % 2 == 0){
        int t = modpow(a, n / 2);
        return t * t % MOD;
    } else {
        int t = modpow(a, n / 2);
        return (t * t % MOD) * a % MOD;
    }
}

// a^{-1} mod を計算する
int modinv(int a) { return modpow(a, MOD - 2); }

signed main() {
    int n, a, b;
    cin >> n >> a >> b;
    int fna = 1, fnb = 1, ifa = 1, ifb = 1;
    int pfac = 1, pifac = 1;
    for(auto i = 1LL; i <= a; i++) {
        fna = pfac * (n - a + i) % MOD;
        ifa = pifac * modinv(i) % MOD;
        pfac = fna;
        pifac = ifa;
    }
    pfac = 1;
    pifac = 1;
    for(auto i = 1LL; i <= b; i++) {
        fnb = pfac * (n - b + i) % MOD;
        ifb = pifac * modinv(i) % MOD;
        pfac = fnb;
        pifac = ifb;
    }
    int ans = modpow(2, n);
    ans -= (fna * ifa % MOD);
    ans -= (fnb * ifb % MOD);
    ans--;
    ans %= MOD;
    ans += MOD;
    ans %= MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

main() {
  int pay, charge, count=0, i;

  while(1) {
    scanf("%d", &pay) ; 
    if(pay == 0) break;
    if(1 > pay || pay >= 1000) continue;
    count = 0;
  charge = 1000 - pay;
  count += i = charge / 500;
  charge = charge - i * 500;
  count += i = charge / 100;
  charge = charge - i * 100;
  count += i = charge / 50;
  charge = charge - i * 50;
  count += i = charge / 10;
  charge = charge - i * 10;
  count += i = charge / 5;
  charge = charge - i * 5;
  count += i = charge / 1;
  charge = charge - i * 1;

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

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int n,cnt[110];

bool check(int x) {
	for (int i=2;i<x;i++) if (x%i==0) return 0;
	return 1;	
}

int count(int n,int k) {
    int num=0;
    while(n) {
        num+=n/k;
        n/=k;
    }
    return num;
}

int main()
{
	cin>>n;
	if (n<10) { printf("0"); return 0; }
	for (int i=2;i<=n;i++)
		if (check(i)) cnt[i]=count(n,i);
	
	long long ans=0;
	for (int i=2;i<=n;i++)
	if (cnt[i]>=4)
		for (int j=i+1;j<=n;j++)
		if (j!=i && cnt[j]>=4)
			for (int k=2;k<=n;k++)
			if (k!=j && k!=i && cnt[k]>=2) 
				ans++;
	
	for (int i=2;i<=n;i++)
	if (cnt[i]>=24)
		for (int j=2;j<=n;j++)
		if (j!=i && cnt[j]>=2) ans++;
	
	for (int i=2;i<=n;i++)
	if (cnt[i]>=4)
		for (int j=2;j<=n;j++)
		if (j!=i && cnt[j]>=14) ans++;
		
	for (int i=2;i<=n;i++)
		if (cnt[i]>=74) ans++;
							
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=3.14159265359;

int main() {
    string S;
    cin>>S;
    ll ans = 0;
    vector<string> arr;
    for(int bit=0;bit<(1<<(S.size()-1));++bit){
        arr.clear();
        arr.push_back(string()+S[0]);
        for(int i=0;i<S.size()-1;++i){
            if((bit&(1<<i))!=0) arr.push_back(string()+S[i+1]);
            else arr[arr.size()-1] += S[i+1];
        }
        for(int i=0;i<arr.size();++i){
            ans += stol(arr[i]);
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i:=0;i<n;i++{
		fmt.Scan(&a[i])
	}
	fmt.Println(sub(a))
}

func sub(a []int) int {
	sort.Ints(a)
	alice := 0
	bob := 0
	for i:=0;i<len(a); i++{
		if i%2 == 0 {
			alice += a[len(a)-i-1]
		} else {
			bob += a[len(a)-i-1]
		}
	}
	return alice-bob
}

Measured memory_bytes: 512
import java.util.*;
 
 
public class Main {
 
    private static final long INF = 1_000_000_000_000_000_000L;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        long[] x = new long[N];
        long[] y = new long[N];
        long[] z = new long[N];
        for (int i = 0; i < N; i++) {
            x[i] = sc.nextLong();
            y[i] = sc.nextLong();
            z[i] = sc.nextLong();
        }
 
        long max = -INF;
        int bit = 1 << 3;
        for (int d = 0; d < bit; d++ ) {
            int a = (d & (1<<2)) != 0 ? 1 : -1;
            int b = (d & (1<<1)) != 0 ? 1 : -1;
            int c = (d & 1) != 0 ? 1 : -1;
            long[] v = new long[N];
            for (int i = 0; i < N; i++) {
                v[i] = a*x[i]+b*y[i]+c*z[i];
            }
            Arrays.sort(v);
            long tmp = 0;
            for (int i = 0; i < M; i++) {
                tmp += v[N-1-i];
            }
            max = Math.max(max, tmp);
        }
 
        System.out.println(max);
    }
}

Measured memory_bytes: 28992
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fastt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pll pair<ll,ll>
const ll INF=1e9;
//--------------------------------------------------//
vector <ll>adj[100001];
vector <ll> T;
ll vis[100001];
ll dis[100001];
void topo(ll v)
{
	ll i,u;
	vis[v]=1;
	for(i=0;i<adj[v].size();i++)
	{
		u=adj[v][i];
		if(vis[u]==0)
		{
			topo(u);
		}
	}
	T.pb(v);
}
int main()
{
	fastt;
    ll n,m,i,u,v;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
    	cin>>u>>v;
    	adj[u].pb(v);
    }
    for(i=1;i<=n;i++)
    {
    	if(vis[i]==0)
    		topo(i);
    }
    memset(dis,-INF,sizeof(dis));
    reverse(T.begin(),T.end());
    dis[*(T.begin())]=0;
    for(auto v:T)
    {
    	for(auto u:adj[v])
    	{
    		if(dis[u]<dis[v]+1)
    			dis[u]=dis[v]+1;		
    	}
    }
    ll mm=0;
    for(i=1;i<=n;i++)
    	mm=max(mm,dis[i]);

    cout<<mm<<"\n";
}

Measured memory_bytes: 9588
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<string> vec(n);
    FOR(i, 0, n) {
        cin >> vec[i];
    } 
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    cout << vec.size() << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





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

  vector<int> p(n);
  rep(i,n){
    cin>>p[i];
  }

  int cnt=0;
  int now=0;
  while(1){
    now=p[now]-1;
    cnt++;
    if(now==1) {
      cout << cnt << endl;
      return 0;
    }
    if(cnt>111111) break;
  }

  cout << -1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

int main(){
    int n;
    cin >> n;
    vl s(n+1,0);
    ll tmp;
    map<ll,ll> mp;
    rep(i,n){
        cin >> tmp;
        s[i+1] = s[i] + tmp;
    }

    reps(i,1,n+1){
        mp[s[i]]++;
    }
    ll ans = 0;
    for(auto e: mp){
        if(e.first == 0) ans += e.second;
        if(e.second > 1)ans += (e.second)*(e.second-1)/2;
        //cout << e.first << " " << e.second << endl;
    }

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

Measured memory_bytes: 17080
n = int(input())
a = list(map(int,input().split()))
l = {}
r = {}
for i in range(n):
    p = i+a[i]
    q = i-a[i]
    if p < n:
        if p in l:
            l[p] = l[p]+1
        else:
            l[p] = 1
    if q > 0:
        if q in r:
            r[q] = r[q]+1
        else:
            r[q] = 1
ans = 0
for i in l:
    if i in r:
        ans+= l[i]*r[i]
print(ans)


Measured memory_bytes: 115848
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void){
    int n,a,b;
    cin >> n >> a >> b;
    if((b-a) % 2 == 0) cout << "Alice" << endl;
    else cout << "Borys" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i, n) for (int i = 0; i < ( n ); ++i )
#define rep(i,n)    for (int i =0; i < ( n ); ++i )
using namespace std;
using ll = long long;
using ull = unsigned long long;
using p  = pair<int, int>;
using vec_int = vector<int>;
using vec_str = vector<string>;
#define INF (1<<29)
ll ans = 0;

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}

void debug_input(vec_str& argv)
{
    // デバッグ用引数読み込み
    ifstream file("./input.txt");
    string str;
    while( getline(file, str) ) {
        argv.push_back(str);
    }
}

void debug_split_string(const string& str, vec_str& v)
{
    stringstream ss{str};
    string buf;
    while (getline(ss, buf, ' ')) {
        v.push_back(buf);
    }
}

void debug_split_int(const string& str, vec_int& v)
{
    stringstream ss{str};
    string buf;
    while (getline(ss, buf, ' ')) {
        istringstream ss(buf);
        int temp;
        ss >> temp;
        v.push_back(temp);
    }
}

int main()
{
    int N, M = 0;
#if 1
	cin >> N >> M;
    vec_int v(M);
    rep(i,M) cin >> v[i];
#endif


    ans = N;
    rep(i, M) {
    
        ans -= v[i];
        if( ans < 0 ) {
            cout << "-1";
            return 0;
        }
    }
        

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

Measured memory_bytes: 3644
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	vector<LL> a(x), b(y), c(z);
	for (int i = 0; i < x; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < y; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i < z; ++i) {
		cin >> c[i];
	}
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	sort(c.rbegin(), c.rend());
	vector<LL> v, w;
	for (int i = 0; i < a.size(); ++i) {
		for (int j = 0; j < b.size(); ++j) {
			v.push_back(a[i] + b[j]);
		}
	}
	sort(v.rbegin(), v.rend());
	int m = min((int)v.size(), k);
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < c.size(); ++j) {
			w.push_back(v[i] + c[j]);
		}
	}
	sort(w.rbegin(), w.rend());
	for (int i = 0; i < k; ++i) {
		cout << w[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 43240
n,*s=open(0)
a=b=c=d=0
for t in s:
    if t[-2]=='A'and t[0]=='B':
        d+=1
    elif t[-2]=='A':
        a+=1
    elif t[0]=='B':
        b+=1
    c+=t.count('AB')
if all(i==0for i in(a,b)):
    print(c+max(0,d-1))
    exit()
elif a==b:
    print(a+c+d)
    exit()
ans=min(a,b)+c
dif=abs(a-b)
ans+=min(dif,d)
d-=min(dif,d)
print(ans+d)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;

string s;
int n, k;
ll dp[200][3][5];

ll solve(int idx, bool smaller, int c){
    if(c == k + 1) return 0;
    if(idx == n) return c == k;
    if(~dp[idx][smaller][c]) return dp[idx][smaller][c];
    if(smaller){
        ll op1 = solve(idx + 1, 1, c);
        ll op2 = 9 * solve(idx + 1, 1, c + 1);
        return dp[idx][smaller][c] = op1 + op2;
    }
    else{
        ll ans = 0;
        for(int i = 0; i < 10; i++){
            if(s[idx] - '0' == i){
                ans += solve(idx + 1, 0, c + (i != 0));
                break;
            }
            else ans += solve(idx + 1, 1, c + (i != 0));
        }
        return dp[idx][smaller][idx] = ans;
    }
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> s >> k;
    n = s.size();
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0, 0);

    return 0;
}




Measured memory_bytes: 3648
import numpy as np
from functools import reduce
from operator import add,sub,mul,truediv
from fractions import gcd

d,g = map(int,input().split())

p = []
c = []

for _ in range(d):
    a,b = map(int,input().split())
    p.append(a)
    c.append(b)


ans = 1000000000

#print(p)
#print(c)
for bit in range(1 << d):
    score = 0
    num = 0
    x = []
    for i in range(d):
        if (bit >>i)&1 == 0:
            x.append(i+1)
        else:
#            print(i)
#            print(p[i])
            score  = score + p[i]*(i+1)*100+c[i]
            num = num + p[i]
    
#    print(bin(bit))
#    print(x[::-1])

    flag = False
    for j in x[::-1]:
        for _ in range(p[j-1]):
            if score >= g:
                flag = True
                break
            score  = score + j*100
            num = num +1
#            print(score)
#            print(num)
        
#        print(num)
        if flag :
            break
        
#    print(score)
#    print(num)
#    print("num:{}".format(num))
    ans= min(ans,num)
#    print("$$$$$$$$$$$$$$$$$$$$$")

print(ans)
    


    


Measured memory_bytes: 14348
n = int(input())
s = list(input())
w_count, e_count = 0, 0
w_list, e_list = [], []
count = []
for i in range(n):
    if s[i] == "W":
        w_count += 1
    w_list.append(w_count)
    if s[n - i - 1] == "E":
        e_count += 1
    e_list.append(e_count)
e_list.reverse()
count.append(e_list[0])
for i in range(1, n - 1):
    count.append(w_list[i - 1] + e_list[i + 1])
count.append(w_list[n - 1])
print(min(count))


Measured memory_bytes: 32184
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

int main(){
  vector<int> primes;
  for(int i=2;i<1010;i++){
    if(prime(i)){
      primes.push_back(i);
    }
  }
  vector<int> e(primes.size(),0);
  int n;
  cin>>n;
  for(int i=2;i<=n;i++){
    int temp = i;
    for(int j=0;j<primes.size();j++){
      while(temp%primes[j]==0){
        temp /= primes[j];
        e[j]++;
      }
    }
  }
  
  long long ans=1;
  REP(j,primes.size()){
    ans = mod(ans *(e[j]+1));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll K;
string s;
void solve() {
    cin >> s >> K;
    vstr K_or_less;
    rep(i,s.size()){
        rng(j,1,K+1){
            K_or_less.pb(s.substr(i,j));
        }
    }
    sort(ALL(K_or_less));
    K_or_less.erase(unique(ALL(K_or_less)));
    // DEBUG_VEC(K_or_less);
    print(K_or_less[K-1]);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 4276
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define sq(a) (a)*(a)
#define nitro std::ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define debug(x) std::cerr<<#x<<"="<<x<<'\n'
#define text std::cerr<<"SacredCoupoid08\n"
#define endl '\n'
#define all(c) (c).begin(),(c).end()
#define U 1000000007
#define N 100005
#define sz(c) (int)c.size()
typedef long long ll;
typedef std::vector< int > vi;
typedef std::pair<int, int> pi;
#define cin std::cin
#define cout std::cout
#define vector std::vector
#define pb push_back
#define pv(x) for(auto y:x)    cerr<<y<<" ";    cerr<<'\n';
#define fr first
#define sc second
#define ppb pop_back
#define max(a,b) a=max(a,b)
#define min(a,b) a=min(a,b)
#define int ll
#define tr(c,it) for(typeof(c.begin()) it= c.begin();it != c.end();it++)
signed main()
{		
	nitro;
	int VASU=1;
	//cin>>VASU;
	while(VASU--)
	{
		string s;
		 cin>>s;
		 if(s[1]=='B')
		 cout<<"ARC"<<endl;
		 else
		 cout<<"ABC"<<endl;
		
	}
	

	
	
	
	return 0;
}



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


int main() {
int N,a=0,w=0,t=0,r=0;
cin >> N;
rep(i,N) {
  string s;
  cin >> s;
  if (s == "AC") a++;
  else   if (s == "WA") w++;
  else   if (s == "TLE") t++;
  else   if (s == "RE") r++;

}
printf("AC x %d\n",a);
printf("WA x %d\n",w);
printf("TLE x %d\n",t);
printf("RE x %d\n",r);






return 0;
}



Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b && n>=a)
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) for(i=0;i<b;i++)
#define rep1(i,b) for(i=1;i<=b;i++)
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
#define MOD 1000000007
LL mpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}
#define MAXK 100000
#define MAXN 1000000000
int ar[MAXK];
int get(int n, int k){
    int i=0;
    while(i<k and ar[i]<=n)i++;
    return n-i;
}
typedef unsigned long long int ULL;
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

bool isSafe(int r, int c, vector<vector<int> > arr) {
	int n = arr.size();
	int m = arr[0].size();
	return (r>=0 && r<n && c>=0 && c<m);
}

/////////////////////////////////////////////////////////////
bool diffSign(int a,int b) {
	return ((a>0 && b<0) || (a<0 && b>0));
}  

int main() 
{ 
	int n;
	sd(n);
	int cnt=0;
	LL x;
	map<LL,bool> MP;
	while(n--) {
		cin>>x;
		if(!MP[x]) {
			cnt++;
			MP[x]=1;
		} else {
			cnt--;
			MP[x]=false;
		}
	}
	cout<<cnt;
	return 0; 
} 


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

int main() {
    char c;
    cin>>c;
    if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o') cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
}


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

int main() {
  int x;
  cin >> x;
  for(int i = x; i < 1000000; i++) {
    bool f = true;
    for(int j = 2; j < i; j++) {
      if(i % j == 0) {
        f = false;
        break;
      }
    }
    if(f) {
      cout << i << endl;
      break;
    }
  }        
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n){
        ll ans = 0, tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll a[n] = {}, b[] = {}, c[] = {};
        vll v;
        cin >> ans;
        rep(i, n - 1){
            cin >> x;
            ans = gcd(ans, x);
        }
        print(ans);
    }
}


Measured memory_bytes: 1152
#include <cstdio>
#include <cctype>
#include <cmath>
#include <algorithm>
#define File(S) freopen(S".in","r",stdin),freopen(S".out","w",stdout)
using namespace std;
typedef long long ll;
namespace Data_stream{
    const int IN_LEN=1<<17;
	char buf[IN_LEN],*HEAD=buf,*TAIL=buf,ch;
	bool sign;
    inline char gec(){
    	if(HEAD==TAIL){
    		TAIL=(HEAD=buf)+fread(buf,1,IN_LEN,stdin);
    		if(HEAD==TAIL)return EOF;
    	}
    	return *HEAD++;
    }
	template <typename T>
	inline int read(T&a){
    	for(sign=0,ch=gec();!isdigit(ch)&&ch!=EOF;ch=gec())
     	    if(ch=='-')sign=1;
     	if(ch==EOF)return EOF;
    	for(a=0;isdigit(ch);ch=gec())a=((a+(a<<2))<<1)+(ch^'0');
    	if(sign)a=-a;
    	return 0;
	}
}
using namespace Data_stream;
int a,b,c,d,n;
int main()
{
	read(a);read(b);read(c);read(d);
	read(n);
	b=min(b,a<<1);c=min(c,b<<1);
	if(c<<1>d){
		printf("%lld",1LL*(n>>1)*d+1LL*(n&1)*c);
	}
	else printf("%lld",1LL*c*n);
	return 0;
}


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

int main(){
  int n; cin >> n;
  int w[n];
  for(int i=0;i<n;i++){
    cin >> w[i];
  }

  int ret = 1000000;
  for(int t=0;t<n;t++){
      int left=0;
      int right = 0;
  	for(int i=0;i<t;i++){
      left += w[i];
  	}
    //cout << "left " << left << endl;
  	for(int j=t;j<n;j++){
      right += w[j];
    }
    //cout << "right " << right << endl;
    int abs_num = abs(left-right);
    if(abs_num<ret){
      ret = abs_num;
    }
  }
  
  cout << ret << endl;

}

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

using namespace std;

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i] == '7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
} 

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll N;
    cin >> N;
    ll L[N];
    for(int i = 0; i<N;i++)
        cin >> L[i];
    sort(L,L+N);
    ll sum = 0;
    int i;
    for(i = 0; i < N - 1;i++)
        sum += L[i];
    if(sum > L[i])
    cout  << "Yes" << "\n";
    else 
    cout << "No" << "\n";
    return 0; 
}


Measured memory_bytes: 256
from collections import deque
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
c = 0

for i in range(M):
    G = [[] for _ in range(N)]
    for j in range(M):
        if i == j:
            continue
        a, b = ab[j][0], ab[j][1]
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)
    Q = deque()
    Q.append(0)
    d = [0] * N
    d[0] = 1
    while Q:
        q = Q.popleft()
        for g in G[q]:
            if d[g] == 0:
                d[g] = 1
                Q.append(g)
    if 0 in d:
        c += 1

print(c)

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

int main(void){
  char n[200001] ;
  // printf("input N > \n") ;
  fflush( stdout ) ;
  scanf( "%s", n ) ;
  // printf( "%s\n", n ) ;
  int l = strlen(n) ;
  // printf( "%d\n", l ) ;
  int S = 0 ;
  int i, k ;
  for( i = 0 ; i < l ; i++ ) {
  	k = n[i] - '0' ;
  	if( 0 <= k && k<= 9 ) {
  	  S += k ;
  	} else {
  	  // printf("This is not a integer.\n") ;
  	  return 1 ;
  	}
  }
  // printf( "%d\n", S ) ;
  if( S % 9 == 0 ) {
  	printf("Yes") ;
  } else {
  	printf("No") ;
  }
  return 0 ;
}

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

void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

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

  ll ans = 0;
  vector <int> x(3);
  int x1, x2, x3;
   for (x1 = 1; x1 <= k; x1++) {
     for (x2 = 1; x2 <= k; x2++) {
       for (x3 = 1; x3 <= k; x3++) {
         // ans = ans + gcd(gcd(x1, x2), x3);
         ans = ans + gcd(x1, gcd(x2, x3));
       }
     }
   }
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include<cstdlib>
#include <cstdio>
using namespace std;
const int MAX = 100;
class Stack{
private:
    int s[MAX];
    int top,base;
public:
    void initialize(){
        this->top =0;
    }
    bool isEmpty(){
        return (this->top == 0);
    }
    bool isFull(){
        return (this->top >= MAX -1);
    }
    void push(int x){
        s[top++] = x; 
    }
    int pop(){
        return s[--top];
    }
};

int main(){
    Stack stack;
    int a,b;
    char x[MAX];
    stack.initialize();
    while(scanf("%s",x)!=EOF){
        if(x[0]=='+'){
            a= stack.pop();
            b = stack.pop();
            stack.push(a+b);
        }
        else if(x[0]=='-'){
            a = stack.pop();
            b = stack.pop();
            stack.push(b-a);
        }
        else if(x[0] =='*'){
            a = stack.pop();
            b = stack.pop();
            stack.push(a*b);
        }
        else stack.push(atoi(x));
    }
    cout<<stack.pop()<<endl;
    return 0;
}















Measured memory_bytes: 3156
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define int64 long long
#define sz(a) ((int) (a).size())

const int M = (int) 1e9 + 7;
const int N = 1000;
int a[N], b[N], whereA[N * N], whereB[N * N], n, m;

int mult(int a, int b) {
	return (a * 1LL * b) % M;
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n * m; ++i) {
		whereA[i] = whereB[i] = -1;
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]), --a[i];
		if (whereA[a[i]] != -1) {
			printf("0\n");
			return 0;
		}
		whereA[a[i]] = i;
	}
	for (int j = 0; j < m; ++j) {
		scanf("%d", &b[j]), --b[j];
		if (whereB[b[j]] != -1) {
			printf("0\n");
			return 0;
		}
		whereB[b[j]] = j;
	}
	int cntA = 0, cntB = 0, ans = 1, used = 0;
	for (int i = n * m - 1; i >= 0; --i, ++used) {
		if ((whereA[i] != -1) && (whereB[i] != -1)) {
			cntA++, cntB++;
			continue;
		}
		if ((whereA[i] == -1) && (whereB[i] == -1)) {
			if (cntA * cntB == used) {
				printf("0\n");
				return 0;
			}
			ans = mult(ans, cntA * cntB - used);
			continue;
		}
		if (whereA[i] != -1) {
			ans = mult(ans, cntB);
			cntA++;
		} else {
			ans = mult(ans, cntA);
			cntB++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
#define endl '\n'
using namespace std;
using ll = long long int;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 112345;
int dp[4][MAXN], v[4][MAXN];
int main() {
    int n, k;
    scanf("%d", &n);
    for (int i = 1; i<=n; ++i) {
        for (int j = 1; j<=3; ++j) {
            scanf("%d", v[j]+i);
        }
    }
    for (int i = 1; i<=3; ++i) dp[i][1] = v[i][1]; 
    for (int i = 2; i<=n; ++i) {
        dp[1][i] = max(dp[2][i-1], dp[3][i-1])+v[1][i];
        dp[2][i] = max(dp[1][i-1], dp[3][i-1])+v[2][i];
        dp[3][i] = max(dp[2][i-1], dp[1][i-1])+v[3][i];
    }
    printf("%d\n", max(dp[1][n], max(dp[2][n], dp[3][n])));
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<stdlib.h>
int matrixChainOrder(int*,int);
int main(void)
{
  int i;//counter
  int n;//the number of matrix
  int *p;//array of each row(column)
  scanf("%d",&n);
  p=(int*)malloc(sizeof(int)*(n+1));
  for(i=0;i<n;i++) scanf("%d%d",&p[i],&p[i+1]);
  printf("%d\n",matrixChainOrder(p,n));
  free(p);
  return 0;
}
int matrixChainOrder(int *p,int n)
{
  int i,j;//counter
  int begin,mid,end;//counter
  int **m;//m[i][j]: the number of multiplication from matrix i to matrix j
  int tempMin;//temporary minimum value
  int cur;//current value
  m=(int**)malloc(sizeof(int*)*n);
  for(i=0;i<n;i++) m[i]=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++) m[i][i]=0;
  for(i=1;i<n;i++)
    {
      for(begin=0,end=i;end<n;begin++,end++)
	{
	  //printf("--\n");
	  for(mid=begin;mid<end;mid++)
	    {
	      //printf("[%d,%d,%d]->",begin,mid,end);
	      cur=m[begin][mid]+m[mid+1][end]+p[begin]*p[mid+1]*p[end+1];
	      //printf("%d+%d+%d*%d*%d=%d\n",m[begin][mid],m[mid+1][end],p[begin],p[mid+1],p[end+1],cur);
	      if(mid==begin) tempMin=cur;
	      else if(cur<tempMin) tempMin=cur;
	    }
	  m[begin][end]=tempMin;
	  //printf("m[%d][%d]=%d\n",begin,end,m[begin][end]);
	}
    }
  return m[0][n-1];
}



Measured memory_bytes: 2104
#include<iostream>
using namespace std;
int main(){
int a[5];
int counter=0;
int checker=0;
int ans;
    for(int i=0;i<5;i++){
    cin>>a[i];
    if(a[i]==0){
        checker=1;
        ans=i;
    }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 3160
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

void solve(){
  while(true){
    int N; cin >> N;
    if(N == 0) break;
    vector<int> A(N);
    int sum = 0;
    for(int i = 0; i < N; i++){
      cin >> A[i];
      sum += A[i];
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
      if(A[i] * N <= sum) ans++;
    }
    cout << ans << endl;
  }
}

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

    solve();
}



Measured memory_bytes: 3168
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from itertools import combinations

N = I()
S = ['0']*N
x = [0]*5
for i in range(N):
    S[i] = str(input())
    if S[i].startswith('M'):
        x[0] += 1
    elif S[i].startswith('A'):
        x[1] += 1
    elif S[i].startswith('R'):
        x[2] += 1
    elif S[i].startswith('C'):
        x[3] += 1
    elif S[i].startswith('H'):
        x[4] += 1

ans = 0
A = list(combinations(range(5),3))
for a in A:
    ans += x[a[0]]*x[a[1]]*x[a[2]]

print(ans)

Measured memory_bytes: 47068
#include <iostream>
#include <string>

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

    if (s == "Sunny")
    {
        std::cout << "Cloudy" << std::endl;
    }
    else if (s == "Cloudy")
    {
        std::cout << "Rainy" << std::endl;
    }
    else
    {
        std::cout << "Sunny" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int a[5];
    for(int i = 0;i <= 2;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+3);
    printf("%d",a[0] + a[1]);
}


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

bool isBingo(int A[3][3]) {
    int flag = false;

    if(A[0][0] ==0 && A[1][1] ==0 && A[2][2] == 0) {
        flag = true;
    }

    else if(A[0][2] == 0 && A[1][1] ==0 &&  A[2][0] == 0){
        flag = true;
    }

    else if(A[0][0] ==0 &&  A[0][1] ==0 &&  A[0][2] == 0){
        flag = true;
    }
    else if(A[1][0] ==0 &&  A[1][1] == 0 && A[1][2] == 0){
        flag = true;
    }
    else if(A[2][0] ==0 &&  A[2][1] ==0 &&  A[2][2] == 0){
        flag = true;
    }

    else if(A[0][0] ==0 &&  A[1][0] ==0 &&  A[2][0] == 0){
        flag = true;
    }
    else if(A[0][1] ==0 &&  A[1][1] ==0 &&  A[2][1] == 0){
        flag = true;
    }
    else if(A[0][2] ==0 &&  A[1][2] ==0 &&  A[2][2] == 0){
        flag = true;
    }

    return flag;
}



int main() {
    int A[3][3];
    int i, j;

    for(i = 0; i< 3 ; ++i) {
        for(j=0;j<3;j++) {
            cin >> A[i][j];
        }
    }

    int N;
    cin >> N;

    int arr[N];
    for(i = 0 ; i < N; ++i) {
        cin >> arr[i];
    }



    for(int k = 0; k < N; k++) {
        int value = arr[k];
        for(i = 0; i< 3 ; ++i) {
        for(j=0;j<3;j++) {
            if(A[i][j] == value) {
                A[i][j] = 0;
                }
            }
        }
    }

    if(isBingo(A)){
        cout << "Yes";
    }
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for x in range(H)]

res = []

for i in range(H):
    r = []
    for j in range(W):
        if S[i][j] == '#':
            r.append('#')
        else:
            count = 0
            for d in [(-1, 1), (0, 1), (1, 1), (-1, 0), (0, 0), (1, 0), (-1, -1), (0, -1), (1, -1)]:
                x = i+d[0]
                y = j+d[1]

                if (0 <= x < H) and (0 <= y < W) and S[x][y] == '#':
                    count += 1
            r.append(count)
    res.append(r)

for i in range(H):
    print(''.join(map(str, res[i])))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,arr[100005];
int dp[100005];
int solve(int pos)
{
    if(pos == n){
        return 0;
    }
    if(dp[pos]!=-1){
        return dp[pos];
    }
    dp[pos] = 1e9+100;
    if(pos+1<=n){
        dp[pos] = min(dp[pos], solve(pos+1) + abs(arr[pos]-arr[pos+1]));
    }
    if(pos+2<=n){
        dp[pos] = min(dp[pos], solve(pos+2) + abs(arr[pos]-arr[pos+2]));
    }
    return dp[pos];
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        dp[i] = -1;
    }
    cout<<solve(1)<<endl;
    return 0;
}


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

int main(void){
    int n, card[4][13], chnum, num;
    char ch;
    cin >> n;
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 13; j++) card[i][j] = 0;
    }

    for(int i = 0; i < n; i++){
        cin >> ch >> num;
        switch (ch)
        {
        case 'S':
            chnum = 0;
            break;
        
        case 'H':
            chnum = 1;
            break;

        case 'C':
            chnum = 2;
            break;

        case 'D':
            chnum = 3;
            break;
        }
        card[chnum][num-1] = 1;
    }

    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 13; j++){
            if(card[i][j] != 1) {
                switch (i)
                {
                case 0:
                    ch = 'S';
                    break;
                
                case 1:
                    ch = 'H';
                    break;

                case 2:
                    ch = 'C';
                    break;

                case 3:
                    ch = 'D';
                    break;
                }
                cout << ch << ' ' << j + 1 << endl;
            }
        }
    }
    return 0;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


int count(int u, int prev, int r, vvi& next) {
    set<int> visited;
    visited.insert(prev);
#ifdef DEBUG
    fprintf(stderr, "count(u=%d, prev=%d,..., r=%d)", u,prev,r);
#endif

    queue<ii> q;
    q.push(ii(u,r));
    int cnt = 0;
    while (!q.empty()) {
        auto t = q.front(); q.pop();
        int u = t.first, rest = t.second;
        visited.insert(u);
        ++cnt;
        if (rest == 0) continue;
        for (int v: next[u]) {
            if (found(visited, v)) continue;
            q.push(ii(v,rest-1));
        }
    }
#ifdef DEBUG
    fprintf(stderr, " = %d\n", cnt);
#endif
    return cnt;
}

int solve(int N,int K,vi& a,vi& b) {
    vvi next(N);
    rep(i,N-1) {
        next[a[i]].pb(b[i]);
        next[b[i]].pb(a[i]);
    }

    int cmax = 0;
    if (K % 2) {
#ifdef DEBUG
        fprintf(stderr, "ODD; r=%d\n", K/2);
#endif
        rep(e,N-1) {
            int a0=a[e], b0=b[e];
#ifdef DEBUG
            fprintf(stderr, " e=%d-%d\n", a0, b0);
#endif
            int c = count(a0, b0, K/2, next) + count(b0, a0, K/2, next);
            cmax = max(cmax, c);
        }
    } else {
#ifdef DEBUG
        fprintf(stderr, "EVEN; r=%d\n", K/2);
#endif
        rep(u,N){
#ifdef DEBUG
            fprintf(stderr, " u=%d\n", u);
#endif
            int c = 1;
            for (int v: next[u]) {
#ifdef DEBUG
                fprintf(stderr, "  -> v=%d\n", v);
#endif
                c += count(v, u, K/2-1, next);
            }
            cmax = max(cmax, c);
        }
    }
    return N - cmax;
}

int main() {
    int N,K; cin >> N >> K;
    vi a(N-1),b(N-1);
    rep(i,N-1) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
    }
    cout << solve(N,K,a,b) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;


int main(){
    
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    int a[4][3][10]={0};
    
    for(int i=0;i<n;i++){
        int b,f,r,v;
        cin>>b>>f>>r>>v;
        b--,f--, r--;
        a[b][f][r] += v;
    }

    for(int i=0;i<4;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                cout<<" "<<a[i][j][k];
            }
            cout<<"\n";
        }
        if(i<3)
            cout<<"####################\n";
    }

    return 0;
}






Measured memory_bytes: 3212
#include<stdio.h>
int main()
{
    int d=0,t=0,e=0,a,b,c,A,B,C,h;
    while(1){
        scanf("%d%d%d",&a,&b,&c);
        if(a>b&&a>c){
            C=a;
            A=b;
            B=c;
        }else if(b>a&&b>c){
            B=c;
            C=b;
            A=a;
        }else{
            A=a;
            B=b;
            C=c;
        }
        if(A+B<=C){
            printf("%d %d %d %d\n",d+t+e,t,e,d);
            break;
        }
        h=A*A+B*B-C*C;
        if(h>0){
            e++;
        }else if(h<0){
            d++;
        }else{
            t++;
        }
    }
    return 0;
}


Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
int n,q,c[26][500009];
string s;
void update(int x,int v,int i) {
	for(;x<=n;x+=x&-x) c[i][x]+=v;
}
int sum(int x,int i) {
	int ans=0;
	for(;x>0;x-=x&-x) ans+=c[i][x];
	return ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>s>>q;
	for(int i=0;i<s.size();i++) update(i+1,1,s[i]-'a');
	for(int i=0;i<q;i++) {
		int type;
		cin>>type;
		if(type==1) {
			int a;
			char b;
			cin>>a>>b;
			update(a,-1,s[a-1]-'a');
			s[a-1]=b;
			update(a,1,b-'a');
		}
		else {
			int l,r,ans=0;
			cin>>l>>r;
			for(int j=0;j<26;j++)
				if(sum(r,j)-sum(l-1,j)>0)
					ans++;
			cout<<ans<<endl;
		}
	}
	return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class FEngines {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n; cin >> n;
      vector<P> vec(n);
      vector<pair<long double, int>> rad;
      rep(i, n) {
        long double x, y; cin >> x >> y;
        auto r = atan2(y, x);
        vec[i].first = x;
        vec[i].second = y;
        rad.emplace_back(r, i);
        rad.emplace_back(r+PI*2, i);
      }
      ll ans = 0;
      sort(all(rad));
      n = 2*n;
      rep(i, n) {
        for(int j=i; j<=min(i+n/2,n); j++) {
          ll x = 0;
          ll y = 0;
          for(int k=i; k<j; k++) {
            auto r = rad[k].first;
            auto p = rad[k].second;
            x += vec[p].first;
            y += vec[p].second;
          }
          chmax(ans, x*x+y*y);
        }
      }
      cout << setprecision(40) << fixed << sqrt((long double)ans) << endl;
    }
};

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

Measured memory_bytes: 256
//This code was made by Chinese_zjc_
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
inline int rd(int &ddd)
{
	char tmp=getchar();
	int xxx=1;
	ddd=0;
	while(('0'>tmp||tmp>'9')&&tmp!='-'&&tmp!=EOF)
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	if(tmp=='-')
	{
		xxx=-1;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		ddd=(ddd<<3)+(ddd<<1)+(tmp^48);
		tmp=getchar();
	}
	return ddd*=xxx;
}
inline char rd(char &ddd)
{
	char tmp=getchar();
	while(tmp==' '||tmp=='\n')
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	return ddd=tmp;
}
inline int max(const int &A,const int &B)
{
	return A<B?B:A;
}
inline int min(const int &A,const int &B)
{
	return A<B?A:B;
}
int ans[2][100001],n;
string s;
signed main()
{
	cin>>s;
	n=s.length();
	s=" "+s;
	fill(ans[0]+1,ans[0]+n+1,1);
	for(int i=1;i<n;++i)
	{
		if(s[i]=='R')
		{
			ans[0][i+1]+=ans[1][i];
			ans[1][i+1]+=ans[0][i];
			ans[1][i]=0;
			ans[0][i]=0;
		}
	}
	for(int i=n;i>1;--i)
	{
		if(s[i]=='L')
		{
			ans[0][i-1]+=ans[1][i];
			ans[1][i-1]+=ans[0][i];
			ans[1][i]=0;
			ans[0][i]=0;
		}
	}
	for(int i=1;i<n;++i)
	{
		if(s[i]=='R'&&s[i+1]=='L')
		{
			ans[0][i]+=ans[1][i+1];
			ans[0][i+1]+=ans[1][i];
			ans[1][i]=0;
			ans[1][i+1]=0;
		}
	}
	for(int i=1;i<=n;++i)
	{
		printf("%lld ",ans[0][i]);
	}
	return 0;
}


Measured memory_bytes: 2172