akhauriyash/Code-Regression huggingface dataset:
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let H = read!(usize);
    let W = read!(usize);

    println!("{}", (N + 1 - H) * (N + 1 - W))
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

using namespace std;
using namespace atcoder;
using ll = long long;

int main() {
    int n;
    cin >> n;
    rep(i,n) cout << "ACL";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.*;
import java.lang.*;
import java.io.*;

class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int arr[] = new int[n];
    for(int i = 0;i < n;i++){
      arr[i] = sc.nextInt();
    }
    
    Arrays.sort(arr);
    
    int x = 0;
    for(int i = 0;i < n-1;i++){
      x += arr[i];
    }
    if(arr[n-1]>x){
      System.out.println("No");
    }
    else if(arr[n-1]==x){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }

  }

}



Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repm(i,m,n) for (int i = m; i < (n); i++)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
  int N, i;
  cin >> N >> i;
  
  cout << N-i+1 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 
 * @author ??\???
 *
 */
class Main {
	/**
	 * ?????? ??????????????°????????§???2?????????????????????????????????????´???°?????????????????????????????¨???????????? ??¬???
	 * 
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args)
			throws IOException {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		boolean[] primeIs = new boolean[1000000];
		int[] count = new int[1000000];

		int cnt = 0;

		for (int i = 2; i < 1000000; i++) {

			primeIs[i] = true;
		}

		for (int i = 2; i < 1000000; i++) {
			if (primeIs[i]) {
				cnt++;

				for (int j = i
						* 2; j < 1000000; j += i) {

					primeIs[j] = false;
				}
			}

			count[i] = cnt;
		}

		String s;
		while ((s = br.readLine()) != null) {
			System.out.println(count[Integer
					.parseInt(s)]);
		}
	}

}

Measured memory_bytes: 30136
#include <bits/stdc++.h>
using namespace std;
int p[2][200005], rk[2][200005];
unordered_map<int,unordered_map<int,int> > m;
void init(int n){
    for (int i = 0; i < n; i++){
        p[0][i] = p[1][i] = i;
        rk[0][i] = rk[1][i] = 0;
    }
}
int findset(int id, int x){
    return p[id][x] == x ? x : p[id][x] = findset(id,p[id][x]);
}
void unionset(int id ,int x, int y){
    x = findset(id,x), y = findset(id,y);
    if (x == y) return;
    if (rk[id][x] < rk[id][y]){
        p[id][x] = y;
    }
    else{
        p[id][y] = x;
        if (rk[id][x] == rk[id][y]) rk[id][x]++;
    }
}
int main(){
    int n,k,l;
    scanf("%d%d%d",&n,&k,&l);
    init(n);
    for (int i = 0; i < k; i++){
        int a,b;
        scanf("%d%d",&a,&b);
        a--; b--;
        unionset(0,a,b);
    }
    for (int i = 0; i < l; i++){
        int a,b;
        scanf("%d%d",&a,&b);
        a--; b--;
        unionset(1,a,b);
    }
    int a[n], b[n];
    for (int i = 0; i < n; i++){
        a[i] = findset(0,i);
        b[i] = findset(1,i);
        m[a[i]][b[i]]++;
    }
    for (int i = 0; i < n; i++){
        printf("%d ",m[a[i]][b[i]]);
    }
}


Measured memory_bytes: 32840
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,st,sr;
	int a=0,i;
	cin>>s>>st;
	sr=s+st;
	for (i=0; i<sr.length(); i++)
		a=a*10+sr[i]-49+1;
	if (sqrt(a)==float(sqrt(a))) cout<<"Yes";
	else cout<<"No";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define N 200001
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,m,k,ans,x[N],y[N],mov[N];
set<int> zx[N];
set<int>::iterator p;
int main()
{
	re(n),re(m),re(k);
	ans=n;
	for(int i=1;i<=k;++i)
	{
		re(x[i]),re(y[i]);
		zx[x[i]].insert(y[i]);
	}
	mov[1]=1;
	int nx=1,ny=1;
	while(nx<n)
	{
		++nx;
		if(zx[nx].count(ny))
		{
			ans=min(ans,nx);
			break;
		}
		p=zx[nx].upper_bound(ny);
		if(p==zx[nx].end() || ny+1!=*p)
			++ny;
		mov[nx]=ny;
	}
	for(int i=1;i<=k;++i)
		if(mov[x[i]-1]>=y[i])
			ans=min(ans,x[i]-1);
	printf("%d\n",ans);
}


Measured memory_bytes: 21376
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define pb push_back
#define inf 1e16
#define mod 998244353
#define en '\n'
#define ld long double
#define ff first
#define ss second
#define ull unsigned long long 
#define fr(a,b,c) for(int a = b ; a <= c ; a ++ )
const ll MAXN = 200010;
ll pw(ll b, ll r, ll md){
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%md;
		b = (b*b)%md;
		r>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s;cin>>s;
	ll ans = 0 ; 
	ll n = s.length();
	ll arr[2020];memset(arr,0,sizeof arr);
	ll sep[2020];memset(sep,0,sizeof sep);
	ll counter = 0 ; 
	sep[0]=arr[0]=1;
	fr(i,0,n-1){
		counter = (counter*10+(s[i]-'0'))%2019;
		memset(arr,0,sizeof arr);
		fr(j,0,2018){
			arr[(j*10)%2019]+=sep[j];
		}

		ans+=arr[counter];
		arr[counter]++;
		fr(j,0,2018)sep[j]=arr[j];
	}
	cout<<ans<<en;
	return 0 ; 
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int cnt[10] = {};
  int n;
  REP(i,4){
    cin>>n;
    cnt[n]++;
  }
  bool flag = true;
  REP(i,10){
    if(i==1 || i==9 || i==7 || i==4){
      if(cnt[i]==1){
        continue;
      }else{
        flag = false;
        break;
      }
    }else{
      if(cnt[i]==0){
        continue;
      }else{
        flag = false;
        break;
      }
    }
  }
  if(flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	string s;
	cin>>s;
	rp(i,0,s.size()-1)cout<<'x';
	return 0;
}/*『你强归你强，Siyuan比你强』*/





Measured memory_bytes: 384
def ef(x):
  l, r = 1, 1000000000
  while l < r:
    mid = (l + r) // 2
    if mid * mid < x:
      l = mid + 1
    else:
      r = mid
  return l

S = int(input())
x = [0, 0, 0]
y = [0, 0, 0]
x[1] = ef(S)
y[2] = x[1]
if x[1] * (x[1] - 1) >= S:
  x[1] -= 1
c = x[1] * y[2] - S
x[2], y[1] = 1, c
for i in range(3):
  print(x[i], y[i], end='')
  if i == 2:
    print()
  else:
    print(end=' ')


Measured memory_bytes: 38256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define mem(dp,a) memset(dp,a,sizeof dp);
#define all(a) a.begin(),a.end()
#define sall(a) sort(all(a))
#define X first
#define Y second
typedef long long int ll;
typedef pair<ll,ll> pp;

#define debug(x) cout << #x << " :: "<< x <<"\n";
#define debug2(x,y) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\n";
#define debug3(x,y,z) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\t" << #z << " :: " << z << "\n";
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree< pp , null_type,less< pp >, rb_tree_tag,tree_order_statistics_node_update>

ll power(ll b, ll exp){
    ll res = 1;
    while(exp > 0){
        if(exp % 2){
            res = 1LL * res * b % mod;
        }
        b = 1LL * b * b % mod;
        exp /= 2;
    }
    return res;
}

int main()
{
    boost
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll ans=0,sum=0;
    for(ll i=0;i<n;i++) {
        cin >> a[i];
        sum+=a[i];
    }
    for(ll i=0;i<n;i++) {
        sum-=a[i];
        ll temp=((sum%mod)*(a[i]%mod))%mod;
        ans = ( (ans%mod) + (temp%mod) )%mod;
    }
    cout << ans ;
    return 0;
}


Measured memory_bytes: 4760
import java.util.Scanner;
class Main {
  static public void main(String[] args) {
    Scanner sc = new Scanner(System.in);
      String S = sc.next();
    switch (S) {
      case "SRR": System.out.println("2"); break;
      case "RRS": System.out.println("2"); break;
      case "RRR": System.out.println("3"); break;
      case "RSR": System.out.println("1"); break;
      case "SSS": System.out.println("0"); break;
      case "SSR": System.out.println("1"); break;
      case "SRS": System.out.println("1"); break;
      case "RSS": System.out.println("1"); break;
    }
  }
}

Measured memory_bytes: 35872
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define nl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

const int N=2e5+11;
const int M=1e6+1;
const int inf=2e9+1;
const ld EPS=1e-6;
const ll INF=1e18;
const ll mod=/*998244353*/1e9+7;
const int dx[8]={0,0,-1,1,-1,1,1,-1};
const int dy[8]={-1,1,0,0,1,-1,1,-1};

ll dv[M];
int used[M];
int a[M];

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0),cout.tie(0);
  for(ll i=1;i<=1000000;i++){
    dv[i]=inf;
    used[i]=0;
  }
  for(ll i=2;i<=1000000;i++){
    if(dv[i]==inf){
      dv[i]=i;
      for(ll j=i*i;j<=1000000;j+=i){
        dv[j]=min(dv[j],i);
      }
    }
  }
  int n;
  cin>>n;
  int g=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    g=__gcd(g,a[i]);
  }
  if(g!=1){
    cout<<"not coprime";
  }
  else{
    for(int i=1;i<=n;i++){
      if(a[i]==1)continue;
      int x=a[i];
      while(x>1){
        if(used[dv[x]]){
          cout<<"setwise coprime";
          return 0;
        }
        used[dv[x]]=1;
        int p=dv[x];
        while(x%p==0){
          x/=p;
        }
      }
    }
    cout<<"pairwise coprime";
  }
}


Measured memory_bytes: 19208
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int N, l, r, sum = 0;
      cin >> N;
      for(int i = 0; i < N; i++){
      	cin >> l >> r;
      	sum += r - l + 1;
      }
      cout << sum << endl;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool check(string str)
{
	int size = str.size();
	for(int i=0, j = size - 1; i < size / 2 && i < j; i++, j--)
	{
		if(str[i] != str[j]) return false;
	}
	return true;
}
int main()
{
	int a, b, cnt = 0;
	cin >> a >> b;
	for(int i=a; i<=b; i++)
	{
		string temp;
		int he = i;
		while(he)
		{
			temp += (he % 10) + '0';
			he /= 10;
		}
		if(check(temp)) cnt ++;
	}
	cout << cnt << '\n';
}

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

using namespace std;

int N, L[2005], ANS, T;

int main(void)

{

	ios::sync_with_stdio(false);

	cin.tie(NULL);

	cin >> N;

	for (int i = 0; i < N; i++)

	{

		cin >> L[i];

	}

	sort(L, L + N);

	for (int i = 0; i < N; i++)

	{

		for (int j = i + 1; j < N-1; j++)

		{

			T = lower_bound(L + j + 1, L + N, L[i] + L[j]) - L;

			if (T!=N)

			{

				ANS += T - j - 1;

			}

			else if (L[i]+L[j]>L[N-1])

			{

				ANS += T - j - 1;

			}

		}

	}

	cout << ANS << endl;

	return 0;

}

Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(1,n-1):
    pre = p[i-1]
    center = p[i]
    post = p[i+1]
    if pre < center < post or pre > center > post:
        count += 1
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> v(n), c(n);
  for(int i=0;i<n;i++){
    cin>>v.at(i);
  }
  for(int j=0;j<n;j++){
    cin>>c.at(j);
  }
  int sum=0;
  for(int k=0;k<n;k++){
    if(v.at(k)-c.at(k)>0){
      sum+=v.at(k)-c.at(k);
    }
  }
  cout<<sum;
}
  

Measured memory_bytes: 256
from collections import deque, Counter
from itertools import chain, combinations
import json
import bisect
import sys
import math

sys.setrecursionlimit(10 ** 8)
# mem = {}

M = 10 ** 9 + 7

mem = {}


def gcd(a, b, c):
    if (a, b, c) not in mem:
        mem[(a, b, c)] = math.gcd(math.gcd(a, b), c)
    return mem[(a, b, c)]


def main():
    K = int(input())
    t1 = 0
    for a in range(1, K + 1):
        for b in range(a + 1, K + 1):
            for c in range(b + 1, K + 1):
                t1 += gcd(a, b, c) * 6
    t2 = 0
    for ab in range(1, K + 1):
        for c in range(ab + 1, K + 1):
            t2 += math.gcd(ab, c) * 6
    t3 = 0
    for abc in range(1, K + 1):
        t3 += abc
    print(t1 + t2 + t3)


if __name__ == "__main__":
    main()


Measured memory_bytes: 296136
#include <bits/stdc++.h>
#define mid (tl+tr)/2
#define mod 1000000007
#define fain(arr) for(int i=0;i<n;i++)cin>>arr[i];
#define all(x) x.begin(),x.end()
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bugv(n1) if(DEBUG)cout<<#n1<<" is "<<n1<<'\n';
#define buga(A) cout<<#A<<" is :"<<endl ; for(auto x:A)cout<<x<<" "; cout<<endl;
#define FILE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ll long long 
#define pii pair<int,int>
#define pll pair<long long ,long long >
#define pi acos(-1)
#define sz(x) ((int)x.size())
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define DEBUG true
using namespace std;


bool isPal(string s){
	int i=0;
	int j =s.length()-1;

	while(i<j){
		if(s[i]!=s[j])return false;
		i++;
		j--;
	}
	return true;
}

int main(){
	// FILE;
	SPEED;
	string s;
	cin>>s;

	int n = s.length();

	bool flag=true;

	if(!isPal(s))flag=false;

	if(!isPal(s.substr(0,(n-1)/2)))flag=false;

	if(!isPal(s.substr(n/2+1,(n-1)/2)))flag=false;

	if(flag){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}


}


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

signed main(void)
{
	int x, i, now;
	cin >> x;
	now = 0;
	i = 0;
	while (now < x)
	{
		i++;
		now += i;
	}
	cout << i << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a - b >= c) {
			System.out.println(0);
		} else {
			System.out.println(c - (a - b));
		}
	}
}

Measured memory_bytes: 21460
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 ln             PIC X(43).
01 A              PIC 9(10).
01 B              PIC 9(10).
01 C              PIC 9(10).
01 K              PIC 9(10).
01 ans            PIC S9(10).
01 zs             PIC -(10)9.

PROCEDURE DIVISION.
  ACCEPT ln.
  UNSTRING ln DELIMITED BY SPACE INTO A B C K.
  IF K <= A
      COMPUTE ans = K
  ELSE
      IF K <= A + B
          COMPUTE ans = A
      ELSE
          COMPUTE ans = A - (K - A - B)
      END-IF
  END-IF.
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


Measured memory_bytes: 3852
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

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

    if ((int)s.size() <= k) {
        cout << s;
        return 0;
    }

    cout << s.erase(k) << "...";


    

    return 0;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
#Tenka1 Programmer Beginner Contest D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
lst = [3]
tmp = 3
if n == 1:
    print('Yes')
    print(2)
    print(1,1)
    print(1,1)
    quit()
for _ in range(500):
    x = lst[-1] + tmp
    lst.append(x)
    tmp += 1
if n not in lst:
    print('No')
else:
    print('Yes')
    x = lst.index(n) + 3
    print(x)
    lst = [[] for _ in range(x-1)]
    tmp = 0
    cnt = 0
    for i in range(1,n+1):
        lst[tmp].append(i)
        if cnt == tmp:
            tmp += 1
            cnt = 0
            continue
        cnt += 1
    ans = [[] for _ in range(x)]
    tmp = 0
    for i in range(x-1):
        for j in range(tmp):
            ans[i].append(lst[tmp][j])
        for j in range(tmp,x-1):
            ans[i].append(lst[j][tmp])
        tmp += 1
    for i in range(x-1):
        ans[-1].append(lst[i][-1])
    for i in range(x):
        print(x-1,*ans[i])


Measured memory_bytes: 48604
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define INF (ll) 1e18
# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


int main(){
    IOS;
    make(ll,n);
    makevec(ll,vec,n);
    vector <ll> dp(n+1,INF);
    dp[0]=0;
    for(ll i=1;i<n;i++){
        for(ll j=i-1;j>=max((ll)0,i-2);j--){
            dp[i]=min(dp[i],dp[j]+abs(vec[i]-vec[j]));
        }
    }
    cout<<dp[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 1792
# coding: utf-8

# https://atcoder.jp/contests/abc107
# 14:34 chudan
# 2020/07/10 retry 12:54-


def main():
    N, K = map(int, input().split())
    xs = list(map(int, input().split()))

    if xs == [0]:
        return 0

    for i in range(N):
        if xs[i] == 0:
            del xs[i]
            N -= 1
            K -= 1
            break

    if xs[0] > 0:
        xs.insert(0, 0)
        s = 0
    elif xs[N-1] < 0:
        xs.append(0)
        s = N
    else:
        for i in range(N-1):
            if xs[i] < 0 and xs[i+1] > 0:
                xs.insert(i+1, 0)
                s = i+1
                break
    N += 1

    candidates = []
    # from left to right
    if s > K-1:
        l = s-K
        r = s
        d = xs[r] - xs[l]
    else:
        l = 0
        r = K
        d = (xs[s] - xs[l]) + (xs[r] - xs[l])
    candidates.append(d)

    # print(candidates)
    while l < s and r < N-1:
        if r == s:
            d = d - (xs[l+1]-xs[l]) + (xs[r+1]-xs[l+1])
        else:
            d = d - 2*(xs[l+1]-xs[l]) + (xs[r+1]-xs[r])
        candidates.append(d)
        # print(l, r, d)
        l += 1
        r += 1

    # print("="*10)
    # from right to left
    if s+K < N:
        l = s
        r = s+K
        d = xs[r] - xs[l]
    else:
        l = N-(K+1)
        r = N-1
        d = (xs[r]-xs[s]) + (xs[r]-xs[l])
    candidates.append(d)

    # print(candidates)
    while l > 0 and r > s:
        if l == s:
            d = d - (xs[r]-xs[r-1]) + (xs[r-1]-xs[l-1])
        else:
            d = d - 2*(xs[r]-xs[r-1]) + (xs[l]-xs[l-1])
        candidates.append(d)
        # print(l, r, d)
        l -= 1
        r -= 1

    # print(candidates)
    return min(candidates)

    # ds = [None] * N
    # for i in range(N):
    #     ds[i] = xs[i+1]-xs[i]


# def main():
#     N, K = map(int, input().split())
#     x = list(map(int, input().split()))

#     if x[-1] <= 0:
#         n_l = N
#         n_r = 0
#         l_start = N-1
#         r_start = None  # all <= 0
#     else:
#         for i in range(N):
#             if x[i] > 0:
#                 n_l = i
#                 n_r = N-i
#                 l_start = i-1 if i > 0 else None  # all > 0
#                 r_start = i
#                 break

#     # left -> right
#     t = []
#     if r_start is None:  # 左に直進するのみ
#         t.append(-x[l_start-K+1])
#     else:
#         n = max(K-n_r, 0)
#         tim = -x[l_start-n+1]*2 + x[K-n]
#         t.append(tim)
#         for n in range(max(K-n_r, 0)+1, n_l+1):
#             tim += 2*(x[l_start-n+1]-x[l_start-n])
#             tim -= x[l_start+K-n]-x[l_start+K-n-1]
#             t.append(tim)

#     # right -> left
#     s = []
#     if l_start is None:  # 右に直進するのみ
#         s.append(x[r_start+K-1])
#     else:
#         m = max(K_n_l, 0)
#         tim = x[r_start+n-1]*2 + 


print(main())


Measured memory_bytes: 20100
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/13 17:07:47
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 2e5 + 5;

int n, k, c;
char s[N];
int nxt[N], last[N];

void run() {
    cin >> n >> k >> c;
    cin >> (s + 1);
    int t = 0;
    int now;
    for (int i = 1, j; i <= n; i = j) {
        now = i;
        j = i + c + 1;
        while (j <= n && s[j] == 'x') ++j;
        if (j <= n) {
            nxt[i] = j;
            last[j] = i;
            ++t;
        }
    }
    ++t;
    if (t != k) {
        return;
    }
    vector <int> pre(n + 2);
    for (int i = 1; i <= n + 1; i++) {
        pre[i] = pre[i - 1] + (s[i] == 'o');
    }
    vector <int> ans;
    int rb = n + 1;
    for (int i = now; i; i = last[i]) {
        if (rb == i || pre[rb] - pre[i] == 0) {
            ans.push_back(i);
        }
        for (int j = min(rb, i + c); j >= i; j--) {
            if (s[j] == 'o') {
                rb = j - c - 1;
                break;
            }
        }
    }
    sort(all(ans));
    for (auto it : ans) cout << it << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    map<string, int> m;
    int n;
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << m.size() << endl;
    return 0;
}

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

using namespace std;
int main() {
   int m,n,k;
   cin>>n>>m>>k;
   vector<string> a(n),b(n);
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=0;i<(1<<n);i++)
   {
       for(int j=0;j<(1<<m);j++)
       {
           for(int x=0;x<n;x++)b[x]=a[x];
           
           int c=0;
           for(int x=0;x<n;x++)
           {
               for(int y=0;y<m;y++)
               {
                   if(b[x][y]=='#')c++;
               }
           }
           
           int ind=0,tp=i;
           while(tp)
           {
               if(tp&1)
               {
                   for(int x=0;x<m;x++)
                   {
                       if(b[ind][x]=='#')
                       {
                           c--;
                           b[ind][x]='.';
                       }
                   }
               }
               tp=(tp>>1);
               ind++;
           }
           
           ind=0;tp=j;
           while(tp)
           {
               if(tp&1)
               {
                   for(int x=0;x<n;x++)
                   {
                       if(b[x][ind]=='#')
                       {
                           c--;
                           b[x][ind]='.';
                       }
                   }
               }
               tp=(tp>>1);
               ind++;
           }
           if(c==k)
           {
               ans++;
           }
       }
   }
   cout<<ans;
}

Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#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 rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

int main(){
  itn n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b(n);
  rep(i,n) b[i]=i;
  ll ans=0;
  rep(i,n){
    if(a[i]>b[i]||(i>0&&a[i-1]+1<a[i])){
      cout << -1 << endl;
      return 0;
    }
    else if(i!=0&&a[i]==a[i-1]+1) ans++;
    else ans+=a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4772
#include<bits/stdc++.h>
using namespace std;
int k,la;
string s,a[55555];
int main(){
	cin >> s >> k;
	int n = s.length();
	for(int l=1; l<=k; l++)
	for(int i=0; i+l<=n; i++)
		a[la++] = s.substr(i,l);
	sort(a,a+la);
	unique(a,a+la);
	cout << a[k-1] << endl;
	return 0;
}


Measured memory_bytes: 1920
#include<stdio.h>
#include<string.h>
char stop,ans[15],c[15]; 
int len,str;
int main()
{int s;
scanf("%s",c);
len=strlen(c);
	for(int i=0;i<=len;i++)
	{
			stop=c[i];
		if(stop=='B')
		{if(str>0)
			{
			str--;
			ans[str]='\0';
		}}
	else{ans[str]=stop;
			str++; 	
		}
	}
printf("%s",ans);

}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    String str = sc.next();
    StringBuilder ret = new StringBuilder();
    for (int i = 0; i < str.length(); i++) {
      ret.append("x");
    }
    System.out.println(ret.toString());
  }
}


Measured memory_bytes: 24276
import java.util.*;
// warm-up
public class Main {

	static class Pair {
		int x=0, y=0;
		Pair(int a, int b) {
			x=a; y=b;
		}
	}

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		Pair[] r = {new Pair(a, a+w), new Pair(b, b+w)};
		if (r[0].x>r[1].y) { Pair t = r[0]; r[0]=r[1]; r[1]=t; }
		System.out.println(r[1].x-r[0].y>0 ? r[1].x-r[0].y : 0);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35764
import sys
readline = sys.stdin.readline
from collections import deque
def dfs(root):
    visited = [False] * n
    queue = deque([(0, root)])
    longest = (-1, -1)
    while queue:
        total_weight, node = queue.pop()
        if visited[node]:
            continue
        visited[node] = True
        longest = max(longest, (total_weight, node))
        for w, t in edges[node]:
            if not visited[t]:
                queue.append((total_weight + w, t))
    return longest
n = int(readline())
edges = [set() for _ in range(n)]
for _ in range(n - 1):
    s, t, w = map(int, readline().split())
    edges[s].add((w, t))
    edges[t].add((w, s))
_, ln = dfs(0)
ld, _ = dfs(ln)
print(ld)

Measured memory_bytes: 53084
from sys import exit
H,W,A,B = [int(n) for n in input().split()]
MOD = 10**9+7
NUM = 2*10**5

fact=[1]*(NUM+1)
factinv=[1]*(NUM+1)
for i in range(1,NUM+1):
    fact[i]=(fact[i-1]*i)%MOD

factinv[NUM]=pow(fact[NUM],MOD-2,MOD)
for i in range(NUM,0,-1):
    factinv[i-1]=(factinv[i]*i) % MOD
ans=0
for i in range(B,W):
    tmp0 = fact[i+H-A-1]
    tmp0 *= factinv[H-A-1]
    tmp0 %= MOD
    tmp0 *= factinv[i]
    tmp0 %= MOD

    tmp1 = fact[W-i-1+A-1]
    tmp1 *= factinv[W-i-1]
    tmp1 %= MOD
    tmp1 *= factinv[A-1]
    tmp1 %= MOD
    ans += (tmp0 * tmp1) % MOD
    ans %= MOD
print(ans)


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

ll h;
ll cnt=1;
ll A=1;
ll attack(int x){
  while(1){
  if(h==1){
    break;
  }
  if(h%2==1){
    h=(h-1)/2;
  }
  else{
    h=h/2;
  }
  A *=2;
  cnt += A;
  }
}
  

int main(){
  cin >> h;
  attack(h);
  cout << cnt <<endl;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string a;
  cin>>a;
  for(int i=0;i<a.size();i++){
  	if(a[i]=='?')
      a[i]='D';
  }
  cout<<a<<endl;
 return 0; 
}

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

int main(){
  int n;
  int a = 0;
  int b = 0;
  cin >> n;
  for (int i = 0; i < n; i++){
    string a_card, b_card;
    cin >> a_card >> b_card;
    transform(a_card.begin(), a_card.end(), a_card.begin(), ::tolower);
    transform(b_card.begin(), b_card.end(), b_card.begin(), ::tolower);
    if (a_card == b_card){
      a += 1;
      b += 1;
      continue;
    }
    int count = min(a_card.length(), b_card.length());
    for (int v = 0; v < count; v++){
      if (v == count - 1 && a_card[v] == b_card[v]){
        if (a_card.length() > b_card.length()){
          a += 3;
        }else{
          b += 3;
        }
      }
      
      if (a_card[v] > b_card[v]){
        a += 3;
        break;
      }else if(a_card[v] < b_card[v]){
        b += 3;
        break;
      }
    }
  }
  cout << a << " " << b << endl;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define N 10000
vector<int> f(N+1, 0);

int func(vector<int> A){
    int k = A[0]*A[0];
    if(A.size()>1) k += A[1]*A[1] + A[1]*A[0];
    if(A.size()>2) k += A[2]*A[2] + A[2]*A[0] + A[2]*A[1];
    return k;
}

int xyz(int x, int y, int z){
    return x*x + y*y + z*z + x*y + y*z + z*x;
}

void dfs(vector<int> A){
    prvec(A); pr(func(A));
    if(A.size()==3){
        int k = func(A);
        if(k<=N){
            if(A[0]==A[1] && A[0]==A[2]) f[k]++;
            else if(A[0]!=A[1] && A[0]!=A[2] && A[1]!=A[2]) f[k]+=6;
            else f[k] += 3;
        } 
        return;
    }else{
        while(func(A)<=N){
            int b = A.back();
            for(int i=b; func(A)+i*i<=N; i++){
                vector<int> B=A;
                B.push_back(i);
                dfs(B);
            }
            A[A.size()-1]++;
        }
    }
}

int main()
{
    int n; cin >> n;
    vector<int> a(3);
    int x=1;
    while(x*x < 10000){
        int y = x;
        while(x*x + x*y + y*y < 10000){
            int z = y;
            while(xyz(x, y, z) <= 10000){
                if(x==y && y==z) f[xyz(x, y, z)]++;
                else if(x!=y && y!=z && z!=x) f[xyz(x, y, z)] += 6;
                else f[xyz(x, y, z)] += 3;
                z++;
            }
            y++;
        }
        x++;
    }

    rep(i, n) pr(f[i+1]);
    return 0;}

Measured memory_bytes: 3636
/*
 * 2408.cc: Social
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50;

/* typedef */

typedef long long ll;

/* global variables */

ll bs[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < k; i++) {
    bs[i] = 0;
    int m;
    cin >> m;
    for (int j = 0; j < m; j++) {
      int bj;
      cin >> bj;
      bj--;
      bs[i] |= 1LL << bj;
    }
  }

  int r;
  cin >> r;

  ll bad = 0;

  for (int i = 0; i < r; i++) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    ll pq = (1LL << p) | (1LL << q);
    for (int j = 0; j < k; j++)
      if ((pq & bs[j]) == pq) {
	bad |= pq;
	break;
      }
  }

  int cnt = 0;
  while (bad) {
    if (bad & 1) cnt++;
    bad >>= 1;
  }

  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 1144
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		List<Integer> list0 = new ArrayList<>();
		List<Integer> list1 = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				list0.add(a[i]);
			} else {
				list1.add(a[i]);
			}
		}

		if (list1.isEmpty()) {
			System.out.println(list0.get(0));
			return;
		}

		StringBuilder sb = new StringBuilder();
		if (n % 2 == 0) {
			Collections.reverse(list1);
			for (int e : list1) {
				sb.append(e).append(' ');
			}
			for (int e : list0) {
				sb.append(e).append(' ');
			}
		} else {
			Collections.reverse(list0);
			for (int e : list0) {
				sb.append(e).append(' ');
			}
			for (int e : list1) {
				sb.append(e).append(' ');
			}
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}


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

using namespace std;
typedef long long ll;

int n;
ll A[100005];
ll B[65];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    cout << ((~0) & 1) << endl;
    cin >> n;
    ll sum = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> A[i];
        sum ^= A[i];
    }
    for (int i = 1; i <= n; ++i) {
        A[i] = A[i] & ~sum;
        for (int j = 60; j--;) {
            if ((A[i] >> j) & 1) {
                if (B[j] == 0) {
                    B[j] = A[i];
                    break;
                } else {
                    A[i] ^= B[j];
                }
            }
        }
    }
    ll x = 0;
    for (int i = 60; i--;)
        x = max(x, x ^ B[i]);
    cout << (x + (x ^ sum));
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using namespace std;

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

    string ans = "";

    /*
    ll digit = 1;
    ll exp26 = 26;
    while(true)
    {
        if(n <= exp26)
        {
            break;
        }
        n -= exp26;
        digit++;
        exp26 *= 26;
    }

    n--;
    while(n > 26)
    {
        ll r = n % 26;
        ans += 'a' + r;
        n /= 26;
    }
    ans += 'a' + n;

    while(ans.size() < digit)
    {
        ans += 'a';
    }

    reverse(ans.begin(), ans.end());
    */

    while(n > 0)
    {
        n--;
        ans += ('a' + n % 26);
        n /= 26;
    }
    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e6 + 5;

int n;
int a[N];
int have[N], mark[N];

void work()
{
	for(int i = 1; i < N; i++)
	{
		if(have[i])
		{
			if(have[i] >= 2)
				mark[i] = 1;
			for(int j = 2; i * j < N; j++)
				mark[i * j] = 1;
		}
	}
}

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		have[a[i]]++;
	}
	int ans = 0;
	work();
	for(int i = 1; i <= n; i++)
		ans += !mark[a[i]];
	cout << ans;
	return 0;
}


Measured memory_bytes: 20768
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359



int main() {
	ll H,W;
	ll N;
	ll HW[100][100];
	ll b = 0;
	ll c = 0;
	bool flag = false;
	ll a[100000];
	cin >> H >> W;
	cin >> N;
	REP(i, N) {
		cin >> a[i];
	}
	REP(i, N) {
		REP(j, a[i]) {
			
			HW[b][c] = i+1;
			if (flag == false) c += 1;
			else c -= 1;
			if (c > W-1 || c < 0) {
				if (flag == false)c -= 1;
				else c += 1;
				flag = !flag;
				b += 1;
			}

		}
	}
	REP(i, H) {
		REP(j, W) {
			cout << HW[i][j] << " ";
			if (j == W - 1)cout << endl;
		}
	}
	cin >> H;

	return 0;

	
}

Measured memory_bytes: 512
main = culcSurfaceArea
culcSurfaceArea = do
        x <- readLn
        h <- readLn
        if x == 0 && h == 0 then return ()
                            else do
                                print $ surfaceArea x h
                                culcSurfaceArea
surfaceArea x h = x^2 + 2 * x * h'
    where h' = sqrt $ (x/2)^2 + h^2

Measured memory_bytes: 3848
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

class BitMax:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] = max(self.table[i], x)
            i += i & -i

    def max(self, i):
        i += 1
        res = 0
        while i > 0:
            res = max(res, self.table[i])
            i -= i & -i
        return res

def main():
    n=int(input())
    hh=LI()
    aa=LI()
    dp=BitMax(n+1)
    for h,a in zip(hh,aa):
        dp.update(h,dp.max(h-1)+a)
    print(dp.max(n))

main()

Measured memory_bytes: 35332
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;


Int turn = 0;
string player[2] = {"First", "Second"};

void ok(){
  cout << player[turn] << endl;
  exit(0);
}

void ng(){
  cout <<  player[1^turn] << endl;
  exit(0);
}

Int n, a[216000];

//return gcd(a,b); calc x,y s.t ax + by = g
Int extEuclid(Int a, Int b, Int &x, Int &y){
  if(a == 0){
    x = 0;
    y = 1;
    return b;
  }
  Int g = extEuclid(b % a, a, y, x);
  x -= b/a * y;
  return g;
}

Int gcd(Int x, Int y){
  Int a, b;
  return extEuclid(x, y, a, b);
}


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

  while(true){
    int evencnt = 0;
    for(int i = 0;i < n;i++)evencnt += a[i] % 2 == 0;
    if(evencnt % 2 == 1)ok();
    if(n - evencnt > 1)ng();
    int oddpos = 0;
    while(a[oddpos] % 2 == 0)oddpos++;
    if(a[oddpos] == 1)ng();
    a[oddpos]--;
    Int g = 0;
    for(int i = 0;i < n;i++)g = gcd(g, a[i]);
    for(int i = 0;i < n;i++)a[i] /= g;
    turn ^= 1;
  }
  return 0;
}

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

using namespace std;

#define INF 1e9
#define MAXH 105
#define MAXW 105
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

int H,W,ans;
string D[MAXH];
int dx[2] = {0, -1}, dy[2] = {-1, 0}, memo[MAXH][MAXW];

bool isInside(int x, int y){
    return 0 <= x && x <= W && 0 <= y && y <= H;
}

int dfs(int x, int y){
    int res = INF;

    if(memo[y][x] != -1) return memo[y][x];

    rep(i, 2){
        if(isInside(x+dx[i], y+dy[i])){
            if(D[y][x] == '.' &&  D[y+dy[i]][x+dx[i]] == '#') res = min(res, dfs(x+dx[i], y+dy[i])+1);
            else res = min(res, dfs(x+dx[i], y+dy[i]));
        }
    }

    memo[y][x] = res;
    return res;
}

void solve(){
    --H, --W;

    ans = dfs(W, H);

    if(D[H][W] == '#') ans++;
    
    cout << ans << endl;
}

int main(){
    cin >> H >> W;

    rep(i, H) cin >> D[i];

    fill(memo[0], memo[MAXH], -1);
    memo[0][0] = 0;

    solve();
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
const double PI=acos(-1.0);
int main()
{
	int a,b,c,d;
	while( cin>>a>>b>>c>>d )
	{
		bool ans=false;
		if( abs(a-b)<=d && abs(b-c)<=d )	ans=true;
		else if( abs(a-c)<=d )	ans=true;
		if( ans )	cout<<"Yes"<<endl;
		else	cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  set<int> S;
  S.insert(A);
  S.insert(B);
  S.insert(C);
  if(S.size() == 2){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int a;
int mod_min;
int ans;

int main(){
    mod_min = 10;
    ans = 0;
    for (int i = 0; i < 5; ++i) {
        cin >> a;
        if (a % 10 != 0 && mod_min > (a % 10)) mod_min = (a % 10);
        ans += ((a / 10) + (a % 10 != 0))*10;
    }

    cout << ans - (10 - mod_min)*(mod_min != 0);
}

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

int n, pos;
vector <int> pre, in, post;

void rec(int l, int r){
  if(l >= r)return;
  int root = pre[pos++];
  int m = distance(in.begin(), find(in.begin(), in.end(), root));
  rec(l, m);
  rec(m + 1, r);
  post.push_back(root);
}

void solve(){
  pos = 0;
  rec(0, pre.size());
  for(int i=0;i<n;i++){
    if(i) cout << " ";
    cout << post[i];
  }
  cout << endl;
}
  
int main(){
  int k, i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> k;
    pre.push_back(k);
  }

  for(i=0;i<n;i++){
    cin >> k;
    in.push_back(k);
  }
  
  solve();
  
  return 0;
}



Measured memory_bytes: 3148
"use strict"
 const Main = (input) =>{
   let str = input.trim().split('');
   let ans =[];

   for(let i=0;i<str.length; i++){
     Number(ans.push(str[i].charCodeAt()+1));
   }
   
   let ans1 =[];
   for(let i=0;i<str.length; i++){
       ans1.push(String.fromCharCode(ans[i]));
   }

    let ans3 = '';
    for(let i=0;i<str.length; i++){
       ans3+=ans1[i];
   }
     console.log(ans3);
 }

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064