akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

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

  vector<vi > a(n,vi(26,0));
  string in;

  rep(i,n){
    cin>>in;
    rep(j,in.size()){
      a[i][in[j]-'a'] ++;
    }
  }
  string ret = "";
  rep(i,26){
    int r = in.size();
    rep(j,n){
      r = min(r, a[j][i]);
    }
    // cout<<char(i + 'a')<< ' ' << r<<endl;
    rep(k,r)ret += char(i + 'a');
  }
  cout<<ret<<endl;

}

Measured memory_bytes: 256
n,p=map(int,input().split())
a=list(map(lambda x:int(x)%2,input().split()))
on=a.count(1)
ze=a.count(0)
ans=0
if on==0:
    if p==0:
        print(2**n)
        exit()
    if p==1:
        print(0)
        exit()
    
print(2**(n-1))

Measured memory_bytes: 9176
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<string> vstr(N);
	for(int i=0;i<N;++i){
		cin >> vstr[i];
	}
	string T;
	cin >> T;
	int Lnum = 0;
	int Cnum = 0;
	int Rnum = 0;
	for(int i=0;i<N;++i){
		int L = 0;
		int C = 0;
		int R = 0;
		string temp = vstr[i];
		int size = temp.size();
		for(int j=0;j<size;++j){
			if( temp[j] == '?' ){
				temp[j] = 'a';
			}
		}
		if( temp <= T ){
			++L;
		}
		temp = vstr[i];
		for(int j=0;j<size;++j){
			if( temp[j] == '?' ){
				temp[j] = 'z';
			}
		}
		if( T <= temp ){
			++R;
		}

		if( L && R ){
			++Cnum;
		}else if( L ){
			++Lnum;
		}else{
			++Rnum;
		}
	}
	
	for(int i=Lnum+1;i<=N+1-Rnum; ++i){
		if( i != Lnum+1 ) cout << ' ';
		cout << i;
	}
	cout << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
inline void update(int &a, int b) { if(a<b) a=b; }

int H, W;
char f[16][16];

void flip() {
    static char tmp[16][16];
    memcpy(tmp, f, sizeof(tmp));
    rep(i, H) rep(j, W) f[j][i] = tmp[i][j];
    swap(H, W);
}

int solve() {
    if(W==1 && H==1) return f[0][0]=='.' ? 0 : 1;
    if(W>H) flip();
    if(W==1) flip();
    map<vector<int>, int> dp[2];
    int cur = 0, nxt = 1;
    dp[cur][vector<int>()] = 0;
    rep(h, H) rep(k, W) {
        dp[nxt].clear();
        for(map<vector<int>, int>::iterator it=dp[cur].begin();
                it!=dp[cur].end(); ++it) {
            int z = 0;
            rep(i, it->first.size()) z |= it->first[i];
            if(f[h][k]=='.' || f[h][k]=='?') {
                // put white
                if((h==0 || z&(1<<k)) && (k==0 || z&(1<<(k-1)))) {
                    vector<int> v(it->first);
                    rep(i, v.size()) v[i] &= ~(1<<k);
                    sort(v.begin(), v.end());
                    if(v.empty() || v[0]!=0) update(dp[nxt][v], it->second);
                }
            }
            if(f[h][k]=='#' || f[h][k]=='?') {
                // put black
                if(k==0) {
                    vector<int> v(it->first);
                    if((z&(1<<k))==0) v.push_back(1<<k);
                    sort(v.begin(), v.end());
                    update(dp[nxt][v], it->second+1);
                }
                else {
                    const int t = (1<<k) + (1<<(k-1));
                    bool loop = false;
                    rep(i, it->first.size()) if((it->first[i]&t)==t) loop=true;
                    if(!loop) {
                        vector<int> v(it->first);
                        const int REMOVED = 1<<30;
                        int x = 1<<k;
                        rep(i, v.size()) if(v[i]&t) {
                            x |= v[i];
                            v[i] = REMOVED;
                        }
                        v.push_back(x);
                        sort(v.begin(), v.end());
                        while(v.size() && v.back()==REMOVED) v.pop_back();
                        update(dp[nxt][v], it->second+1);
                    }
                }
            }
        }
        swap(cur, nxt);
    }
    int ans = -1;
    for(map<vector<int>, int>::iterator it=dp[cur].begin();
            it!=dp[cur].end(); ++it) {
        if(it->first.size()==1) update(ans, it->second);
    }
    return ans;
}

int main() {
    scanf("%d%d", &H, &W);
    rep(i, H) rep(j, W) scanf(" %c", f[i]+j);
    printf("%d\n", solve());
    return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N + 1);
    vector<bool> b(N + 1, false);
    FOR(i, 1, N + 1, 1) {
        cin >> a[i];
        b[i] = i > N / 2 && a[i] == 1;
    }
    RFOR(i, N / 2, 1, 1) {
        int cnt = 0;
        FOR(j, 1, N / i + 1, 1) {
            cnt += b[i * j];
        }
        b[i] = cnt % 2 != a[i];
    }
    int res = 0;
    FOR(i, 1, N + 1, 1) {
        res += b[i];
    }
    cout << res << endl;
    FOR(i, 1, N + 1, 1) {
        if (b[i]) {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1792
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
a,v = gets.chomp.split.map(&:to_i)
b,w = gets.chomp.split.map(&:to_i)
t = gets.chomp.to_i

if a == b
  puts 'YES'
else
  if (b - a).abs <= t*v - t*w
    puts 'YES'
  else
    puts 'NO'
  end
end




Measured memory_bytes: 14708
#include <cstdio>
#include <vector>
using namespace std;
int v[100005], b[100005] = { 0 };
int main() {
	int N, K, R = 0, k = 0;
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) scanf("%d", &v[i]);
	int start = 0, stop = 0;
	for (;;) {
		for (; stop < N && k < K; stop++) {
			if (v[stop] <= K && ++b[v[stop]] == 1)k++;
		}
		if (k < K) break;
		for (; start < N && k >= K; start++) {
			if (!R || R > stop - start)R = stop - start;
			if (v[start] <= K && !--b[v[start]]) k--;
		}
	}
	printf("%d\n", R);
}



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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

ll len(ll n){
    ll le=0;
    while(n>0){n/=10;le++;};
    return le;
}

void solve(){
    ll l;
    cin>>l;
    double a=(double)l/3;
    a*=a*a;
    printf("%.10lf",a);
}

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

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
	int i,j,a[3][3],b[3][3],c[3][3];
	for(i=0;i<3;i++)
		for(j=0;j<3;j++)
			scanf("%d",&c[i][j]);
	a[0][0]=c[1][0]-c[0][0];
	a[0][1]=c[2][0]-c[1][0];
	a[1][0]=c[1][1]-c[0][1];
	a[1][1]=c[2][1]-c[1][1];
	a[2][0]=c[1][2]-c[0][2];
	a[2][1]=c[2][2]-c[1][2];
	b[0][0]=c[0][1]-c[0][0];
	b[0][1]=c[0][2]-c[0][1];
	b[1][0]=c[1][1]-c[1][0];
	b[1][1]=c[1][2]-c[1][1];
	b[2][0]=c[2][1]-c[2][0];
	b[2][1]=c[2][2]-c[2][1];
	if(a[0][0]==a[1][0]&&a[1][0]==a[2][0]
		&&b[0][0]==b[1][0]&&b[1][0]==b[2][0]
		&&a[0][1]==a[1][1]&&a[1][1]==a[2][1]
		&&b[0][1]==b[1][1]&&b[1][1]==b[2][1])
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}


ll xorsum(ll x){
    if(x%4==1)return 1;
    if(x%4==2)return x+1;
    if(x%4==3)return 0;
    if(x%4==0)return x;
    return 0;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;

//    ll x = 0;
//    REP(i,1,21){
//        x ^= i;
//        dbg(bitset<8>(x));
//    }

    ll suma = xorsum(a-1);
    ll sumb = xorsum(b);
    cout<<(suma^sumb)<<endl;
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 200005;
ll A[MAX_N],B[MAX_N];
vector<ll> sumA,sumB;

int main()
{
	ll N,M,K;
	cin >> N >> M >> K;
	sumA.push_back(0);
	rep(i,N)
	{
		cin >> A[i];
		sumA.push_back(sumA[i] + A[i]);
	}
	sumB.push_back(0);
	rep(i,M)
	{
		cin >> B[i];
		sumB.push_back(sumB[i] + B[i]);
	}
	ll ans = 0;
	for (int i = 0; i <= N; ++i)
	{
		if (sumA[i] > K) break;
		ans = max(ans,i+(upper_bound(sumB.begin(), sumB.end(), K - sumA[i]) - sumB.begin() - ll(1)));
		//cout << ans << " ";
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    string s; cin >> s;
    vector<int> vec(s.size()-2);
    rep(i,s.size()-2){
        string st = s.substr(i,3);
        int num = std::stoi(st);
        vec.at(i) = abs(num-753);
    }
    cout << *min_element(vec.begin(),vec.end()) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define MODU 33
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	vector<int> dis(n), wet(m);
	REP(i, n) {
		scanf("%d", &dis[i]);
	}
	REP(i, m) {
		scanf("%d", &wet[i]);
	}
	int dp[1001][1001] = {};//??\?????????????????´
	Fill(dp, INT_MAX);
	dp[0][0] = 0;
	REP(i, m) {
		REP(j, n) {
			if (dp[i][j] != INT_MAX) {
				dp[i + 1][j + 1] = min(dp[i + 1][j + 1] ,dp[i][j] + dis[j] * wet[i]);
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			}
		}
	}
	int ans = INT_MAX;
	REP(i, m+1) {
		ans = min(ans, dp[i][n]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 7116
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;
typedef vector<ll>		VLL;
typedef vector<VLL>		VVLL;
typedef vector<VVLL>	VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int N, Z, W;
vector<int> a;
int main()
{
	cin >> N >> Z >> W;
	a.resize(N);
	REP(i, N) cin >> a[i];

	int ans = abs(a[N - 1] - W);
	if (1 < N) {
		ans = max(ans, abs(a[N - 1] - a[N - 2]));
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    int d, n;
    cin >> d >> n;
    int xxx = 1;
   if(d==1) xxx*=100;
  if(d==2) xxx*=10000;
  if(n==100) n=101;
    cout << xxx * n << endl;
}


Measured memory_bytes: 256
#include<iostream>

using std::cin;
using std::cout;

inline int dis( int x , int y )
{
	return x + y;
}

int main( void )
{
	int T;
	cin >> T;
	int buf1 , buf2 , buf3;
	while( T-- )
	{
		cin >> buf1 >> buf2 >> buf3;
		if( buf1 < dis( buf2 , buf3 ) )
		{
			cout << "No";
			return 0;
		}
		if( ( buf1 - dis( buf2 , buf3 ) ) & 1 )
		{
			cout << "No";
			return 0;
		}
	} 
	cout << "Yes";
}

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

float a,j;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	if(i%2==1)
	j++;
	a=j/n;
	cout<<fixed<< setprecision(10)<<a;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
#define Ms(a,b) memset(a,b,sizeof a);
#define db(x) cout<<#x<<"="<<x<<endl;
using namespace std;
int n,a[N],m1,m2;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++) {
		scanf("%d",&a[i]);
		if(a[i]<=m1)m2=max(m2,a[i]);
		else m2=m1,m1=a[i];
	}
	for(int i=1; i<=n; i++)
		if(a[i]==m1)printf("%d\n",m2);
		else printf("%d\n",m1);
	return 0;
}


Measured memory_bytes: 2432
//
//  GetManyPersimmonTrees.cpp
//  
//
//  Created by ??°????????? on 2015/10/30.
//
//

#include <iostream>
using namespace std;

int main() {
    int n;
    while (cin >> n, n) {
        int w, h, field[101][101], s, t, m = 0;
        cin >> w >> h;
        
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                field[i][j] = 0;
            }
        }
        
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            field[y][x] = 1;
        }
        
        cin >> s >> t;
        
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                // (i, J)?????§?¨????????????????????????????
                if (i+t-1 <= h && j+s-1 <= w) {
                    int sum = 0;
                    for (int k = 0; k < t; k++) {
                        for (int l = 0; l < s; l++) {
                            sum += field[i+k][j+l];
                        }
                    }
                    m = max(m, sum);
                }
            }
        }
        
        cout << m << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define endl "\n"
 
const LD EPS=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

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


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

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

template<typename Head, typename... Tail>
struct vector_demensions
{
	using type=vector<typename vector_demensions<Tail...>::type>;
};

template<typename Head>
struct vector_demensions<Head> { using type=Head; };

template<typename T>
vector<T> make_vectors(int size, T val)
{
	return vector<T>(size, val);
}

template<typename T=int, typename... Args>
auto make_vectors(int size, Args... tail)
	-> typename vector_demensions<Args..., T>::type
{
	auto val=make_vectors<T>(forward<Args>(tail)...);
	return vector<decltype(val)>(size, val);
}

int main()
{
	int n,k;
	cin>>n>>k;
	auto a(read<int>(n));
	if(n==k)
	{
		print(1);
		return 0;
	}
	int p=0;
	REP(i,n) if(a[i]==1) p=i;
	int ans=0;
	//ans+=(p+k-2)/(k-1);
	//ans+=(n-p-1+k-2)/(k-1);
	ans=(n-1+k-1-1)/(k-1);
	print(ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
#define booga cout << "booga" << endl
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

void testcase(){

}

int main(int argc, char** argv){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	double v[55];
	cin >> n;
	for(int i{0};i < n;i++){
		cin >> v[i];
	}
	sort(v,v+n);
	double ans = v[0];
	for(int i{1};i < n;i++){
		ans += v[i];
		ans /= 2;
	}
	cout << fixed << setprecision(5) << ans << "\n";
	return 0;
}



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

#define ll long long

const ll llf = (signed ll) (~0ull >> 3);

const int N = 1e5 + 5;

typedef class Edge {
	public:
		int L, R;
		ll c;

		void read() {
			scanf("%d%d%lld", &L, &R, &c);
		}
		boolean operator < (Edge b) const {
			return c > b.c;
		}
} Edge;

int n, m;
ll f[N];
vector<Edge> G[N];
priority_queue<Edge> Q;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		f[i] = llf;
	f[1] = 0;
	for (int i = 1; i <= m; i++) {
		Edge tmp;
		tmp.read();
		G[tmp.L].push_back(tmp);
	}
	for (int i = 1; i <= n; i++) {
		while (!Q.empty() && Q.top().R < i)
			Q.pop();
		if (i > 1) {
			if (Q.empty()) {
				puts("-1");
				return 0;
			}
			f[i] = Q.top().c;
		}
		for (auto e : G[i]) {
			e.c += f[i];
			Q.push(e);
		}
	}
	printf("%lld\n", f[n]);
	return 0;
}


Measured memory_bytes: 8056
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char s[100010];
int i,j,len;
int id[100010],t[100010];
int main()
{
	scanf("%s",s+1);
	j=strlen(s+1);
	i=1;
	while (j)
	{
		while (s[i]=='x') i++;
		while (s[j]=='x') j--;
		if (!j) break;
		//cout<<s[i]<<" "<<s[j]<<endl;
		if (s[i]!=s[j]) {printf("-1");return 0;}
		else len++,t[len]=s[i],id[len]=i;
		i++;
		j--;
	}
	int q=(len+1)/2;
	int ans=0;
	i=1;j=strlen(s+1);
	if (len&1)
	{
		while (j>=id[q])
		{
			//cout<<i<<" "<<j<<" "<<id[q]<<endl;
			while (s[i]=='x'&&s[j]!='x') ans++,i++;
			while (s[j]=='x'&&s[i]!='x') ans++,j--;
			i++;
			j--;
		}
	}
	else
	{
		while (j>=id[q+1]-1)
		{
			while (s[i]=='x'&&s[j]!='x') ans++,i++;
			while (s[j]=='x'&&s[i]!='x') ans++,j--;
			i++;
			j--;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 998244353;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, s; cin >> n >> s;
	vi dp(s + 1), a(n);
	rep(i, n) cin >> a[i];
	
	ll ans = 0;
	for(int i : a){
		dp[0]++;
		vi next = dp;
		for(int j = 0; j + i <= s; j++){
			(next[j + i] += dp[j]) %= mod;
		}
		ans += next[s];
		dp = next;
	}
	cout << ans % mod << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int h,n;
   scanf("%d %d",&h,&n);
   int a[n];
   for(int i=0;i<n;i++){
      scanf("%d",&a[i]);
      h=h-a[i];
   }
   if(h<=0){
      printf("Yes\n");
   }else{
      printf("No\n");
   }
   return 0;
}


Measured memory_bytes: 2000
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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 namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};


const int MAX = 510000;

// 二項係数計算
long long com(ll n){
    ll k = 2;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return n*(n-1)/2;
}

int main()
{

    ll N;
    cin >> N;
    vector<ll> A;
    ll same[200005] = {};
    ll done[200005] = {};

    for(ll i=0; i<N; ++i)
    {
        ll tmp;
        cin >> tmp;
        A.push_back(tmp);
        ++same[tmp];
    }

    ll all = 0;
    for(ll i=0; i<N; ++i)
    {
        if(done[A[i]]==1) continue;
        else
        {
            done[A[i]] = 1;
            all += com(same[A[i]]);
        }
    }

    for(ll i=0; i<N; ++i)
    {
        cout << all - com(same[A[i]]) + com(same[A[i]]-1) << endl;
    }

    return 0;
}


Measured memory_bytes: 7408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll w,h,x,y;
	cin>>w>>h>>x>>y;
	cout<<h*w/2.0<<" ";
	if(x*2==w && y*2==h) cout<<1;
	else cout<<0;
}

Measured memory_bytes: 3768
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    immutable long MOD = 924844033;

    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];

    auto F = new long[](N+1);
    F[0] = F[1] = 1;
    foreach (i; 2..N+1)
        F[i] = F[i-1] * i % MOD;

    auto C = new long[][](N+10, N+10) ;
    C[0][0] = 1;
    foreach (i; 0..N+9) {
        foreach (j; 0..N+9) {
            (C[i+1][j] += C[i][j]) %= MOD;
            (C[i+1][j+1] += C[i][j]) %= MOD;
        }
    }
    

    auto dp = new long[][][](N+1, N+1, 2);
    dp[0][0][0] = 1;

    foreach (i; 0..N) {
        foreach (j; 0..N) {
            dp[i+1][j][0] = (dp[i][j][0] + dp[i][j][1]) % MOD;
            dp[i+1][j+1][1] = dp[i][j][0];
        }
    }

    auto dp2 = new long[][](2, N+1);
    dp2[0][0] = 1;
    int cur = 0, tar = 1;
    
    foreach (_; 0..2) {
        for (int i = 0; i < K; ++i) {
            int n = N / K;
            if (i < N % K) n += 1;
            for (int j = 0; j <= N; ++j) {
                for (int k = 0; j + k <= N && k <= n; ++k) {
                    dp2[tar][j+k] += dp2[cur][j] * dp[n-1][k].sum % MOD;
                    dp2[tar][j+k] %= MOD;
                }
            }
            swap(cur, tar);
            fill(dp2[tar], 0L);
        }
    }


    for (int i = N; i >= 0; --i) {
        dp2[cur][i] = dp2[cur][i] * F[N-i] % MOD;
        for (int j = i + 1; j <= N; ++j) {
            (dp2[cur][i] -= dp2[cur][j] * C[j][i] % MOD) %= MOD;
        }
    }

    writeln((dp2[cur][0] + MOD) % MOD);
}


Measured memory_bytes: 227836
#[allow(unused_macros)]
macro_rules! debug {
	($($a:expr),*) => {
		println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
	}
}
use itertools::Itertools;
#[allow(unused_imports)]
use std::cmp;
#[allow(dead_code)]
const MOD: usize = 1e9 as usize + 7;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let xy = sc.read_pairs::<i64>(n);

    let mut ans = 0.0;
    let mut count = 0;
    for perm in xy.into_iter().permutations(n) {
        for w in perm.windows(2) {
            ans += (((w[1].0 - w[0].0).pow(2) + (w[1].1 - w[0].1).pow(2)) as f64).sqrt();
        }
        count += 1;
    }
    ans /= count as f64;
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}

#[allow(dead_code)]
fn yn(flag: bool) {
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int S, W;
    cin >> S >> W;
    if (S > W) OUT("safe")
    else OUT("unsafe")

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  if(n==25) cout<<"Christmas"<<endl;
  else if(n==24) cout<<"Christmas Eve"<<endl;
  else if(n==23) cout<<"Christmas Eve Eve"<<endl;
  else cout<<"Christmas Eve Eve Eve"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
long a[200005];
pair<long,long>b[200005];
long c[200005];
int main()
{
    long n,m=0;
    cin>>n;
    for(long i=0;i<n;i++){
        scanf("%ld",&a[i]);
        if(a[i]>a[m])m=i;
    }
    cout<<a[m]<<' ';
    long f=(a[m]%2==0?a[m]:a[m]+1);
    long k=(m==0?a[1]:a[0]);k*=2;
    for(long i=0;i<n;i++){
            a[i]*=2;
        if(abs(a[i]-f)<abs(k-f)&&i!=m)
            k=a[i];
    }
    cout<<k/2<<endl;
	return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    map<ll,int>mp;
    vector<ll>b,c;
    rep(i,n){
        cin >> a[i];
        mp[a[i]]++;
        if(mp[a[i]]==2)b.push_back(a[i]);
        if(mp[a[i]]==4)c.push_back(a[i]);
    }
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans = 0;
    if(c.size())ans = c.back()*c.back();
    if(b.size()>=2)ans = max(ans,b[b.size()-1]*b[b.size()-2]);
    cout << ans << endl;
}

Measured memory_bytes: 7296
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll m = 1e9;
int main(void) {
  int n, k;
  ll s;
  cin >> n >> k >> s;
  rep(i, n) {
    ll a = s;
    if((i < n - k) && !(i % 2)) {
      a = (s + 1) / 2;
      if(s == 1 || s == 2)
        a = m;
    } else if((i < n - k) && (i % 2)) {
      a = s / 2 + 1;
      if(s == 1 || s == 2)
        a = m;
    }
    cout << a;
    if(i < n - 1)
      cout << ' ';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1280
import sys
stdin = sys.stdin
from itertools import product

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

s = ns()
n = len(s) - 1

ans = 0
for plus in product([0,1], repeat=n):
    num = []
    a = s[0]
    for i, flag in enumerate(plus):
        if flag == 0:
            a = a + s[i+1]
        else:
            num.append(a)
            a = s[i+1]
    num.append(a)
    ans += sum(map(int, num))
print(ans)


Measured memory_bytes: 3064
import itertools
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N, M, *ab = map(int, read().split())
    E = [[] for _ in range(N+1)]

    for a, b in zip(*[iter(ab)] * 2):
        E[a].append(b)
        E[b].append(a)
    
    ans = 0
    fact_p = itertools.permutations(range(2,N+1))
    for p in fact_p:
        par = 1
        flag = True
        for i in p:
            if par not in E[i]:
                flag = False
                break
            par = i
            
        if flag:
            ans += 1
    
    print(ans)


if __name__ == "__main__":
    main()


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

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

	ll N, H, a[100000], b[100000];
	cin >> N >> H;
	ll amax = -1;
	REP(i, N) {
		cin >> a[i] >> b[i];
		amax = max(amax, a[i]);
	}
	sort(b, b+N, greater<ll>());
	ll ans = 0;
	REP(i, N) {
		if(b[i] > amax) {
			H -= b[i]; ans++;
		}
		if(H <= 0){
			cout << ans << endl;
			return 0;
		}
	}
	ans += (H+amax-1) / amax;

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


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

int n, m, a;
int h, p, q;

int main()
{
  while(cin >> n >> m >> a, n){
    vector<vi> vec(m, vi(3));
    rep(i, m){
      cin >> h >> p >> q;
      vec[i][0] = h;
      vec[i][1] = p - 1;
      vec[i][2] = q - 1;
    }

    sort(ALL(vec), greater<vi>());

    vi shf(n);
    rep(i, n) shf[i] = i;
    rep(i, m) swap(shf[vec[i][1]], shf[vec[i][2]]);

    rep(i, n) if(a - 1 == shf[i]) cout << i + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1272
import java.util.Scanner;

public class Main {
	
	private static int n;
	private static int[] A;

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		n = Integer.parseInt(sc.nextLine());
		String[] a = (sc.nextLine()).split(" ");
		int[] X = new int[n];
		for (int i = 0; i < n; i++) {
			X[i] = Integer.parseInt(a[i]);
		}
		A = X;

		int q = Integer.parseInt(sc.nextLine());
		String[] m = (sc.nextLine()).split(" ");
		int[] M = new int[q];
		for (int i = 0; i < q; i++) {
			M[i] = Integer.parseInt(m[i]);
			if (solve(0,M[i])) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}

	public static boolean solve(int i, int m) {
		if (m == 0) {
			return true;
		} else if (i >= n) {
			return false;
		}
		return solve(i + 1, m) || solve(i + 1, m - A[i]);

	}

}

Measured memory_bytes: 26524
n = int(input())
cards = [[0 for j in range(13)] for i in range(4)]

def symbolToNum(symbol):
    if symbol == 'S':
        return 0
    elif symbol == 'H':
        return 1
    elif symbol == 'C':
        return 2
    elif symbol == 'D':
        return 3

def symbolFromNum(num):
    if num == 0:
        return 'S'
    elif num == 1:
        return 'H'
    elif num == 2:
        return 'C'
    elif num == 3:
        return 'D'

for i in range(n):
    symbol, number = input().split()
    cards[symbolToNum(symbol)][int(number) - 1] = 1

for i in range(4):
    for ii in range(13):
        if cards[i][ii] == 0:
            print(symbolFromNum(i), ii + 1)



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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000001;
using namespace std;
typedef long long ll;

string s;

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

  std::cout << (s<="2019/04/30"?"Heisei":"TBD") << '\n';
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
string S;
int N;
char ball[4010];
ll dp[4010][4010] = {};
const ll inf = 998244353;
int main(){
    cin >> S;
    int N = 2*S.size();
    ll r = 0,b = 0;
    dp[0][0] = 1;
    for(int i=0;i<N;i++){
        if(i<N/2){
            if(S[i]=='0') r += 2;
            else if(S[i]=='2') b += 2;
            else{r++; b++;}
        }
        for(ll j=0;j<=r;j++){
            if(i+1-j<0 || i+1-j>b) continue;
            (dp[i+1][j] += dp[i][j])%=inf;
            if(j>0) (dp[i+1][j] += dp[i][j-1])%=inf;
        }
    }
    cout << dp[N][r] << endl;
}

Measured memory_bytes: 123520
#include <stdio.h>

int main( void )
{
	int arry[100];
	int length, number, cou;
	
	scanf( "%d", &length );
	cou = 0;
	
	while( cou < length )
	{
		scanf( "%d", &arry[ cou ] );
		cou++;
	}
	
	cou = 1;
	
	while( cou <= length )
	{
		if( length - cou == 0 )
		{
			printf( "%d\n", arry[ length - cou ] );
			break;
		}
		else
		{
			printf( "%d ", arry[ length - cou ] );
		}
		cou++;
	}

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll, ll, ll>>>;

// MOD確認

ll tableF[200010];
ll tableI[200010];

ll modfact(ll a,ll m){
   if(tableF[a] != -1){
      return tableF[a];
   }
   if(a == 1){
      tableF[a] = 1;
      return tableF[a];
   }
   ll res = 1;
   res = a * modfact(a-1,m);
   res %= m;
   tableF[a] = res;
   return res;
}

ll modpow(ll a,ll n,ll m){//modpow(a,n,m) := a ^ n (mod m)
  ll res = 1;
  while(n > 0){
    if(n & 1)res = res * a % m;
    a = a * a % m;
    n >>= 1;
  }
  return res;
}

ll modinv(ll a,ll p){//modinv(a,p) := pを法とするaの逆元(※pは素数でなければならない)
    ll res = modpow(a,p-2,p);
    return res;
}

ll modCON(ll n,ll r,ll m){
   if(n < 200010){
   ll res = 1;
   if(n < 0 || r < 0 || n < r){
      return 0;
   }
   res *= tableF[n];
   res %= m;
   res *= tableI[r];
   res %= m;
   res *= tableI[n-r];
   res %= m;
   return res;
   }else{
   ll res = 1;//tableを持ってないときよう
   for(int i = 1;i <= n;i++){
      res *= i;
      res %= m;
   }
   for(int i = 1;i <= r;i++){
      res *= modinv(i,m);
      res %= m;
   }
   for(int i = 1;i <= n-r;i++){
      res *= modinv(i,m);
      res %= m;
   }
   return res;
   }
}

void modfill(ll m){//忘れない　約200ms
   fill(tableF,tableF+200010,-1);
   fill(tableI,tableI+200010,-1);
   tableF[0] = 1;
   tableI[0] = 1;
   for(int i = 1;i < 200010;i++){
      tableF[i] = modfact(i,m);
      tableI[i] = modinv(tableF[i],m);
   }
}

ll A[100010];

int main(){
   ll N;
   cin >> N;
   ll sum = 0;
   rep(i,N){
      ll a;
      cin >> a;
      sum += a;
      A[a]++;
   }
   ll Q; 
   cin >> Q;
   rep(i,Q){
      ll b,c;
      cin >> b >> c;
      sum = sum + (c-b) * A[b];
      cout << sum << endl;
      A[c] += A[b];
      A[b] = 0;
   }
}

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  bool result;
  
  cin >> N;
  result=false;
  
  for (int i=1; i < 10; i++){
    if (N%i == 0 && N/i>0 && N/i<10){
      result=true;
      break;
    }
  }
  
  if (result){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
int main() {

    int x,y, z;
    std::cin >> x >> y >> z;
    int postA  = z;
    int postB  = x;
    int postC  = y;
    std::cout << postA  << " "<< postB  << " " << postC << std::endl;
    

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
void init(int n);
void unite(int x,int y);
int find(int x);
bool same(int x,int y);
int n,m,price[5050];
map<string,int> id;

int par[200010]; // ???
int rnk[200010]; // ??±???

/* Union Find ????????? */
void init(int n){
  for(int i=0;i<=n;i++){
    par[i] = i;
    rnk[i] = 0;
  }
}

/* x???????????¨y?????????????????? */
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rnk[x] < rnk[y]){
	  par[x] = y;
	}
	else {
	  par[y] = x;
	}
	if(rnk[x] == rnk[y]) rnk[x]++;
}

/* x????????????????????¢?´¢ */
int find(int x){
  if(par[x] == x){
    return x;
  }
  else {
    return par[x] = find(par[x]);
  }
}

/* x??¨y????????????????????????????????? */
bool same(int x,int y){
  return find(x) == find(y);
}

int main(){
	cin >> n;
	init(n);
	for(int i=0;i<n;i++){
		string str;
		int a;
		cin >> str >> a;
		id[str] = i;
		price[i] = a;
	}
	cin >> m;
	for(int i=0;i<m;i++){
		string a,b;
		cin >> a >> b;
		unite(id[a],id[b]);
	}
	for(int i=0;i<n;i++){
		price[find(i)] = min(price[find(i)],price[i]);
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		ans += price[find(i)];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1844
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N, Y;
  cin >> N >> Y;
  for (ll i = 0; i <= N; i++) {
    for (ll j = 0; j <= N; j++) {
      ll k = N - i - j;

      if (k < 0) break;

      if (Y == i * 10000 + j * 5000 + k * 1000) {
        cout << i << ' ' << j << ' ' << k << endl;
        return 0;
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  return 0;
}


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

int vote[102] = {0};

int main(){
    int n, q;
    while(cin >> n >> q, n != 0 || q != 0){
        fill(vote, vote + 102, 0);
        for(int i=0;i<n;++i){
            int m;
            cin >> m;
            for(int j=0;j<m;++j){
                int d;
                cin >> d;
                vote[d]++;
            }
        }

        int maxi = vote[0], idx = 0;
        for(int i=1;i<101;++i)
            if(vote[i] > maxi && vote[i] >= q){
                maxi = vote[i];
                idx = i;
            }
        cout << idx << endl;
    }

    return 0;
}


Measured memory_bytes: 3068