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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

const int NMAX=200100;
using Graph=vector<vector<ll>>;

Graph G(NMAX);
vector<int> dist(NMAX, -1); // 全頂点を「未訪問」に初期化

int bfs(int s){
    queue<int> que;
    int res=s;
    // 初期条件 (頂点 0 を初期ノードとする)
    dist[s] = 0;
    que.push(s); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();
        res=v;

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
    return res;
}



int main(){
    int N;
    cin>>N;
    
    REP(i,N-1){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int s1=bfs(0);
    dist.assign(NMAX,-1);
    int s2=bfs(s1);
    
    int d=dist[s2];
    if(d%3==1){
        cout<<"Second"<<endl;
    }else{
        cout<<"First"<<endl;
    }

    
    
}

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const ll NN = 1e10 + 7;
const int N = 1e5 + 7;
const int M = 11;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;
const int B = sqrt(N);



void solve1()
{
    int n;
    cin >> n;
    vector < int > v(n);
    for( auto &x : v ){
        cin >> x;
    }
    int ans = 2e9;
    for( int i = 0; i <= 200; i++ ){
        int cnt = 0;
        for( int j = 0; j < n; j++ ){
            cnt += (v[j] - i) * (v[j] - i);
        }
        ans = min( ans , cnt );
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 256
#include<stdio.h>
using namespace std;
int main()
{
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  int x=c-a,y=d-b;
  printf("%d %d %d %d\n",c-y,d+x,a-y,b+x);
}

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

using namespace std;

int main(void) {
    int used[100010] = {};
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int p = 1;
    for (int i = 0; i < n; i++) {
        used[p] = 1;
        if (p == 2) {
            cout << i << endl;
            return 0;
        }
        p = a[p];
    }
    cout << "-1\n";
    
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int isOP(char z){
  if(z=='+')return mod+1;
  if(z=='-')return mod+2;
  if(z=='*')return mod+3;
  if(z=='/')return mod+4;
  return 0;
}
int solve(string s){
  queue<int> Q;
  int cnt=0,i=0;
  bool done=false;
  while(i<s.size()){
    
    if('0'<=s[i]&&s[i]<='9'){
      cnt*=10;
      cnt+=s[i]-'0';
      done=true;
    }
    else{
      if(done)Q.push(cnt);
      done=false;
      cnt=0;
    }
    
    if(s[i]=='('){
      int pnt=0,tnt=1;
      for(int j=i+1;j<s.size();j++){
	if(s[j]=='(')tnt++;
	if(s[j]==')')tnt--;
	if(tnt==0){pnt=j;break;}
      }
      Q.push(solve(s.substr(i+1,pnt-i-1)));
      i=pnt+1;continue;
    }
    
    int tmp=isOP(s[i]);
    if(tmp>0)Q.push(tmp);
    
    i++;
  }
  if(done)Q.push(cnt);
  
  queue<int> R;
  int x;
  while(!Q.empty()){
    int a=Q.front();Q.pop();
    if(a==mod+1||a==mod+2){
      R.push(x);
      R.push(a);
    }
    if(a==mod+3){
      int b=Q.front();Q.pop();
      x*=b;
    }
    if(a==mod+4){
      int b=Q.front();Q.pop();
      x/=b;
    }
    if(a<mod) x=a;
  }
  R.push(x);
  
  x=0;
  while(!R.empty()){
    int a=R.front();R.pop();
    if(a==mod+1){
      int b=R.front();R.pop();
      x+=b;
    }
    if(a==mod+2){
      int b=R.front();R.pop();
      x-=b;
    }
    if(a<mod) x=a;
  }
  return x;
}

int main(){
  int n;cin>>n;
  lol(i,n){
    string s;
    cin>>s;
    s=s.substr(0,s.size()-1);
    cout<<solve(s)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
import fractions
A,B,C,D=map(int,input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
E=lcm(C,D)
a=A-1
ans=(a//C)+(a//D)-(a//E)
ans2=(B//C)+(B//D)-(B//E)
print(B-A+1-(ans2-ans))


Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define vi vector<int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n;
double p[3000],dp[3000][3000],ans;

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    dp[0][0]=1;
    fort (i,n)
    {
        cin >> p[i];
        for (int j = 0; j <= i; ++j)
            dp[i][j]=p[i]*dp[i-1][j-1]+(1.00-p[i])*dp[i-1][j];
    }
    for (int i = n/2+1; i <= n; ++i)
        ans+=dp[n][i];
    cout << fixed << setprecision(9) << ans;
}


Measured memory_bytes: 68992
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdint>

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int64_t N; std::cin >> N;
  int64_t x[11];
  int64_t tmp = 26;
  for(int i = 0; i < 11; ++i) { x[i] = tmp; tmp *= 26; }
  for(int i = 1; i < 11; ++i) x[i] += x[i-1];
  int i = 0;
  while(N > x[i]) ++i;
  if(i > 0) N -= x[i-1];
  --N;
  ++i;
  std::vector<char> ans(i);
  for(int j = ans.size()-1; j >= 0; --j) {
    ans[j] = (N%26) + 'a';
    N /= 26;
  }
  for(char c: ans) std::cout << c;
  std::cout << std::endl;
  return 0;
}


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

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;

    int cnt0 = 0;
    rep (i, s.size()) cnt0 += (s[i] == '0');

    vector <int> va;
    va.push_back(0);
    bool prev = true;
    int cnt = 0;
    rep (i, n) {
        if ((int)prev == s[i] - '0') cnt++;
        else {
            va.push_back(cnt);
            cnt = 1;
            prev = s[i] - '0';
        }
    }
    va.push_back(cnt);
    if (s.back() != '1') va.push_back(0);

    k = min(k, ((int)va.size() - 1) / 2);

    rep (i, va.size() - 1) va[i + 1] += va[i];
    // 1, 3, 5, 7, 9
    // a_n = 1 * 2^(n-1)
    int ans = va[1];
    int aida = 3 + 2 * (k - 1);
    for (int i = 1;;i++) {
        if (i >= (int)va.size() - aida + 1) break;
        if (i % 2 == 1) {
            ans = max(va[i + aida - 1] - (va[i - 1]), ans);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
typedef long long ll;
using namespace std;
const ll INF = 1<<30;
 
double n, x;
int t;
 
int main(){
    cin >> n >> x >> t;
    cout << int(ceil(n/x))*t << endl;
}

Measured memory_bytes: 3720
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element

//---------- 素数列挙 ----------
vector<bool> GetIsPrimeList(int max)
{
	vector<bool> list;
	for (int i = 0; i <= max; i++)
	{
		list.push_back(true);
	}
	for (int i = 2; i < sqrt(max); i++)
	{
		if (list[i])
		{
			for (int j = 0; i * (j + 2) < max; j++)
			{
				list[i * (j + 2)] = false;
			}
		}
	}
	list[0] = false;
	list[1] = false;
	return list;
}

vector<int> GetPrimeList(int max)
{
	vector<int> list;
	vector<bool> prime_bool = GetIsPrimeList(max);
	for (int i = 0; i < max; i++)
	{
		if (prime_bool[i])
			list.push_back(i);
	}
	return list;
}



signed main()
{
	int X;
	cin >> X;
	auto list = GetPrimeList(200000);
	for (int p : list)
	{
		if (X <= p)
		{
			cout << p << endl;
			return 0;
		}
	}
}




Measured memory_bytes: 1272
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-05-10 21:07:27 +0900
# LastModified: 2020-05-10 21:10:45 +0900
#


import os
import sys


def main():
    a,b,c,k=map(int,input().split())
    if k<=a:
        print(k)
    elif a<k and k<=a+b:
        print(a)
    else:
        print(a-(k-a-b))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9168
#include<cstdio>
using namespace std;

int main (){
	int G,R,H;
    scanf("%d%d",&G,&R);
    H=2*R-G;
    	if(R>=0&&G<=4500)
    printf("%d",H);
        if(R<0||G>4500)
    printf("请重新输入"); 
    return 0;}


Measured memory_bytes: 128
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };



int main(void) {
	int n;
	int h[102];
	int count = 0;
	int total = 0;

	cin >> n;
	FOR(i, 1, n) {
		cin >> h[i];
		total += h[i];
	}
	h[n + 1] = 0;

	while (total > 0) {


		FOR(i, 1, n) {
			if (h[i] != 0) {
				FOR(j, i + 1, n+1) {
					if (h[j] != 0) {
						continue;
					}
					else {
						FOR(k, i, j - 1) {
							h[k]--;
							total--;
						}
						count++;
						break;
					}
				}
				break;
			}
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
/*
ID: alec3
LANG: C++14
PROG: highcard
*/


#include <bits/stdc++.h>

#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define FOR(i, a, b) for (int i = a; i < b; i++)

typedef long long ll;
typedef unsigned long long ull;

int pct(int x) { return __builtin_popcount(x); }

using namespace std;

ifstream fin("zerosum.in");
ofstream fout("zerosum.out");
const int MAXN = 100;



int main() {
    //ofstream fout("lightson.out");
    //ifstream fin("lightson.in");
    int n, d;
    cin >> n >> d;

    double a, b;
    int ans = 0;
    double dist;
    while (n --){
        cin >> a >> b;
        dist = sqrt(a* a + b * b);

        if (dist <=d)
            ans ++;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  int maxa=0,mina=INF;
  rep(i,N) {
    cin >> A[i];
    chmax(maxa,A[i]);
    chmin(mina,A[i]);
  }
  if(maxa-mina>1) {
    cout << "No" << endl;
    return 0;
  }
  if(maxa-mina) {
    int uniq=0;
    rep(i,N) {
      if(A[i]==mina) uniq++;
    }
    int maxkind = uniq+(N-uniq)/2;
    int minkind = uniq+1;
    if(minkind>maxa||maxkind<maxa) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
    return 0;
  }
  if(maxa==N-1) {
    cout << "Yes" << endl;
    return 0;
  }
  int minkind=1;
  int maxkind=N/2;
  if(minkind>maxa||maxkind<maxa) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

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

int a, b,n;

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

	if (abs(a - b) % 2 == 0) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<int> v[101010],ret[101010];
int ans[101010];

int dfs(int x,int p){
    ret[x].push_back(0);
    for(auto to:v[x]){
        if(to==p)continue;
        ret[x].push_back(dfs(to,x));
    }
    sort(ret[x].begin(),ret[x].end(),greater<>());
    return ret[x][0]+1;
}

void dfs2(int x,int p){
    int res=ret[x][0];
    if(x){
        if(ret[p][0]!=res+1)ret[x].push_back(ret[p][0]+1);
        else ret[x].push_back(ret[p][1]+1);
    }
    sort(ret[x].begin(),ret[x].end(),greater<>());
    for(auto to:v[x]){
        if(to==p)continue;
        dfs2(to,x);
    }
    ans[x]=ret[x][0];
}

int main(){
    int n;
    cin>>n;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        --a;--b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(0,-1);
    dfs2(0,-1);
    rep(i,n)cout<<2*(n-1)-ans[i]<<endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int A, B, K;
    cin >> A >> B >> K;

    int cnt = 0;
    int N = min(A, B);
    for (int i = N; i > 0; --i) {
        if (A % i == 0 && B % i == 0) cnt++;
        if (cnt == K) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
A = input().split()
S = []


for i in A:
    if i == '+' or i == '-' or i == '*':
        a = S.pop()
        b = S.pop()
        if i == '+': S.append(b+a)
        elif i == '-': S.append(b-a)
        else: S.append(b*a)
    else:
        x = int(i)
        S.append(x)
    #print(S)

print(S[0])


Measured memory_bytes: 5600
#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(void){
    double a, b, c;
    cin >> a >> b >> c;
    double rad, x;
    rad = c * (M_PI / 180);
    x = sqrt(a * a + b * b - 2 * a * b * cos(rad));
    double S, L, h;
    L = a + b + x;
    double s = L / 2;
    S = a * b * sin(rad) / 2;
    h = S * 2 / a;
    cout << fixed << S << endl << L << endl << h << endl;
    return 0;
}


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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    int N;
    cin >> N;
    
    int A[N];
    int kisu = 0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i]%2!=0) kisu++;
    }
    
    if(kisu%2==0) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;

map<string, int> memo;

using P=pair<ll,ll>;

/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}



const int INF = 1001001001;
string f(ll n) {
	if (n == 0)return "";
	n--;
	return f(n / 26) + string(1, 'a' + n % 26);
}

string x(ll n) {
	string s = "";
	if (n == 0)return "";
	n--;
	s += 'a' + n % 26;
	return x(n / 26) + s ;
}
int main() {
	ll n;
	cin >> n;
	cout << x(n);
	return 0;
}













Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define N 1050
#define M 200
#define ll long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
  	map<string , int > ma;
  	ma["AC"]=0;ma["WA"]=0;ma["TLE"]=0;ma["RE"]=0;
  	int n; cin>>n;
  	for(int i=0;i<n;i++){
  	    string s; cin>>s;
  	    ma[s]++;
  	}
  	cout<<"AC x "<<ma["AC"]<<'\n';
  	cout<<"WA x "<<ma["WA"]<<'\n';
  	cout<<"TLE x "<<ma["TLE"]<<'\n';
  	cout<<"RE x "<<ma["RE"]<<'\n';
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	uint64_t t;
	uint64_t current = 1;
	int depth = 0;
	uint64_t skipped = 0;
	uint64_t elapsed = 0;
	if (scanf("%" PRIu64, &t) != 1) return 1;
	if (t == 0) {
		puts("0");
		return 0;
	}
	for (;;) {
		if (skipped + current * 4 <= t) {
			depth++;
			skipped += current * 4;
			current *= 3;
			elapsed += 2;
		} else {
			break;
		}
	}
	while (skipped < t) {
		if (skipped + current <= t) {
			skipped += current;
			elapsed++;
		} else {
			current /= 3;
		}
	}
	printf("%" PRIu64 "\n", elapsed);
	return 0;
}



Measured memory_bytes: 2144
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int Q = sc.nextInt();
    String S = sc.next();
    
    int[] l = new int[Q];
    int[] r = new int[Q];

    for (int i = 0; i < Q; i++) {
      l[i] = sc.nextInt();
      r[i] = sc.nextInt();
    }

    sc.close();

    String[] s = S.split("");

    int count = 0;

    // 累積和
    int[] ac = new int[N+1];
    ac[0] = 0;
    ac[1] = 0;

    for (int i = 1; i < N; i++){
      if (s[i-1].equals("A") && s[i].equals("C")) {
        ac[i+1] = ac[i] + 1; 
      } else {
        ac[i+1] = ac[i];
      }
    }

    //0 1 2 3 4 5 6 7 8
    //0 0 1 1 2 2 2 3 3
    // A C A C T A C G 
    // 1 2 3 4 5 6 7 8

    for (int i = 0; i < Q; i++){
      count = ac[r[i]] - ac[l[i]];
      System.out.println(count);
    }

  }

}

Measured memory_bytes: 88244
#include <iostream>
#include <string>
#define llint long long

using namespace std;

llint n;

int main(void)
{
	cin >> n;
	
	llint ans = 0;
	while(n >= 2){
		ans++;
		n = (n+2)/3;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3104
#import <stdio.h>

int main(){
    int n,x;
    scanf("%d %d",&n,&x);
    int d = 0;
    for(int i=1;i<=n;i++){
        int y;
        scanf("%d",&y);
        d += y;
        if (d>x) {
            printf("%d",i);
            return 0;
        }
    }
    printf("%d",n+1);
    return 0;
}


Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

long long quick_mod(long long a, long long b){
	long long ans = 1;
	while (b > 0){
		if (b & 1){
			ans = (ans * a) % MOD;
		}
		a = (a * a) % MOD;
		b /= 2;
	}
	return ans % MOD;
}

long long C(int n, int m){
	if (m > n) return 0;
	long long ans = 1;
	for (int i = 1; i <= m; ++i){
		ans = (ans * quick_mod(i, MOD - 2)) % MOD;
		ans = (ans * (n - i + 1)) % MOD;
	}
	return ans % MOD;
}

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	long long n, a, b;
	cin >> n >> a >> b;
	long long ans = quick_mod(2, n) - 1;
	ans = (ans - C(n, a) + MOD) % MOD;
	ans = (ans - C(n, b) + MOD) % MOD;
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
while True:
    try:
        a,b,c,d,e,f = map(int, input().split())
        g = (a*e - b*d) 
        x = (c*e - b*f)
        y = (a*f - c*d)
        print('{0:.3f}'.format(x/g+0.0001) +' {0:.3f}'.format(y/g +0.0001))
              
    except EOFError: break


Measured memory_bytes: 5612
n = int(input())
p_mn = m_mn= 10**9 * 2
p_mx = m_mx = -p_mn
for i in range(n):
    x, y = map(int, input().split())
    p = x + y
    m = x - y
    p_mx = max(p_mx, p)
    p_mn = min(p_mn, p)
    m_mx = max(m_mx, m)
    m_mn = min(m_mn, m)
print(max(p_mx-p_mn, m_mx-m_mn))


Measured memory_bytes: 9068
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int N,M;
char mz[55][55];
int mark[55][55];
int ans=0,sum=0;
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
int BFS(int c,int l)
{
    queue<P>que;
    que.push(P(c,l));
    while(!que.empty())
    {
        c=que.front().first,l=que.front().second;
        if(c==N-1&&l==M-1)
                return mark[c][l];
        que.pop();
        for(int i=0;i<4;i++)
        {
            int x=c+dx[i];
            int y=l+dy[i];
            if(x<0||y<0||x>=N||y>=M)
                continue;
            if(!mark[x][y]&&mz[x][y]!='#')
            {
                mark[x][y]=mark[c][l]+1;
                que.push(P(x,y));
            }
        }
    }
    return -1;
}
int main()
{
    memset(mark,0,sizeof(mark));
    scanf("%d%d",&N,&M);
    for(int i=0;i<N;i++)
    {
        scanf("%s",mz[i]);
    }
    for(int i=0;i<N;i++)
        for(int j=0;j<M;j++)
    {
        if(mz[i][j]=='.')
            sum++;
    }
    ans=BFS(0,0);
    if(ans!=-1)
    printf("%d\n",sum-ans-1);
    else
    printf("-1");
    return 0;
}


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

using namespace std;

#define ll long long
#define all(x) (x).begin(), (x).end()

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    // 入力
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    // 処理
    reverse(all(a));

    // 出力
    rep(i, n) {
        cout << a[i];
        cout << (i == n - 1 ? "" : " ");
    }
    cout << "\n";

    return 0;
}



Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <complex>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

typedef complex<double> P;

const double PI = 3.14159265358979;

char xp, yp; double dp, lp;
char xq, yq; double dq, lq;

double calcTheta(char a, char b, int d) {
	double angle;
	
	if (a == 'D' && b == 'B') {
		angle = 0 + d;
	}
	if (a == 'B' && b == 'C') {
		angle = 60 + d;
	}
	if (a == 'C' && b == 'D') {
		angle = 120 + d;
	}
	return angle * PI / 180.0;
}

double cross(P a, P b) {
	return a.real() * b.imag() - a.imag() * b.real();
}

bool isIn(P a, P b, P c, P p) {
	double p1 = cross(b - a, p - a);
	double p2 = cross(c - b, p - b);
	double p3 = cross(a - c, p - c);
	if (p1 * p2 < 0) return false;
	if (p2 * p3 < 0) return false;
	if (p3 * p1 < 0) return false;
	return true;
}

bool isContained(P p, int id) {
	P base[4];
	base[0] = P(0, 0);
	base[1] = P(1, 0) * exp(P(0, 1) * PI / 3.0);
	base[2] = P(1, 0) * exp(P(0, 1) * PI * 2.0 / 3.0);
	base[3] = P(1, 0) * exp(P(0, 1) * PI * 3.0 / 3.0);
	
	P vec1 = P(2, 0);
	P vec2 = vec1 * exp(P(0, 1) * PI / 3.0);
	
	int T = 50;
	for (int i = -T; i <= T; i++) {
		for (int j = -T; j <= T; j++) {
			P center = base[id] + vec1 * (double)i + vec2 * (double)j;
			
			P inner[6];
			P outer[6];
			int k;
			
			double sq3 = sqrt(3.0);
			rep(k, 6) inner[k] = center + P(1, 0) * exp(P(0, 1) * (double)k * PI / 3.0);
			rep(k, 6) outer[k] = center + P(sq3, 0) * exp(P(0, 1) * (double)(k * PI / 3.0 + PI / 6.0));
			
			rep(k, 6) {
				//inner[k], inner[k + 1], outer[k]からなる三角形に、pが含まれるか？
				if (isIn(inner[k], inner[(k + 1) % 6], outer[k], p)) {
					return true;
				}
			}
		}
	}
	return false;
}

int calcAreaId(P p) {
	for (int i = 0; i < 4; i++) {
		if (isContained(p, i)) {
			return i;
		}
	}
	return -1;
}

int main() {
	cin >> xp >> yp >> dp >> lp;
	cin >> xq >> yq >> dq >> lq;
	
	double theta1 = calcTheta(xp, yp, dp);
	double theta2 = calcTheta(xq, yq, dq);
	
	P p1 = lp * exp(P(0, 1) * theta1);
	P p2 = lq * exp(P(0, 1) * theta2);
	
	int id1 = calcAreaId(p1); assert(id1 >= 0);
	int id2 = calcAreaId(p2); assert(id2 >= 0);
	
	if (id1 == id2) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }
	
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define MAX 1111
#define mod 1000000007
const long long  inf = 20000000000000000;
using namespace std;
int main(){ 
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);  
    long long n,m,d;
    cin>>n>>m>>d;
    long double ans = 1.0 * (n-d) * (m-1) / (n*n);
    if(d != 0)ans *= 2;
    cout<<fixed<<setprecision(9)<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long N,M;
    cin >> N >>M;
    long long ans=1;
    if(N==M){
        for(int i=1;i<=N;i++){
            ans=ans*i%MOD;;
        }
        ans=ans*ans%MOD;
        ans=ans*2%MOD;
    }
    else if(N-M==1){
        for(int i=1;i<=M;i++){
            ans=ans*i%MOD;;
        }
        ans=ans*ans%MOD;
        ans=ans*N%MOD;
    }
    else if(M-N==1){
        for(int i=1;i<=N;i++){
            ans=ans*i%MOD;;
        }
        ans=ans*ans%MOD;
        ans=ans*M%MOD;
    }
    else ans=0;

    cout << ans << endl;



}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int s1[] = new int[N];
      	int s2[] = new int[N];
        
		int tmp1 = 0;
      	for(int i = 0; i < N; i++){
          int a1 = sc.nextInt();
          s1[i] = a1 + tmp1;
          //System.out.println(s1[i]);
          tmp1 += a1;
        }
      	int tmp2 = 0;
      	for(int i = 0; i < N; i++){
          int a2 = sc.nextInt();
          s2[i] = a2 + tmp2;
          tmp2 += a2;
        }
      int max = 0;
      if(N != 1){
      	max = s1[N - 1] + (s2[N - 1] - s2[N - 2]);
      }else {
      	max = s1[N - 1] + s2[N - 1];
      }
      //System.out.println(max);
      int total = 0;
      for(int i = 0; i < N; i++){
        if(i == 0){
          	total = s1[i] + s2[N - 1];
        }else{
        	total = s1[i] + (s2[N - 1] - s2[i - 1]);
        }
        if(max <= total){
        	max = total;
        }
        total = 0;
      }
      System.out.println(max);
    }
}

Measured memory_bytes: 23892
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	H, W, D := ReadInt(), ReadInt(), ReadInt()
	toID := func(x, y int) int {
		return y*W + x
	}
	toXY := func(id int) (int, int) {
		return id % W, id / W
	}
	valToID := make([]int, H*W)
	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			valToID[ReadInt()-1] = toID(x, y)
		}
	}

	s := make([]int, H*W+1)
	for val := D; val < H*W; val++ {
		prevVal := val - D
		x, y := toXY(valToID[val])
		prevX, prevY := toXY(valToID[prevVal])
		s[val] = s[prevVal] + Abs(x-prevX) + Abs(y-prevY)
	}

	Q := ReadInt()
	for q := 0; q < Q; q++ {
		L, R := ReadInt()-1, ReadInt()-1
		fmt.Println(s[R] - s[L])
	}
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 6292
n=int(input())
result=""
if n==0:
  result="0"
else:
  while n!=1:
    if n%(-2)==0:
        a=0
        n=int(n/(-2))
    else:
        a=1
        if n>0:
            n=int(n/(-2))
        else:
            n=int(n/(-2))+1
    result=result+str(a)
  result=result+"1"
print(result[::-1])

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    unordered_map<string,int> ht_M, ht_A, ht_R, ht_C, ht_H;
    
    for(int i=0; i<N; ++i){
        string s; cin >> s;
        if(s[0]=='M'){ ht_M[s]+=1; continue; }
        if(s[0]=='A'){ ht_A[s]+=1; continue; }
        if(s[0]=='R'){ ht_R[s]+=1; continue; }
        if(s[0]=='C'){ ht_C[s]+=1; continue; }
        if(s[0]=='H'){ ht_H[s]+=1; continue; }
    }
    
    vector<int64> v;
    if(ht_M.size()!=0){ v.push_back( ht_M.size() ); }
    if(ht_A.size()!=0){ v.push_back( ht_A.size() ); }
    if(ht_R.size()!=0){ v.push_back( ht_R.size() ); }
    if(ht_C.size()!=0){ v.push_back( ht_C.size() ); }
    if(ht_H.size()!=0){ v.push_back( ht_H.size() ); }
    
    int64 sum=0;
    for(uint i=0; i<(uint)1<<v.size(); ++i){
        uint bit=i;
        if(__builtin_popcount(bit)!=3){ continue; }
        int64 mul=1;
        for(uint i=0; i<v.size(); ++i){
            if(bit & 1){ mul*=v[i]; }
            bit>>=1;
        }
        sum+=mul;
    }
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
const double EPS=1e-9;
#define MOD ll(1e9L+7)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define t() ll tt;cin>>tt;while(tt--) 
#define t2() ll tt2; cin>>tt2; for(ll tti=1;tti<=tt2;tti++)
#define printcj "Case #"<<tti<<": "
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << "=>";
#define debugarray(arr,n,x) { cout << "[" ; for(ll i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"] , "<<#x<<" = "<<x<<'\n';}

const ll N=401;
ll a[N],pre[N];
ll dp[N][N];
ll solve(ll start,ll end)
{
    if(start==end) return 0;
    if(dp[start][end]!=-1) return dp[start][end]; 
    ll current_min=LLONG_MAX;
    for(ll i=start;i<end;i++)
        current_min = min(current_min,solve(start,i)+solve(i+1,end));
    
    current_min += pre[end] - (start>0 ? pre[start-1] : 0 );
    // debug2(start,end);
    // debug1(current_min);
    return dp[start][end]=current_min;
}
int main()
{
    fastio;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)for(int j=0;j<n;j++)dp[i][j]=-1;
    for(int i=0;i<n;i++) cin>>a[i];
    pre[0]=a[0];
    for(ll i=1;i<n;i++) pre[i]=a[i]+pre[i-1];
    ll mincost = solve(0,n-1);
    cout<<mincost;



    
}


Measured memory_bytes: 4928
#include <stdio.h>
#include <stdlib.h>
int main(void){
    char buf[10];
    int data;
    int i,a,b;
    i = 0;
    a = 0;
    scanf("%s",&buf);
    b = atoi(buf);
    while(buf[i] != NULL){
        a += (buf[i] - '0');
        i++;
    }
    if(b%a == 0){
        printf("Yes");
    } else{
        printf("No");
    }
    return 0;   
}

Measured memory_bytes: 128
#include <cstdio>
#include <queue>
using namespace std;
int N; priority_queue<double, vector<double>, greater<double>> q;
int main() {
  scanf("%d", &N);
  for(int i = 0, t; i < N; ++i) {
    scanf("%d", &t);
    q.push((double)t);
  }
  double t1, t2, tmp;
  while(q.size() > 1) {
    t1 = q.top(); q.pop();
    t2 = q.top(); q.pop();
    tmp = (t1+t2)*0.5;
    q.push(tmp);
  }
  printf("%.10lf\n", q.top());
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		B(sc);
	}
	
	public static void A(Scanner sc) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int ret = ((int)(t+0.5)/a)*b;
		out.println(ret);
	}
	
	public static void B(Scanner sc) {
		int max = Integer.MIN_VALUE;
		int sum = 0;
		int N = sc.nextInt();
		int[] subs = new int[N];
		for(int i=0;i<N;i++) {
			subs[i] = sc.nextInt();
 		}
		for(int i=0;i<N;i++) {
			subs[i] -= sc.nextInt();
			if(subs[i]>0) sum+=subs[i];
		}
		out.println(sum);
		
	}
}


Measured memory_bytes: 22612
#include<stdio.h>
int main(){
  int a,b,c,d,e,k;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);
  scanf("%d",&e);
  scanf("%d",&k);
  if(e-d<=k&&e-c<=k&&e-b<=k&&e-a<=k&&d-c<=k&&d-b<=k&&d-a<=k&&c-b<=k&&c-a<=k&&b-a<=k){
    printf("Yay!\n");
  }
  else{
    printf(":(\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  for (char i = 'a'; i <= 'z'; i++) {
    int cnt = 0;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == i) cnt++;
    }
    if (cnt % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <map>
#include <vector>
using namespace std;

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

  vector<bool> lamp(N,false);
  lamp[0] = true;

  for(int i = 0;i < N;i++){
    int a;
    cin >> a;
    mp[i] = a-1;//ボタンの対応を保存.
  }

  int push = 0;//今ついているボタン
  int count = 0;

  for(int i = 0;i < N;i++){
    lamp[push] = false;//ついているボタンを押す(押すと消える)
    lamp[mp[push]] = true;//対応するボタンが光る
    push = mp[push];//光っているボタンの場所を格納.
    count++;
    if(lamp[1]){
      cout << count << endl;
      return 0;
    }
  }

  cout << -1 << endl;


}

Measured memory_bytes: 4992
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  # key ^ value
    accum = tuple(accumulate(range(1, 40)))  # because 10^12 < 2^39

    def facs(n):
        yield 2
        for x in range(3, int(pow(n, 0.5)) + 1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for accum_count, accum_value in enumerate(accum):
            if c < accum_value:
                break
        ans += accum_count
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    a[i]=k;
  }
  sort(a,a+n);
  long long ans=999999999999;
  for(int i=a[0];i<a[n-1]+1;i++){
    long long t=0;
    for(int j=0;j<n;j++){
      t+=(a[j]-i)*(a[j]-i);
    }
    ans=min(ans,t);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, j, k, l;
	int input;
	int count;
	
	while (scanf("%d", &input) != EOF){
		count = 0;
		if (input < 37){
			for (i = 0; i <= 9; i++){
				for (j = 0; j <= 9; j++){
					for (k = 0; k <= 9; k++){
						for (l = 0; l <= 9; l++){
							if (input == i + j + k + l){
								count++;
							}
						}
					}
				}
			}
		}
		printf("%d\n", count);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <iomanip> //cout << fixed << setprecision(12) << ans << endl;
using namespace std;
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define loop(i, l, r) for(int i = l; i < r; i++)
#define rloop(i, l, r) for(int i = l; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vec_i;
typedef pair<int,int> pair_ii;
typedef pair<ull,ull> pair_ull;
 
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int INF = 1e9;
const int MOD = 1e9+7;
 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	cout << fixed << setprecision(9) << double((n+1)/2)/n << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

vector<pair<i64, int>> factorize(i64 x)
{
    vector<pair<i64, int>> res;
    for (i64 f = 2; f * f <= x; f++)
    {
        if (x % f)
        {
            continue;
        }
        int cnt = 0;
        while (x % f == 0)
        {
            cnt++;
            x /= f;
        }
        res.push_back(make_pair(f, cnt));
    }
    if (x > 1)
    {
        res.push_back(make_pair(x, 1));
    }
    return res;
}

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 n;
    cin >> n;
    auto ps = factorize(n - 1);
    i64 ans = 1;
    for (auto &p : ps)
    {
        ans *= p.second + 1;
    }
    for (i64 k = 2; k * k <= n; k++)
        for (int e = 1; e < 45; e++)
        {
            i64 x = n;
            i64 y = pow(k, e);
            x -= y;
            if (x < 0)
            {
                break;
            }
            if (x % (y * k) == 0)
            {
                ans++;
            }
        }

    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;

    vector<string> start = {"SS", "SW", "WS", "WW"};

    for(auto st : start) {
        string A(N, 'a');
        A.at(0) = st.at(0);
        A.at(1) = st.at(1);
        for(int i = 2; i < N; i++) {
            if(S.at(i - 1) == 'o' && A.at(i - 1) == 'S') {
                A.at(i) = A.at(i - 2);
            } else if(S.at(i - 1) == 'x' && A.at(i - 1) == 'W') {
                A.at(i) = A.at(i - 2);
            } else {
                A.at(i) = (A.at(i - 2) == 'W') ? 'S' : 'W';
            }
        }
        bool a1 = (A.at(N - 1) == 'S');
        bool a2 = (S.at(N - 1) == 'o');
        bool a3 = (A.at(N - 2) == A.at(0));
        if((int(a1 + a2 + a3) % 2) == 0)
            continue;
        bool b1 = (A.at(0) == 'S');
        bool b2 = (S.at(0) == 'o');
        bool b3 = (A.at(N - 1) == A.at(1));

        if(int(b1 + b2 + b3) % 2) {
            cout << A << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 512
N = int(input())
ARR = [int(s) for s in input().split(" ")]

def calculate(arr):
    evens = []
    for ar in arr:
        if ar % 2 == 0:
            evens.append(ar)

    counts = 0
    for ev in evens:
        while ev % 2 == 0:
            counts = counts + 1
            ev = ev / 2
    print(counts)

calculate(ARR)

Measured memory_bytes: 4148
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long> 
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll


signed main(){
  int n; cin>>n;
  
  for(int c=0; c<n; c++){
    int a[15];
    for(int j=0; j<10; j++){
      cin>>a[j];
    }
    
    bool ans=false;
    for(int i=0; i<(1<<10); i++){
      vector<int> ve1,ve2;
      for(int j=0; j<10; j++){
        if(i&(1<<j)) ve1.push_back(a[j]);
        else ve2.push_back(a[j]);
      }
      

      bool no=false;
      for(int j=1; j<ve1.size(); j++){
        if(ve1[j]<ve1[j-1]){
          no=true;
          break;
        }
      }
      for(int j=1; j<ve2.size(); j++){
        if(ve2[j]<ve2[j-1]){
          no=true;
          break;
        }
      }
      if(!no){
        ans=true;
        break;
      }
      
    }
    
    if(ans) cout<<"YES"<<en;
    else cout<<"NO"<<en;
  }
}



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

int main(){
    string s;
    cin >> s;
    if(s=="Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(s=="Cloudy"){
        cout << "Rainy" << endl;
    }
    else{
        cout << "Sunny" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> mp;
  rep(i,n){
    int x;
    cin >> x;
    mp[x]++;
  }
  int jama = 0;
  for(auto p : mp) jama += max(p.second-1,0);
  cout << mp.size()-jama%2 << endl;
}

Measured memory_bytes: 5376
#include <algorithm>
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
constexpr int INF = 100100100;

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

using namespace std;

int main() {
  // cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<int> value, cost;
  REP(i, N) {
    int V; cin >> V;
    value.push_back(V);
  }
  REP(i, N) {
    int C; cin >> C;
    cost.push_back(C);
  }
  int sum = 0;
  REP(i, N) {
    sum += max(0, value[i] - cost[i]);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256