akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<string> v;
  string s;
  char c;
  while(getline(cin,s) && s!="END_OF_TEXT") v.push_back(s);
  int x=0,y=0;
  string b="";
  while(cin >> c && c!='-') {
    if(c=='a') y=0;
    if(c=='e') y=v[x].size();
    if(c=='p') {
      if(x) x--;
      y=0;
    }
    if(c=='n') {
      if(x<v.size()-1) x++;
      y=0;
    }
    if(c=='f') {
      if(y<v[x].size()) y++;
      else if(x<v.size()-1) {
        x++;
        y=0;
      }
    }
    if(c=='b') {
      if(y) y--;
      else if(x) {
        x--;
        y=v[x].size();
      }
    }
    if(c=='d') {
      if(y<v[x].size()) v[x].erase(v[x].begin()+y);
      else if(x<v.size()-1) {
        v[x]+=v[x+1];
        v.erase(v.begin()+x+1);
      }
    }
    if(c=='k') {
      if(y<v[x].size()) {
        b=v[x].substr(y);
        v[x]=v[x].substr(0,y);
      } else if(x<v.size()-1) {
        b="\n";
        v[x]+=v[x+1];
        v.erase(v.begin()+x+1);
      }
    }
    if(c=='y') {
      if(b=="\n") {
        v.insert(v.begin()+x+1,v[x].substr(y));
        v[x]=v[x].substr(0,y);
        x++;
        y=0;
      } else {
        v[x].insert(y,b);
        y+=b.size();
      }
    }
  }
  for(int i=0; i<v.size(); i++) cout << v[i] << endl;
  return 0;
}


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

 #define int long long
 using namespace std;

int a[10][10],w[10],l[10];
int n;
int ans;
void dfs(int nokori){
//	cout<<nokori<<endl;
	for(int i=1;i<=n;i++){
		if(w[i]>n/2 || l[i]>n/2)return;
	}
	
	if(nokori==0){
		ans++;
		return ;
	}
	
	for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(a[i][j]==0){
		a[i][j]=1;
		a[j][i]=-1;
		w[i]++;
		l[j]++;
		if(w[i]<=n/2 && l[j]<=n/2)dfs(nokori-1);
		a[i][j]=0;
		a[j][i]=0;
		w[i]--;
		l[j]--;
		
		
		a[i][j]=-1;
		a[j][i]=1;
		w[j]++;
		l[i]++;
		if(w[j]<=n/2 && l[i]<=n/2)dfs(nokori-1);
		a[i][j]=0;
		a[j][i]=0;
		w[j]--;
		l[i]--;
		
		return;
	}
	
	return;
}


void solve(){
cin>>n;
	if(n==0) exit(0);
	//cout<<" "<<n<<endl;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++)a[i][j]=0;
		w[i]=0;
		l[i]=0;
	}
	ans=0;
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int y,yy;
		cin>>y>>yy;
		a[y][yy]=1;
		a[yy][y]=-1;
		w[y]++;
		l[yy]++;
	}
	
	int allnum=n*(n-1)/2-m;
	
	dfs(allnum);
cout<<ans<<endl;
}

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

    int t;
    	//cin>>t;
    	for(int i=0;;i++){
    		solve();
    	
    	}
    	return 0;
    	
            }


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
 long long int a, b,ans,flag;
 cin>>a;
 flag=0;
 ans=0;
 b=1;
 for(int i=0;i<a;i++){
 	int tmp;
 	cin>>tmp;
 	if(tmp==b){
 	  flag=1;
 	  b++;
 	  ans++;
 	}

 }
 if(flag==1){
   cout<<a-ans<<endl;
  }else{
  	cout<<"-1"<<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 MOD = 1000000007;

ll modpow(ll a, ll n){
  a%=MOD;
  ll res=1;
  while(n){
    if(n&1) res=res*a%MOD;
    a=a*a%MOD;
    n>>=1;
  }
  return res;
}

ll modinv(ll a) {
    return modpow(a,MOD-2);
}

vector<pair<ll,int>> factorize (ll n) {
  vector<pair<ll,int>> v;
  for (ll i=2; i*i<=n; i++) {
    if (n%i) continue;
    v.emplace_back(i,0);
    while (n%i==0) {
      v.back().second++;
      n/=i;
    }
  }
  if (n!=1) {
    v.emplace_back(n,1);
  }
  return v;
}



int main(){
  int n;
  cin>>n;
  int a[10005];
  rep(i,n) cin>>a[i];
  map<ll,int> ma;
  rep(i,n){
    auto v=factorize(a[i]);
    for(auto x:v){
      int b=ma[x.first];
      ma[x.first]=max(b,x.second);
    }
  }
  ll lcm=1;
  for(auto x:ma){
    lcm=lcm*modpow(x.first,x.second)%MOD;
  }
  ll ans=0;
  rep(i,n){
    ans=(ans+(lcm*modinv(a[i])%MOD))%MOD;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 896
void main() {
	auto N = ri;
	long[] C;
	long res;
	foreach(i; 0..N) {
		auto ip = readAs!(int[]), A = ip[0], B = ip[1];
		res -= B;
		C ~= A + B;
	}
	C.sort!((a, b) => a > b);
	foreach(i; iota(0, N, 2)) res += C[i];
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=4e3+5,M=5e3+5,INF=1e9,mod=924844033;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
int n,k;
ll fac[N],c[N],st[N],a[N],tmp,top,f[N][N];//c[i] 
il void ad(ll&a,ll b){a+=b;a%=mod;if(a<0)a+=mod;}
int main(){
	read(n,k);
	fac[0]=1;
	rep(i,1,n)fac[i]=1ll*fac[i-1]*i%mod,c[i%k]++;
	re(i,0,k)a[c[i]]+=2;
	rep(i,1,n)while(a[i]){
		tmp++;
		rep(j,1,i)st[++top]=tmp;a[i]--;
	}
	f[0][0]=1;
	rep(i,1,n+n){
		rep(j,0,n)f[i][j]=f[i-1][j];
		if(st[i]==st[i-1])rep(j,1,n)ad(f[i][j],f[i-2][j-1]);
	}
	ll res=0;
	rep(i,0,n)ad(res,f[n+n][i]*fac[n-i]%mod*((i&1)?-1:1));
	cout<<res<<endl;
}

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

const double PI = acos(-1.0);
int main() {
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double alpha = (H * 60 + M) / 720 * (PI * 2);
    double beta = M / 60 * (PI * 2);
    double theta = alpha - beta;
    double res = sqrt(A*A + B*B - 2.0*A*B*cos(theta));
    cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 4008
#include<iostream>
using namespace std;
int main()
{
	int A ,B;
	cin>>A>>B;
	if(A<=13 && A>=1){
		if(B<=13 && B>=1){
			if(A>B && B!=1){
				cout<<"Alice";
			}
			else if(A>B && B==1){
				cout<<"Bob";
			}
			if(A<B && A!=1){
					cout<<"Bob";
			}
			else if(A<B && A==1){
				cout<<"Alice";
			}
			else if(A==B){
				cout<<"Draw";
			}
		}
		else{
			cout<<"Error";
		}
	}
	else{
			cout<<"Error";
		}
		return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())

S = []
for i in range(N):
  S.append(list(input()))
T = Counter(S[0])
for i in range(1,N):
  T &= Counter(S[i])

s =""
for k in sorted(list(T)):
  s += k * T[k]
print (s)

Measured memory_bytes: 3316
from sys import stdin
import math
import fileinput

for line in fileinput.input():
    a, b = [int(n) for n in line.split()]
    print(math.floor(math.log10(a + b) + 1))
    # x1, y1, x2, y2, x3, y3, xp, yp = [float(r) for r in line]
    # print(x1, y1, x2, y2, x3, y3, xp, yp)

Measured memory_bytes: 7816
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

ll n,a[5];



int main(){
    cin >> n;
    inrep(5,a);
    
    int m = 0;
    rep(i,0,5)if(a[m] > a[i])m = i;
   
    ll ans = (n + a[m]-1)/a[m];

    P(ans + 4);
	return  0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	int s1size = s1.size();
	int s2size = s2.size();
	if (s1[s1size - 1] == s2[0] && s2[s2size - 1] == s3[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define rep(i, a, b) for(int i = a; i < b; ++i)

int debug = 0;

const int N = 3e5, LG = 60;

int n, k, m, pos, INF = 5e17;
int a[N], go[LG][N], sm[LG][N], lst[N], f[N];
vector <int> st;

main() {
    scanf("%lld%lld", &n, &k);
    rep(i, 0, n) {
        scanf("%lld", &a[i]);
        lst[a[i]] = i;
    }
    rep(i, 0, n) {
        go[0][lst[a[i]]] = (i + 1) % n;
        sm[0][lst[a[i]]] = (i + n - lst[a[i]] - 1) % n + 2;
        lst[a[i]] = i;
    }
    if (debug) {
        rep(i, 0, n) {
            cerr << "       i=" << i << ' ' << go[0][i] << ' ' << sm[0][i] << '\n';
        }
    }
    rep(j, 1, LG) {
        rep(i, 0, n) {
            go[j][i] = go[j - 1][go[j - 1][i]];
            sm[j][i] = min(sm[j - 1][i] + sm[j - 1][go[j - 1][i]], INF);
        }
    }
    m = n * k;
    pos = 0;
    if (debug) { cerr << "ok\n"; }
    for (int j = LG - 1; j >= 0; --j) {
        while (sm[j][pos] <= m) {
            m -= sm[j][pos];
            pos = go[j][pos];
        }
    }
    if (debug) { cerr << "kek\n" << ' ' << m << '\n'; }
    fill(f, f + N, 0);
    while (m--) {

        if (debug) { cerr << " m=" << m << ' ' << pos << ' ' << a[pos] << '\n'; }
        if (f[a[pos]] == 0) {
            st.push_back(a[pos]);
            f[a[pos]] = 1;
        } else {
            while (st.back() != a[pos]) {
                f[st.back()] = 0;
                st.pop_back();
            }
            st.pop_back();
            f[a[pos]] = 0;
        }
        pos = (pos + 1) % n;
    }
    if (debug) { cerr << "fin\n"; }
    for (auto i : st) {
        printf("%lld ", i);
    }
}

/**
10 1000000000000
1 2 3 4 2 6 7 8 4 10
*/

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

k=int(input())
i=1

c>b>a #青，緑，赤
ans='No'
if c>b and b>a:
    ans='Yes'
else:
    while b<=a and i<=k:
        b=b*2
        i+=1

    while c<=b and i<=k:
        c=c*2
        i+=1
    if c>b and b>a:
        ans='Yes'
print(ans)







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

typedef long long ll;
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define rep(i,n) for(int i=0;i<(n);i++)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
#define nl cout<<endl;
#define pu push
#define pb push_back
//str.substr(pos,number)
//str.insert(str.begin()+5,'3')
//set<int> myset
//myset.insert(num)
//myset.count(i)!=0
const int maxn = 2e5 + 5;
int main(){
    fio();
	int k;
	cin>>k;
	long long int ans=0;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			for(int h=1;h<=k;h++){
				int a = min(i,j);
				int b = min(a,h);
				for(int d=b;d>=1;d--){
					if(i%d==0&&j%d==0&&h%d==0){
						ans+=d;
						break;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}














Measured memory_bytes: 3652
n = int(input())
a = list(map(int, input().split()))
ans = 0
maxh = 0
for i in range(len(a)-1):
    if maxh < a[i]:
        maxh = a[i]
    if maxh > a[i+1]:
        ans += maxh - a[i+1]


print(ans)


Measured memory_bytes: 32364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    map<int, int> mp;

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

    int ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++){
        if(itr->second < itr->first) ans += itr->second;
        else ans += itr->second - itr->first;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#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()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
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 = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl

/*--------------------template--------------------*/

class UF
{
public:
    vi rank, data;
    UF() {}
    UF(ll size)
    {
        rank.resize(size, 0);
        data.resize(size, 0);
        REP(i, size)
        {
            init(i);
        }
    }
    void init(ll x)
    {
        data[x] = x;
        rank[x] = 0;
    }

    bool same(ll x, ll y)
    {
        return root(x) == root(y);
    }

    void unite(ll x, ll y)
    {
        link(root(x), root(y));
    }

    void link(ll x, ll y)
    {
        if (rank[x] > rank[y]) {
            data[y] = x;
        } else {
            data[x] = y;
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
    }
    // xの根を探す。同じ集合なら同じ根が帰る, O(A^-1)
    ll root(ll x)
    {
        return (x == data[x] ? data[x] : data[x] = root(data[x]));
    }

    // 分離されている集合の数を返す, O(n)
    ll getSetNum() {
        map<ll, ll> c;
        REP(i, data.size()) {
            c[root(i)]++;
        }
        return c.size();
    }

    // 頂点vと連結な集合を返す, O(n)
    vi getContainingSet(int v)
    {
        vi ret;
        REP(i, data.size()) {
            if (root(i) == root(v)) {
                ret.push_back(i);
            }
        }
        return ret;
    }
};

set<ll> ss[100005];


int main() {
    cin >> n >> m;
    vi v(n);
    REP(i, n) {
        cin >> k;
        k--;
        v[i] = k;
    }
    vp vv(m);
    REP(i, m) {
        cin >> vv[i].first >> vv[i].second;
    }

    UF uf(n);
    REP(i, m) {
        vv[i].first -= 1;
        vv[i].second -= 1;
        uf.unite(vv[i].first, vv[i].second);
    }

    REP(i, n) {
        ss[uf.root(i)].insert(i);
    }

    REP(i, n) {
        if (ss[uf.root(i)].count(v[i]) != 0) {
            cnt++;
        }
    }
    cout << cnt << Endl;
}

Measured memory_bytes: 13568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

float Abs(float n) {
    if (n < 0) {
        return -n;
    } else {
        return n;
    }
}

int main() {
    int n, t, A;
    cin >> n >> t >> A;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    int ans = 0;
    for (int i = 1; i < n; i++) {
        float a, b;
        a = t - h[ans] * 0.006;
        b = t - h[i] * 0.006;
        if (Abs(b - A) < Abs(a - A)) {
            ans = i;
        }
    }

    cout << ans + 1 << endl;

    return 0;
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

const ll MOD = 1000000007;

int n,k,q;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> n >> k >> q;
    vector<ll> a(n+1, 0LL);
    rep(n) cin >> a[i];

    ll ans = LLONG_MAX;
    rep(n){
        ll min_ = a[i];
        vector<ll> maxs;
        vector<ll> b;
        repp(j, n+1){
            if(a[j] < min_){
                int m = int(b.size());
                if(m >= k){
                    sort(all(b));
                    repp(j, min(m-k+1, q)) maxs.push_back(b[j]);
                }
                b.clear();
            }else{
                b.push_back(a[j]);
            }
        }

        if(int(maxs.size()) >= q){
            sort(all(maxs));
            ans = min(ans, maxs[q-1]-min_);
        }
    }
    cout << ans << endl;
}

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

int main()
{
	int N, A;
	
	cin >> N >> A;
	
	if(N%500==0)
	  cout << "Yes" << endl;
	else if(N%500/1<=A)
	  cout << "Yes" << endl;
	else
	  cout << "No" << endl;
	  
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
int main(){
  int n,x[102],y[102],i,j,k,D1=0,D4=0;
  double D2=0.0,D3=0.0;
  scanf("%d",&n);
  for(i=0; i<n; i++)scanf("%d",&x[i]);
  for(i=0; i<n; i++)scanf("%d",&y[i]);
  for(i=0; i<n; i++)D1+=abs(x[i]-y[i]);
  for(i=0; i<n; i++)D2+=pow(x[i]-y[i],2);
  D2=pow(D2,(double)1/2);
  for(i=0; i<n; i++)D3+=pow(abs(x[i]-y[i]),3);
  D3=pow(D3,(double)1/3);
  for(i=0; i<n; i++)if(D4<abs(x[i]-y[i]))D4=abs(x[i]-y[i]);
  printf("%lf\n%lf\n%lf\n%lf\n",(float)D1,D2,D3,(float)D4);
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#pragma GCC optimize ("O3,unroll-loops")
#define f first
#define s second
#define ri register int
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
#define MAXN 100000
#define INF 100000000000000
int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, w, items[100][2];
	ll dp[MAXN + 1];
	cin >> n >> w;
	for(ri k = 0; k < n; ++k)
		cin >> items[k][0] >> items[k][1];
	for(int k = 0; k <= MAXN; ++k) dp[k] = INF;
	dp[0] = 0;
	for(ri k = 0; k < n; ++k)
		for(ri i = MAXN - items[k][1]; i >= 0; --i)
			dp[i + items[k][1]] = min(dp[i + items[k][1]], dp[i] + items[k][0]);
	int ans = 0;	
	for(int k = MAXN; k >= 0; --k) {
		if(dp[k] <= w) {
			ans = k;
			break;
		}			
	}
	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1024
s = gets.chomp
t = gets.chomp

x = {}
y = {}

s.size.times{|i|
  x[s[i]] = t[i] if !x[s[i]]
  y[t[i]] = s[i] if !y[t[i]]
  if x[s[i]]!=t[i] || y[t[i]]!=s[i]
    puts "No"
    exit
  end
}

puts "Yes"


Measured memory_bytes: 2752
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii, std.numeric, std.random;
import std.typecons, std.functional, std.traits,std.concurrency;
import std.algorithm, std.container;
import core.bitop, core.time, core.memory;
import std.bitmanip;
import std.regex;

enum INF = long.max/3;
enum MOD = 10L^^9+7;

T[] scanArray(T = long)()
{
    static char[] scanBuf;
    readln(scanBuf);
    return scanBuf.split.to!(T[]);
}

dchar scanChar()
{
    import core.stdc.stdlib;
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    return cast(dchar)c;
}

T scanElem(T = long)()
{
    import core.stdc.stdlib;
    static auto scanBuf = appender!(char[])([]);

    scanBuf.clear;

    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        scanBuf ~= cast(char) c;
        c = getchar;
    }
    return scanBuf.data.to!T;
}

dchar[] scanString(){
    return scanElem!(dchar[]);
}

void main()
{
    auto A = scanString;
    auto B = scanString;
    auto C = scanString;
  	write(A[0], B[1], C[2], '\n');
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);
	    String input1 = scanner.next();
	    String input2 = scanner.next();

	    int h=Integer.parseInt(input1);
	    int n=Integer.parseInt(input2);
	    int a[]=new int[n];
	    List<String> sa=new ArrayList<String>();
	    for(int i=0;i<n;i++) {
	    	sa.add(scanner.next());
	    }
	    scanner.close();
	    int sum=sa.stream()
	    		.mapToInt(s->Integer.parseInt(s))
	    		.sum();
	    if(sum<h)
	    	System.out.println("No");
	    else
	    	System.out.println("Yes");
	}

}

Measured memory_bytes: 50768
using System;
 
class Suuretu{
  static void Main(){
  
    int input = int.Parse(Console.ReadLine());
    int inputA = input - 1;
    int[] Arr = new int[32] {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    Console.WriteLine(Arr[inputA]);
    
  }
}

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

int main()
{
    int n;
    cin>>n;
    int x  = n%10;
    if(x == 3){
        cout<<"bon";
    }
    else if(x == 0 or x==1 or  x==6 or x==8){
        cout<<"pon";
    }
    else{
        cout<<"hon";
    }
    cout<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

int main() {
    int N, D, X;
    int sum = 0;
    cin >> N >> D >> X;
    vector<int> A(N), Count(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    for (int i = 0; i < N; i++) {
        sum += 1 + (D - 1) / A.at(i);
    }
    
    cout << sum + X << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n,m;
    cin>>n>>m;
    int a=0;
    for(int i=0;i<m;i++){
        int b;
        cin>>b;
        a+=b;
    }
    cout<<max(-1,n-a)<<endl;
}

Measured memory_bytes: 3636
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef vector <int> vi;
typedef vector <long long> vl;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define ll long long
#define pb push_back   
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second

ll modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

const int M = 1e6 + 10;
int prime[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!prime[i])
        {
            for (int j = 2*i; j < M; j += i)
                prime[j] = max(prime[j], i);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int x[n],y[n],h[n];
    FOR(i,0,n)
        cin >> x[i] >> y[i] >> h[i];
    FOR(i,0,101)
    {
        FOR(j,0,101)
        {
            int H = 0;
            FOR(k,0,n)
            {
                if (h[k] > 0)
                {
                    H = h[k]+abs(i-x[k])+abs(j-y[k]);
                    break; 
                }
            }
            int cnt = 0;
            FOR(k,0,n)
            {
                int z = max(H - abs(i-x[k]) - abs(j-y[k]), 0);
                if (z == h[k])
                    ++cnt;
            }
            if (cnt == n)
            {
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll s, w;
  cin >> s >> w;
  if (s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;

  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

int main()
{
   string str;
   cin>>str;
   //cout << str << endl;
   int sum=0;
   int len = str.length();
   for(int i=0;i<len;i++){
       //cout <<  << endl;
       sum+=(str[i]-'0');
       sum=sum%9;
   }
   //cout << "sum: "<< sum<<endl;
   if(sum%9==0) cout << "Yes" <<endl;
   else cout << "No"<<endl;
   return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
LL inv(LL x, LL m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
LL mpow(LL a, LL k, LL m) { LL r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

const int N = 1e5 + 5;
int n, m, F[N];
vector<int> G[N], rG[N];

vector<int> tpsort(bool dir = true) {
    vector<int> R, D(n + 1);
    for (const auto &V : G) for (auto x : V) D[x]++;
    for (size_t i = 0; i < n + 1; i++) if (D[i] == !dir) R.push_back(i);
    for (size_t i = 0; i < R.size(); i++)
        for (auto x : G[R[i]]) if (--D[x] == !dir) R.push_back(x);
    return R;
}

int main() {
    cin >> n >> m;
    for (int i = 1, u, v; i < n + m; i++)
        scanf("%d%d", &u, &v), G[u].push_back(v), rG[v].push_back(u);
    auto R = tpsort(true);
    FI(i, 1, n) F[R[i - 1]] = i;
    FI(i, 1, n) {
        int ans = 0;
        for (auto p : rG[i]) if (ans == 0 || F[p] > F[ans]) ans = p;
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 12660
import java.util.Scanner;

/**
 * @author penguin_410
 *         Date: 2014/03/06
 */
public class Main {
    public static void main(String... args) {
        final Scanner scanner = new Scanner(System.in);
        String str;
        while (!(str = scanner.nextLine()).equals("0 0")) {
            final int x = Integer.parseInt(str.split(" ")[0]);
            final int y = Integer.parseInt(str.split(" ")[1]);
            System.out.println(x < y ? x + " " + y : y + " " + x);
        }
    }
}

Measured memory_bytes: 32564
#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> pii;
ll gcd(ll a,ll b){
  if (a%b==0) return(b);
  else return(gcd(b,a%b));
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main(){
  int N,M;
  cin >> N >> M;
  if(M==0){
    cout << "-1" << endl;
    return 0;
  }
  vector<vector<int>> vvi(M);
  rep(i,M){
    int u,v;
    cin >> u >> v;
    u--;v--;
    vvi[u].push_back(v);
  }
  int S,T;
  cin >> S >> T;
  S--;T--;
  queue<int> q[3];
  q[0].push(S);
  int f[3][N];
  rep(i,3)rep(j,N) f[i][j]=-1;
  f[0][S]=0;
  while(!q[0].empty() or !q[1].empty() or !q[2].empty()){
    rep(i,3){
      if(!q[i].empty()){
        int a=q[i].front();
        q[i].pop();
        int b=(i+1)%3;
        for(auto x:vvi[a]){
          if(f[b][x]==-1){
            f[b][x]=f[i][a]+1;
            q[b].push(x);
          }
        }
      }
    }
  }
  //rep(i,3)rep(j,N) cout << f[i][j] << (j==N-1?"\n":" ");
  int ans=(f[0][T]>0)?f[0][T]/3:-1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6912
//Volume0-0054
import java.util.Scanner;
 
public class Main {

    public static void main(String[] args) {
    	
    	//declare    	
    	int      a,b,n,s;
    	String[] str;
    	
    	//input
    	Scanner sc = new Scanner(System.in);
    	while(sc.hasNext()){
    		str = sc.nextLine().split("\\s");
    		a   = Integer.parseInt(str[0]);
    		b   = Integer.parseInt(str[1]);
    		n   = Integer.parseInt(str[2]);
    		
    		//calculate
    		s = 0;
    		a %= b;
    		while(n-- > 0){
    			a *= 10;
    			s += a / b;
    			a %= b;
    		}
    		//output
    		System.out.println(s);
    	}
    }
}

Measured memory_bytes: 17256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	long long N,a[100005],b[10],j=1;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	cin>>N;
	for(long long i=1;i<=N;i++)
		cin>>a[i];
	sort(a+1,a+N+1);
	for(long long i=N;i>=1;){
		if(a[i]==a[i-1]){
			b[j]=a[i];
			j++;
			i-=2;
		}
		else i-=1;
		if(j>2)break;
	}
	if(b[1]==0||b[2]==0){
		cout<<0<<endl;
		return 0;
	}
	cout<<b[1]*b[2]<<endl;
	return 0;
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}


// セグメント木
template<class T>
struct SegmentTree {
private:
    int n;
    vector<T> node;
	T ininum; // 初期値。区間sumなら0、区間minならINFなど
	function<T(T,T)> f; // sum,minなどの演算を設定

public:
    SegmentTree(vector<T> v, T ininum, function<T(T,T)> f) {
    	this->ininum = ininum;
    	this->f = f;
    	
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = f(node[2*i+1], node[2*i+2]);
    }

    void update(int x, T val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = f(node[2*x+1], node[2*x+2]);
        }
    }

    ll get(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return ininum;
        if(a <= l && r <= b) return node[k];

        ll vl = get(a, b, 2*k+1, l, (l+r)/2);
        ll vr = get(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }
};

void mainsolve(){

	int n;
	cin >> n;
	vector<ll> h(n), a(n);
	rep(i,n){
		cin >> h[i];
		h[i]--;
	}
	rep(i,n) cin >> a[i];
	vector<ll> dp(n);
	SegmentTree<ll> seg(dp, 0, [&](ll a, ll b){return max(a,b);});

	rep(i,n){
		dp[h[i]] = a[i] + seg.get(0,h[i]);
		seg.update(h[i], dp[h[i]]);
	}
	
	ll res = 0;
	rep(i,n) res = max( res, dp[i] );
	
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 10624
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int x,n;
	cin>>x;
	if(x==1) {cout<<1;return 0;}
	for(int i=2;i*i<=x;i++)
	for(int j=1;pow(i,j)<=x;j++)
	{
		if((x-pow(i,j))<(x-n)) n=pow(i,j);
	}
	cout<<n;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define ull unsigned int
using namespace std;

void saiki2(vector<vector<ull>>& ki, vector<ull>& p, ull current, ull t2) {
	if (!ki[current].empty()) {
		for (auto& kt : ki[current]) {
			p[kt] += t2;
			saiki2(ki, p, kt, p[kt]);
		}
	}
}

int main()
{
	ull n, q;
	cin >> n >> q;

	vector<vector<ull>> ki(n + 1);
	{
		ull t1, t2;
		for (ull i = 0; i < n - 1; ++i) {
			cin >> t1 >> t2;
			ki[t1].push_back(t2);
		}
	}

	vector<ull> p(n + 1, 0);
	{
		ull t1, t2;
		for (ull i = 0; i < q; ++i) {
			cin >> t1 >> t2;
			p[t1] += t2;
		}
	}

	saiki2(ki, p, 1, p[1]);

	for (ull i = 1; i < n; ++i) {
		cout << p[i] << " ";
	}
	cout << p[n] << endl;

	return 0;
}

Measured memory_bytes: 23552
#include <stdio.h>
int main(){
  int k,s,r=0;
  scanf("%d%d",&k,&s);
  for(int i=0;i<=k;i++)for(int j=0;j<=k;j++)if(i+j<=s&&s<=i+j+k)r++;
  printf("%d",r);
  return 0;
}

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

using namespace std;

string S;

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

}

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//
int N;
ll W, w[101], v[101];
ll dp[101][100100];
int main () {
  cin >> N >> W;
  rep(i,N) cin >> w[i] >> v[i];

  rep(i,101) rep(j, 100100) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(i, N){
    rep(j, 100100){
      if(j - v[i] >= 0) chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
      chmin(dp[i + 1][j], dp[i][j]);
    }
  }
  ll ans = 0;
  rep(i, 100100){
    if(dp[N][i] <= W)ans = i;
  }
  cout << ans << endl;
}




Measured memory_bytes: 82620
while True:
    instr = input()
    instrSp = instr.split()
    x = int(instrSp[0])
    op = str(instrSp[1])
    y = int(instrSp[2])

    res = 0
    if op == '+':
        res = x + y
    elif op == '-':
        res = x - y
    elif op == '*':
        res = x * y
    elif op == '/':
        res = x // y
    else:
        break
    print(res)



Measured memory_bytes: 5592
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <vector>

using namespace std;

typedef unsigned long ul;

int main(void) {
	string x;
	cin >> x;
	ul n = x.size();
	vector<bool> b;
	b.push_back(x[0] == 'S');

	for (int i = 1; i < n; ++i)
	{
		if (x[i] == 'T') {
			if(b.back()) b.erase(b.end() - 1);
			else b.push_back(false);
		} else {
			b.push_back(true);
		}
	}

    cout << b.size() << endl;
    return 0;
}


Measured memory_bytes: 640
N = int(input())
S = input()
Sl = S[:N]
Sr = S[N:]

from collections import defaultdict
L = defaultdict(int)
R = defaultdict(int)
for i in range(1<<N):
    t1 = ""
    t2 = ""
    for j in range(N):
        if i & (1<<j):
            t1 += Sl[j]
    for j in range(N-1, -1, -1):
        if not i & (1<<j):
            t2 += Sl[j]
    L[(t1, t2)] += 1
    t1 = ""
    t2 = ""
    for j in range(N-1, -1, -1):
        if i & (1<<j):
            t1 += Sr[j]
    for j in range(N):
        if not i & (1<<j):
            t2 += Sr[j]
    R[(t1, t2)] += 1
ans = 0
for k, v in L.items():
    ans += R[k] * v
print(ans)


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

int main(){
  int n,a[50],v[50];

  cin >> n;
  for(int i=0;i<n;i++)cin >> a[i] >> v[i];

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(v[i] < v[j]){
	swap(a[i],a[j]); swap(v[i],v[j]);
      }else if(v[i] == v[j] && a[i] > a[j]){
	swap(a[i],a[j]); swap(v[i],v[j]);
      }
    }
  }	

  cout << a[0] << " " << v[0] << endl;
}

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

int		main()
{
	long long N, M; cin >> N >> M;
	if (N * 2 == M) cout << N;
	else if (N * 2 > M)
	{
		cout << M / 2;
	}
	else
	{
		cout << N + (M - 2 * N) / 4;
	}
	cout << endl;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	int R,X,Y,l,M=0;
	scanf("%d %d %d %d",&R,&X,&Y,&l);
	float X_=float(X)/R, Y_=float(Y)/R;
	int ms[l];
	float ts[l+1];
	for(int i=0;i<l;i++){
		scanf("%d",ms+i);
		M+=ms[i];
	}
	float t=0;
	ts[0]=t;
	for(int i=0;i<l;i++){
		t+=float(ms[i])/M*2*acos(-1.0);
		ts[i+1]=t;
		printf("%d",int(( 1 + ( (sin(ts[i])*Y_-cos(ts[i])*X_) + (X_*cos(ts[i+1])-Y_*sin(ts[i+1])) ) / (ts[i+1]-ts[i]) )*100));
		if(l-i-1) printf(" ");
	}
	printf("\n");

}

Measured memory_bytes: 1064
# -*- coding: utf-8 -*-
# 整数の入力




args = []
for _ in range(5):
    tmp = int(input())
    args.append(tmp)
k = int(input())
for i in range(5):
    for j in range(i+1, 5):
        if i == j:
            continue
        dis = args[j] - args[i]
        if dis > k:
            print(':(')
            exit()
print('Yay!')


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

int main(){
    int x;
    int y;
    while (1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        else if(x>y){
            cout << y << " " << x << endl;
        }else{
            cout << x << " " << y << endl;
        }
        
    
    }
    return 0;
}
	



Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
int n;
int main() {
#ifdef fwat
#endif
	n = gi();
	printf("%lld\n", (LL) (n - 2) * 180);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a,const void *b);

typedef struct _idx_int{
	int num;
	int idx;
}Int_idx;

int main(){

	Int_idx sum[100];
	int n;
	int m;
	int anq[100];
	int i,j;

	while(scanf("%d %d",&n,&m)!=EOF){
		if(!n&&!m)break;


		for(i=0;i<m;i++){sum[i].num=0;sum[i].idx=i;}
		for(j=1;j<=n;j++){
			for(i=0;i<m;i++)scanf("%d",anq+i);
			for(i=0;i<m;i++){sum[i].num+=anq[i];}
		}
		qsort(sum,m,sizeof(Int_idx),comp);
		for(i=0;i<m;i++)printf(i==m-1?"%d\n":"%d ",1+sum[i].idx);
	}

	return 0;
}

int comp(const void *a,const void *b){
	Int_idx x,y;
	x=*(Int_idx *)a;
	y=*(Int_idx *)b;
	return y.num-x.num;
}
	

Measured memory_bytes: 604
/*Partition*/
#include <stdio.h>
#include <stdlib.h>
#define N 2000001

int partition(int *, int, int);

int main(){
  int A[N];
  int k, i, j, tmp, n;

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

  k = partition(A, 0, n-1);
  
  for (i=0; i<n-1; i++){
    if (i == k)
      printf("[%d] ", A[i]);
    else
      printf("%d ", A[i]);
  }
  if (n-1 == k)
    printf("[%d]\n", A[n-1]);
  else
    printf("%d\n", A[n-1]);
  
  return 0;
}

int partition(int *A, int p, int r){
  int i, j, x, tmp;
  x = A[r];
  i = p-1;

  for (j=p; j<r; j++){
    if (A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;
}



Measured memory_bytes: 2112
import java.util.*;

class Main{
  static class U{
    int f;
    int[] a;
    U(int n){
      f=n;
      a=new int[n];
      for(int i=0;i<n;i++){
        a[i]=i;
      }
    }
    int r(int i){
      if(i==a[i]){
        return i;
      }
      a[i]=r(a[i]);
      return a[i];
    }
    void m(int i,int j){
      if(r(i)!=r(j)){
        f--;
        a[a[i]]=a[j];
      }
    }
  }
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    U u=new U(n);
    for(int i=0;i<m;i++){
      u.m(sc.nextInt()-1,sc.nextInt()-1);
      sc.nextInt();
    }
    System.out.println(u.f);
  }
}

Measured memory_bytes: 92188
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>


int main()
{
    // std::cout << std::fixed << std::setprecision(10);
    
    int n; std::cin >> n;
    std::vector<int> h(n);
    for(int i=0; i<n; i++) std::cin >> h[i];
    int cnt = 1, highest = h[0];
    for(int i=1; i<n; i++)
    {
        if(h[i] == std::max(h[i], highest))
        {
            cnt++;
            highest = h[i];
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}

Measured memory_bytes: 256
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll i,x,alp[26]={0},cnt=0;
    string s;
    cin>>s;
    for(i=0; s[i]; i++)
    {
        x=s[i]-'A';
        alp[x]++;
    }
    for(i=0; i<26; i++)
    {
        if(alp[i]==2) cnt++;
    }

if(cnt==2)

    cout<<"Yes"<<endl;
 else   cout<<"No"<<endl;




    return 0;
}





Measured memory_bytes: 3640
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
q = gets.chomp.to_i
m = gets.chomp.split.map(&:to_i)

h = {}

0.upto((1 << n) - 1) do |i|
  sum = 0
  0.upto(n - 1) do |j|
    if i & (1 << j) > 0
      sum += a[j]
    end
  end
  h[sum] = true
end

m.each do |mi|
  puts h[mi] ? 'yes' : 'no'
end



Measured memory_bytes: 6904
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	
	public static void main(String[] args) {

		try {
	
			BufferedReader questionreader = new BufferedReader(new InputStreamReader(System.in));
			PrintWriter answerwriter = new PrintWriter(System.out);

			String answer = "A";
			
			String[] params = null;
			String question = null;

			while (questionreader.ready()) {
				if ("".equals(question = questionreader.readLine())) break;
				params = question.split(",");
				if (answer.equals(params[0])) answer = params[1];
				else if (answer.equals(params[1])) answer = params[0];
			}
			
			answerwriter.println(answer);
			
			answerwriter.close();
			questionreader.close();
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return;
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
	}
}

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

int main(){
    int a;
    cin >> a;
    int A[a];
    int count,b=0,c=0;
    for(int i=1;i<a+1;i++){
        A[i]=i;
        count=0;
        if(a==1){
            c=1;
            break;
        }
        while(A[i]!=1){
            if(A[i]%2==0){
                count++;
                A[i]=A[i]/2;
            }
            else{
                A[i]=1;
            }
            if(count>b){
                b=count;
                c=i;
            }
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

int seen[200001] = { false };
int a[200001] = { 0 };
int ans[200001] = { 0 };
void dfs(int v, int sum,whei(int)&G) {
	seen[v] = true;
	ans[v] = sum;
	for (auto x : G[v]) {
		if (seen[x])continue;
		dfs(x, sum + a[x], G);
	}
}

int main() {
	int n, k;
	cin >> n >> k;
	hei(Pint) a(k);
	priority_queue<Pint, hei(Pint)> Q;
	rep(i, 0, k) {
		cin >> a[i].first;
		a[i].second = i;
		Q.push(a[i]);
	}
	int ans = 0;
	if (k == 1)ans = n - 1;
	else {
		int x = -1;
		rep(i, 0, n) {
			Pint s = Q.top();
			Q.pop();
			if (s.second != x) {
				s.first--;
				x = s.second;
				Q.push(s);
			}
			else {
				Pint z = Q.top();
				Q.pop();

				if (z.first == 0) {
					ans++;
					s.first--;
					Q.push(s);
					Q.push(z);
				}
				else {
					z.first--;
					Q.push(z);
					Q.push(s);
					x = z.second;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
using namespace std;
	
int main(){
	int n,c= 0;
	double d;
	cin >> n >> d;
	for(int i = 1; i <= n; i++){
		double a, b;
		cin >> a >> b;
		if(sqrt(a*a+b*b) <= d)c++;	 	
	}
	cout << c << endl;
	return 0;
}
















Measured memory_bytes: 3844