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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000003
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >

ll mulmod(ll, ll);
ll fastpower(ll, ll);
void getprime(vector<bool>&);
void getfact(vector<ll>&, vector<ll>&);
ll ncr(ll, ll, vector<ll>&, vector<ll>&);

void solve()
{
    ll n, m, k;
    cin>>n;
    vector<bool>prime(MAX + 1, true);
    getprime(prime);
    for(ll i=n;;i++)
    {
        //cout<<i;
        if(prime[i])
        {    
            cout<<i;
            break;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();        
    }
    return 0;
}

ll mulmod(ll a, ll b)
{
    ll res = 0; 
    a = a % MOD;
    while(b > 0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
 
        a = (a * 2) % MOD; 
        b /= 2;
    } 
    return res % MOD; 
}

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a = (a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
    fact[0] = 1;
    ifact[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
    {
        fact[i] = (fact[i-1] * i)%MOD;
        ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
    }
}

ll ncr(ll n, ll r, vector<ll>&fact, vector<ll>&ifact)
{
    ll res;
    res = (((fact[n] * ifact[r]) % MOD) * ifact[n-r]) % MOD;
    return res;
}


Measured memory_bytes: 3780
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
  }
  int top() {
    return s[0];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  string s;cin >> s;
  for(int i=0;i<s.size();i++) d.roll(s[i]);
  cout << d.top() << endl;
  return 0;
}


Measured memory_bytes: 3236
N = int(input())
A = list(map(int, input().split()))
cnt_odd = 0
cnt_4 = 0
for a in A:
    if a % 2 != 0:
        cnt_odd += 1
    elif a % 4 == 0:
        cnt_4 += 1
if cnt_odd + cnt_4 == N and cnt_odd -1 == cnt_4:
    print('Yes')
else:
    print('Yes' if cnt_4 >= cnt_odd else 'No')


Measured memory_bytes: 20056
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    double b,c,d;
    int a;
    b=3.14159265358979323846;
    cin>>a;
    c=2*a*b;
    cout<<c<<endl;

    return 0;

}



Measured memory_bytes: 3788
module Main where

import Control.Applicative
import Control.Monad
import Data.Function

data Stat = Stat Int Int

updateStat :: Stat -> Int -> Stat
updateStat (Stat smin sdiff) x =
    Stat newMin newDiff
    where
        newMin  = min x smin
        newDiff = if newMin == smin then max (x - newMin) sdiff else sdiff

initStat :: Int -> Int -> Stat
initStat x y =
    Stat smin sdiff
    where
        smin  = min x y
        sdiff = y - x

diffStat (Stat _ sdiff) = sdiff

max_diff (x:y:xs) =
    foldl updateStat (initStat x y) xs

main = do
    times <- (read <$> getLine) :: IO Int

    xs <- ($ times) . fix $ \loop n -> do
            if n /= 0 then do
                x  <- (read <$> getLine) :: IO Int
                xs <- loop (n-1)
                pure $ x : xs
            else pure []

    print $ diffStat $ max_diff xs



Measured memory_bytes: 171132
from collections import defaultdict
n = int(input())
d = list(map(int,input().split()))
dic = defaultdict(int)
ans = 1
mod = 998244353
for i in range(n):
    dic[d[i]] += 1
if dic[0] == 1 and d[0] == 0:
    for i in range(n):
        if not (dic[i] == 0 and dic[i+1] == 0):
            ans *= dic[i]**dic[i+1] % mod
            ans %= mod
    print(ans)
else:
    print(0)


Measured memory_bytes: 20092
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define int long long
#define ll long long
#define ld long double
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(__typeof(b) i = a; i < b; i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i > b; i--)

typedef vector<int> vi;		typedef vector<
ll> vl;
typedef pair<int, int> ii; 	typedef vector<ii> vii;

// code start here //

const int N = 100005;
vi tree[N];
queue<int> q; 
ii range[N];
bool check;

int globalmin = 1e18, globalmax = -1e18;
void bfs() {
	while(!q.empty() && check) {
		int t = q.front(); q.pop();
		rep(i, 0, (int)tree[t].size()) {
			int u = tree[t][i];
			if(range[u].second < range[t].first - 1 || range[u].first > range[t].second + 1) {
				check = 0;
				break;
			}
			if(range[u].second > range[t].second + 1 && range[u].first < range[t].first - 1) {
				range[u].second = range[t].second + 1;
				range[u].first = range[t].first - 1;
				q.push(u);
				continue;
			}
			if(range[u].second <= range[t].second + 1 && range[u].first >= range[t].first - 1) {
				continue;
			}
			range[u].first = max(range[t].first - 1, range[u].first);
			range[u].second = min(range[t].second + 1, range[u].second);
			q.push(u);
		}
	}
}

signed main() {
	fastio;
	int n, m, a, b; cin >> n;
	rep(i, 0, n - 1) {
		cin >> a >> b;
		a--; b--;
		tree[a].pb(b); tree[b].pb(a);
		range[i].first = -1e18; range[i].second = 1e18;
	}
	range[n - 1].first = -1e18; range[n - 1].second = 1e18;
	cin >> m;
	while(m--) {
		cin >> a >> b;
		globalmin = min(globalmin, b);
		globalmax = max(globalmax, b);
		a--;
		range[a] = mp(b, b);
		q.push(a);
	}
	if(globalmax - globalmin >= n + 1)
	{
		return cout << "No\n", 0;
	}
	check = 1; bfs();
	if(!check) return cout << "No\n", 0;
	for(int i = 1; i <= n; i++)
	{
		for(auto x : tree[i])
		{
			if(abs(range[i].first - range[x].first) != 1)
			{
				cout << "No\n";
				return 0;
			}
		}
	}
	cout << "Yes\n";
	rep(i, 0, n) {
		cout << range[i].first << "\n";
	}
}


Measured memory_bytes: 11604
from decimal import *

n=Decimal(input())
chars=['z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y']
ans=''
while n>0:
    r=n%26
    ans = chars[int(r)]+ans
    if r==0:
        n = n//26-1
    else:
        n=n//26

print(ans)


Measured memory_bytes: 71304
package main

import (
	"fmt"
  	"bufio"
  	"os"
  	"strconv"
  	"strings"
)

func main(){
  var sc = bufio.NewScanner(os.Stdin)
  sc.Scan()
  pne := strings.Split(sc.Text(), " ")
  A, _ := strconv.Atoi(pne[0])
  B, _ := strconv.Atoi(pne[1])
  C, _ := strconv.Atoi(pne[2])
  
  if A == B && B == C && A == C{
    fmt.Println(1)
  }else if A == B && B != C || A == C && B != C || B == C && A != C{
    fmt.Println(2)
  }else{
    fmt.Println(3)
  }
}

Measured memory_bytes: 640
var
    n,k,i,x:longint;
    ans:int64;
    a:array[0..100010] of int64;
function min(a,b:int64):int64;
begin
    if a<b then exit(a) else exit(b);
end;
function max(a,b:int64):int64;
begin
    if a>b then exit(a) else exit(b);
end;
begin
    readln(n,k);
    for i:=1 to n do
        begin
            read(a[i]);
            if a[i]<=0 then x:=i;
        end;
    ans:=maxlongint;
    if x>=k then ans:=min(ans,abs(a[x-k+1]));
    if x+k<=n then ans:=min(ans,abs(a[x+k]));
    for i:=max(x,k) to min(n,x+k) do
        ans:=min(ans,min(abs(a[i]),abs(a[i-k+1]))*2+max(abs(a[i]),abs(a[i-k+1])));
    writeln(ans);
end.

Measured memory_bytes: 896
using System;
using System.Linq;

namespace _2149
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int[] y = Console.ReadLine().Split().Select(int.Parse).ToArray();
                long ran = x[4]; int ret = 0;
                for (int i = 0; i < x[0]; i++)
                {
                    while (ret <= 10000 && ran != y[i])
                    {
                        ran = (x[1] * ran + x[2]) % x[3];
                        ret++;
                    }
                    ran = (x[1] * ran + x[2]) % x[3];
                    ret++;
                }
                ret--;
                Console.WriteLine(ret <= 10000 ? ret : -1);
            }
        }
    }
}


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

int main() {

  int N, Ai, min, m2;
  m2 = 0;
  cin >> N;
  

  for(int i = 0; i < N; i++){
    cin >> Ai;
    while(Ai % 2 == 0){
      Ai /= 2;
      m2 += 1;
    }
    
    if(i == 0)
      min = m2;

    else if(m2 < min)
      min = m2;
    
    m2 = 0;

    }

  cout << min;

}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int x = a * 800;
		int y = (a / 15) * 200 ;
		System.out.println(x-y);
	}
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<long long> h(n);
    for(int i = 0; i < n; i++)cin >> h.at(i);
    sort(h.begin(), h.end());
    long long sum = 0;
    for(int i = 0; i < n-k; i++)sum += h.at(i);
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4828
import java.util.Scanner;
import java.lang.Math;

class Judge {

	/**
	   素数かどうかを判定します。
	   @param p 数字
	   @return 素数ならtrue,違うならfalse
	 */
	boolean isPrime(int p) {
		// pが2
		if (p == 2) {
			return true;
		}

		// pが2未満 または 偶数
		if (p < 2 || (p % 2) == 0) {
			return false;
		}

		for (int i = 3; i <= Math.sqrt(p); i += 2) {
			if (p % i == 0) {
				return false;
			}
		}

		return true;
	}
}

class Main {

	public static void main(String[] args) {

		int num;
		int input;
		int cnt = 0;

		Scanner sc = new Scanner(System.in);
		Judge j = new Judge();

		num = sc.nextInt();

		for (int i = 0; i < num; i++) {
			input = sc.nextInt();
			if(j.isPrime(input)) cnt++;
		}

		System.out.println(cnt);
	}
}



Measured memory_bytes: 40980
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

int h[202020];
ll dp[202020];

ll rec(int i){
    if(dp[i] < LINF) return dp[i];
    if(i <= 0) return 0;

    ll res = INF;
    chmin(res, rec(i-1) + abs(h[i] - h[i-1]));
    if(i > 1) chmin(res, rec(i-2) + abs(h[i] - h[i-2]));

    return dp[i] = res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    REP(i,N) cin >> h[i];
    REP(i,N+1) dp[i] = LINF;

    cout << rec(N-1) << endl;
}


Measured memory_bytes: 6144
#include <stdio.h>
#include <iostream>

using namespace std;

template<class T> inline T gcd(T a, T b) {
  while (b > 0) {
    T r = a % b;
    a = b;
    b = r;
  }

  return a;
}

template<class T> inline T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int main() {
    long A, B; cin >> A >> B;
    cout << lcm(A, B) << endl;
    return 0;
}


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var l = Console.ReadLine().Split().Select(int.Parse).ToList();

            var d = new List<int>();
            d.Add(0);

            foreach(var x in l)
            {
                d.Add(d.Last()+x);
            }

            if(d.Last() <=nx[1] && d.Count()-1 <= nx[0])
            {
                Console.WriteLine(nx[0]+1);
            }
            else
            {
                var ans = d.FindIndex(x => x > nx[1]);
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;cin>>a>>b>>c;
  int x=max({a,b,c}),z=min({a,b,c}),y=a+b+c-x-z;
  if (x==z) cout<<1;
  else if (x==y||z==y) cout<<2;
  else cout<<3;
}

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

struct st{
	int a, b, c, d;
};

int n, m, q, ans=0;
st quad[55];

void solve(vector<int>v){
	if (v.size()==n){
		int tmp=0;
		for (int i=0;i<q;i++){
			if ((v[quad[i].b-1]-v[quad[i].a-1])==quad[i].c) tmp+=quad[i].d;
		}
		ans=max(ans,tmp);
		return;
	}
	if (v.empty()){
		for (int i=1;i<=m;i++){
			solve({i});
		}
	}
	else{
		vector<int>tmp;
		for (int i=v.back();i<=m;i++){
			tmp=v;
			tmp.push_back(i);
			solve(tmp);
		}
	}
}

int main(){
	cin >> n >> m >> q;
	for (int i=0;i<q;i++) cin >> quad[i].a >> quad[i].b >> quad[i].c >> quad[i].d;
/*	for (int mask=0;mask<(1<<m);mask++){
		if ((__builtin_popcount(mask))==n){
			vector<long long>v;
			for (int i=0;i<m;i++){
				if (mask&(1<<i)) v.push_back(i+1);
			}
			long long tmp=0;
			for (int i=0;i<q;i++){
				if ((v[quad[i].b-1]-v[quad[i].a-1])==quad[i].c) tmp+=quad[i].d;
			}
			ans=max(ans,tmp);
		}
	}*/
	solve({});
	cout << ans << "\n";
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int a[100000];
int main()
{
    int l,r;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    l=1;
    r=n;
    int sum1=0;
    int sum2=0;
    while(l<=r)
    {
        sum1=sum1+a[l];
        sum2=sum2+a[r];
        if(sum1==sum2)
        {
            l++;
            r--;
        }
        else if(sum1<sum2)
        {
            sum2=sum2-a[r];
            l++;
        }
        else if(sum1>sum2)
        {
            sum1=sum1-a[l];
            r--;
        }
    }
    int sum=fabs(sum1-sum2);
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,cnt=0,ans=0;
  string s;
  cin>>s;
  rep(i,s.size()){
    cnt+=s[i]=='B';
    ans+=(s[i]=='W')*cnt;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        //int[] a = new int[N];
        //int count = 0;

        if(A <= 8 && B <= 8){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }
    }
}


Measured memory_bytes: 23380
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>


int main(){
	int i, j, n, m;
	char str[20];
	char key[5] = "YAKI";

	scanf("%s", str);

	for (i = 0; i < 4; i++) {
		if (str[i] != key[i])break;
	}
	printf("%s\n", (i == 4) ? ("Yes") : ("No"));

	return 0;
}


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

bool solve(const vector<string>& W){
  const int n = W.size();

  for(int i=0;i < n-1; ++i){
    if(W[i].back() != W[i+1].front()){
      return false;
    }
  }

  for(int i=0; i<n;i++){
    for(int j=i+1;j<n;j++){
      if(W[i] == W[j]){
	return false;
      }
    }
  }
  return true;
}

vector<string> input(){
  int n;
  cin >> n;
  vector<string> W(n);
  for(int i=0;i<n;++i){
    cin >> W[i];
  }
  return W;
}

int main(){
  const vector<string> W = input();
  if(solve(W)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, x;
int a[100];
signed main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] <= x) {
			ans++;
			x -= a[i];
		}
	}
	if (ans == n && x > 0) {
		ans--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b) cout << c << endl;
    if(a==c) cout << b << endl;
    if(c==b) cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
main(){
  int ans=0;
  string s,t="";
  cin>>s;
  r(i,s.size())if(s[i]!='x')t+=s[i];
  r(i,t.size()/2){
    if(t[i]!=t[t.size()-1-i]){
      cout<<-1<<endl;
      return 0;
    }
  }
  int l=0,r=s.size()-1;
  while(l<r){
    if(s[l]!=s[r]){
      if(s[l]=='x')l++;
      else r--;
      ans++;
    }
    else r--,l++;
  }
  cout<<ans<<endl;
}

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

int main(){
  int n,x;
  while(1){
    cin>>n>>x;
    if(n==0&&x==0)break;
    int p=0;
    for(int i=1;i<=n-2;i++){
      for(int j=i+1;j<=n-1;j++){
        for(int k=j+1;k<=n;k++){
          if(i+j+k==x)p+=1;
        }
      }
    }cout<<p<<endl;
  }return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int n, q, t, cnt = 0;
int S[100001];

int binarySearch(int target, int A[])
{
  int left = 0;
  int right = n;
  int mid;
  while (left < right)
  {
    mid = (left + right) / 2;
    if (S[mid] == target)
      return mid;
    else if (target < S[mid])
      right = mid;
    else
      left = mid + 1;
  }
  return -1;
}

int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++)
  {
    scanf("%d", &t);
    if (binarySearch(t, S) != -1)
      cnt++;
  }
  printf("%d\n", cnt);
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<queue>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,j,used[1005],x;
double dis[1005],px[1005],py[1005],pr[1005],d[1005][1005];
priority_queue<pair<double,int>/**/> pq;
int main()
{
	cin>>px[1]>>py[1]>>px[2]>>py[2]>>n;
	for (i=3;i<=n+2;i++) cin>>px[i]>>py[i]>>pr[i];
	n+=2;
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=n;j++)
		{
			d[i][j]=max((double)0,sqrt(sqr(px[i]-px[j])+sqr(py[i]-py[j]))-pr[i]-pr[j]);
		}
	}
	for (i=1;i<=n;i++) dis[i]=1e18;
	dis[1]=0;
	pq.push(make_pair(-0,1));
	while (!pq.empty())
	{
		x=pq.top().second;pq.pop();
		if (used[x]) continue;
		used[x]=1;
		for (i=1;i<=n;i++)
		{
			if (dis[i]>dis[x]+d[x][i])
			{
				dis[i]=dis[x]+d[x][i];
				pq.push(make_pair(-dis[i],i));
			}
		}
	}
	printf("%.10f",dis[2]);
	return 0;
}

Measured memory_bytes: 14448
divisors_8 = [105]

for i in range(107, 200, 2):
    divisors = []
    for j in range(1, 201):
        if i%j == 0:
            divisors.append(j)
    if len(divisors) == 8:
        divisors_8.append(i)

n = int(input())

divisors_8.append(n)
divisors_8.sort()
result = divisors_8.index(n)
divisors_8.remove(n)

if n not in divisors_8:
    print(result)
else:
    print(result+1)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define all(a) a.begin(), a.end()
#define forn(l, r) for(int i = l; i < (r); ++i)
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
///#define int long long int

using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using li = pair<ll, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 998244353;
const int INF = 0x3f3f3f3f;
const int MAXN = 1123456;
const double pi = 3.14159265359;
const double eps = 0.00000001;

li arr[MAXN];

int32_t main() {

    
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    s[k - 1] = tolower(s[k - 1]);

    cout << s << endl;
    

}

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

int mod = 1e9 + 7;

int N;

int main() {
    cin >> N;
    vector<int> A(N + 1);
    int x, y;
    vector<vector<int>> honest(N + 1, vector<int>(N + 1, -1));
    for (int i = 0; i < N; i++) {
        cin >> A[i + 1];
        for (int j = 0; j < A[i + 1]; j++) {
            cin >> x >> y;
            honest[i + 1][x] = y;
        }
    }
    long long M = 1 << N;
    int ans = 0;
    
    for (int i = 1; i < M; i++) {
        bool flag = true;
        int cnt = 0;
        for (int j = 0; j < N; j++) {
            if (!(i & 1 << j)) continue;
            cnt++;
            for (int k = 0; k < N; k++) {
                if (honest[j + 1][k + 1] == 1 && !(i & 1 << k)) {
                    flag = false;
                    break;
                } else if (honest[j + 1][k + 1] == 0 && (i & 1 << k)) {
                    flag = false;
                    break;
                }
            }
            if (!flag) break;
        }
        if (flag) ans = max(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
for _ in range(input()):
	if _ > 0: print
	H,W = map(int,raw_input().split())
	A = [list(raw_input()) for i in range(H)]
	for h in range(H):
		for w in range(W):
			if A[h][w] in "^<v>":
				x,y = w,h
				d = A[h][w]
				A[h][w] = "."
	input()
	cmd = raw_input()
	for c in cmd:
		if   c == "S":
			if d == "^":
				for h in range(y-1,-1,-1):
					if A[h][x] == "*":
						A[h][x] = "."
						break
					if A[h][x] == "#":
						break
			if d == "<":
				for w in range(x-1,-1,-1):
					if A[y][w] == "*":
						A[y][w] = "."
						break
					if A[y][w] == "#":
						break
			if d == "v":
				for h in range(y+1,H):
					if A[h][x] == "*":
						A[h][x] = "."
						break
					if A[h][x] == "#":
						break
			if d == ">":
				for w in range(x+1,W):
					if A[y][w] == "*":
						A[y][w] = "."
						break
					if A[y][w] == "#":
						break
		elif c == "U":
			d = "^"
			if y-1 >= 0 and A[y-1][x] == ".":
				y = y-1
		elif c == "L":
			d = "<"
			if x-1 >= 0 and A[y][x-1] == ".":
				x = x-1
		elif c == "D":
			d = "v"
			if y+1 <  H and A[y+1][x] == ".":
				y = y+1
		elif c == "R":
			d = ">"
			if x+1 <  W and A[y][x+1] == ".":
				x = x+1
	A[y][x] = d
	for h in range(H):
		print "".join(A[h])

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 998244353;
const int N = 2e5 + 10, M = 1e3 + 10;
const ll INF = 1e17;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)

default_random_engine e(time(0));

struct wc
{
    int l, r;
    ll dat;
} tr[N << 4];

ll a[N];
int lazy[N << 2];
ll num[N][10];

void pushup(int p)
{
    tr[p].dat = (tr[p << 1].dat * (a[tr[p << 1 | 1].r - tr[p << 1 | 1].l + 1]) + tr[p << 1 | 1].dat) % mod;
}

void push_down(int p)
{
    lazy[p << 1] = lazy[p << 1 | 1] = lazy[p];
    tr[p << 1].dat = num[tr[p << 1].r - tr[p << 1].l + 1][lazy[p]];
    tr[p << 1 | 1].dat = num[tr[p << 1 | 1].r - tr[p << 1 | 1].l + 1][lazy[p]];
    lazy[p] = 0;
}

void build(int p, int l, int r)
{
    tr[p] = {l, r, 1};
    if (l == r)
        return;
    int mid = l + r >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
    pushup(p);
}

void update(int p, int l, int r, int v)
{
    if (tr[p].l >= l && tr[p].r <= r)
    {
        lazy[p] = v;
        tr[p].dat = num[tr[p].r - tr[p].l + 1][v];
        return;
    }
    if (lazy[p])
    {
        push_down(p);
    }
    int mid = (tr[p].l + tr[p].r) >> 1;
    if (r <= mid)
    {
        update(p << 1, l, r, v);
    }
    else if (l > mid)
    {
        update(p << 1 | 1, l, r, v);
    }
    else
    {
        update(p << 1, l, mid, v);
        update(p << 1 | 1, mid + 1, r, v);
    }
    pushup(p);
}

ll ask(int p, int l, int r)
{
    if (tr[p].l >= l && tr[p].r <= r)
    {
        return tr[p].dat;
    }
    if (lazy[p])
    {
        push_down(p);
    }
    ll sum = 0;
    int mid = tr[p].l + tr[p].r >> 1;
    if (l > mid)
        sum = (sum + ask(p << 1 | 1, l, r)) % mod;
    else if (r <= mid)
        sum = (sum + ask(p << 1, l, r)) % mod;
    else
    {
        ll left = ask(p << 1, l, mid);
        ll right = ask(p << 1 | 1, mid + 1, r);
        sum = (sum + left * a[(r - mid)] + right) % mod;
    }

    return sum;
}

int main()
{
    int t;
    a[0] = 1;
    for (int i = 1; i < N; i++)
        a[i] = a[i - 1] * 10 % mod;
    for (int i = 1; i < N; i++)
    {
        for (int j = 1; j < 10; j++)
            num[i][j] = (num[i - 1][j] * 10 + j) % mod;
    }
    int n, q;
    cin >> n >> q;
    build(1, 1, n);
    while (q--)
    {
        int l, r, v;
        scanf("%d%d%d", &l, &r, &v);
        update(1, l, r, v);
        printf("%lld\n", ask(1, 1, n));
    }
    return 0;
}
/*

*/

Measured memory_bytes: 31232
n,m=map(int,input().split())
a=list(int(input()) for _ in range(m))
a.append(n+1)
key=0
ways = list(0 for _ in range(n))
if a[key] == 1:
    key += 1
else:
    ways[0] = 1

if a[key] == 2:
    key += 1
else:
    ways[1] = ways[0] + 1

for i in range(3, n+1, 1):
    if a[key] == i:
        key += 1
    else:
        ways[i-1] = (ways[i-2] + ways[i-3])%1000000007

print(ways[-1])

Measured memory_bytes: 7836
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };


void  bubbleSort(int number[], int length);

int main() {
	int N;
	scanf("%d", &N);
	int A[105];
	for (int i = 0; i < N; i++)scanf("%d", &A[i]);

	bubbleSort(A, N);

	printf("%d", A[N - 1] - A[0]);
}

void  bubbleSort(int number[], int length) {
	for (int i = 0; i < length; i++)
		for (int j = i + 1; j < length; j++)
			if (number[i] > number[j]) {
				int tmp = number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
}



/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

int N,C;

int main(){
    cin >> N >> C;

    vector<pair<int, int> > st[31],st2[31];

    REP(i,N){
        int ss,tt,cc;
        cin >> ss >> tt >> cc;
        st[cc].push_back(make_pair(ss,tt));
    }
    FOR(i,1,C+1){
        sort(st[i].begin(),st[i].end());
    }
    FOR(i,1,C+1){
        int ss = -1;
        int tt = -1;
        REP(j,st[i].size()){
            if(ss == -1)ss=st[i][j].first;
            if(tt == -1){
                tt=st[i][j].second;
            }else{
                if(tt == st[i][j].first){
                    tt=st[i][j].second;
                }else{
                    st2[i].push_back(make_pair(ss,tt));
                    ss=st[i][j].first;
                    tt=st[i][j].second;
                }
            }
        }
        if(ss != -1)st2[i].push_back(make_pair(ss,tt));
    }

    // FOR(i,1,C+1){
    //     REP(j,st[i].size()){
    //         cout << st[i][j].first << " " << st[i][j].second << endl;
    //     }
    // }
    // FOR(i,1,C+1){
    //     REP(j,st2[i].size()){
    //         cout << st2[i][j].first << "  " << st2[i][j].second << endl;
    //     }
    // }

    int rec[300000] = {0};
//    FOR(i,300001)rec[i] = 0;

    FOR(i,1,C+1){
        REP(j,st2[i].size()){
            rec[st2[i][j].first * 2 - 1] += 1;
            rec[st2[i][j].second * 2] -= 1;
        }
    }

    // REP(i,30){
    //     cout << i << " " << rec[i] << endl;
    // }
    int ans = 0;
    REP(i,300000-1){
        rec[i+1] = rec[i+1] + rec[i];
        ans = max(ans, rec[i+1]);
    }

    // REP(i,30){
    //     cout << i << " " << rec[i] << endl;
    // }
    cout << ans << endl;

}

Measured memory_bytes: 3584
N, M = (int(x) for x in input().split())
A = [-1]*(N+1)
for i in range(M):
  a = int(input())
  A[a] = 0
A[N] = 1
if A[N-1] == -1:
	A[N-1] = 1
for i in reversed(range(N-1)):
#  print("i",i)
  if A[i] == -1:
  	A[i] = A[i+1] + A[i+2]
#  print("A[i]",A[i])
print(A[0]%(1000000007))

Measured memory_bytes: 460020
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    ll N;cin>>N;

    N -= 6;
    ll ans = 1;
    ans = ans + N/11 *2;
    if(N%11 > 5) ans+=2;
    else if(N%11 > 0) ans++;

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


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

int main(){
  int A,B;
  cin >> A >> B;
  if(A%2==0){
    for(int x=A*25/2;x<(A+1)*25/2;x++){
      if(x>=B*10&&x<(B+1)*10){
        cout << x << endl;
        return 0;
      }
    }
  }else{
    for(int x=A*25/2+1;x<(A+1)*25/2;x++){
      if(x>=B*10&&x<(B+1)*10){
        cout << x << endl;
        return 0;
      }
    }
  }
  cout << "-1" << endl;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int A,B,result;
  result =1;

  for(int i=0;i<N;i++){
    A = result*2;
    B = result+K;
    if(A<=B){
      result =A;
    }else{
      result =B;
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

        if(a<b){
            if(a+w>b){
                System.out.println(0);
            }
            else{
                System.out.println(b-a-w);
            }
        }
        else{
            if(b+w>a){
                System.out.println(0);
            }
            else{
                System.out.println(a-b-w);
            }
        }
    }
}


Measured memory_bytes: 21844
def main(s):
    if len(s) % 2 == 1:
        return 'No'
    else:
        p = int(len(s)/2)
        for i in range(p):
            if s[2*i] != 'h' or s[2*i+1] != 'i':
                return 'No'
        return 'Yes'
s = input()
print(main(s))

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>

using namespace std;

void makeMemo(int memo[], int n, int A[], int i, int v) {

	memo[v] = 1;
	if (i == n) {
		return;
	}
	makeMemo(memo, n, A, i + 1, v);
	makeMemo(memo, n, A, i + 1, v + A[i]);
}

//?????¢
int main() {

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

	int q;
	scanf("%d", &q);
	int m[q];
	for (int i = 0; i < q; ++i) {
		scanf("%d", &m[i]);
	}

	int memo[2001];
	for (int i = 0; i <= 2000; ++i) {
		memo[i] = 0;
	}

	makeMemo(memo, n, A, 0, 0);

	for (int i = 0; i < q; ++i) {
		if (memo[m[i]] == 1) {
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int main(){
	
	int w, d;
	
	while(true){
		cin >> w >> d;
		if(w == 0){
			break;
		}
		int a[21] = {};
		int b[21] = {};
		for(int i = 0; i < w; i++){
			int num;
			cin >> num;
			a[num]++;
		}
		for(int i = 0; i < d; i++){
			int num;
			cin >> num;
			b[num]++;
		}
		int ans = 0;
		for(int i = 1; i <= 20; i++){
			ans += i * max(a[i], b[i]);
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

int main() {
	int N; cin >> N;
	int A=N;
	int S=0;
	vector<int> vec(10);

	rep(i,10) {
		if (A>0) {
			vec.at(i) = (A % 10);
			A = A / 10;
			S = S + vec.at(i);
		}
	}

	if (N%S == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int length[55];
int sum;
int n,k;


int main()
{
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++)
    {
        cin>> length[i];
        
    }
    sort(&length[0],&length[n]);
    for(int i=n-1;i>n-1-k;i--)
    {
        sum=sum+length[i];
    }
    printf("%d",sum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int notf[100]={0},l=0,a[100];
	for(int i=1;i<=n;++i){
		cin>>a[i];
		if(a[i]!=i)	notf[++l]=i;
	}
	swap(a[notf[1]],a[notf[2]]);
	for(int i=1;i<=n;++i)
		if(a[i]!=i){
			cout<<"NO\n";
			return 0;
		}
	cout<<"YES\n";
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

ll ts(ll x){
    ll sum=1;
    while(x>0){
        sum*=26;
        x--;
    }
    return sum;
}
int main(){
    ll n; cin>>n;
    ll cnt=0;
    ll i=0;
    while(cnt<n){
        i++;
        cnt+=ts(i);
    }
    cnt-=ts(i);
    cnt++;
    ll keta=i;
    ll kk=i;
    ll first=cnt;
    ll ff=cnt;
    string ans="";
    rep(i,keta){
        for(char a='a';a<='z';a++){
            first+=ts(kk-1);
            if(first>n){
                cout<<a;
                first-=ts(kk-1);
                break;
            }
        }
        kk--;
    }
    cout<<endl;



}




























































































Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int64 mod;
int64 power_mod(int64 a, int64 n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
  }
  return ret;
}

// sum_{i,0,n-1}q^i
int64 geometric_seq(int64 q, int64 n) {
  q %= mod;
  if (n == 1) return 1;
  if (n % 2) return (1 + q * geometric_seq(q, n - 1)) % mod;
  int64 ret = geometric_seq(q, n / 2);
  ret = ret * (power_mod(q, n / 2) + 1) % mod;
  return ret;
}

// sum_{i,0,n-1}i*q^i
int64 geometric_seq1(int64 q, int64 n) {
  q %= mod;
  if (n == 1) return 0;
  if (n % 2) return (geometric_seq(q, n - 1) +
                     geometric_seq1(q, n - 1)) * q % mod;
  int64 t = power_mod(q, n / 2);
  int64 L = geometric_seq1(q, n / 2);
  int64 R = (L + n / 2 % mod * geometric_seq(q, n / 2) % mod) * t % mod;
  return (L + R) % mod;
}

int get_len(int64 n) {
  int ret = 0;
  for (; n; n /= 10) ++ret;
  return ret;
}

int main() {
  int64 L, A, B;
  scanf("%lld%lld%lld%lld", &L, &A, &B, &mod);
  int longest = get_len(A + (L - 1) * B);
  int64 pre = 0, ret = 0;
  for (int k = 1; k <= longest; ++k) {
    if (k < get_len(A + B * pre)) continue;
    int64 low = pre, high = L - 1;
    while (low != high) {
      int64 mid = (low + high + 1) / 2;
      if (get_len(A + B * mid) > k) {
        high = mid - 1;
      } else {
        low = mid;
      }
    }
    int64 len = high - pre + 1;
    // trace(k, pre, high);
    int64 a0 = (A + pre * B) % mod;
    int64 d = B % mod;
    int64 q = power_mod(10, k);
    int64 cur = (a0 + (len - 1) % mod * d % mod) * geometric_seq(q, len) % mod;
    cur = (cur + mod - geometric_seq1(q, len) * d % mod) % mod;
    // trace(cur);
    ret = ret * power_mod(q, len) % mod + cur;
    ret %= mod;
    pre = high + 1;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int judge(int a,int b) {
	if (a == b)
		return 0;
	if (a < b) {
		if (a == 1)
			return -1;
		else
			return 1;
	}
	else {
		if (b == 1)
			return 1;
		else
			return -1;
	}
}
int main() {
	int a, b;
	scanf("%d %d",&a,&b);
	if (judge(a, b) == 1) {
		printf("Bob");
	}
	else if (judge(a, b) == 0)
		printf("Draw");
	else
		printf("Alice");
}

Measured memory_bytes: 128
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int AA[SIZE];
int main(){
    int n; R(n);
    if(n%2==0){
        FOR(i,1,n)AA[i]=min(i,n+1-i);
    }
    else{
        FOR(i,1,n-1)AA[i]=min(i,n-i);
    }
    VPII e;
    FOR(i,1,n)FOR(j,i+1,n){
        if(AA[i]!=AA[j])e.PB({i,j});
    }
    W(SZ(e));
    for(auto x:e)W(x);
    return 0;
}


Measured memory_bytes: 384
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
const int MAXN=int(2e5);
int n,p,q;
int fa[2][MAXN+5];
map< pair<int,int> ,int> cnt;
int Find(int x,int y)
{
	if(fa[y][x]==x) return x;
	return fa[y][x]=Find(fa[y][x],y);
}
int main()
{
	scanf("%d%d%d",&n,&p,&q);
	for(int i=1;i<=n;i++)
		fa[0][i]=fa[1][i]=i;
	for(int i=0,u,v;i<p;i++)
	{
		scanf("%d%d",&u,&v);
		if(Find(u,0)!=Find(v,0))
			fa[0][fa[0][u]]=fa[0][v];
	}
	for(int i=0,u,v;i<q;i++)
	{
		scanf("%d%d",&u,&v);
		if(Find(u,1)!=Find(v,1))
			fa[1][fa[1][u]]=fa[1][v];
	}
	for(int i=1;i<=n;i++)
		cnt[make_pair(Find(i,0),Find(i,1))]++;
	for(int i=1;i<=n;i++)
	{
		if(i!=1) printf(" ");
		printf("%d",cnt[make_pair(fa[0][i],fa[1][i])]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 13568
//
// Created on 2020/06/14.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int x,n;
    cin>>x>>n;
    vector<int>p(n);
    for (int i = 0; i < n; ++i) {
        cin>>p[i];
    }
    if(n == 0){
        cout<<x<<endl;
        return 0;
    }
    sort(all(p));
    int cnt = 0;
    vector<int>ans;
    int ans_abs = INF;
    for (int j = 0; j <= 105; ++j) {
        if(j == p[cnt]){
            cnt ++;
            continue;
        }
        if(abs(j - x) < ans_abs){
            ans_abs = abs(j-x);
            ans.clear();
            ans.push_back(j);
        }else if(abs(j - x) == ans_abs){
            ans.push_back(j);
        }
    }
    sort(all(ans));
    cout<<ans[0]<<endl;


    return 0;
}


Measured memory_bytes: 3628