akhauriyash/Code-Regression huggingface dataset:
// 2014/05/31 Tazoe

#include <iostream>
using namespace std;

int main()
{
	bool flg = false;

	while(true){
		int n;
		cin >> n;

		if(cin.eof())
			break;

		char A[8][5];
		for(int y=0; y<8; y++){
			for(int x=0; x<5; x++){
				if(y==2){
					A[y][x] = '=';
				}
				else{
					A[y][x] = '*';
				}
			}
		}

		for(int i=0; i<5; i++){
			switch(n%10){
			case 0:
				A[1][4-i] = A[3][4-i] = ' ';
				break;
			case 1:
				A[1][4-i] = A[4][4-i] = ' ';
				break;
			case 2:
				A[1][4-i] = A[5][4-i] = ' ';
				break;
			case 3:
				A[1][4-i] = A[6][4-i] = ' ';
				break;
			case 4:
				A[1][4-i] = A[7][4-i] = ' ';
				break;
			case 5:
				A[0][4-i] = A[3][4-i] = ' ';
				break;
			case 6:
				A[0][4-i] = A[4][4-i] = ' ';
				break;
			case 7:
				A[0][4-i] = A[5][4-i] = ' ';
				break;
			case 8:
				A[0][4-i] = A[6][4-i] = ' ';
				break;
			case 9:
				A[0][4-i] = A[7][4-i] = ' ';
				break;
			default:
				break;
			}

			n /= 10;
		}

		if(flg){
			cout << endl;
		}
		else{
			flg = true;
		}

		for(int y=0; y<8; y++){
			for(int x=0; x<5; x++){
				cout << A[y][x];
			}
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <atcoder/math>
using namespace std;
using namespace atcoder;

int main() {
	int t;
	cin >> t;
	
	for (int i = 0; i < t; i++) {
		long long n, m, a, b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(n, m, a, b) << endl;
	}
	return 0;
}

Measured memory_bytes: 3592
<?php
for ($i = 0; $i < 3; $i++) {
	fscanf(STDIN, "%d %d %d", $a, $b, $c);
	if ($i) {
		if ($a - $b != $x || $b - $c != $y) exit('No');
	} else {
		$x = $a - $b;
		$y = $b - $c;
	}
}
echo 'Yes';


Measured memory_bytes: 4604
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		String [] strArray = new String[S.length()];

		for (int i=0; i<S.length(); i++) {
			String ans = String.valueOf(S.charAt(i));
			strArray[i] = ans;

		}
		List<String> s3 = Arrays.asList(strArray[2]);
		List<String> s4 = Arrays.asList(strArray[3]);
		List<String> s5 = Arrays.asList(strArray[4]);
		List<String> s6 = Arrays.asList(strArray[5]);

		if (Collections.disjoint(s3,s4) || Collections.disjoint(s5,s6)) {
			
			System.out.print("No");

		}else {
			System.out.print("Yes");
		}

		}
	}







Measured memory_bytes: 21844
<?php
    $n;
    $k;
    fscanf(STDIN, "%d", $n);
    fscanf(STDIN, "%d", $k);
    $input = fgets(STDIN);
    $x = explode(" ", $input);
    $ans = 0;
    for($i = 0; $i < $n; $i++){
        $ans += min($x[$i], abs($x[$i] - $k)) * 2;
    }
    echo "$ans\n";
?>


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

int main() {
    int i = 0;
    char S[101];
    scanf("%s", &S[0]);

    while(S[i] != 0) {
        if ((i%2) == 1) {
            if (S[i] == 'R') {
                printf("No\n");
                return 0;
            }
        } else {
            if (S[i] == 'L') {
                printf("No\n");
                return 0;
            }
        }
        i++;
    }
    printf("Yes\n");
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int l;
int lo;
const int N = 20;
vector<pii> g[N+1];

void dfs(int p, int d, vector<bool> &x){
  if(p==N){
    if(d>=lo || x[d]){
      DEBUG("NG");
      DEBUG(d);
      exit(0);
    }else{
      x[d] = true;
    }
  }else{
    for(pii P : g[p]){
      dfs(P.first, d+P.second, x);
    }
  }
}

void check(){
  vector<bool> x(lo, false);
  dfs(1,0,x);
  REP(i,lo)if(!x[i]){
    DEBUG("NG");
    DEBUG(i);
    exit(0);
  }
  puts("OK");
}

int main(){
  scanf("%d",&l);
  lo = l;
  int m = 0;
  FOR(i,3,N+1){
    int c = 1<<(N-i);
    g[i-1].push_back(pii(i,0));
    g[i-1].push_back(pii(i,c));
    m += 2;
  }
  int ac = 0;
  while(l > 0){
    int b = 0;
    while((1<<b)<=l)b++;
    b--;
    if(b==19){
      g[1].push_back(pii(2,0));
      g[1].push_back(pii(2,1<<18));
      m+=2;
    }else{
      g[1].push_back(pii(20-b,ac));
      m++;
    }
    ac += 1<<b;
    l -= 1<<b;
  }
  printf("%d %d\n",N,m);
  REP(i,N+1)for(pii P : g[i]){
    printf("%d %d %d\n",i,P.first,P.second);
  }
  // check();
  return 0;
}


Measured memory_bytes: 256
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;
int x;
int t;

void input() {
  cin >> n >> x >> t;
}

void solve() {
  int ans = t;
  int cur = x;

  while (cur < n) {
    cur += x;
    ans += t;
  }

  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 2;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3648
import java.util.*;
import java.math.*;
import java.lang.*;
import java.io.*;

public class Main{
  public static void main(String args[]) throws IOException{
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    
    int p=0;
    int a[]=new int[n];
    for(int i=0;i<n;i++)
    a[i]=s.nextInt();
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        p+=(a[i]*a[j]);
      }
    }
    System.out.println(p);
  }
}

Measured memory_bytes: 23892
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    if(abs(A-C)>1000000000000000000ll){
        cout << "Unfair" << el;
    }else if(K%2){
        cout << B-A << el;
    }else{
        cout << A-B << el;
    }
}



Measured memory_bytes: 256
n=int(input())
x=[]
x.append(input())
last_char=x[0][-1]
f_l_checker=True
 
for i in range(1,n):
    x.append(input())
    if f_l_checker:
        first_char=x[i][0]
        if first_char==last_char:
            f_l_checker=True
            last_char=x[i][-1]
        else:
            f_l_checker=False
            
set_x=set(x)
if len(set_x)==n and f_l_checker==True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main() {
	char s[200], t[200];
	int i, j, length, m, k;
	while (1) {
		scanf("%s", s);
		if (s[0] == '-') {
			break;
		}
		length = strlen(s);
		scanf("%d", &i);
		for (j = 0;j < i;j++) {
			scanf("%d", &m);
			strncpy(t, s, m);
			t[m] = '\0';
			for (k = 0;k < length - m;k++) s[k] = s[k + m];
			s[k] = '\0';
			strcat(s, t);
		}
		printf("%s\n", s);
	}
	return 0;
}

Measured memory_bytes: 604
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++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 SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b, bool equal = false){
    if(a < b || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false){
    if(b < a || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

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

    lint n, m;
    cin >> n >> m;

    lint ans = 1;
    for(lint i = 1 ; i * i <= m ; ++i){
        if(m % i == 0LL){
            if(i <= m / n){
                chmax(ans, i);
            }
            if(m / i <= m / n){
                chmax(ans, m / i);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m;
const int N = 1e5+10;
char s[N],t[N];
int gcd(int x, int y){
    return y == 0 ? x : gcd(y, x % y);
}
typedef long long ll;
int main() {
    scanf("%d%d%s%s", &n, &m, s, t);
    ll lcm = 1LL*n/gcd(n,m)*m;
    for (ll i = 0; i < n; i++) {
        if (i*m%n!=0) continue;
        int j = i*m/n;
        if (j >= m) continue;
        if (s[i] != t[j]) return puts("-1"), 0;
    }
    printf("%lld\n", lcm);
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
using namespace std;
int d1[105],d2[105],n;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&d1[i],&d2[i]);
	}
	for(int i=0;i<n-2;i++){
		if(d1[i]==d2[i]&&d1[i+1]==d2[i+1]&&d1[i+2]==d2[i+2]){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


int main() {
  int N;
  cin >> N;
  int ans=0;

  reps(i,N){
    if(((int)log10(i)+1)%2)ans++;
  }

  cout << ans;
}

Measured memory_bytes: 256
n=int(input());s=[input()for i in range(n)];b=input();ans=[]
def change(s,az):
  ans=""
  for i in s:ans+=i if i!="?"else az
  return ans
a,z=[b],[b]
for i in s:
  a.append(change(i,"a"))
  z.append(change(i,"z"))
a.sort();z.sort()
for i in range(n+1):
  if a[i]==b:ans.append(i+1);break
for i in range(1,n+2):
  if z[-i]==b:ans.append(n+2-i);break
ans.sort();anss=str(ans[0])
for i in range(1,ans[1]-ans[0]+1):anss+=" "+str(ans[0]+i)
print(anss)

Measured memory_bytes: 4980
import collections
import sys
from scipy.misc import comb


scan = sys.stdin.readline

def count_abc(string):
  alphabet = dict.fromkeys("abcdefghijklmnopqrstuvwxyz",0)
  
  for char in string:
    num = alphabet[char]
    alphabet[char] = num + 1
  
  c_str = ""
  for k, v in alphabet.items():
    c_str += k
    c_str += str(v)
  
  return c_str


def main():
  n = int(scan().rstrip())
  s = [scan().rstrip() for _ in range(n)]
  
  s_c = [count_abc(st) for st in s]
  
  c_dict = collections.Counter(s_c)
  
  ans = 0
  
  for v in c_dict.values():
    if v > 1:
      ans += comb(v, 2, exact=True)
  
  print(ans)

  
if __name__ == "__main__":
  main()


Measured memory_bytes: 41612
w, h, x, y = list(map(int, input().split()))

center_x = w / 2
center_y = h / 2

if center_x == x and center_y == y:
    ans_b = 1
else:
    ans_b = 0

ans_a = w * h / 2

print('{} {}'.format(ans_a, ans_b))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    int x,y;
    cin >> x >> y;

    if(y%2!=0||x*4<y||y/2<x){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include<string>

int main(void){
  std::string day;
  std::cin >> day;
  if(day=="SUN"){
    std::cout << 7;
  }else if(day=="SAT"){
    std::cout << 1;
  }else if(day=="FRI"){
    std::cout << 2;
  }else if(day=="THU"){
    std::cout << 3;
  
  }else if(day=="WED"){
    std::cout << 4;
  
  }else if(day=="TUE"){
    std::cout << 5;
  }else if(day=="MON"){
    std::cout << 6;
  }
  return 0;
}


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

  const int MOD = 1000000007;

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }






int main() {

int N;
cin >> N;
vector<int>a(N);
REP(i, N) cin >> a.at(i);
if(a.size() == 1) {
  if(a.at(0) == 1) {
    print(0);
    return 0;
  }else{
    print(1);
    return 0;
  }
}
sort(all(a));
int now = a.at(0);
int cnt = 1;
int ans = 0;
for(int i = 1; i < N; i++){
  if(a.at(i) == now){
    cnt++;
    if(a.at(i) < cnt)
    ans++;
  }else{
    if(now > cnt) ans += cnt;
    cnt = 1;
    now = a.at(i);
  }
  
  if(i == N - 1 && cnt < now){
    ans += cnt;
  }
}

print(ans);
}


Measured memory_bytes: 640
#include <stdio.h>

int gcd(int a, int b){
    int tmp;
    if(a<b){tmp=a;a=b;b=tmp;}
    if(b == 0)return a;
    return gcd(b, a%b);
}

int main(){
    int K, ans=0;
    int M[200][200] = {0};
    int t,i,j,k;
    scanf("%d", &K);
    for(i=1; i<=K; i++){
        ans += i;
        for(j=i+1; j<=K; j++){
            ans += gcd(i,j) * 6;
            for(k=j+1; k<=K; k++){
                ans += gcd(gcd(i,j), k) * 6;
            }
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int dp[1010][5000];

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> A(m), B(m);
    vector<int> C(m);
    rep(i, m) {
        cin >> A[i] >> B[i];
        int bit = 0;
        rep(_, B[i]) {
            int c;
            cin >> c;
            c--;
            bit |= 1 << c;
        }
        C[i] = bit;
    }
    rep(i, 1010) rep(j, 5000) {
        dp[i][j] = INF;
    }
    dp[0][0] = 0;
    rep(i, m) {
        rep(j, 1 << n) {
            chmin(dp[i + 1][j | C[i]], dp[i][j] + A[i]);
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }
    cout << (dp[m][(1 << n) - 1] == INF ? -1 : dp[m][(1 << n) - 1]) << endl;
}

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


Measured memory_bytes: 23368
#include <iostream>
using namespace std;
int main(void) {
  int h, w;
  cin >> h >> w;
  int dist[10][10];
  int wall[200][200];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> dist[i][j];
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> wall[i][j];
    }
  }
  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        if (dist[i][j] > dist[i][k] + dist[k][j]) {
          dist[i][j] = dist[i][k] + dist[k][j];
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (wall[i][j] >= 0) {
        ans += dist[wall[i][j]][1];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
a = list(map(int,input().split()))
x =a[0]
n =a[1]
if n==0:
  print(x)
else:
  p = list(map(int,input().split()))
  p.sort()
  out_p = []
  for i in range(p[n-1]-p[0]+1):
    if not i+p[0] in p:
      out_p.append(i+p[0])
  if min(p)>x or max(p)<x:
    print(x)
  else:
    re_p =[]
    for j in range(len(out_p)):
      re_p.append(abs(out_p[j]-x))
    if re_p:
      print(out_p[re_p.index(min(re_p))])
    else:
      if abs(max(p)-x)>=abs(min(p)-x):
        print(min(p)-1)
      else:
        print(max(p)+1)

Measured memory_bytes: 9272
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char **argv){
    int n,t,a;
    cin >> n;
    cin >> t >> a;

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

    int min_idx = 0;
    vector<double> temps(n);
    for(int i=0;i<n;i++){
        temps[i] = pow(a-(t-h[i]*0.006),2);
    }
    vector<double>::iterator min = min_element(temps.begin(),temps.end());
    int minIndex = distance(temps.begin(),min);
    cout << minIndex+1 << endl;


    return 0;
}

Measured memory_bytes: 256
def main():
    line1 = "#." * 150
    line2 = ".#" * 150
    while True:
        H, W = map(int, input().split())
        if (H, W) == (0, 0):
            break

        for i in range(H):
            if i % 2 == 0:
                print(line1[:W])
            else:
                print(line2[:W])
        print("")

if __name__ == "__main__":
    main()

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

using namespace std;

int n;
string s;
bool ok;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s;
	if (n % 2) {
		cout << "No" << endl;
		exit(0);
	}
	n /= 2; ok = 1;
	for (int i=0; i<n; i++) {
		if (s[i] != s[n + i]) ok = 0;
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
    int n;
    cin >> n;
    while (n--) {
        string ord, msg;
        cin >> ord >> msg;
        reverse(ord.begin(), ord.end());
        for (int i = 0; i < ord.size(); i++) {
            if (ord[i] == 'C') {
                char c = msg[0];
                msg.erase(0, 1);
                msg.push_back(c);
            } else if (ord[i] == 'J') {
                char c = msg[msg.size() - 1];
                msg.erase(msg.size() - 1, 1);
                msg.insert(msg.begin(), c);
            } else if (ord[i] == 'E') {
                int cnt = msg.size() / 2;
                string s, s1, s2;
                if (msg.size() % 2) {
                    s = msg[cnt];
                    s1 = msg.substr(0, cnt);
                    s2 = msg.substr(cnt + 1, cnt);
                } else {
                    s = "";
                    s1 = msg.substr(0, cnt);
                    s2 = msg.substr(cnt, cnt);
                }
                msg = s2 + s + s1;
            } else if (ord[i] == 'A') {
                reverse(msg.begin(), msg.end());
            } else if (ord[i] == 'M') {
                for (int j = 0; j < msg.size(); j++) {
                    if ('0' <= msg[j] && msg[j] <= '9') {
                        if (msg[j] == '9')
                            msg[j] = '0';
                        else
                            msg[j] = msg[j] + 1;
                    }
                }
            } else if (ord[i] == 'P') {
                for (int j = 0; j < msg.size(); j++) {
                    if ('0' <= msg[j] && msg[j] <= '9') {
                        if (msg[j] == '0')
                            msg[j] = '9';
                        else
                            msg[j] = msg[j] - 1;
                    }
                }
            }
        }
        cout << msg << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b;
    c = a * 500;
 
    if (c >= b) { cout << "Yes" << endl; }
      
    else {
    cout << "No" << endl;
}

}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a.begin(), a.end())

int main(){
    int r,c,sum = 0;
    cin >> r >> c;
    int e[r+1][c+1];

    rep(i,r)rep(j,c)cin >> e[i][j];

    rep(i,r){
        int sum_c = 0;
        rep(j,c)sum_c += e[i][j];
        
        e[i][c] = sum_c;
        sum += sum_c;
    }
    e[r][c] = sum;

    rep(i,c){
        int sum_r = 0;
        rep(j,r)sum_r += e[j][i];

        e[r][i] = sum_r;
    }

    rep(i,r+1){
        rep(j,c+1){
            cout << e[i][j];
            if(j < c)printf(" ");
        }
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 3100
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll=long long;
#define MOD  1000000007

int main(int argc, char const *argv[]) {
  string s;
  std::cin >> s;

  string v;
  int p=0;
  for(int i=0; i<s.size(); i++){
    if(s[i]=='0'){
      v.insert(p,"0");
      p++;
    }
    else if(s[i]=='1'){
      v.insert(p,"1");
      p++;
    }

    else if(s[i]=='B' && v.size()>=1){
      v.erase(p-1);
      p--;
    }
  }

  std::cout << v << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
static const int MAX=101;

vector<int> Adjacency[MAX];
int dt[MAX];
bool Visited[MAX];

void bfs(int i)
{
    queue<int> Q;
    dt[i]=0;Q.push(i);
    Visited[i]=true;
    int d=0;
    while(!Q.empty())
    {
        int p=Q.front();Q.pop();d=dt[p]+1; //important
        for(int j=0;j<Adjacency[p].size();j++)
        {
            if(Visited[Adjacency[p][j]]==true) continue;
            //else
            Q.push(Adjacency[p][j]); Visited[Adjacency[p][j]]=true;
            dt[Adjacency[p][j]]=d;
        }
    }
}
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) dt[i]=-1;
    for(int i=1;i<=n;i++)
    {
        int j,num;
        cin>>j>>num;
        for(int k=0;k<num;k++)
        {
            int t;cin>>t;
            Adjacency[j].push_back(t);
        }
    }
    bfs(1);
    for(int i=1;i<=n;i++)
    {
        cout<<i<<' '<<dt[i]<<endl;
    }
}

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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%"  SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

//#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read();
	int k;
	{
		int m=n*8+1;
		int w=round(sqrt(double(m)));
		if(w*w!=m){
			No();
		}
		w++;
		if(w%2)
			No();
		k=w/2;
	}
	vector<vi> ans(k);
	int idx=0;
	REP(i,k)FOR(j,i+1,k){
		ans[i].PB(idx);
		ans[j].PB(idx);
		idx++;
	}
	Yes(false);
	print(k);
	for(auto s:ans){
		print(s.size(),2);
		for(auto v:s){
			print(v+1,2);
		}
		puts("");
	}
}


Measured memory_bytes: 3200
import numpy as np

a,b,c =[int(i) for i in input().split()]

lh = 4*a*b

rh = c**2 + (a+b)**2 -2*c*(a+b)
if (c < (a+b)):
	print("No")
elif lh<rh:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 21532
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void) {

	int y = 0;
	long long N;
	cin >> N;
	long long  now = 2;
	unsigned long long  yaku[1000] = {};
	int temp;
	unsigned long long res = 1;
	
	for (int now = 2; now <= N; now++) {
		temp = now;
		for (int e = 2; e <= now; e++) {

			while (now % e == 0 && now != 1) {
				yaku[e]++;
				now /= e;
			}
		}
		now = temp;
	}

	for (int i = 2; i <= N; i++) {
		if (yaku[i] != 0) {
			res *= (yaku[i] + 1);
			res %= 1000000007;
		}
	}



	cout << res << endl;


	


	return 0;




}


Measured memory_bytes: 256
#include<cstdio>
long long x[1005], y[1005];
long long r[1005], c[1005];
long long power[105];
long long dx[4] = {0,0,1,-1};
long long dy[4] = {1,-1,0,0};
char direct[4] = {'D','U','L','R'};
char s[50];

long long abs(long long u){ return u>0?u:-u; }

int isReach(long long x,long long y,int i){
    if(i==-1) return x==0 && y==0;
    long long sum = abs(x)+abs(y);
    if(sum<=power[i+1]-1) return 1;
    else return 0;
}

int main(){
    power[0] = 1;
    for(int i = 1; i <= 40; i++) power[i] = power[i-1]*2;
    int n;
    scanf("%d",&n);
    int bit = -1, ok = 1;
    for(int i = 1; i <= n; i++){
        scanf("%lld%lld",&x[i],&y[i]);
        r[i] = x[i], c[i] = y[i];
        int cur = (abs(x[i])+abs(y[i]))%2;
        if(i==1) bit = cur;
        else{
            if(bit!=cur) ok = 0;
        }
    }
    if(!ok) printf("-1\n");
    else{
        int m = -1;
        if(bit%2) m = 31;
        else m = 32;
        printf("%d\n",m);
        for(int i = 1; i <= 31; i++) printf("%lld ",power[i-1]);
        if(bit%2==0) printf("1 ");
        printf("\n");
        //test
        //printf("%d\n",n);
        for(int i = 1; i <= n; i++){
            int size = 0;
            if(bit%2==0){
                for(int j = 0; j < 4; j++){
                    long long xx = x[i]+dx[j], yy = y[i]+dy[j];
                    if(isReach(xx,yy,30)){
                        s[++size] = direct[j];
                        x[i] = xx, y[i] = yy;
                        break;
                    }
                }
            }
            for(int t = 30; t >= 0; t--){
                for(int j = 0; j < 4; j++){
                    long long xx = x[i]+dx[j]*power[t], yy = y[i]+dy[j]*power[t];
                    if(isReach(xx,yy,t-1)){
                        s[++size] = direct[j];
                        x[i] = xx, y[i] = yy;
                        break;
                    }
                }
            }
            //printf("x = %lld,y = %lld\n",x[i],y[i]);
            for(int j = size; j >= 1; j--) printf("%c",s[j]);
            printf("\n");
        }
        //for(int i = 1; i <= n; i++) printf("%lld %lld\n",r[i],c[i]);
        //printf("\n");
    }
    return 0;
}



Measured memory_bytes: 1732
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
char mp[50][50];
int main(){
  int h,w;cin>>h>>w;
	for(int i = 0; h > i; i++){
		for(int j = 0; w > j; j++){
			cin>>mp[i][j];
		}
	}
	for(int i = 0; h > i; i++){
		for(int j = 0; w > j; j++){
			if(mp[i][j] == '#'){
				bool ok = false;
				for(int z = 0; 4 > z; z++){
					if(0 <= i+ar4[z].first && i+ar4[z].first < h && 0 <= j+ar4[z].second && j+ar4[z].second < w){
						if(mp[i+ar4[z].first][j+ar4[z].second] == '#'){
							ok = true;
							break;
						}
					}
				}
				if(!ok){
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
}

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


int main(){
    string S, ans = "";
    cin >> S;
    int num;
    int a = stoi(S.substr(0, 2));
    int b = stoi(S.substr(2, 2));
    if (1 <= a && a <= 12 && 1 <= b && b <= 12)
        cout << "AMBIGUOUS" << endl;
    else if (1 <= a && a <= 12 && !(1 <= b && b <= 12))
        cout << "MMYY" << endl;
    else if (!(1 <= a && a <= 12) && 1 <= b && b <= 12)
        cout << "YYMM" << endl;
    else cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
K = INT()
x = LIST()

ans = 0
for i in range(N):
	ans += 2*min(x[i], abs(x[i]-K))

print(ans)

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

vector <int> g[100000];
int memo[100000];
int n,m;

int dfs(int x){
	if(memo[x]!=-1) return memo[x];
	memo[x]=0;
	for(int i=0;i<g[x].size();i++){
		int a=g[x][i];
		memo[x]=max(dfs(a)+1,memo[x]);
	}
	return memo[x];
}

int main(){
	memset(memo,-1,sizeof(memo));
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		x--;y--;
		g[x].push_back(y);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		ans=max(ans,dfs(i));
	//	printf("%d\n",dfs(i));
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[100010];
map<ll, ll> mp[2];
ll cnt[66];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        for(int i=0; i<60; ++i){
            cnt[i]=0;
        }
        for(int i=0; i<n; ++i){
            scanf("%lld",a+i);
            for(int j=0; j<60; ++j){
                if(a[i]&(1ll<<j)){
                    ++cnt[j];
                }
            }
        }
        ans=0;
        ll tmp;
        for(int i=59; i>=0; --i){
            if(cnt[i]%2){
                ans+=(1ll<<i);
                for(int j=0; j<n; ++j){
                    a[j]&=~(1ll<<i);
                }
            }
        }
        int x=0;
        for(int i=59; i>=0; --i){
            int tmp=-1, tmp1=0;
            for(int j=0; j<x; ++j){
                if(a[j]&(1ll<<i))
                    ++tmp1;
            }
            for(int j=x; j<n; ++j){
                if(a[j]&(1ll<<i)){
                    tmp=j;
                    break;
                }
            }
            if(tmp1%2||tmp!=-1)
                ans+=2*(1ll<<i);
            if(tmp==-1)
                continue;
            swap(a[x], a[tmp]);
            for(int j=0; j<n; ++j){
                if(x==j)
                    continue;
                if(a[j]&(1ll<<i)){
                    a[j]^=a[x];
                }
            }
            ++x;
        }
        cout<<ans<<endl;

    }
  return 0;
}




Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int X;
int main()
{
    cin >> X;
    int ans = 0;
    for(int i = 0; i < X; i++)
    {
        if((i + 1) * (i + 2) / 2 >= X)
        {
            ans = i;
            break;
        }
    }
    cout << ans +1<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;
 
 
 
int main(){
    int N,K;
    cin >> N >> K;
    string S;
    cin >> S;

    int ans = 0;
    int X = 0;
    for (int i = 1; i < N; i++)
    {
        if(S[i] == S[i-1]) ans += 1;
        else{
            X++;
        }

    }
    if(X <= 2*K) ans = N-1;
    else ans += 2*K;

    cout << ans << endl;
}

Measured memory_bytes: 512
N,X = map(int,input().split())

# 層の総数
T = [1]
for i in range(1, 50+1):
    T.append(T[i-1]*2+3)

def hash(n,x):
    return "{0:d},{1:d}".format(n,x)

# レベルnバーガーの下からx層内のパティの数
memo = dict()
def solve(n,x):
    global T, memo
    if hash(n,x) in memo:
        return memo[hash(n,x)]
    if n == 0 and x >= 1:
        memo[hash(n,x)] = 1
        return 1
    if x <= 1:
        memo[hash(n,x)] = 0
        return 0
    memo[hash(n,x)] = solve(n-1, min(x-1, T[n-1]))
    if x >= T[n-1]+2:
        memo[hash(n,x)] += 1
    if x >= T[n-1]+3:
        memo[hash(n,x)] += solve(n-1, min(x-1-T[n-1]-1, T[n-1]))
    return memo[hash(n,x)]

print(solve(N,X))


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n,ans;
int d[200000];
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>d[i];
    sort(d+1,d+1+n);
    ans = d[(n/2)+1] - d[(n/2)];
    cout<<ans<<newl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}





int main(){

  ll N;
  string ans;

  cin >> N;
  N--;
  if(N==0){
    cout << "a" << endl;
    return 0;
  }

  while(N>=0){
    ans += ('a' + (N%26) );
    N /= 26;
    N--;
  }
  REV(ans);
  //for(char &x:ans)x--;
  /*FOR(i,0,ans.size()) {
    if(i+1!=ans.size())ans[i]--;
  }*/
  cout << ans << endl;

}



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

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

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int h,w;cin>>h>>w;
  vector<string> s(h);
  rep(i, h)cin>>s[i];

  vector<vector<int>> dp(h, vector<int>(w) );
  rep(i, h)rep(j, w)dp[i][j]=1000000;
  dp[0][0]=0;
  rep(i, h)rep(j, w){
    if(i<h-1)dp[i+1][j] = min(dp[i+1][j], dp[i][j]+(s[i][j]!=s[i+1][j] ? 1 : 0) );
    if(j<w-1)dp[i][j+1] = min(dp[i][j+1], dp[i][j]+(s[i][j]!=s[i][j+1] ? 1 : 0) );
  }
  int result=dp[h-1][w-1];
  if(s[0][0]=='#')result++;
  if(s[h-1][w-1]=='#')result++;
  cout<<result/2<<endl;

  return 0;

  rep(i, h){
    rep(j,w)cout<<dp[i][j];cout<<endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin>>a>>b;
    char Atul[a][b];

	for(int i=0;i<a;i++)
	{
		for(int j=0;j<b;j++)
		{cin>>Atul[i][j];
		}
	}
	for(int k=0;k<b+2;k++)
	{cout<<"#";
	}
	cout<<endl;



	for(int l=0;l<a;l++)
	{cout<<"#";
	for(int m=0;m<b;m++)
	{cout<<Atul[l][m];
	}
	cout<<"#"<<endl;}
	
	for(int k=0;k<b+2;k++)
	{cout<<"#";
	}
	return 0;
}


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

const int N = 1e5 + 33;
int n,m, cnt = 0;

map<int ,int> e;
void unique_factorization(int n){
    int m = sqrt(n + 0.5);
    
    for (int i = 2; i <= m; i++){
        while (n%i == 0) {
            n/= i;
            e[i] ++;
            cnt++;
        }
        if(n==1) break;
    }
    if(n>1){e[n]++;cnt++;}
}

using ll = long long;
const int mod = 1e9 + 7;
int fac[N], finv[N];

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

void init_fac_mod(int to){
    //only when mod is prime
    fac[0] = finv[0] = 1;
    for(int i = 1; i <= to; ++i)
        fac[i]=(ll)fac[i-1]*i%mod;
    finv[to] = quick_pow(fac[to], mod-2);
    for(int i = to-1; i; --i)
        finv[i] = (ll)finv[i+1]*(i+1)%mod;
}

struct modular {
    int value;
    modular(long long v = 0) { value = v % mod; if (value < 0) value += mod;}
    modular(long long a, long long b) : value(0){ *this += a; *this /= b;}
    modular& operator+=(modular const& b) {value += b.value; if (value >= mod) value -= mod; return *this;}
    modular& operator-=(modular const& b) {value -= b.value; if (value < 0) value += mod;return *this;}
    modular& operator*=(modular const& b) {value = (long long)value * b.value % mod;return *this;}
    //其他函数调用mexp(modular(10),3);
    friend modular mexp(modular a, long long e) {
        modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
        return res;
    }
    friend modular inverse(modular a) { return mexp(a, mod - 2); }
    modular& operator/=(modular const& b) { return *this *= inverse(b); }
    friend modular operator+(modular a, modular const b) { return a += b; }
    friend modular operator-(modular a, modular const b) { return a -= b; }
    friend modular operator-(modular const a) { return 0 - a; }
    friend modular operator*(modular a, modular const b) { return a *= b; }
    //除法只有在mod是素数可用;
    friend modular operator/(modular a, modular const b) { return a /= b; }
    friend ostream& operator<<(ostream& os, modular const& a) {return os << a.value;}
    friend istream& operator>>(istream& is, modular & a){long long value; is >> value;a.value = 0; a += value;  return is;}
    friend bool operator==(modular const& a, modular const& b) {return a.value == b.value;}
    friend bool operator!=(modular const& a, modular const& b) {return a.value != b.value;}
};


int comb(int n, int m){
    //n!/(m!(n-m)!
    return (ll)fac[n] * finv[m] % mod * finv[n - m]% mod;
}



int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>m;
    
    unique_factorization(m);
    
    init_fac_mod(1e5+32);
    modular ans = 1;
    
    for (auto i : e) {
        ans *= comb(i.second + n-1, n-1);
    }
    
    
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
int main(void) 
{
	int i, j;
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= 9; j++) {
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int n,x=0,y=0,ans=100000,c;
  cin>>n;
  int a[n];
  rep(i,0,n){
    cin>>a[i];
    y+=a[i];
  }
  rep(i,0,n-1){
    x+=a[i];
    y-=a[i];
    c=abs(x-y);
    ans=min(ans,c);
  }
  co(ans);
  
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    int m, d, i, sum;
    int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int date[] = {0,1,2,3,4,5,6};
    
    while(scanf("%d %d", &m, &d) != EOF) {
        if(m == 0) break;
        sum = 0;
        for(i=0; i<m-1; i++) {
            sum += month[i];
        }
        sum = (sum+d) % 7;
        switch(sum) {
            case 0 : printf("Wednesday\n");
            break;
            case 1 : printf("Thursday\n");
            break;
            case 2 : printf("Friday\n");
            break;
            case 3 : printf("Saturday\n");
            break;
            case 4 : printf("Sunday\n");
            break;
            case 5 : printf("Monday\n");
            break;
            case 6 : printf("Tuesday\n");
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s;
int w;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> s;
    cin >> w;
    for (int i = 0; i < s.size(); i++) {
        if (i % w == 0) cout << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdtr1c++.h>
using namespace std;
const int maxn = int(1e6+7);
int main() {
    int n, m;
    while (scanf("%d%d", &n, &m) != EOF) {
        double x = 100 * (n - m) + 1900 * m;
        printf("%.0f\n", x * pow(2.0, m));
    }
}

Measured memory_bytes: 256
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, Q) = (input[0], input[1])
let S = (readLine()!+"_").characters.map{String($0)}
var t = Array(count: N+1, repeatedValue: 0)
for i in 0..<N {
  	t[i+1] = t[i] + (S[i] + S[i+1] == "AC" ? 1 : 0)
}
for _ in 0..<Q {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    let (l, r) = (input[0], input[1])
    print(t[r-1] - t[l-1])
}

Measured memory_bytes: 9216