akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(c: "List[List[int]]"):

    for a1 in range(101):
        b1 = c[0][0] - a1
        b2 = c[0][1] - a1
        b3 = c[0][2] - a1
        
        a2 = c[1][0] - b1
        a3 = c[2][0] - b1

        if(a1+b1 == c[0][0] and a2+b1 == c[1][0] and a3+b1 == c[2][0] and 
        a1+b2 == c[0][1] and a2+b2 == c[1][1] and a3+b2 == c[2][1] and 
        a1+b3 == c[0][2] and a2+b3 == c[1][2] and a3+b3 == c[2][2]):
            print(YES)
            exit()

    print(NO)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    c = [ [ int(next(tokens)) for _ in range(3) ] for _ in range(3) ]  # type: "List[List[int]]"
    solve(c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef long long ll;

const ll INF = 1e9+5;
const ll MOD = 1e9+7;

int main() {
	ll sol = 1000;
	int n;
	scanf("%d", &n);
	ll l;
	for (int i=0 ; i<n ; i++) {
		ll x;
		scanf("%lld", &x);
		if (i) {
			if (x>l) {
				sol = sol%l + (sol/l)*x;
			}
		}
		l = x;
	}
	printf("%lld\n", sol);
	return 0;
}

Measured memory_bytes: 3828
#include<iostream>
#include <malloc.h>
using namespace std;

int main() {
	int N;
	int A[100000];
	int max = -10001;
	int min = 10001;
	int count = 0, count2 = 0;
	/*int save[100000][2];*/
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> A[i];
	}
	for (int i = 0;i < N;i++) {
		if (max < A[i]) {
			max = A[i];
			count = i;
		}
		else if (min > A[i]) {
			min = A[i];
			count2 = i;
		}
	}
	/*cout << count << "//" << count2 << endl;*/
	for (int i = 0;i < N;i++) {
		if (A[i] > 0 && (i != count && i != count2)) {
			/*save[i][0] = min;*/
			/*cout << min << " " << A[i] << endl;*/
			min -= A[i];
		}
		if (A[i] <= 0 && (i != count && i != count2)) {
			/*save[i][0] = max;*/
			/*cout << max << " " << A[i] << endl;*/
			max -= A[i];
		}
		/*save[i][1] = A[i];*/
	}
	/*cout << max << " " << min << endl;*/
	cout << max - min << endl;
	max = A[count];
	min = A[count2];

	for (int i = 0;i < N;i++) {
		if (A[i] > 0 && (i != count && i != count2)) {
			//save[i][0] = min;
			cout << min << " " << A[i] << endl;
			min -= A[i];
		}
		if (A[i] <= 0 && (i != count && i != count2)) {
			/*save[i][0] = max;*/
			cout << max << " " << A[i] << endl;
			max -= A[i];
		}
		/*save[i][1] = A[i];*/
	}
	/*for (int i = 0;i < N;i++) {
		if (A[i] > 0 && (i != count && i != count2)) {
			cout << min << " " << A[i] << endl;
		}
		if (A[i] <= 0 && (i != count && i != count2)) {
			cout << max << " " << A[i] << endl;
		}
	}*/
	cout << max <<" "<< min << endl;
	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<map>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
map<ll,ll>mp;
ll dp(ll n){
    if(n==1)return 1;
    if(mp[n]!=0)return mp[n];
     return mp[n] = 1+ 2 * dp(n/2);
}
int main(){

    ll n;
    L(n);
    cout<<dp(n)<<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,A,B,C,D=map(int,input().split())
S=input().strip()
S+="#####"

A-=1
B-=1
C-=1
D-=1

if C<D:
    while B!=D or  A!=C:
        #print(A,B)
        if B!=D and S[B+1]==".":
            B+=1
        elif B!=D and S[B+2]==".":
            B+=2
        elif B!=D and S[B+1]=="#" and S[B+2]=="#":
            print("No")
            sys.exit()


        if A!=C and S[A+1]==".":
            A+=1
        elif A!=C and S[A+2]==".":
            A+=2
        elif A!=C and S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()

    print("Yes")

else:
    while A<B:
            
        if S[A+1]=="." and A+1!=B:
            A+=1
        elif S[A+2]=="." and A+2!=B:
            A+=2
        elif S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()

        if A+1==B or (A+2==B and S[A+1]=="#"):
            break

    while True:
        if A+1==B and S[B+1]==".":
            A+=2
            break

        if S[B+1]==".":
            B+=1
        elif S[B+2]==".":
            B+=2
        else:
            print("No")
            sys.exit()

        if S[A+1]==".":
            A+=1
        elif S[A+2]==".":
            A+=2

        if B>D:
            print("No")
            sys.exit()

    
    while B!=D or  A!=C:
        
        if A!=C and S[A+1]==".":
            A+=1
        elif A!=C and S[A+2]==".":
            A+=2
        elif A!=C and S[A+1]=="#" and S[A+2]=="#":
            print("No")
            sys.exit()
            
        if B!=D and S[B+1]==".":
            B+=1
        elif B!=D and S[B+2]==".":
            B+=2
        elif B!=D and S[B+1]=="#" and S[B+2]=="#":
            print("No")
            sys.exit()




    print("Yes")
    

        
            
        


Measured memory_bytes: 41480
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
ll dp[2001],mod=(ll)1e9+7;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int s;
	cin>>s;
	dp[1]=dp[2]=0;
	dp[3]=1;
	for(int i=4;i<=s;i++){
		dp[i]=1;
		for(int j=i-3;j>0;j--)
			dp[i]+=dp[j],dp[i]%=mod;
		dp[i]%=mod;
	}
	cout<<dp[s];
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
const int max_n = 30;
using pq = pair<long, long>;

int main()
{
    int n, m, c;
    int b[max_n], a[max_n][max_n];

    cin >> n >> m >> c;

    for (int i = 0; i < m; ++i)
    {

       cin >> b[i];
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a[i][j];
        }
    }

    long long res = 0;
    for (int i = 0; i < n; ++i)
    {
        int total = c;
        for (int j = 0; j < m; ++j)
        {
            total += a[i][j] * b[j];
        }
        if(total > 0)
        {
            ++res;
        }
    }
    cout << res << endl;

}

Measured memory_bytes: 256
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
bool can[1000005];
int n,a,has[1000005],ans;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a;
		++has[a];
		can[a]=(has[a]==1);
	}
	for(int i=1;i<=1000000;++i)
	{
		if(can[i])
		{
			++ans;
		}
		if(has[i])
		{
			for(int j=i<<1;j<=1000000;j+=i)
			{
				can[j]=false;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 12436
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a[3][3];
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n; cin >> n;
    rep(i, n){
        int b; cin >> b;
        rep(j, 3)rep(k, 3){
            if(a[j][k] == b) a[j][k] = -1;
        }
    }
    rep(i, 3){
        bool flag = true;
        rep(j, 3){ 
            if(a[i][j] != -1) flag = false;
            if(j == 2){
                if(flag){
                    Yes;; 
                    return 0;
                }
            }
        }
    }
    rep(i, 3){
        bool flag = true;
        rep(j, 3){ 
            if(a[j][i] != -1) flag = false;
            if(j == 2){
                if(flag){
                    Yes; 
                    return 0;
                }
            }
        }
    }
    if(a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1){
        Yes;
        return 0;
    }
    if(a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1){
        Yes;
        return 0;
    } 
    No;

    return 0;
}

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

int main(){
    int dp[4010];
    int n;

    fill(dp, dp+4010, 0);
    for(int i=0; i < 1001; i++)for(int j=0; j < 1001; j++) dp[i+j]++;

    while(cin >> n){
        int ans = 0;
        for(int i=0; i <= n; i++){
            ans += dp[i]*dp[n-i];
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL);
    int i,j,k,n;
    cin>>n;
    vector<int>a(n);
    long long sum=0;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=1;i<n;i++){
        if(a[i]<a[i-1]){
            sum+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<sum<<endl;
    return 0;
}

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

using namespace std;

struct d
{
    int x;
    int y;
    int s;
};

bool p(d&a,d&b)
{
    return a.s > b.s;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,h;
    cin >> n;
    d dp[n];
    for(int i=0;i<n;i++)
        cin >> dp[i].x >> dp[i].y >> dp[i].s;
    sort(dp,dp+n,p);
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            h=dp[0].s+abs(dp[0].x-i)+abs(dp[0].y-j);
            for(int k=1;k<n;k++)
            {
                if(max(h-abs(dp[k].x-i)-abs(dp[k].y-j),0)!=dp[k].s)
                    break;
                else if(k==n-1)
                {
                    cout << i << " " << j << " " << h;
                    return 0;
                }
            }
        }
    }
	return 0;
}


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

int main() {
    ll k;
    cin >> k;
    if (k == 1 || k == 7) {
        cout << 1 << endl;
        return 0;
    }
    ll num = 7;
    for (ll a = 1; a <= k; a++) {
        if (num == 0) {
            cout << a << endl;
            return 0;
        }
        num *= 10;
        num += 7;
        num %= k;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 100006

char s[MAX], t[MAX];
int sx[2][MAX], sy[2][MAX];
int memo[3][3], n;

signed main(){
	memo[0][0] = memo[1][1] = memo[2][2] = 1;
	memo[1][0] = memo[0][2] = memo[2][1] = 2;
	memo[2][0] = memo[0][1] = memo[1][2] = 3;
	scanf("%s%s", s, t);
	int sn = strlen(s), tn = strlen(t);
	
	for(int i = 1;i <= sn;i++){
		if(s[i-1] == 'A')sx[0][i]++;
		else sx[1][i]++;
		sx[0][i] += sx[0][i-1];
		sx[1][i] += sx[1][i-1];
	}
	for(int i = 0;i <= tn;i++){
		if(t[i-1] == 'A')sy[0][i]++;
		else sy[1][i]++;
		sy[0][i] += sy[0][i-1];
		sy[1][i] += sy[1][i-1];
	}
	
	scanf("%lld", &n);
	for(int i = 0;i < n;i++){
		int x[2], y[2];
		for(int j = 0;j < 2;j++)scanf("%lld", &x[j]);
		for(int j = 0;j < 2;j++)scanf("%lld", &y[j]);
		int a1 = (sx[0][x[1]]-sx[0][x[0]-1])%3;
		int b1 = (sx[1][x[1]]-sx[1][x[0]-1])%3;
		int a2 = (sy[0][y[1]]-sy[0][y[0]-1])%3;
		int b2 = (sy[1][y[1]]-sy[1][y[0]-1])%3;
		if(memo[a1][b1] == memo[a2][b2])printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i=s.size()-1; i>=0; i--){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3144
a, b, h, m = gets.chomp.split(" ").map {|c| c.to_i}
h = h.to_f
m = m.to_f

theta = (30.0*h + (m/2.0) - 6.0*m).abs

if theta > 180.0
  theta = 360.0 - theta
end

puts Math.sqrt(a**2 + b**2 \
    - 2.0*a*b*Math.cos(Math::PI * theta / 180.0))

Measured memory_bytes: 14712
Ss = '>' + input() + '<'

N = len(Ss) - 1

A1s = [0] * N
for i in range(N):
    if Ss[i:i+2] == '><':
        A1s[i] = 0
    elif Ss[i:i+2] != '>>':
        A1s[i] = A1s[i-1] + 1

A2s = [0] * N
for i in reversed(range(N)):
    if Ss[i:i+2] == '><':
        A2s[i] = 0
    elif Ss[i:i+2] != '<<':
        A2s[i] = A2s[i+1] + 1

As = [A1 if A1 >= A2 else A2 for A1, A2 in zip(A1s, A2s)]
print(sum(As))


Measured memory_bytes: 87680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll N,M;
  cin >> N >> M;
  vector<tuple<ll,ll,ll>> t(M);
  for(ll i = 0;i<M;i++){
    cin >> get<0>(t[i]);
    cin >> get<1>(t[i]);
    get<2>(t[i]) = i;
  }
  
  sort(t.begin(),t.end());

  vector<pair<ll,string>> p(M);
  int c = 1;
  string ID ;
  for(ll i = 0;i<M;i++){
    string a = to_string(get<0>(t[i]));
    string b = to_string(c);
   while(a.size() < 6){
     a = '0' + a;
   }
   while(b.size() < 6){
     b = '0' + b;
   }
     ID = a+b;
     p[i].first =get<2>(t[i]) ;
     p[i].second = ID;                                
    if(get<0>(t[i]) == get<0>(t[i+1])){
     c++;
    }
    else{
      c =1;
    }
  }  
  
   sort(p.begin(),p.end());
      for(ll i = 0;i<M;i++){
        cout << p[i].second << endl;
      }
    
}


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

using namespace std;

struct UnionFind
{
  vector<int> data;
  UnionFind(int size)
  {
    data.resize(size, -1);
  }
  int find(int now)
  {
    return (data[now] < 0 ? now : data[now] = find(data[now]));
  }
  int size(int now)
  {
    return -data[find(now)];
  }
  bool same(int x, int y)
  {
    return (find(x) == find(y));
  }
  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
      return;
    data[x] += data[y];
    data[y] = x;
    return;
  }
};

int main()
{
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> edge(M);
  for (int i = 0; i < M; i++)
  {
    cin >> edge[i].first >> edge[i].second;
    edge[i].first--;
    edge[i].second--;
  }
  vector<long long> ans(M);
  UnionFind uf(N);
  for (int i = M; 0 < i; i--)
    if (i == M)
      ans[i - 1] = (long long)N * (N - 1) / 2;
    else
    {
      if (uf.same(edge[i].first, edge[i].second))
        ans[i - 1] = ans[i];
      else
      {
        ans[i - 1] = ans[i] - (long long)uf.size(edge[i].first) * uf.size(edge[i].second);
        uf.unite(edge[i].first, edge[i].second);
      }
    }
  for (long long t : ans)
    cout << t << endl;

  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);
	ll a, b, c, n, m, x, y;
	string s;
	cin >> n;
	map<ll, ll> p, q;
	vll v(n);
	rep(i, n) {
		cin >> v[i];
		if (i % 2 == 1) p[v[i]]++;
		else q[v[i]]++;
	}
	ll max1 = 0, max2 = 0, v1, v2;
	ll m1 = 0, m2 = 0;
	for (auto m : p) {
		if (max1 < m.second) {
			m1 = max1;
			max1 = m.second;
			v1 = m.first;
		}
		else if(m1 < m.second) {
			m1 = m.second;
		}
	}
	for (auto m : q) {
		if (max2 < m.second) {
			m2 = max2;
			max2 = m.second;
			v2 = m.first;
		}
		else if(m2 < m.second) {
			m2 = m.second;
		}
	}
	//cout << max1 << " " << max2 << " " << v1 << " " << v2 << endl;
	ll ret = 0;
	if (v1 == v2) {
		ret = max(max1 + m2, max2 + m1);
	}
	else ret = max1 + max2;
	cout << n - ret << endl;
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

vector<vector<int>> kyo(100005, vector<int>(0));
vector<int> col(100005, -1);

void dfs(int x) {
  for (int i = 0; i < kyo[x].size(); i++) {
    int aite = kyo[x][i];
    int K;
    if (aite > 0) K = aite;
    else K = 0 - aite;
    
    if (col[K] == -1) {
      if (aite > 0) {
        col[K] = col[x];
        dfs(K);
      }
      else {
        col[K] = 1 - col[x];
        dfs(K);
      }
    }
  }
}
  
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N-1; i++) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    if (c % 2 == 0) {
      kyo[a].push_back(b);
      kyo[b].push_back(a);
    }
    else {
      kyo[a].push_back(0-b);
      kyo[b].push_back(0-a);
    }
  }
  col[0] = 0;
  dfs(0);
  for (int i = 0; i < N; i++) {
    cout << col[i] <<endl;
  }
} 


Measured memory_bytes: 8448
#include<iostream>
#include<map>

using namespace std;

int N, M;
map<int, int> d;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		d[a]++;
	}
	cin >> M;
	bool f = true;
	for (int i = 0; i < M; i++) {
		int a;
		cin >> a;
		if (d[a] != 0)d[a]--;
		else { f = false; }
	}
	if (f)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

vector<pii> G[51];
int par[51],dep[51],ord[51];

void dfs(int s)
{
	for(pii p:G[s]){
		int e = p.va;
		if(e==par[s]) continue;
		par[e] = s;
		ord[e] = p.vb;
		dep[e] = dep[s]+1;
		dfs(e);
	}
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    int N,M;
    cin >> N;

    ll K[N];
    K[0] = 1;
    for(int i=1; i<N; i++){
    	K[i] = K[i-1]*2;
    }

    int u,v;
    for(int i=1; i<N; i++){
    	cin >> u >> v;
    	G[u].emplace_back(v,i);
    	G[v].emplace_back(u,i);
    }

    dfs(1);

    cin >> M;
    bitset<51> B[1<<M];

    for(int i=0; i<M; i++){
    	cin >> u >> v;

    	if(dep[v]>dep[u]) swap(u,v);


    	while(dep[u]>dep[v]){
    		B[1<<i][ord[u]] = 1;
    		u = par[u];
    	}
    	while(u!=v){
    		B[1<<i][ord[u]] = 1;
    		u = par[u];
    		B[1<<i][ord[v]] = 1;
    		v = par[v];    		
    	}
    }

    ll ans = K[N-1];

    for(int i=1; i<(1<<M); i++){

    	B[i] = B[i-(i&-i)]|B[i&-i];

    	int cnt = N-1;
    	for(int j=1; j<N; j++){
    		cnt -= B[i][j];
    	}

    	if(__builtin_popcount(i)%2) ans -= K[cnt];
    	else ans += K[cnt];
    }

    cout << ans;
}

Measured memory_bytes: 8448
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define DEBUG
//#undef DEBUG

int N;
string S[50];

int bin[26];

void solve()
{
    fill(begin(bin), end(bin), 99999);

    REP(i, N) {
        int cnt[26] = {};
        for(char c : S[i]) {
            ++cnt[c-'a'];
        }
        REP(j, 26) {
            bin[j] = min(bin[j], cnt[j]);
        }
    }

    string ans;
    REP(i, 26) {
        ans.append(bin[i], i+'a');
    }

    cout << ans << "\n";
}

int main()
{
    cin >> N;
    REP(i, N) {
        cin >> S[i];
        //cout << S[i] << "\n";
    }

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int main(){
	int a,b,c;
	while(~scanf("%d%d",&a,&b)&&a<10&&b<10&&a>=0&&b>=0)
	{
	
		if(a>=b)
		printf("10\n");
		else
		printf("0\n");//
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,mx,ans=0;
    cin >> a >> b >> c;
    mx = max(a,max(b,c));
    if(mx == a){
        cout << a*10+b+c << endl;
        return 0;
    }else if(mx == b){
        cout << b*10+a+c << endl;
        return 0;
    }else if(mx == c){
        cout << c*10+b+a << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

const int64_t MOD=1000000007;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int64_t dp[2][100002]={};
  std::string s;
  cin>>s;
  dp[1][0]=2;
  dp[0][0]=1;
  for(int i=1;i<s.size();i++){
    if(s[i]=='1'){
      dp[1][i]=dp[1][i-1]*2;
      dp[0][i]=dp[1][i-1]+dp[0][i-1]*3;
    }else{
      dp[1][i]=dp[1][i-1];
      dp[0][i]=dp[0][i-1]*3;
    }
    dp[1][i]%=MOD;
    dp[0][i]%=MOD;
  }

  cout<<(dp[0][s.size()-1]+dp[1][s.size()-1])%MOD<<endl;





  return 0;
}


Measured memory_bytes: 2424
#include<iostream>
#include<stdio.h>
using namespace std;

int a, b, c;

int main() {
	scanf("%d/%d/%d", &a, &b, &c);
	cout << (((a < 2019) || (a == 2019 && b < 4) || (a == 2019 && b == 4 && c <= 30)) ? "Heisei" : "TBD");
	return 0;
}

Measured memory_bytes: 256
h, w = map(int , input().split())
s = [list(input()) for _ in range(h)]

# 上下左右斜め方向への移動に使う
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
           continue

        num = 0
        for k in range(8):
            ni = i + dx[k]
            nj = j + dy[k]
            # 上下はみ出してたら何もせん
            if ni < 0 or h <= ni: continue
            # 左右はみ出してたら何もせん
            if nj < 0 or w <= nj: continue
            # はみだしてなかったらそこ見て#やったら1増やす
            if s[ni][nj] == '#': num += 1
        
        s[i][j] = str(num)
    
for i in range(h):
    print(''.join(s[i]))


Measured memory_bytes: 3188
N = int(input())
rec = [0] * (N+1)
for i in range(1,N+1):
    rec[i] = rec[i-1] + 1
    for b in [6,9]:
        u = b
        while u <= i:
            rec[i] = min(rec[i], rec[i-u]+1)
            u *= b
print(rec[N])

Measured memory_bytes: 42220
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1))%mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	return (n + 9) / 10 * 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion
signed main() {
	int ans = 1000,x;
	string s;
	cin >> s;
	rep(i, s.size() - 2) {
		x = 100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0');
		ans = min(ans, abs(x - 753));
	}
	cout << ans;
}

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

const ll MOD = 1e9+7;
const int INF = (int)1e9+7;

// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v = get<0>(item);
// long w = get<1>(item);
// long v, w;
//   for( int i = 0; i < N; i++ ){
//     cin >> v >> w;
//     items.push_back( make_tuple(v, w) ); // item : (value, weight)
//   }

deque<int> g[100001];
int dp[100001];

int rec(int i){
    if(dp[i] != -1) return dp[i];
    int res = 0;
    for(auto j : g[i]){
        res = max(res, rec(j) + 1);
    }
    return dp[i] = res;
}

int main(){
    int N, M;
    cin >> N >> M;
    int x, y;
    rep(i, M){
        cin >> x >> y;
        g[x].push_back(y);
    }

    rep(i, N+1) dp[i] = -1;

    // for(int i=1; i<N+1; i++){
    //     cout << i << " : ";
    //     for(auto j : g[i]){
    //         cout << j << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    for(int i=1; i<N+1; i++){
        ans = max(ans, rec(i));
    }
    cout << ans << endl;

}


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

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

int main() {
  std::vector<int> data(5);
      int num{1};
  for (auto &i : data) {
    cin >> i;
  }
  for (auto i : data) {
    if (i == 0) {
      cout << num;
      break;
    }
    num++;
  }
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int buff = 0;
    vector<int>num;
    int n = 0;
    int start = 0;
    int second = 0;
    int ans = 0;
    cin >> n;
    n *= 2;
    for (int i = 0; i < n; ++i) {
        cin >> buff;
        num.push_back(buff);
    }
    sort(num.begin(),num.end(),greater<int>());
    while (n > 0){
        second = num[n -1];
        ans += second;
        n -= 2;
    }

    cout << ans;
    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 per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

ll dp[500][500];
ll sum[500][500];

int main() {
  ll n;
  cin >> n;
  vll a(n);
  rep(i,n) cin >> a[i];
  for(ll l = 0; l<n; l++) {
    sum[l][l+1] = a[l];
    for(ll r = l+2; r<=n; r++) {
      sum[l][r] = sum[l][r-1] + a[r-1];
    }
  }
  for(ll width = 2; width<=n; width++) {
    for(ll l = 0; l+width<=n; l++) {
      ll r = l + width;
      dp[l][r] = 1000000000000000;
      for(ll m = l+1; m<=r-1; m++) {
        dp[l][r] = min(dp[l][r], dp[l][m] + dp[m][r] + sum[l][r]);
      }
    }
  }
  cout << dp[0][n] << endl;
  return 0;
}

Measured memory_bytes: 3328
X,N=map(int,input().split())
P=list(map(int,input().split()))
S=[0]*(102);a=1000;b=1000;c=10000
for i in range(N):
  S[P[i]]=1
#print(S)
if N==0:
  print(X)
else:
  i=X
  while i>=0:
    if S[i]==0:
      a=i
      break
    i=i-1
  i=X
  while i<=101:
    if S[i]==0:
      b=i
      break
    i=i+1
    #print(a,b)
  if abs(a-X)>abs(b-X):
    c=b
  else:
    c=a
  print(c)

Measured memory_bytes: 9244
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

#define SIZE (1E5)+1

int main(void)
{
	vector<bool> prime(SIZE, true);
	vector<int> cnt(SIZE, 0);

	prime[0] = false;
	prime[1] = false;
	for(int i=2; i<SIZE; i++){
		cnt[i] = cnt[i-1];

		if(prime[i] == false)
			continue;

		for(int j=i+i; j<SIZE; j+=i)
			prime[j] = false;

		if(prime[(i+1)/2] == true)
			cnt[i]++;
	}

	int Q;
	cin >> Q;

	for(int i=0; i<Q; i++){
		int l, r;
		cin >> l >> r;

		cout << cnt[r] - cnt[l-1] << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
N = int(input())

q = 0
res = []
for i in range(20):
    print(q)
    s = input()
    if s[0] == 'V':
        exit()
    res.append((q,s[0]))
    res.sort()
    if len(res) == 1:
        q = N//2
        continue
    for (i1,g1),(i2,g2) in zip(res,res[1:]):
        if i2-i1 == 1: continue
        if (i2-i1)%2 == int(g1==g2):
            q = (i2+i1)//2
            break
    else:
        q = (res[-1][0] + N + 1)//2


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int a,ok=0;
	cin>>a;
	for(int i=1;i<10;i++)
	{
		if((a%i)==0 && ((a/i)>=1 && (a/i)<=9))
		{
			ok=1;
			break;
		}
	}
	if(ok)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int temp;
	temp=b;
	b=a;
	a=temp;
	temp=c;
	c=a;
	a=temp;
	cout<<a<<" "<<b<<" "<<c<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

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

  int N,M; cin >> N >> M;

  vector<vector<int>> DP(M+1, vector<int>(pow(2, N), 1e9));
  DP[0][0] = 0;

  rep(i, M) {
    int a,b; cin >> a >> b;
    int c = 0;
    rep(_, b) {
      int cc; cin >> cc; --cc;
      c += 1<<cc;
    }

    for(int bit = 0; bit < (1<<N); ++bit) {
      chmin(DP[i + 1][bit], DP[i][bit]);
      chmin(DP[i + 1][bit | c], DP[i][bit] + a);
    }
  }

  int ans = DP[M][pow(2, N) - 1];
  if(ans == 1e9) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}


Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  sort(a.begin(),a.end(), greater<int>());
  
  int ct=0;
  double x = 1.0/(4*m);
  //cout<<x*sum<<endl;
  for(int i=0;i<m;i++){
    if(a[i] >= x*sum) ct++;
  }
  
  if(ct==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n, k;
    int ans = 0;
    int height;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> height;
        if (height >= k)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

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

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  string S, T;
  cin >> S >> T;
  int n = S.size();
  S += S;
  for (int i = 0; i < n; i++) {
    if (S.substr(i, n) == T) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


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

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

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

    sort(v, v + n);

    double res = v[0];
    for (int i = 0; i < n; ++i){
        res += v[i];
        res /= 2;
    }
    printf("%.5f\n", res);
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

typedef long long int ll;
#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 FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


using namespace std;
int main() {
   ll N;
   cin >> N;
   string T="zabcdefghijklmnopqrstuvwxy";
   string V="abcdefghijklmnopqrstuvwxyz";
   string U="";
   ll k;
   ll sum =0,in=0;
   
   
   // while(N>=1){
   // cout << N % 27<< endl;
   // N=N/27;
   //    // U+=T[N%26];   
   //    // N=N/26;
   // }
   // cout << endl;

   for(ll i=0;i<100;i++){
      sum+=pow(26,i+1);
      if(N<=sum){
         in=sum-pow(26,i+1)+1;
         k=i+1;
         break;
      }
   }
   N=N-in;
   REP(i,k){
   U+=V[N%26];
   N=N/26;
   } 



   // N=N-(N%26==0?26:N%26);
   // while(N>26){
   //    U+=T[(N/26)%26];
   //    N=N/26;
   // }
   reverse(U.begin(), U.end());
   cout << U << endl;
}

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

int solveGCD(int x,int y){
  if(x<y)swap(x,y); // x>=yの形に統一
  if(x%y==0)return y;
  else solveGCD(y,x%y);
}

int main(){
  int x,y;
  cin >> x >> y;

  cout << solveGCD(x,y) << endl;
}


Measured memory_bytes: 3116
#include <cstdio>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int N;
string s[200005];
int flag[200005], pf;
int most;
bool cmp(string a,string b)
{
    return a < b;
}
int main()
{
	cin>>N;
	for(int i=1;i<=N;i++)
	    cin>>s[i];
	sort(s+1, s+N+1, cmp);
	for(int i=1;i<=N;i++)
	{
		int cnt = 1, j = i+1;
		while(s[i]==s[j])
		{
			cnt++;
			j++;
		}
		if(cnt>most)
		{
			for(int k=0;k<pf;k++)
			    flag[k] = 0;
			pf = 0;
			flag[pf++] = i;
			most = cnt;
		}
		else if(cnt==most)
		{
			flag[pf++] = i;
		}
        i = j-1;	
	}
	for(int i=0;i<pf;i++)
	    printf("%s\n", s[flag[i]].c_str());
	return 0;
}

Measured memory_bytes: 15104
#include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    using namespace __gnu_pbds;
    using namespace std;
     
    #define ff                  first
    #define ss                  second
    #define int                 long long
    #define pb                  push_back
    #define mp                  make_pair
    #define pii                 pair<int,int>
    #define vi                  vector<int>
    #define vvi                 vector< vi > 
    #define vpii                vector< pair<int,int> > 
    #define mii                 map<int,int>
    #define pqb                 priority_queue<int>
    #define pqs                 priority_queue<int,vi,greater<int> >
    #define loop(i,a,b)         for(int i=a;i<b;i++)
    #define LOOP(i,a,b)         for(int i=a;i<=b;i++)
    #define looprev(i,a,b)      for(int i=a;i>=b;i--)
    #define rloop(it,c)         for(auto& it : c)
    #define sz(a)               a.size()
    #define all(c)              c.begin(),c.end()
    #define tr(i,c)             for(auto i = c.begin(); i != c.end(); i++)
    #define present(c,x)        (c.find(x) != c.end())
    #define cpresent(c,x)       (find(all(c),x) != c.end())
    #define spresent(s,x)       (s.find(x) != s.npos)           //use 'x' while passing to parameters  ||  we can also use cpresent(c,x)
    #define setbits(x)          __builtin_popcountll(x)
    #define zrobits(x)          __builtin_ctzll(x)
    #define SETINT(a,x)         memset(a, x, sizeof(a))
    #define SETCHAR(str,x)      memset(str, x, sizeof(str)      //use 'x' while passing to parameters  
    #define mod                 1000000007
    #define inf                 1e18
    #define ps(x,y)             fixed<<setprecision(y)<<x
    #define w(x)                int x; cin>>x; while(x--)
    mt19937                     rng(chrono::steady_clock::now().time_since_epoch().count());
     
    typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
     
     
    int raise(int a,int n,int m)
    {
      
      if(n == 0)return 1;
      if(n == 1)return a;
      int x = 1;
        x *= raise(a,n/2,m);
        x %= m;
        x *= x;
        x %= m;
        if(n%2)x*= a;
        x %= m;
        return x;
    }
     
    int floor1(int n,int k)
    {
        if(n%k == 0 || n >= 0)return n/k;
        return (n/k)-1;
    }
     
    int ceil1(int n,int k)
    {
        return floor1(n+k-1,k);
    }
     
     
    void Gur27()
    {
        ios::sync_with_stdio(0); cin.tie(0); 
     
    }
     
    int32_t main()
    {
        Gur27();
        long double a;
        long double b;
        cin>>a>> b;
        long double prod=(a*b);
        int t=floor(prod);
        cout<<t;
        
            
        
        return 0;
    }

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


bool mark[100005];

void sieve()
{
    int sz = 100000;
    mark[1] = true;
    mark[0] = true;

    for (int i=4; i<=sz; i+=2)    mark[i] = true;

    for (int p=3; p<=sz; p+=2)
    {
        if (mark[p] == false)
        {
            for (int i = 2*p; i<=sz; i += p)
            {
                mark[i] = true;
            }
        }
    }
}

int cnt[100005];

int main(){

    memset(mark, 0, sizeof(mark));

    sieve();

    memset(cnt, 0, sizeof(cnt));

    for(int i = 1; i<=100005; i++){

        int x = i;
        int y = (i+1)/2;

        if(mark[x] == false && mark[y] == false) cnt[i] = 1;
        else cnt[i] = 0;
        cnt[i] += cnt[i-1];



    }

    int q;

    scanf("%d", &q);

    while(q--){

        int x, y;

        scanf("%d %d", &x, &y);

        printf("%d\n", cnt[y] - cnt[x-1]);


    }

    return 0;


    return 0;
}


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

class D_List
{
    private:
        int num;
        D_List* head;                   //先頭のアドレスを指すポインタ
        D_List* old;                    //常に最古のノードを指す
        D_List* prev;                   //前ノード
        D_List* next;                   //次ノード
    public:
        D_List();                       //コンストラクタ
        void Insert( int x );           //値を挿入する関数
        void Delete_X( int x );         //任意の値xを持つノードを削除する関数
        void Delete_F();                //先頭ノードを削除する関数
        void Delete_L();                //後尾ノードを削除する関数
        void Print_List();
};

D_List::D_List()
{
    head = old = prev = next = NULL;
}

void D_List::Insert( int x )
{
    D_List* n = new D_List;

    if( head == NULL )
    {
        head = n;
        old = n;
        //head -> next = NULL;
        //head -> prev = NULL;
    }
    else
    {
        head -> prev = n;
        n -> next = head;
        head = n;
    }
    head -> num = x;
}

void D_List::Delete_X( int x )
{
    D_List* n = head;

    while( n != NULL )
    {
        if( n -> num == x )
        {
            if( n -> prev == NULL )
                Delete_F();
            else if( n -> next == NULL )
                Delete_L();
            else
            {
                n -> prev -> next = n -> next;
                n -> next -> prev = n -> prev;
                delete n;
            }
            break;
        }
        n = n -> next;
    }
}

void D_List::Delete_L()
{
    D_List* n = old;

    if( n -> prev != NULL )
    {
        old = old -> prev;
        old -> next = NULL;
    }
    else
        head = old = next = prev = NULL;
    

    delete n;
}

void D_List::Delete_F()
{
    D_List* n = head;

    if( n -> next != NULL )
    {
        head = head -> next;
        head -> prev = NULL;
    }
    else
        head = old = next = prev = NULL;

    delete n;
}

void D_List::Print_List()
{
    D_List* n = head;
    while( n -> next != NULL )
    {
        cout << n -> num << " ";
        n = n -> next;
    }
    cout << n -> num << endl;
}

int main()
{
    int n, key;
    string command;

    D_List d;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> command;

        if( command == "insert")
        {
            cin >> key;
            d.Insert( key );
        }
        else if( command == "delete")
        {
            cin >> key;
            d.Delete_X( key );
        }
        else if( command == "deleteFirst")
            d.Delete_F();
        else if( command == "deleteLast")
            d.Delete_L();
        else;
    }

    d.Print_List();

    return 0;
}


Measured memory_bytes: 49908
#include <stdio.h>
int main()
{
    int n,T;
    scanf("%d %d",&n,&T);
    int c[n],t[n],temp[n],cnt = 0;
    for(int i = 0;i<n;i++)
    {
        scanf("%d %d",&c[i],&t[i]);
        if(T>=t[i])
        {
            temp[cnt] = c[i];
            cnt++;
        }
    }

 
        for(int j = cnt-1;j>0;j--)
        {
            if(temp[j]<temp[j-1])
            {
                int kari = temp[j];
                temp[j] = temp[j-1];
                temp[j-1] = kari;
            }
        }
    
    if(cnt == 0)
    {
        printf("TLE\n");
        return 0;
    }
    
    printf("%d\n",temp[0]);

    return 0;




}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#define llt long long int

using namespace std;
int main()
{
    string s;
    llt count = 0;

    cin >> s;
    if (s[0] == '1')
        count++;
    if (s[1] == '1')
        count++;
    if (s[2] == '1')
        count++;

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256