akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef pair<int,int> pii;
const int N = 10000;

void compute(int i,int *buf){
  buf[0]=i/1000%10;
  buf[1]=i/100%10;
  buf[2]=i/10%10;
  buf[3]=i%10;
}

pii hitAndBlow(int n,int q){
  int hit=0,blow=0;
  int buf1[5],buf2[5];
  compute(n,buf1);
  compute(q,buf2);
  rep(i,4){
    rep(j,4){
      if (buf1[i] == buf2[j]){
	if (i == j)hit++;
	else blow++;
      }
    }
  }
  return make_pair(hit,blow);
}

int solve(vector<int> &a,vector<int> all){
  if (a.size() > 15)return -1;
  rep(i,all.size()){
    int buf[5];
    bool isok=true;
    int cnt[5][5]={0};
    rep(j,a.size()){
      pii tmp = hitAndBlow(a[j],all[i]);
      cnt[tmp.first][tmp.second]++;
      if (cnt[tmp.first][tmp.second] > 1)isok=false;
    }
    if (isok)return all[i];
  }
  return -1;
}

main(){
  int n;
  vector<int> all(N);
  rep(i,N){
    int buf[4];
    compute(i,buf);
    bool isok=true;
    rep(j,4)REP(k,j+1,4)if (buf[j] == buf[k]){isok=false;}
    all[i]=(isok?i:-1);
  }
  sort(all.begin(),all.end());
  all.erase(remove(all.begin(),all.end(),-1),all.end());
  while(cin>>n && n){
    /*
    vector<pii> in(n);
    vector<int> cand,query(n);
    rep(i,n)cin>>query[i]>>in[i].first>>in[i].second;
    rep(i,all.size()){
      bool isok=true;
      int buf[5];
      rep(j,n){
	pii tmp =hitAndBlow(all[i],query[j]);
	if (tmp.first == in[j].first && tmp.second == in[j].second);
	else {
	  isok=false;
	}
      }
      if (isok)cand.push_back(all[i]);
    }
    sort(cand.begin(),cand.end());
    */
    vector<int> cand;
    cand=all;
    rep(k,n){
      vector<int> b;
      int q,hit,blow;
      cin>>q>>hit>>blow;
      rep(i,cand.size()){
	bool isok=true;
	pii tmp =hitAndBlow(q,cand[i]);
	if (hit == tmp.first && blow == tmp.second);
	else {
	  isok=false;
	}
	if (isok)b.push_back(cand[i]);
      }
      cand=b;
    }
    int ans = cand.size() == 1?cand[0]:solve(cand,all);
    if (ans !=-1)printf("%04d\n",ans);
    else puts("????");
  }
  return false;
}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;

	lli cnt=0;
	lli num=INF;
	REP(i,0,n){
		lli a;
		cin>>a;
		if(num>a){
			cnt++;
			num=a;
		}
	}
	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define res register int
using namespace std;
int n,a[1005],ans;
inline int read()
{
  int X=0,w=0;
  char ch=0;
  while(!isdigit(ch))
  {
    w|=ch=='-';
    ch=getchar();
  }
  while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
  return w?-X:X;
}
int main()
{
  n=read();
  for(res i=1; i<=n<<1; i++)
    a[i]=read();
  sort(a+1,a+(n<<1)+1);
  for(res i=1; i<=n; i++)
    ans+=a[i*2-1];
  printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <bitset>
#include <map>
#include <climits>
#include <set>

using namespace std;

int main()
{
    int N;
    cin >> N;
    using T = bool;
    map<int, bool> table;
    for (int i = 0; i < N; ++i)
    {
        size_t j;
        cin >> j;
        if (table.count(j))
        {
            table[j] = !table[j];
        }
        else
        {
            table.insert(make_pair(j, true));
        }
    }

    auto s = accumulate(table.begin(), table.end(), 0, [](long s, pair<int, bool> p) {
        return p.second ? s + 1 : s;
    });
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 4992
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   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; }
    const int MAX =1002;
const int MOD =1000000007;
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
signed main(){
  COMinit();
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  int ans[n+1]={};
  ans[n]=1;
  for(int i=a;i<=b;i++){
    for(int j=0;j<n;j++){
      int t=1;
      for(int k=1;k<=d&&j+i*k<=n;k++){
        t=(t*COM(j+i*k,i))%MOD;
        if(k>=c)ans[j]=(ans[j]+t*ans[j+i*k]%MOD*finv[k]%MOD)%MOD;
      }
    }
  }
  cout<<ans[0]<<endl;
}

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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) cin >> h.at(i);
  sort(h.begin(), h.end());
  ll ans = 10e9;
  rep(i,n-k+1) ans = min(ans, h.at(i+k-1)-h.at(i));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import sys
import itertools
n, k = map(int, sys.stdin.readline().split())
s = [int(string) for string in input()]

tmp = []
flag = s[0]
cnt = 1

if s[0] == 0:
    tmp.append(0)
for i in range(1, n):
    if flag == s[i]:
        cnt += 1
    else:
        tmp.append(cnt)
        cnt = 1
        flag = 1 - flag
tmp.append(cnt)
if s[-1] == 0:
    tmp.append(0)

ruisekiwa = list(itertools.accumulate(tmp))
ans = 0
ruisekiwa.insert(0, 0)
for left in range(0, len(ruisekiwa), 2):
    right = left + 2*k+1
    if len(ruisekiwa) <= right:
        right = len(ruisekiwa)-1
    ans = max(ans, ruisekiwa[right] - ruisekiwa[left])

print(ans)


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

int main(){
  int n; cin >> n;
  int m = 1;
  while(n>m*(m+1)/2) m++;
  
  for(int i = 1; i <= m; i++){
  	if(i==m*(m+1)/2-n) continue;
  	cout << i << endl;}
}

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

int main() {
    string N; cin >> N;
    int n = stoi(N);
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        if ((int)s.size() % 2 == 1) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

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

    if (s[0] == 'W' || s[n * 2 - 1] == 'H') {
        cout << 0 << endl;
        return 0;
    }

    bool left_right[n * 2] = {};
    left_right[0] = true;

    repd(i, 1, 2 * n) {
        if (s[i] == s[i - 1]) {
            left_right[i] = !left_right[i - 1];
        } else {
            left_right[i] = left_right[i - 1];
        }
    }

    ll count = 0;
    rep(i, 2 * n) {
        if (left_right[i]) {
            count++;
        } else {
            count--;
        }
    }
    if (count != 0) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    rep(i, 2 * n) {
        if (left_right[i]) {
            count++;
        } else {
            ans *= count;
            count--;
            ans %= mod;
        }
    }

    ll base = 1;
    repd(i, 1, n + 1) {
        base *= i;
        base %= mod;
    }

    ans *= base;
    ans %= mod;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  
  int A,B;
  cin >> A >> B;
  
  if(A > 9 || B > 9){

    cout << "-1" <<endl;
    
  }else{

    cout << A * B <<endl;
    
  }
}
    

Measured memory_bytes: 256
// this program finds the longest anagramatically equivalent substring of s1 and s2


#include <bits/stdc++.h>

using namespace std;

namespace std { 
  template<> struct hash<pair<int, int> > { 
    size_t operator() (const pair<int, int>& key) const {
      return hash<int>()(key.first) + hash<int>()(key.second);
    }
  };
}
  

int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  string s1;
  string s2;
  cin >> s1 >> s2;
  if (s1.size() > s2.size()) swap(s1, s2);
  const vector<int> primes = {1000000007, 1000000009};
    
  int psize = primes.size();

  int n = 4001;
  vector<vector<int>> powers(psize, vector<int>(26));
  for (int i = 0; i < primes.size(); i++) {
    long long cur = 1;
    for (int j = 0; j < 26; j++) {
      powers[i][j] = cur;
      cur = (cur * n) % primes[i];
    }
  }
  vector<vector<int>> asums1(psize, vector<int>(s1.size() + 1, 0));
  vector<vector<int>> asums2(psize, vector<int>(s2.size() + 1, 0));
  for (int i = 0; i < primes.size(); i++) {
    for (int j = 0; j < s1.size(); j++) {
      asums1[i][j + 1] = (asums1[i][j] + powers[i][s1[j] - 'a']) % primes[i];
    }
    for (int j = 0; j < s2.size(); j++) {
      asums2[i][j + 1] = (asums2[i][j] + powers[i][s2[j] - 'a']) % primes[i];
    }
  }

  
  int ans = 0;
  for (int len = s1.size(); len >= 1; len--) {
    // vector<unordered_set<int>> table(psize);
    unordered_set<pair<int, int>> table;
    for (int i = 0; i <= s1.size() - len; i++) {
      int j = i + len;
      int hash1 = asums1[0][j] - asums1[0][i];
      int hash2 = asums1[1][j] - asums1[1][i];
      if (hash1 < 0) hash1 += primes[0];
      if (hash2 < 0) hash2 += primes[1];
      table.insert({hash1, hash2});
      // for (int k = 0; k < psize; k++) {
      // 	int hash = asums1[k][j] - asums1[k][i];
      // 	if (hash < 0) hash += primes[k];
      // 	table[k].insert(hash);
      // }
    }
    
    for (int i = 0; i <= s2.size() - len; i++) {
      int j = i + len;
      int hash1 = asums2[0][j] - asums2[0][i];
      int hash2 = asums2[1][j] - asums2[1][i];
      if (hash1 < 0) hash1 += primes[0];
      if (hash2 < 0) hash2 += primes[1];
      if (table.find({hash1, hash2}) != table.end()) {
	ans = len;
	break;
      }
      // bool contains = true;
      // for (int k = 0; k < psize; k++) {
      // 	int hash = asums2[k][j] - asums2[k][i];
	
      // 	if (hash < 0) hash += primes[k];
      // 	if (table[k].find(hash) == table[k].end()) {
      // 	  contains = false;
      // 	  break;
      // 	}
      // }
      // if (contains) {
      // 	ans = len;
      // 	break;
      // }
    }
    if (ans) break;
  }
  cout << ans << endl;
}



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

int main ()
{
    string S ;
    int N;
    cin >> N >> S ;
    for(int i = 0 ; i < S.size() ; i ++)
    {

       S[i]= S[i]+N;
       if(S[i]>'Z')
        S[i]= S[i]-26;


    }

    cout << S ;
        return 0 ;
}

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

int main(){
    int N,L,sum=0;
    cin>>N>>L;

    vector<int> r(N+1,1000);
    for(int i=1;i<=N;i++){
        r[i] = L + i - 1;
        sum += r[i];
    }

    int mi = 100000;
    bool a =  true;
    for(int i=1;i<=N;i++){
        mi = min(mi,abs(r[i]));
        if(r[i]<0){
            a = false;
        }
    }
    if(a)
        cout<<sum-mi;
    else{
            cout<<sum+mi;
    } 
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<random>
#include<unordered_set>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const int big=1e16+10;
const long double pai=3.141592653589793238462643383279;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(b==0){return a;}return gcd(b,a%b);}//a>b
llint lcm(llint a,llint b){return (a/gcd(max(a,b),min(a,b)))*b;}
vector<vector<int>> ko;
int n;
vector<bool> onpa;
int make_tree(int per,int ter){
	//ぱすのながさ+1を返す
	//cout<<"de "<<ter<<endl;
	int ans=0;
	if(per!=-1){ko[ter].erase(find(ko[ter].begin(),ko[ter].end(),per));}
	for(auto it=ko[ter].begin();it!=ko[ter].end();it++){
		ans+=make_tree(ter,*it);
	}
	if(ter==n-1){onpa[n-1]=true;return 1;}
	if(ans==0){return 0;}
	onpa[ter]=true;
	return ans+1;
}
int solve(int nok,int ter){
	int ans=1;
	for(auto it=ko[ter].begin();it!=ko[ter].end();it++){
		ans+=solve(nok-1,*it);
	}
	if(nok<=0&&onpa[ter]){ans=0;}
	return ans;
}
int main(void){
	cin>>n;ko.res(n);onpa.res(n);
	for(int i=0;i<n-1;i++){
		int a,b;cin>>a>>b;a--;b--;
		ko[a].pub(b);
		ko[b].pub(a);
	}
	int pas=make_tree(-1,0);
	int ret=solve((pas+1)/2,0);
	if(ret>n/2){cout<<"Fennec"<<endl;return 0;}
	else{cout<<"Snuke"<<endl;return 0;}
	return 0;
}

Measured memory_bytes: 13568
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    cout << a[n-1];
    for(int i=n-2; i>=0; i--){
        cout << " " << a[i];
    }
    cout << endl;
}



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

int main(){
  int64_t N;
  cin >> N;
  int64_t N0=N;
  vector<int> E(0);
  E.push_back(N0%10);
  N0/=10;
  while(N0>0){
    E.push_back(N0%5);
    N0/=5;
  }
  int L=E.size();
  int64_t K5=0;
  int64_t a=0;
  for(int i=0; i<L; i++){
    K5+=a*E.at(i);
    a=5*a+1;
  }
  if(N%2==1){
    cout << 0 << endl;
  }
  else{
    cout << K5 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int A1,A2,A3;
    scanf("%d %d %d",&A1,&A2,&A3);
    if((A1+A2+A3)>=22){
        printf("bust\n");
    }
    else{
        printf("win\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;

long long n,a[M],tot=0,tot2=0,x[M];

int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		a[i]*=2;
		tot+=a[i];
	}
	tot2=tot/2;
	for (int i=1;i<n;i+=2){
		tot2-=a[i];
	}
	//now, tot2=Xn
	x[n]=tot2;
	x[1]=a[n]-x[n];
	for (int i=1;i<n;i++){
		x[i+1]=a[i]-x[i];
	}
	for (int i=1;i<=n;i++){
		cout<<x[i]<<" ";
	}
	return 0;
}


Measured memory_bytes: 5152
package main

import (
	"fmt"
)

func main() {
	var a, b, c int64
	fmt.Scan(&a, &b, &c)

	x := c - a - b
	if x > 0 && 4*a*b < x*x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main()
{
    int m;
    cin >> m;
    int ans = 24 + (24-m);
    cout << ans << endl;
}


Measured memory_bytes: 256
unittest
{
	assert( [ "1 3 2" ].parse.expand.solve == 1 );
	assert( [ "1 3 1" ].parse.expand.solve == 2 );
	assert( [ "2 3 3" ].parse.expand.solve == 1 );
	assert( [ "2 3 1" ].parse.expand.solve == 5 );
	assert( [ "7 1 1" ].parse.expand.solve == 1 );
	assert( [ "15 8 5" ].parse.expand.solve == 437760187 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto hwk = input.front.split.to!( long[] );
	return tuple( hwk[ 0 ], hwk[ 1 ], hwk[ 2 ] );
}

auto solve( long h, long w, long k )
{
	// dp[ 上からy段目 ][ 右からx本目 ] = 辿り着くパターン数 を計算
	auto dp = new long[][]( 1 + h, w );
	dp[ 0 ][ 0 ] = 1;
	auto bm = 1L << ( w - 1 );
	for( auto y = 0L; y < h; y++ )
	{
		// 横棒のパターンを全列挙
		for( auto b = 0L; b < bm; b++ )
		{
			if( !b.validate ) continue;
			for( auto x = 0L; x < w; x++ )
			{
				if( b & ( 1L << x ) )
				{
					// 横棒で繋がっている場合
					dp[ y + 1 ][ x     ] = dp[ y + 1 ][ x     ].addMod( dp[ y ][ x + 1 ] );
					dp[ y + 1 ][ x + 1 ] = dp[ y + 1 ][ x + 1 ].addMod( dp[ y ][ x     ] );
					x++;		// 次も計算済なのでスキップする
				}
				else
				{
					// 横棒で繋がっていない場合
					dp[ y + 1 ][ x ] = dp[ y + 1 ][ x ].addMod( dp[ y ][ x ] );
				}
			}
		}
	}
	return dp[ $ - 1 ][ k - 1 ];
}

// 横棒の引き方が正しいか判定
bool validate( long b )
{
	auto memo = [ 0L:true, 1L:true ];
	if( b !in memo ) memo[ b ] = ( ( b & 3 ) != 3 && ( b >> 1 ).validate );
	return memo[ b ];
}

// 足し算
auto addMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	return ( x + y ) % MOD;
}


Measured memory_bytes: 1276
#include <iostream>
#include<vector>

using namespace std;

vector<pair<long long, long long>> prime_factorize(long long N) {
	vector<pair<long long, long long>>res;
	for (long long a = 2; a * a <= N; a++) {
		if (N % a != 0) continue;
		long long ex = 0;
		while (N % a == 0) {
			++ex;
			N /= a;
		}
		res.push_back({ a,ex });
	}
	if (N != 1) res.push_back({ N,1 });
	return res;
}

long long GCD(long long x, long long y) {
	return y ? GCD(y, x % y) : x;
}

int main()
{
	long long A, B;
	cin >> A >> B;
	
	long long G = GCD(A, B);

	const auto& pf = prime_factorize(G);
	cout << pf.size() + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
	
	char input[4];
	
	scanf("%s", input);
	
	for(int i=0; i<3; i++){
		if(input[i] == '1') input[i] = '9';
		else if(input[i] == '9') input[i] = '1';
	}
	
	printf("%s\n", input);
	return 0;
	
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();

        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }
        sc.close();

        Collections.sort(a, Collections.reverseOrder());

        long sum = a.get(0);
        for (int i = 1; i < N - 1; i++) {
            sum += a.get((i + 1) / 2);
        }

        System.out.println(sum);

        sc.close();

    }
}

Measured memory_bytes: 65244
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  string s;
  cin>>A>>B>>s;
  string t = s.substr(0,A-1);
  string u = s.substr(A+1);
  bool ok = true;
  for(int i=0;i<t.size();i++){
    if(t.at(i)!='0' && t.at(i)!='1' && t.at(i)!='2' && t.at(i)!='3' && t.at(i)!='4' && t.at(i)!='5' && t.at(i)!='6' && t.at(i)!='7' && t.at(i)!='8' && t.at(i)!='9'){
      ok = false;
    }
  }
  for(int i=0;i<u.size();i++){
    if(u.at(i)!='0' && u.at(i)!='1' && u.at(i)!='2' && u.at(i)!='3' && u.at(i)!='4' && u.at(i)!='5' && u.at(i)!='6' && u.at(i)!='7' && u.at(i)!='8' && u.at(i)!='9'){
      ok = false;
    }
  }
  if(s.size()!=A+B+1){
    ok = false;
  }
  if(s.at(A)!='-'){
    ok = false;
  }
  if(ok){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = l[0], p = l[1];
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var check = a.Any(z => z % 2 == 1);
            var val = 0L;
            if (!check && p == 0) val = (long)Math.Pow(2, n);
            Console.WriteLine(check ? (long)Math.Pow(2, n - 1) : val);
        }
    }
}


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

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

const int N=2e5+5;

void solve()
{	
	int n,k;
	cin>>n>>k;
	int a[n+5];

	for(int i=1;i<=n;i++)
		cin>>a[i];
	
	for(int j=1;j<=k;j++)
	{
		bool flag=true;
		for(int i=1;i<=n;i++)
		{
			if(a[i]!=n)
				flag=false;
		}	
		if(flag)
			break;
		int prev[n+5];
		for(int i=0;i<=n;i++)
			prev[i]=0;
		for(int i=1;i<=n;i++)
		{
			prev[max(1LL,i-a[i])]+=1;
			prev[min(n+1,i+a[i]+1)]-=1;
		}
		for(int i=1;i<=n;i++)
			prev[i]+=prev[i-1];
		for(int i=1;i<=n;i++)
			a[i]=prev[i];
	}
	for(int i=1;i<=n;i++)
		cout<<a[i]<<" ";
}

int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	
	IOS;

	int t=1;
	//cin>>t;
	while(t--)
		solve();

}

Measured memory_bytes: 6800
#include <iostream>

int main(){
  std::string S;

  std::cin >> S;

  int Size = S.size();

  std::string head = S.substr(0,(Size-1)/2);

  std::string tail = S.substr((Size+2)/2,Size);
  /*for(int i=Size-1;i>(Size-1)/2;i--)
    tail += S[i];*/

  //std::cout << Size << " "<< head << " " << tail;
  if(head == tail)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string input;
    cin >> input;
    if(input=="Sunny"){
        cout << "Cloudy" << endl;
    }

    if(input=="Cloudy"){
        cout << "Rainy" << endl;
    }

    if(input=="Rainy"){
        cout << "Sunny" << endl;
    }
    
}

Measured memory_bytes: 888
import sys
import numpy as np
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 1 mod 3のグループを先に決めてあとは順番に

N = ir()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(N-1):
    a, b = lr()
    graph[a].append(b)
    graph[b].append(a)

root = 1
rank = [0] * (N+1) # 1-indexed
rank[1] = 1
parent = [0] * (N+1) # 1-indexed
order = []
stack = [root]
while stack:
    cur = stack.pop()
    r = rank[cur]
    order.append(cur)
    for next in graph[cur]:
        if next == parent[cur]:
            continue
        parent[next] = cur
        rank[next] = r + 1
        stack.append(next)

counter = [0, 0]
for x in rank[1:]:
    counter[x%2] += 1
num0mod3 = N // 2
num1mod3 = (N+2) // 3
num2mod3 = (N+1) // 3
answer = [0] * (N+1)
if max(counter) >= num1mod3 + num2mod3:
    #この時ここに1mod3、2mod3を全部入れる
    if counter[0] > counter[1]:
        index = 0
    else:
        index = 1
    cur = 1
    used = set()
    for i in range(1, N+1):
        if rank[i] % 2 == index:
            answer[i] = cur
            used.add(cur)
            cur += 1
            if cur % 3 == 0:
                cur += 1
            if cur > N:
                break
    cur = 1
    for j in range(1, N+1):
        while cur in used:
            cur += 1
        if answer[j] == 0:
            answer[j] = cur
            used.add(cur)
else:
    #ここではcounterの多い方にnum1mod3を入れる
    if counter[0] > counter[1]:
        index = 0
    else:
        index = 1
    cur = 1
    used = set()
    for i in range(1, N+1):
        if rank[i] % 2 == index:
            answer[i] = cur
            used.add(cur)
            cur += 3
            if cur > N:
                break
    cur = 2
    for i in range(1, N+1):
        if rank[i] % 2 == 1-index:
            answer[i] = cur
            used.add(cur)
            cur += 3
            if cur > N:
                break
    cur = 1
    for j in range(1, N+1):
        while cur in used:
            cur += 1
        if answer[j] == 0:
            answer[j] = cur
            used.add(cur)

print(*answer[1:])


Measured memory_bytes: 88340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
*/
using Graph = vector<bitset<10>>;
ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
const ll P =  1000000007;
ll factorial(ll n){
   ll ans = 1;
   for(int i = n;i>=1;i--){
     ans *= i;
     ans %= P;
   }
   return ans;
}

int main(){
  ll H,W;
  cin >> H >> W;
  char data[2000][2000];
  rep(i,H){
    rep(j,W){
      cin >> data[i][j];
    }
  }
  ll L[2000][2000];//L[i][j]は(i,j)に明かりを置いた時の、照らされる左側のマス数
  for(int i = 0;i<H;i++){
    for(int j = 0;j<W;j++){
      if(data[i][j] == '#') L[i][j] = 0;
      else if(j == 0) L[i][j] = 1;
      else L[i][j] = L[i][j-1] + 1;
    }
  }
  //cout << L[1][5] << endl;
  
  ll R[2000][2000];//L[i][j]は(i,j)に明かりを置いた時の、照らされる右側のマス数
  for(int i = 0;i<H;i++){
    for(int j = W-1;j>=0;j--){
      if(data[i][j] == '#') R[i][j] = 0;
      else if(j == W-1) R[i][j] = 1;
      else R[i][j] = R[i][j+1] + 1;
    }
  }

  //cout << R[3][5] << endl;
  
  ll U[2000][2000];//U[i][j]は(i,j)に明かりを置いた時の、照らされる上側のマス数
  for(int i = 0;i<H;i++){
    for(int j = 0;j<W;j++){
      if(data[i][j] == '#') U[i][j] = 0;
      else if(i == 0) U[i][j] = 1;
      else U[i][j] = U[i-1][j] + 1;
    }
  }
  //cout << U[3][5] << endl;
  
  ll S[2000][2000];//S[i][j]は(i,j)に明かりを置いた時の、照らされる下側のマス数
  for(int i = H-1;i>=0;i--){
    for(int j = 0;j<W;j++){
      if(data[i][j] == '#') S[i][j] = 0;
      else if(i == H-1) S[i][j] = 1;
      else S[i][j] = S[i+1][j] + 1;
    }
  }
  //cout << S[3][5] << endl;
  
  ll ans = 0;
  rep(i,H){
    rep(j,W){
      ll count = L[i][j] + R[i][j] + U[i][j] + S[i][j] - 3;
      ans = max(ans,count);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 129152
s = input()
ans = 0
if s == 'SUN':
  ans = 7
elif s == "MON":
  ans = 6
elif s == "TUE":
  ans = 5
elif s == "WED":
  ans = 4
elif s == "THU":
  ans = 3
elif s == "FRI":
  ans = 2
elif s == "SAT":
  ans = 1
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(ll &a,ll b){
	a = min(a,b);
}

int main(){
	vector<string> con ={"MON", "TUE", "WED", "THU", "FRI","SAT","SUN","MON", "TUE", "WED", "THU", "FRI","SAT","SUN"};
	string s; cin >> s;
	if(s == "MON") cout << 6 << endl;
	if(s == "TUE") cout << 5 << endl;
	if(s == "WED") cout << 4 << endl;
	if(s == "THU") cout << 3 << endl;
	if(s == "FRI") cout << 2 << endl;
	if(s == "SAT") cout << 1 << endl;
	if(s == "SUN") cout << 7 << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
bool D(string S){
  string S1;
  string S2;
  if(S.size()%2 == 0){
    for(int i = 0;i<=S.size()/2 -1;i++){
      S1 += S[i];
    }
    for(int i =S.size()/2 ;i<S.size();i++){
      S2 += S[i];
    }
    if(S1 == S2) return true;
  }
 return false;
}
    
int main(){
  string S;
  cin >> S;
  int ans = 0;
  while(1){
    S.pop_back();
    if(D(S)){
      ans = S.size();
      break;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
 
#define LL long long
 
int main(){
	int N;
	cin >> N;
	cout << 800*N - 200*(N/15) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n ; ++i)
const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll N, M;
    cin >> N >> M;
    cout << ((1900 * M) + 100 * (N - M)) * pow(2, M) << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	int n, ans = 0, x = 0;
	string s;
	cin >> n >> s;
	rep(i, s.size()) {
		if (s[i] == 'I') {
			x++;
			ans = max(ans, x);
		}
		else {
			x--;
			ans = max(ans, x);
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
s = input()

#print(s)

n = int(input())
#print(n)

for i in range(n):
    s1 = input().split()
    #print(s1)
    if s1[0] == 'replace':
        #print(s)
        a = s[:int(s1[1])]
        #print(a)
        b = s[int(s1[2])+1:]
        #print(b)
        s = a + s1[3] + b
        #print(s)
    elif s1[0] == 'reverse':
        #print(s)
        a = s[:int(s1[1])]
        #print(a)
        b = s[int(s1[2])+1:]
        #print(b)
        c = s[int(s1[1]):int(s1[2])+1]
        d = c[::-1]
        #print(d)
        s = a + d + b
        #print(s)
    else:
        #print(s)
        d = s[int(s1[1]):int(s1[2])+1]
        print(d)


Measured memory_bytes: 5616
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define REP(i, a) for (int i = 0; i < (a); i++)
#define REPR(i, a) for (int i = (int)(a) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b) - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<long long>;
using vvl = vector<vl>;
using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &a) { cout << a << ' '; }
void br() { putchar('\n'); }

struct BiconnectedComponent {
  vector<int> ord, low;
  vector<bool> used;
  vector<vector<int>> g;
  vector<vector<pair<int, int>>> bc;
  vector<pair<int, int>> tmp;
  int n, k = 0;
  BiconnectedComponent(const vector<vector<int>> &g) : g(g) {
    n = g.size();
    ord.resize(n, -1);
    low.resize(n, -1);
    used.resize(n, false);
  }
  void dfs(int u, int prev) {
    used[u] = true;
    ord[u] = k ++;
    low[u] = ord[u];
    int cnt = 0;
    for (auto v : g[u]) if (v != prev) {
      if (ord[v] < ord[u]) { 
        tmp.emplace_back(min(u, v), max(u, v));
      }
      if (!used[v]) {
        cnt ++;
        dfs(v, u);
        low[u] = min(low[u], low[v]);
        if (low[v] >= ord[u]) {
          bc.push_back({});
          while (true) {
            pair<int, int> e = tmp.back();
            bc.back().emplace_back(e);
            tmp.pop_back();
            if (min(u, v) == e.first && max(u, v) == e.second) {
              break;
            }
          }
        }
      } else {
        low[u] = min(low[u], ord[v]);
      }
    }
  }
};

bool solve() {
  int N = si(), M = si();
  vvi G(N);
  vector<int> deg(N);
  REP(i, M) {
    int u = si() - 1, v = si() - 1;
    G[u].push_back(v);
    G[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  REP(i, N) if (deg[i] % 2 == 1) return false;
  REP(i, N) if (deg[i] >= 6) return true;
  BiconnectedComponent bc(G);
  bc.dfs(0, -1);
  if (bc.bc.size() >= 3) return true;
  if (bc.bc.size() == 2) {
    int c = 0;
    REP(i, N) if (deg[i] >= 4) c++;
    return c >= 2;
  }
  int c = 0;
  REP(i, N) if (deg[i] >= 4) c++;
  return c >= 3;
}

int main() {
  cout << (solve() ? "Yes" : "No") << '\n';
}



Measured memory_bytes: 18804
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,l int
    fmt.Scan(&n,&l)
    s := scanString(n)
    sort.Sort(sort.StringSlice(sort.StringSlice(s)))
    for i:=0;i<n;i++{
        fmt.Printf("%s",s[i])
    }
    fmt.Println("")
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}



Measured memory_bytes: 640
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
constexpr long long MOD = 1000000007;
constexpr long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  IN(n);
  ll ans = 0;
  vi a(n+1);
  FOR(i,1,n+1) {
    ll num = i;
    while (num <= n) {
      a[num] += 1;
      num += i;
    }
    ans += i * a[i];
  }

  OUT(ans);
}


Measured memory_bytes: 81336
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){

    const int MAX = 1000001;
    int n, tmp, a_max = 0;
    cin >> n;
    vector<int> num_count(MAX, 0);
    vector<bool> num_bool(MAX, false);
    int ans = 0;
    rep(i,n){
        cin >> tmp;
        num_count[tmp]++;
        num_bool[tmp] = true;
        a_max = max(a_max, tmp);
    }
    a_max++;
    for(int i = 1; i < a_max; i++) {
        if (!num_bool[i]) continue;
        if (num_count[i] == 1) ans++;
        for(int j = i; j < a_max; j += i) {
            num_bool[j] = false;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7204
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,i,l,r,mid,a[200005],b[200005],max1,ans,ll,rr;
int read(){
	int xx=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
		ch=getchar();
	while(ch>='0'&&ch<='9'){
		xx=xx*10+ch-'0';
		ch=getchar();
	}
	return xx;
}
int che(int x){
	for(i=1;i<=m;i++)
		if(a[i]>=x)
			b[i]=1;
		else
			b[i]=0;
	ll=0;rr=m+1;
	for(i=n;i>=2;i--)
		if(b[i]==b[i-1]){			
			ll=i;
			break;
		}
	for(i=n;i<=m-1;i++)
		if(b[i]==b[i+1]){
			rr=i;
			break;
		}
	if(ll==0&&rr==m+1)
		return b[1];
	if(ll==0)
		return b[rr];
	if(rr==m+1)
		return b[ll];
	if(n-ll<rr-n)
		return b[ll];
	else
		return b[rr];
}
int main(){
	n=read();m=(n<<1)-1;
	for(i=1;i<=m;i++){
		a[i]=read();
		max1=max(max1,a[i]);
	}
	l=1;r=max1;mid=(l+r)/2;
	while(l<=r){
		if(che(mid)==1){
			ans=max(ans,mid);
			l=mid+1;
		}
		else	
			r=mid-1;
		mid=(l+r)/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int i;
        for(i = 0; i < 30; i++){
            if((A - 1) * i + 1 >= B) break;
        }
        
        System.out.println(i);
    }
}


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

int main(){
	int n;
	cin >> n;
	long long a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	long long sum[n + 1]{};
	for(int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
	int t = 0;
	for(int i = 1; i < n; i++) if(2 * sum[i] < a[i]) t = i;
	cout << n - t << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long n, vector<string> S) {
  const ll INT = 1 << 25;
  std::vector<ll> v('z' - 'a' + 1, INT);

  REP(i, n) {
    std::vector<ll> b('z' - 'a' + 1, 0);
    REP(j, S[i].size()) b[S[i][j] - 'a']++;
    REP(j, b.size()) { v[j] = min(v[j], b[j]); }
  }

  string ans = "";
  REP(i, v.size()) if (v[i] > 0) { REP(j, v[i]) ans += (char)('a' + i); }

  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<string> S(n - 1 + 1);
  for (int i = 0; i <= n - 1; i++) {
    cin >> S[i];
  }
  solve(n, S);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
index = 2
result = 10**13
while index * index <= n:
    if n % index == 0:
        curr = (n // index) - 1
        curr += (index - 1)
        result = min(curr, result)
    index += 1
if result == 10**13:
    result = n - 1
print(result)


Measured memory_bytes: 2940
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()




S = list(input())
for i in range(len(S)):
    S[i] = chr((ord(S[i])-ord("A")+N)%26+ord("A"))

print(''.join(S))


Measured memory_bytes: 4200
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

x = 0  # 2 を含まない
y = 0  # 2^1 のみを含む
z = 0  # 2^2を含む
for num in a:
	if num % 2 == 1:
		x += 1
	elif num % 4 == 0:
		z += 1
	else:
		y += 1

if y:
	x += 1


if (x+z) % 2 == 1:
	if z >= x-1:
		print("Yes")
	else:
		print("No")

else:
	if z >= x:
		print("Yes")
	else:
		print("No")


Measured memory_bytes: 16380
use proconio::input;

fn main() {
    input! {
        l: i32,
        r:i32,
        d:i32,
    }
    println!(
        "{}",
        if l % d == 0 {
            r / d - l / d + 1
        } else {
            r / d - l / d
        }
    );
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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
use std::io;

fn main() {
    let s = {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
   let (a, b, c) = {
        let mut ws = s.split_whitespace();
        let a: i32 = ws.next().unwrap().parse().unwrap();
        let b: i32 = ws.next().unwrap().parse().unwrap();
        let c: i32 = ws.next().unwrap().parse().unwrap();
        (a, b, c)
    };
    match (a, b, c) {
        (5, 7, 5) => print!("YES"),
        (7, 5, 5) => print!("YES"),
        (5, 5, 7) => print!("YES"),
        _ => print!("NO"),
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h, m, s;
		h = a / (60 * 60);
		m = a / 60 - h * 60;
		s = a - h * 3600 - m * 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 26204
#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);
    int fst = 0, scd = 0;
    REP(i, N) {
        cin >> A[i];
        if (fst <= A[i]) {
            scd = fst;
            fst = A[i];
        } else if (scd < A[i]) {
            scd = A[i];
        }
    }
    REP(i, N) {
        if (A[i] < fst) {
            cout << fst << endl;
        } else {
            cout << scd << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2432
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
using namespace std;
int n, a[N], p, p1;
inline bool cmp(int a, int b){return a>b;}
int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++)scanf("%d", &a[i]);
	sort(a+1, a+1+n, cmp); a[0]=a[1]; a[n+1]=0;
	p=0; while(p<a[p+1])p++; p--;
	p1=p; while(p<a[p1+1])p1++;
	if((p1-p)&1&&(a[p+1]-p)&1)printf("Second"); else printf("First");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  string S1 = S.substr(0, N);
  map<pair<string, string>, int> mp;
  for (int i = 0; i < (1 << N); i++){
    string red = "";
    string blue = "";
    for (int j = 0; j < N; j++){
      if (i >> j & 1){
        red += S1[j];
      } else {
        blue += S1[j];
      }
    }
    mp[make_pair(red, blue)]++;
  }
  long long ans = 0;
  string S2 = S.substr(N);
  for (int i = 0; i < (1 << N); i++){
    string red = "";
    string blue = "";
    for (int j = N - 1; j >= 0; j--){
      if (i >> j & 1){
        red += S2[j];
      } else {
        blue += S2[j];
      }
    }
    ans += mp[make_pair(blue, red)];
  }
  cout << ans << endl;
}

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

typedef long long lint;
typedef unsigned long long ulint;
typedef long double louble;

#define lf ('\n')

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int ts(char *s)
	{
		int a=0,c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		while(c>32 && c!=EOF)s[a++]=c,c=fetch();
		s[a]=0;
		return a;
	}
}
using ae86::ty;
using ae86::ts;

const int _ = 39;
const ulint bas = 1145141;

#define pick(a,b) (((a)>>(b))&1)

int n,nn;
unordered_map<ulint,int> cnt;
char s[_];

int main()
{
	n=ty(),nn=1<<n,ts(s);
	for(int i=0;i<nn;i++)
	{
		ulint a=0,b=0;
		for(int j=n-1;j>=0;j--)(pick(i,j))?(a=a*bas+s[n+j]):(b=b*bas+s[n+j]);
		for(int j=1;j<=n;j++)a=a*bas;
		a+=b,cnt[a]++;
	}
	lint ans=0;
	for(int i=0;i<nn;i++)
	{
		ulint a=0,b=0;
		for(int j=0;j<n;j++)(pick(i,j))?(a=a*bas+s[j]):(b=b*bas+s[j]);
		for(int j=1;j<=n;j++)a=a*bas;
		a+=b,ans+=cnt[a];
	}
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 28788