akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  int K;
  cin >> K;
  vector<vector<vector<ll>>> dp(s.size()+1, vector<vector<ll>>(K+1, vector<ll>(2, 0)));
  dp.at(0).at(0).at(0) = 1;
  rep(i, s.size())rep(j, K+1)rep(k, 2){
    int ni = i+1;
    int now = s.at(i) - '0';
    rep(m, 10){
      int nj = j, nk = k;
      if(k == 0){
        if(m > now) break;
        if(m < now) nk++;
      }
      if(m != 0) nj++;
      if(nj > K) continue;
      dp.at(ni).at(nj).at(nk) += dp.at(i).at(j).at(k);
    }
  }
  // rep(j, K+1){
  //   rep(i, s.size()+1){
  //     cerr << dp.at(i).at(j).at(0) << " ";
  //   }
  //   cerr << endl;
  // }
  // rep(j, K+1){
  //   rep(i, s.size()+1){
  //     cerr << dp.at(i).at(j).at(1) << " ";
  //   }
  //   cerr << endl;
  // }
  cout << dp.at(s.size()).at(K).at(0) + dp.at(s.size()).at(K).at(1) << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>

using namespace std;


int main(void)
{
	int k, a, b;
	cin >> k >> a >> b;
	int i = 0;
	while (i < a)
		i += k;
	
	if (i <= b)
		cout << "OK";
	else
		cout << "NG";

	return 0;
}

Measured memory_bytes: 3596
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD=10**9+7

N,M,K=rl()

#nCr % MOD
def cmb(n, r, MOD=0):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            if MOD != 0:
                result %= MOD
 
    return result


ans = 0
for d in range(1,N):
    ans += d*(N-d)*M**2
for d in range(1,M):
    ans += d*(M-d)*N**2
ans *= cmb(N*M-2,K-2)
print(ans%MOD)

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<typename T=int>inline T get(){
   char c=getchar(); bool neg=(c=='-');
   T res=neg?0:c-'0'; while(isdigit(c=getchar()))res=res*10+(c-'0');
   return neg?-res:res;
}
template<typename T=int>inline void put(T x,char c='\n'){
   if(x<0)putchar('-'),x*=-1; int d[20],i=0;
   do{d[i++]=x%10;}while(x/=10); while(i--)putchar('0'+d[i]);
   putchar(c);
}
//end



int main(){
   ll n; int res=0; cin>>n;
   for(__int128_t x=100;x<n;x=x*101/100)res++;
   printf("%d\n",res);
   return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std ; 
const int INF = 1001001001 ; 

int a[12][12] ; 

int main () {
  int N ,M ,X  ;
  cin >> N >> M >> X ; 
  
  vector<int> C(N) ; 
  vector<vector<int>> A(N , vector<int>(M)) ;  
  vector<int> sum(M) ; 

  for(int i = 0 ; i< N ; i++){
    cin >> C.at(i) ;
    for(int j = 0 ; j < M ; j++){
      cin >> A.at(i).at(j) ; 
    }
  }
  
  //bit全探索
  int ans = INF ; 
  for(int s = 0 ; s < (1 << N) ; s++){
    int cost = 0 ;
    vector<int> d(M) ;  
    for(int i = 0 ; i < N ; i++){
      if (s >> i&1){ //sのi bitsが立っている時だけ
        cost += C.at(i)  ;
        for(int j = 0 ; j < M ; j++){
          d.at(j) += A.at(i).at(j) ; 
        }
      }
    }
    bool ok = true ; 
    for(int j = 0 ; j < M ; j++) {
      if(d.at(j) < X ) ok = false ;
    }
    if(ok) ans = min(ans,cost) ; 
    
  }
  if(ans == INF) cout << -1 << endl ; 
  else cout << ans << endl;
  
  return 0 ; 
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=n;i<=200000;i++)
	{
		int f=1;
		for(int j=2;j<=int(sqrt(i));j++)
		if(i%j==0)
		{
			f=0;
			break;
		}
		if(f==1)
		{
			cout<<i;
			return 0;
		}
	}
}

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

#define mod 1000000007 
#define check exit(0)
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace __gnu_pbds;
using namespace std;

int main()
{
    jaldi
    int arr[3][3];
    map<int,int> m;
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++) cin>>arr[i][j];
    }
    int n;
    cin>>n;
    for(int i=0;i<n;i++) 
    {
        int x;
        cin>>x;
        m[x]++;
    }
    bool flag=false;
    for(int i=0;i<3;i++)
    {
        int ans=0;
        for(int j=0;j<3;j++)
        {
            if(m[arr[i][j]]) ans++;
        }
        if(ans==3) 
        {
            cout<<"Yes";
            return 0;
        }
    }
    for(int i=0;i<3;i++)
    {
        int ans=0;
        for(int j=0;j<3;j++)
        {
            if(m[arr[j][i]]) ans++;
        }
        if(ans==3) 
        {
            cout<<"Yes";
            return 0;
        }
    }
    int ans=0;
    for(int i=0;i<3;i++) 
    {
        
        if(m[arr[i][i]]) ans++;
        if(ans==3) 
        {
            cout<<"Yes";
            return 0;;
        }
    }
    ans=0;
    for(int i=0;i<3;i++) 
    {
        if(m[arr[i][3-i-1]]) ans++;
        if(ans==3) 
        {
            cout<<"Yes";
            return 0;;
        }
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

const ll MX = 1e18;

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

  vector<ll> a(n);
  ll ans = 1;
  REP(i, n){
    cin >> a[i];
    if(a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  REP(i,n){

    //かけてから判定するとオーバーフローしてしまう．
    // if(ans > MX){
    //   cout << -1 << endl;
    //   return 0;
    if(ans*a[i] > MX || MX/ans < a[i]){
      cout << -1 << endl;
      return 0;

    }
    ans *= a[i];
  }


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

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#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 Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define ZERO(a) memset(a,0,sizeof(a))

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll dp[100010][2];
ll n;
vll edge[100010];

ll rec(ll index, ll pre){
  dp[index][0]=1;
  dp[index][1]=1;

  for(auto e:edge[index]){
      if(e==pre)
        continue;
      rec(e, index);
      dp[index][0] = dp[index][0]*((dp[e][0]+dp[e][1])%MOD)%MOD;
      dp[index][1] = dp[index][1]*dp[e][0]%MOD;
    }
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);


  cin>>n;
  REP(i,n-1){
      ll x,y;
      cin>>x>>y;
      x--;
      y--;
      edge[x].push_back(y);
      edge[y].push_back(x);
    }

  rec(0, -1);
  ll ans = (dp[0][0]+dp[0][1])%MOD;
  cout<<ans<<endl;
}



Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9+7;
int n;
vector<vector<int>>adj;
vector<int>dp1,dp2;
void dfs(int i,int par)
{
    dp1[i]=dp2[i]=1;
    for(int c:adj[i]){
        if(c==par)continue;
        dfs(c,i);
        dp2[i]=(dp2[i]*(dp2[c]+dp1[c])%mod)%mod;
    }
    for(int c:adj[i]){
        if (c!=par)dp1[i]=(dp1[i]*dp2[c])%mod;
    }
}
int32_t main()
{
    cin>>n;adj.resize(n+1);dp1.resize(n+1);dp2.resize(n+1);
    for(int i = 0;i<n-1;i++){int a,b;cin>>a>>b;adj[a].push_back(b);adj[b].push_back(a);}
    dfs(1,1);
    cout<<((dp1[1]+dp2[1])%mod+mod)%mod;
    return 0;
}

Measured memory_bytes: 17064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;

const double PI = acos(-1.0);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int r;
    cin>>r;
    cout<<r*r<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int n;
	cin >> n;
	if (n <= 2)
		cout << "0";
	else
		cout << n / 3;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>

using namespace std;

int main() {
  int x,t;
  cin >> x >> t;
  if(x <= t)
    cout << "0" << endl;
  else cout << x-t << endl;
}

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

int main(void) {
	int i, N;
	long long A[1010], T[1010];
	long long V, VA, VA1, VA2, VT, VT1, VT2;
	scanf("%d", &N);
	for (i=0;i<N;i++) scanf("%lld%lld", &T[i], &A[i]);

	VA = A[0];
	VT = T[0];
//		printf("%lld %lld\n", VT, VA);
	for (i=1;i<N;i++) {
		if (VA <= A[i] && VT <= T[i]) {
			VA = A[i]; VT = T[i];
		} else {
			VA1 = VA + (A[i] - (VA % A[i])) % A[i];
			VT1 = VA1 / A[i] * T[i];
			VT2 = VT + (T[i] - (VT % T[i])) % T[i];
			VA2 = VT2 / T[i] * A[i];
			if (VA1 < VA || VT1 < VT) { VA = VA2; VT = VT2; }
			else if (VA2 < VA || VT2 < VT) { VA = VA1; VT = VT1; }
			else if (VA1 + VT1 < VA2 + VT2) { VA = VA1; VT = VT1; }
			else { VA = VA2; VT = VT2; }
		}
//		printf("%lld %lld\n", VT, VA);
	}

	V = VA + VT;
	printf("%lld\n", V);

	return 0;
}


Measured memory_bytes: 128
N=int(input())
A= list(map(int,input().split()))
kin=[0]*N
gin=[0]*N
if N<=3:
 print(max(A))
else:
 kin[0]=A[0]
 kin[1]=A[1]
 kin[2]=kin[0]+A[2]
 gin[2]=A[2]
 for i in range(3,N):
  if i%2==1:
   kin[i]=max(kin[i-2],kin[i-3])+A[i]
  else:
   kin[i]=kin[i-2]+A[i]
   gin[i]=max(kin[i-3],gin[i-2])+A[i]
 if N%2==0:
  print(max(kin[N-1],kin[N-2]))
 else:
  print(max(gin[N-1],kin[N-2]))


Measured memory_bytes: 94168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long N, K;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                K = line[1];
            }
            long ret = 0;

            for (long k = K; k <= N + 1; k++)
            {
                long mn = k * (k - 1) / 2;
                long mx = k * (N + N - k + 1) / 2;
                ret += (mx - mn + 1);
                ret %= MOD;
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 28240
#include<stdio.h>
#define ll long long
#define fup(i,a,b) for(int i=a;i<=b;++i)

void Main()
{
    ll f[90]={2,1};
    int n;
    scanf("%d",&n);
    fup(i,2,n)f[i]=f[i-1]+f[i-2];
    printf("%lld",f[n]);
}
int main()
{
Main();
return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

long long a[100000];
pair <long long, int> a_ind[100000];
long long ans[100000];
int main(){
    int N;
    cin >> N;
    long long left = 0;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        left += a;
        a_ind[i] = make_pair(a, -i);
    }
    sort(a_ind, a_ind + N);

    long long cur_max = a_ind[N - 1].first;
    long long before_ind = - a_ind[N - 1].second;
    long long bigger_total = 0;
    long long bigger_num = 0;
    for(int i = N - 1; i >= 0; i--){
        if((- a_ind[i].second) >= before_ind){
            bigger_total += a_ind[i].first;
            bigger_num ++;
        } else {
            ans[before_ind] = bigger_total - a_ind[i].first * bigger_num;
            left -= bigger_total - a_ind[i].first * bigger_num;
            cur_max = a_ind[i].first;
            before_ind = - a_ind[i].second;
            bigger_num++;
            bigger_total = cur_max * bigger_num;
        }
    }
    ans[0] = left;

    for(int i = 0; i < N; i++){
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3456
s = input()

S = []
N = len(s)
i = 0
while i < N:
    if i < N - 1 and s[i:i + 2] == 'BC':
        S.append('D')
        i += 2
    else:
        S.append(s[i])
        i += 1

ans = 0
c = 0
for l in S:
    if l == 'A':
        c += 1
    elif l == 'D':
        ans += c
    else:
        c = 0
print(ans)


Measured memory_bytes: 5096
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   int mx = 0;
   int ans = 0;
   for(int i = 0; i < n; ++i){
      int x;
      cin >> x;
      mx = max(mx,x);
      ans += mx-x;
   }
   cout << ans;
   return 0;
} 

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define sec setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.1415926

using namespace std;
ll gcd(ll a, ll b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}

int main() {
	string s, t;
	cin >> s >> t;
	int k = s.size();
	int count = 0;
	rip(i, k) {
		if (s[i] != t[i])count++;
	}
	if (count == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

const int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
int r[][6] = {
	{0, 2, 3, 4, 1, 5},
	{4, 1, 0, 3, 5, 2},
	{1, 5, 2, 0, 4, 3}
};
inline int hash(const vi &v){
	int res = 0;
	rep(i, 6) res *= 6, res += v[i];
	return res;
}
inline void rot(vi &v, int d){
	vi res;
	rep(i, 6) res.pb(v[r[d][i]]);
	swap(res, v);
}
int h, w, col[256];
char in[32][32], ptn[9];

int main(){
	const char *name = "rmbgyc";
	rep(i, 6) col[name[i]] = i;
	
	while(cin >> w >> h, h){
		int y, x;
		set<pair<int, pi> > s;
		queue<pair<pi, pi> > q;
		rep(i, h){
			cin >> in[i];
			rep(j, w) if(in[i][j] == '#') y = i, x = j;
		}
		cin >> ptn;
		
		vi v;
		rep(i, 6) v.pb(i);
		q.push(mp(mp(0, y * w + x), mp(hash(v), 0)));
		
		while(!q.empty()){
			int co = q.front().F.F, ha = q.front().S.F, bit = q.front().S.S;
			y = q.front().F.S / w; x = q.front().F.S % w; q.pop();
			
			if(s.count(mp(y * w + x, mp(ha, bit)))) continue;
			s.insert(mp(y * w + x, mp(ha, bit)));
			if(bit == 6){
				cout << co << endl;
				goto END;
			}
			v.clear();
			rep(i, 6) v.pb(ha % 6), ha /= 6;
			reverse(all(v));
			
			rep(d, 4){
				int ny = y + dy[d], nx = x + dx[d];
				if(ny < 0 || nx < 0 || ny >= h || nx >= w || in[ny][nx] == 'k') continue;
				int c = col[in[ny][nx]], nbit = bit;
				
				vi nv = v;
				if(d == 0) rot(nv, 2);
				if(d == 1) rep(i, 3) rot(nv, 1);
				if(d == 2) rep(i, 3) rot(nv, 2);
				if(d == 3) rot(nv, 1);
				
				if(in[ny][nx] != 'w' && in[ny][nx] != '#'){
					if(ptn[bit] != in[ny][nx]) continue;
					if(nv[0] != c) continue;
					nbit++;
				}
				int nh = hash(nv);
				if(!s.count(mp(ny * w + nx, mp(nh, nbit))))
					q.push(mp(mp(co + 1, ny * w + nx), mp(nh, nbit)));
			}
		}
		cout << "unreachable" << endl;
		END:;
	}
	return 0;
}

Measured memory_bytes: 5316
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string S, T, U;
	int A, B;
	
	cin>>S>>T;
	cin>>A>>B;
	cin>>U;
	
	if(S == U) A--;
	else B--;
	
	cout<<A<<" "<<B<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
ll dp[11][11];
int ans[11];

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

void sol(ll sum, int i, int j, int k) {
	if (i == 0)return;
	if (i == 1) {
		ans[i] = j;
		return;
	}
	if (j != 0) {
		if (sum + dp[i - 1][j - 1] < k) {
			sum += dp[i - 1][j - 1];
		}
		else {
			ans[i] = j;
			sol(sum, i - 1, j - 1, k);
		}
	}

	if (sum + dp[i - 1][j] < k) {
		sum += dp[i - 1][j];
	}
	else {
		ans[i] = j;
		sol(sum, i - 1, j, k);
	}

	if (j != 9) {
		if (sum + dp[i - 1][j + 1] < k) {
			sum += dp[i - 1][j + 1];
		}
		else {
			ans[i] = j;
			sol(sum, i - 1, j + 1, k);
		}
	}
}



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

	int k;
	cin >> k;

	if (k < 10) {
		cout << k << endl;
		return 0;
	}
	REP(i, 10) {
		dp[1][i] = 1;
	}
	dp[1][10] = 9;

	FOR(i, 2, 11) {
		REP(j, 10) {
			if (j != 0) dp[i][j] += dp[i - 1][j - 1];
			dp[i][j] += dp[i - 1][j];
			if (j != 9) dp[i][j] += dp[i - 1][j + 1];
		}
		dp[i][10] = dp[i - 1][10];
		REPS(j, 9) {
			dp[i][10] += dp[i][j];
		}
	}

	REPS(i, 10) {
		if (dp[i][10] >= k) {
			ll sum = dp[i - 1][10];
			REPS(j, 9) {
				if (sum + dp[i][j] >= k) {
					cout << j;
					int disit = i - 1;
					int prev = j;
					while (disit > 0) {
						FOR(l, prev - 1, prev + 2) {
							if (l == -1 || l==10)continue;
							if (sum + dp[disit][l] >= k) {
								cout << l;
								disit--;
								prev = l;
								break;
							}
							sum += dp[disit][l];
						}
					}
					break;
				}
				sum += dp[i][j];
			}
			break;
		}
	}
}

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


int main (){
    int k,x;    cin >> k >> x;
    for(int i=x-k+1;i<x+k;i++){
        cout << i << " " ;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int min(int a,int b){
    if (a>b){
        return b;
    } else {
        return a;
    }
}

int main(void){
    int n,ma,mb,ans=1000000;
    scanf("%d%d%d",&n,&ma,&mb);
    int a[n],b[n],c[n];
    for (int i=0; i<n; i++){
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    }
    int d[n+1][420][420];
    for (int i=0; i<=n; i++){
        for (int j=0; j<=400; j++){
            for (int k=0; k<=400; k++){
                d[i][j][k]=1000000;
            }
        }
    }
    d[0][0][0]=0;
    for (int i=0; i<n; i++){
        for (int j=0; j<=400; j++){
            for (int k=0; k<=400; k++){
                if(d[i][j][k]==1000000){
                    continue;
                }
                d[i+1][j][k]=min(d[i+1][j][k],d[i][j][k]);
                d[i+1][j+a[i]][k+b[i]]=min(d[i+1][j+a[i]][k+b[i]],d[i][j][k]+c[i]);
            }
        }
    }
    for (int j=1; j<=400; j++){
        for (int k=1; k<=400; k++){
            if (j*mb==k*ma){
                if(ans>d[n][j][k]){
                    ans=d[n][j][k];
                }
            }
        }
    }
    if (ans==1000000){
        printf("-1\n");
    } else {
        printf("%d\n",ans);
    }
	return 0 ;
}

Measured memory_bytes: 28416
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))

BC = [list(map(int, input().split())) for _ in range(M)]

A.sort()
BC.sort(key=lambda x: -x[1])

tmp = []

for B, C in BC:
    tmp += [C] * B
    if len(tmp) >= N:
        break
A.extend(tmp)
A = sorted(A, reverse=True)
print(sum(A[:N]))

Measured memory_bytes: 38164
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
int n,m;
ll hoge=0;
vvi d(11,vi(11,INF));
void dfs(int num, int cnt,vb used){
    if(!used[num])return;
    else used[num]=false;
    rep(i,n+1){
        if(used[i])break;
        if(cnt==n-1&&i==n){hoge++; return;}
        
    }
    rep(i,n+1){
        if(i){if(d[num][i]==0&&used[i])dfs(i,cnt+1,used);}
    }
    
}
int main(){
    cin>>n>>m;int cnt=1;
    vb used(100,true); used[1]=false; used[0]=false;
    rep(i,m){int a,b; cin>>a>>b; d[a][b]=0; d[b][a]=0;}
    rep(i,n+1){
        if(d[1][i]==0)dfs(i,cnt,used);
    }
    cout<<hoge<<endl;
}

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

int main() {
	
	int a,b;
	cin >> a >> b;
	int m=-1;
	for(int i=1; i<=10000; i++){
		if(i*8/100==a && i*10/100==b) {
			m = i;
			break;
		}
	}
	cout << m << endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i;
	int j;
	
	for (i = 1; i < 10; i++){
		for (j = 1; j < 10; j++){
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return (0);
}

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

int main() {
  int A, B;
  string S;
  cin >> A >> B >> S;
  string ans = "Yes";
  for (int i = 0; i < A; i++) {
    if (S.at(i) < '0' || S.at(i) > '9') {
      ans = "No";
    }
  }
  if (S.at(A) != '-') ans = "No";
  for (int i = A + 1; i < A + B + 1; i++) {
    if (S.at(i) < '0' || S.at(i) > '9') {
      ans = "No";
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
    #include<cstdio>
    #include<math.h>
    #include<string>
    #include<algorithm>
    #include<functional>
    #include<vector>
    #include<set>
    #include<map>
    #define INF 999999
    #define EPS 1.0e-6
     
    using namespace std;
     
    typedef long long ll;
    typedef pair<int, int> P;
    typedef pair<int, P> PP;
     
    int a, b, c, d;
    int op1, op2, op3;
     
    int p[2] = { -1,1 };
    string m = "-+";
     
    int main()
    {
    	string s;
    	cin >> s;
    	a = (int)(s[0] - '0');
    	b = (int)(s[1] - '0');
    	c = (int)(s[2] - '0');
    	d = (int)(s[3] - '0');
    	//cout << a << " " << b << " " << c << " " << d << endl;
     
    	int f, g, h;
     
    	
    	for (int j = 0; j < 2; j++) {
    		for (int k = 0; k < 2; k++) {
    			for (int l = 0; l < 2; l++) {
    				f = b*p[j];
    				g = c*p[k];
    				h = d*p[l];
    				//cout << f + g + h << endl;
    				//cout <<j << " " << k<< " " << l << endl;
    				if ( a + f + g + h == 7) {
    					op1 = j; 
    					op2 = k;
    					op3 = l;
    					//cout << j << " " << k << " " << l << endl;
    					break;
    				}
    			}
    		}
    	}
    	
    	cout << a << m[op1] << b << m[op2] << c << m[op3] << d << "=7" << endl;
    	return 0;
    }

Measured memory_bytes: 256
n = int(input())
ps = list(map(int, input().split()))

cnt = 0
for i in range(1, n-1):
    mn = min([ps[i-1], ps[i+1]])
    mx = max([ps[i-1], ps[i+1]])
    if ps[i] > mn and ps[i] < mx:
        cnt += 1
print(cnt)

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
void chmax(T1 &a, const T2 &b) {
  if(a < b) a = b;
}

template <typename T1, typename T2>
void chmin(T1 &a, const T2 &b) {
  if(a > b) a = b;
}

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i != (int)(s.size())-1) cout << " ";
  }
  cout << "\n";
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

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

  ll a, b; cin >> a >> b;
  cout << a / __gcd(a, b) * b << endl;

}


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

int main(){
	ll n,k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i=0;i<n;i++) {
		cin >> a[i];
	}
	ll plusm = 0;
	vector<int> ini(n,0), plus(n,0);
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			if(a[i] > a[j]) {
				plus[i]++;
			}
		}
		plusm += plus[i];
		plusm %= MOD;
	}
	ll inim = 0;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			if(a[i] > a[j]) {
				ini[i]++;
			}
		}
		inim += ini[i];
		inim %= MOD;
	}
	ll sum = 0;
	sum += (inim*k);
	sum %= MOD;
	ll tmp = ((k-1)*k/2)%MOD;
	sum += (plusm*tmp)%MOD;
	sum %= MOD;
	cout << sum << endl;

}

Measured memory_bytes: 256
A, V = gets.split.map(&:to_i)
B, W = gets.split.map(&:to_i)
T = gets.to_i

if W >= V
  puts "NO"
  exit
end

if B > A
  if (V - W) * T >= (B - A)
    puts 'YES'
  else
    puts 'NO'
  end
else
  if (V - W) * T >= (A - B)
    puts 'YES'
  else
    puts 'NO'
  end
end


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
typedef pair<ll, ll> P;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

class UnionFind {
public:
    // 親の番号を格納する。親だった場合-size
    vector<int> parents;

    UnionFind(int n) {
        parents = vector<int>(n, -1);
    }

    // aがどのグループに属しているか
    int root(int a) {
        if (parents[a] < 0) {
            return a;
        }
        return parents[a] = root(parents[a]);
    }

    int size(int a) {
        return -parents[root(a)];
    }

    // aとbをくっつける
    bool connect(int a, int b) {
        int ra = root(a);
        int rb = root(b);
        if (ra == rb) {
            return false;
        }
        // 大きいほうにA
        if (size(ra) < size(rb)) {
            swap(ra, rb);
        }
        parents[ra] += parents[rb];
        parents[rb] = ra;
        return true;
    }

    bool is_union(int a, int b) {
        int ra = root(a);
        int rb = root(b);
        return ra == rb;
    }

    set<int> roots() {
        set<int> res;
        rep(i, parents.size()) if (i == root(i)) res.insert(i);
        return res;
    }

};


int main() {
    ll n, m;
    cin >> n >> m;

    vector<ll> values(n);
    rep(i, n)cin >> values[i];
    vector<P> edges(m);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
//        a--;
//        b--;
        edges[i].first = a;
        edges[i].second = b;
    }

    UnionFind uf(n);
    for (P p : edges) uf.connect(p.first, p.second);

    set<int> roots = uf.roots();
    if (roots.size() == 1) {
        cout << 0 << endl;
        ret();
    }

    map<int, vector<int>> children;
    rep(i, n) children[uf.root(i)].push_back(i);

    map<int, ll> min_vv;
    for (int p: roots) min_vv[p] = INF;
    rep(i, n) cmin(min_vv[uf.root(i)], values[i]);

    ll t = 0;
    for (auto e : min_vv) t += e.second;

    map<int, int> min_vi;
    rep(i, n) if (min_vv[uf.root(i)] == values[i]) min_vi[uf.root(i)] = i;

    set<int> min_vis;
    for (auto e : min_vi) min_vis.insert(e.second);

    vector<ll> v;
    rep(i, n) if (min_vis.find(i) == min_vis.end()) v.push_back(values[i]);
    sort(v.begin(), v.end());

    int f = 2 * (n - m - 1) - roots.size();

    if (f > v.size()) {
        cout << "Impossible" << endl;
        ret();
    }

    ll k = accumulate(v.begin(), v.begin() + f, 0ll);

    ll ans = k + t;
    cout << ans << endl;

}



Measured memory_bytes: 32640
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (s[0] == '0' || s[n - 1] == '1') {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - 2 - i]) {
      cout << -1;
      return 0;
    }
  }

  queue<int> zeros;
  vector<int> ones;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') zeros.push(i + 1);
    else ones.push_back(i + 1);
  }

  int prev = 1;
  for (int i = 1; i < ones.size(); i++) {
    cout << ones[i - 1] << ' ' << ones[i] << endl;
  }
  cout << ones[ones.size() - 1] << ' ' << n << endl;

  for (int i = 1; i < ones.size(); i++) {
    int feet = ones[i] - ones[i - 1] - 1;
    for (int j = 0; j < feet; j++) {
      cout << ones[i] << ' ' << zeros.front() << endl;
      zeros.pop();
    }
  }
  
}


Measured memory_bytes: 2040
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(void){
    double r;
  cin>>r;
  
  double m_pi=acos(-1);
  
  cout<<fixed<< setprecision(6);
  
  
  cout<<r*r*m_pi<<" "<<r*2*m_pi<<endl;
}


Measured memory_bytes: 3284
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC153A - Serval vs Monster

        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int a = sc.nextInt();

        System.out.println((h / a) + ((h % a > 0) ? 1 : 0));
    }
}

Measured memory_bytes: 25044
#include <iostream>

using namespace std;

int prime[100001];
int sum[100001];

int main() {
    ios::sync_with_stdio(false);

    for (int i = 2; i <= 100000; i++)
        prime[i] = true;
    
    for (int i = 2; i <= 100000; i++)
        if (prime[i])
            for (int j = i+i; j <= 100000; j += i)
                prime[j] = false;

    sum[0] = 0;
    for (int i = 1; i <= 100000; i++)
        sum[i] = sum[i-1] + (i%2 == 1 && prime[i] && prime[(i+1)/2]);

    int q;
    cin >> q;
    
    while (q--) {
        int a, b;
        cin >> a >> b;
        cout << sum[b] - sum[a-1] << endl;
    }
}


Measured memory_bytes: 1408
import numpy as np 
n = int(input())
if n  < 2:
    print(0)
    exit()
e = [[int(i) for i in input().split()] for i in range(2)]
e3 = np.array(e)
a = np.sort((e3[0] - e3[1]))
print(a[a>0].sum())

Measured memory_bytes: 20644
(let ((a (read))
    (b (read))
    (ans 0))
    (setq ans (+ a b))
    (if (< ans (- a b))
        (setq ans (- a b))
    )
    (if (< ans (* a b))
        (setq ans (* a b))
    )
    (princ ans)
)

Measured memory_bytes: 24220
#include<stdio.h>

int main(){

int L,A,B,C,D;
int t1,t2;
scanf("%d",&L);
scanf("%d",&A);
scanf("%d",&B);
scanf("%d",&C);
scanf("%d",&D);

t1=A/C;if(A%C!=0)t1++;
t2=B/D;if(B%D!=0)t2++;

if(t2>t1)t1=t2;

L=L-t1;
printf("%d\n",L);
return 0;
}

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

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

  cout << a / b << " ";
  cout << a % b << " ";

  double f1, f2;
  cout << fixed << setprecision(6);
  f1 = a;
  f2 = b;
  cout << f1 / f2 << endl;
}



Measured memory_bytes: 3244
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin >> x >> y;
        if(x == 0 && y == 0)break;
    if(x < y){
        cout << x << " " << y << endl;
    }else{
        cout << y << " " << x << endl;
    }
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
struct edge{ll to, cost;};
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1000000000000
#define ALL(a)  (a).begin(),(a).end()
#define large 1000000000000000000
 
int main(){
    ll n;
    cin >> n;
    ll a[n+10];
    ll ans = 1;
    bool ok = true;
    bool zero = false;
    for(ll i = 0; i < n; i++){
        ll temp;
         cin >> temp;
         if(temp == 0){
             cout << 0 << endl;
             return 0;
         }
         a[i]= temp;
    }
  ll prev = large;
  for(int i = 0; i < n; i++){
    if(a[i] > prev){
            //ans = -1;
            ok = false;
            break;
    }
    else{
        ans *= a[i];
        prev = large / ans;}
    }
  if(ok) cout << ans << endl;
  else cout << -1 << endl;
  return 0;
 
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  
  int cnt = 0;
  while (a >= b) {
    b *= 2;
    cnt++;
  }
  while (b >= c) {
    c *= 2;
    cnt++;
  }
  
  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3628
/*
   Created by Rahul Goel.
*/
/*******************************************************************************/
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
/*******************************************************************************/
using namespace std;
using ll = long long;
using ld = long double;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
/*
.-.. . -. -.- .- / .. ... / .-.. --- ...- . -.-.--
 */
/* For PBDS */
/*Two new methods X.order_of_key() and X.find_by_order()*/
/*
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*******************************************************************************/
ll mod_sum() { return 0LL; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_prod(T a, Args... args) { return (a*mod_prod(args...))%mod; }
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/

/*
    Code begins after this.
*/


ll solve(){
    ll n;
    cin >> n;
    string str;
    while(n > 0)
        n--, str += 'a' + n%26, n/=26;
    reverse(all(str));
    cout << str << endl;
    return 0;
}


signed main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}

/*******************************************************************************/
// Remeber - In a custom comparator cmp(a, b) a==b must always return to false.


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N, M;
vector<int> G[1010], col;

bool dfs(int v, int c) {
    if (col[v]) return (col[v] == c);
    col[v] = c;
    for (auto nv : G[v]) if (!dfs(nv, -c)) return false;
    return true;
}

void _main() {
    while (cin >> N >> M, N) {
        REP (i, N) G[i].clear();
        REP (i, M) {
            int u, v;
            cin >> u >> v;
            u--; v--;
            G[u].push_back(v);
            G[v].push_back(u);
        }
        set<int> ans;
        col.assign(N, 0);
        if (dfs(0, 1)) {
            int sum = 0;
            REP (i, N) sum += (col[i] == -1);
            if (sum % 2 == 0) ans.insert(sum / 2);
        }
        col.assign(N, 0);
        if (dfs(0, -1)) {
            int sum = 0;
            REP (i, N) sum += (col[i] == -1);
            if (sum % 2 == 0) ans.insert(sum / 2);
        }
        cout << ans.size() << endl;
        for (int v : ans) cout << v << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


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

#define mod 1000000007
using namespace std;

double dp[3001][3001];
vector<double> ar;

double func(int n, int heads){
    if (heads == 0) {
        return 1;
    }
    if (n == 0) {
        return 0;
    }
    if (heads > n) {
        return 0;
    }
    if (dp[n][heads] > -0.9) {
        return dp[n][heads];
    }
    return dp[n][heads] = ar[n]*func(n-1,heads-1) + (1-ar[n])*func(n-1,heads);
}

int main(){
    memset(dp, -1, sizeof(dp));
    int n;
    cin>>n;
    double x;
    ar.push_back(0);
    for (size_t i = 0 ; i < n; i++) {
        cin>>x;
        ar.push_back(x);
    }
    std::cout << setprecision(10)<< func(n, (n+1)/2) << endl;
}


Measured memory_bytes: 74308
W,H,N = map(int,input().split())
dl = (0,0)
ur = (W,H)
for i in range(N):
    x,y,a = map(int,input().split())
    if a==1:
        dl = (max(dl[0],x),dl[1])
    elif a==2:
        ur = (min(ur[0],x),ur[1])
    elif a==3:
        dl = (dl[0],max(dl[1],y))
    else:
        ur = (ur[0],min(ur[1],y))
print(max((ur[0]-dl[0]),0)*max((ur[1]-dl[1]),0))



Measured memory_bytes: 38256
n, a, b = map(int, input().split())

lm = min(n, 2*10**5)

# ①nCrの各項のmod(10^9+7)を事前計算
p = 10 ** 9 + 7
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, lm + 1):
  fact.append((fact[-1] * i) % p)
  inv.append((-inv[p % i] * (p // i)) % p)
  factinv.append((factinv[-1] * inv[-1]) % p)

# ②事前計算した項を掛け合わせ
def cmb(n, r, p):
  if (r < 0) or (n < r):
    return 0
  r = min(r, n - r)
  rt = 1
  for i in range(r):
    rt = (rt * (n-i)) % p
  rt = rt*factinv[r] % p
  return rt

def pow_r(x, n, p):
  """
  O(log n)
  """
  if n == 0:  # exit case
    return 1
  if n % 2 == 0:  # standard case ① n is even
    return pow_r(x ** 2 % p, n // 2, p)
  else:  # standard case ② n is odd
    return x * pow_r(x ** 2 % p, (n - 1) // 2, p) % p

rlt = pow_r(2,n,p)
  
rlt -= 1


rlt -= cmb(n,a,p) % p
rlt -= cmb(n,b,p) % p

while rlt < 0:
  rlt += p

print(rlt)

Measured memory_bytes: 80880
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i <= 999; i++) {
		string num = to_string(i);
		while (num.size() != 3) num = '0' + num;
		int p = 0;
		for (int j = 0; j < n; j++) {
			if (p < 3 && s[j] == num[p]) p++;
		}
		if (p == 3) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define itn int
signed main(){
  int k;
  string s;
  cin>>k>>s;
  if(k<s.size()){
    for(int i=0;i<k;i++){
      cout<<s[i];
    }
    cout<<"...\n";
  }
  else cout<<s<<"\n";
}


Measured memory_bytes: 3508
n, k = list(map(int, input().split(' ')))
#l = {}
#l[0] = 'P'
#def f(index):
#  return l[index] if index in l else 'B' + f(index-1) + 'P' + f(index-1) + 'B'
# print(f(50)) dead
    #P
   #BPPPB
  #BBPPPBPBPPPBB
 #BBBPPPBPBPPPBBPBBPPPBPBPPPBBB
#BBBBPPPBPBPPPBBPBBPPPBPBPPPBBBPBBBPPPBPBPPPBBPBBPPPBPBPPPBBBB
# length(x) = 2 * length(x-1) + 3
lens = {}
lens[0] = 0
lens[1] = 1
for i in range(2,52):
  lens[i] = lens[i-1] * 2 + 3
memo = {}
def sumP(level, index):
  key = (level, index)
  if key in memo:
    return memo[key]
  if level <= 0 or index <= 0:
    memo[key] = 0
  elif level == 1 and index == 1:
    memo[key] = 1
  elif index == lens[level] // 2 + 1:  # ど真ん中のPを入れて一つ下全部(index-1は左端のB)
    memo[key] = 1 + sumP(level-1, index-1)
  elif index < lens[level] // 2 + 1:  # レベル一つ下の奴の一部分のみ
    memo[key] = sumP(level-1, index-1)
  else: # レベル一つ下の奴の丸々1つ + P + レベル一つ下の奴の一部分もしくは全部
    memo[key] = sumP(level-1, lens[level-1]) + 1 + sumP(level-1, index-lens[level-1]-2)
  return memo[key]
print(sumP(n+1, k))  # level 1ずれてる！

#BBPPPBPBPPPBB = 13 

  

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string c;
  cin>>c;
  if(c=="a"||c=="e"||c=="i"||c=="o"||c=="u"){
    cout<<"vowel"<<endl;
  }else{
    cout<<"consonant"<<endl;
  }
}

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

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

  int n; cin >> n;
  vector<int> t(n+1),x(n+1),y(n+1);
  for(int i = 1; i <= n; i++){
    cin >> t[i] >> x[i] >> y[i];
  }

  t[0] = x[0] = y[0] = 0;
  for(int i = 0; i < n; i++){
    int m = abs(x[i]-x[i+1])+abs(y[i]-y[i+1]);
    if(abs(m - (t[i+1]-t[i]))%2 != 0 || m > (t[i+1]-t[i])){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

using namespace std;

int gcd(int a, int b) {
  while (a > 0 && b > 0) {
    if (a > b) a %= b;
    else b %= a;
  }
  return a+b;
}

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

  int n, a;
  cin >> n;
  int res = 0;
  while (n--) {
    cin >> a;
    res = gcd(res, a); 
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int m,f,r;
  while(1){
    scanf("%d %d %d",&m,&f,&r);
    if(m==-1 && f==-1 && r==-1)break;
    else if(m+f<30 ||m==-1 ||f==-1)printf("F\n");
    else if((m+f>=50 && m+f<65) || r>=50){
      printf("C\n");
      continue;
    }
    else if(m+f>=30 && m+f<50)printf("D\n");
    else if(m+f>=65 && m+f<80)printf("B\n");
    else if(m+f>=80)printf("A\n");
  }
    return 0;
}

Measured memory_bytes: 584