akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
char map[810][810];
int qx[640010],qy[640010],hd,tl,dist[810][810];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi(),k=gi();
	for(int i=1;i<=n;++i)scanf("%s",map[i]+1);
	memset(dist,-1,sizeof dist);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if(map[i][j]=='S')qx[tl]=i,qy[tl]=j,++tl,dist[i][j]=0;
	while(hd^tl){
		int x=qx[hd],y=qy[hd];++hd;if(dist[x][y]==k)break;
		if(map[x-1][y]=='.'&&dist[x-1][y]==-1)qx[tl]=x-1,qy[tl]=y,dist[x-1][y]=dist[x][y]+1,++tl;
		if(map[x+1][y]=='.'&&dist[x+1][y]==-1)qx[tl]=x+1,qy[tl]=y,dist[x+1][y]=dist[x][y]+1,++tl;
		if(map[x][y-1]=='.'&&dist[x][y-1]==-1)qx[tl]=x,qy[tl]=y-1,dist[x][y-1]=dist[x][y]+1,++tl;
		if(map[x][y+1]=='.'&&dist[x][y+1]==-1)qx[tl]=x,qy[tl]=y+1,dist[x][y+1]=dist[x][y]+1,++tl;
	}
	int ans=1e9;
	for(int i=1;i<=n;++i)if(~dist[i][1])ans=1;
	for(int i=1;i<=n;++i)if(~dist[i][m])ans=1;
	for(int i=1;i<=m;++i)if(~dist[1][i])ans=1;
	for(int i=1;i<=m;++i)if(~dist[n][i])ans=1;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if(~dist[i][j])ans=std::min(ans,1+(std::min(std::min(i-1,n-i),std::min(j-1,m-j))+k-1)/k);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int dx[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1 };
const int dy[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 };
#define NN 8010000
#define TC int t;cin>>t;for(int T=1;T<=t;T++)
#define mod 1000000007
#define PI acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
void AIA() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
//cout<<fixed<<setprecision(20);
// freopen("stand.in","r",stdin);
// freopen("stand.out","w",stdout);
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0)return 0;
	}
	return (n!=1);
}
ll gcd(ll x, ll y)
{
	return (y == 0 ? x : gcd(y, x % y));
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll rem(int x, int N){
	return (x % N + N) % N;
}
ll nCr(ll n, ll r){
	ll ans = 1;
	ll div = 1; // r! 
	for (ll i = r + 1; i <= n; i++){
		ans = ans * i;
		ans /= div;
		div++;
	}
	return ans;
}
ll NpR(ll n, ll r){
	ll ans = 1;
	for (ll i = (n - r) + 1; i <= n; i++){
		ans *= i;
		ans %= mod;
	}
	return ans;
}
/*
bool prime[20000010];
void sieve()
{
    int i,j;
    for(i=4;i<=20000000;i+=2)
    {
     	prime[i] = 0;
    }
    for(i = 3; i * i <= 20000000;i+=2)
    {
        if(prime[i] == 1)
        {
            for(j = i * i; j <= 20000000; j += i + i)
            {
                prime[j] = 0;
            }
        }
    }
}*/
/*
 _____________              __                ___        ___       ___________________________     ____        ____
|             |            /\ \              |   |      |   |     |                           |    \   \      /   /
|   __________|           / /\ \             |   |      |   |     |      _____      _____     |     \   \    /   /
|  |                     / /  \ \            |   |      |   |     |     |     |    |     |    |      \   \  /   /
|  |                    / /    \ \           |   |      |   |     |     |     |    |     |    |       \   \/   /
|  |______             / /      \ \          |   |______|   |     |     |     |    |     |    |        \      /
|         |           / /        \ \         |              |     |     |     |    |     |    |         \    /
|   ______|          / /          \ \        |    ______    |     |     |     |    |     |    |          |  |
|  |                / /============\ \       |   |      |   |     |     |     |    |     |    |          |  |
|  |               / /==============\ \      |   |      |   |     |     |     |    |     |    |          |  |
|  |              / /                \ \     |   |      |   |     |     |     |    |     |    |          |  |
|  |             / /                  \ \    |   |      |   |     |     |     |    |     |    |          |  |
|__|            /_/                    \_\   |___|      |___|     |_____|     |____|     |____|          |__|

									<<<<<<<<<< NEVER GIVE UP !! >>>>>>>>>>>
									<<<<<<<<<< YOU CAN DO IT IF YOU WANT !! >>>>>>>>
									<<<<<<<<<< BELIEVE IN YOURSELF !! >>>>>>>>>

*/
int main()
{
	//cout<<fixed<<setprecision(6);
	AIA();
	ll a , b;
	cin>>a>>b;
	cout << lcm(a,b);
	return 0;
}

Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        int[] tokens = Pattern.compile(" ").splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int n = tokens[0];
        int k = tokens[1];
        int q = tokens[2];
        
        int[] score = new int[n];
        for (int i = 0; i < q; i++) {
            int a = Integer.parseInt(stdin.readLine()) - 1;
            score[a]++;
        }
        
        for (int i = 0; i < n; i++) {
            if (k - q + score[i] > 0) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 61888
fun main(args: Array<String>) {
    val s = readLine()!!
    var ans = s.toLong()
    for (i in 1 until (1 shl s.length - 1)) {
        var ss = ""
        for (j in s.indices) {
            ss += s[j]
            if (i.shr(j).and(1) == 1) {
                ans += ss.toLong()
                ss = ""
            }
        }
        if(ss.isNotBlank()) ans += ss.toLong()
    }
    println(ans)
}

Measured memory_bytes: 33656
(function(input) {
  'use strict';
  var s = ''
  input.split("\n").some(function(line) {
    for (var i = 0; i < line.length; i++) {
      s += line[i] == '1' ? '9' : '1'
    }
  })
  console.log(s)
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

int main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size();i++){
        if(s.at(i)=='1'){
            s.at(i) = '9';
        }
        else if(s.at(i)=='9'){
            s.at(i) = '1';
        }
    }
    cout << s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;
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;}
int const INF = 1 << 30;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int h = -1;
    ll sum = 0;
    vector<int> ma(n);
    rep(i,n) {
        h = max(h, a[i]);
        ma[i] = h;
        sum += ma[i] - a[i];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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 ll INF = 1e18;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    COMinit();

    int n;
    cin >> n;
    n++;
    ll dup;
    vector<ll> a(n), v(n);
    rep(i, n){
        cin >> a[i];
        v[a[i]-1]++;
        if(v[a[i]-1] == 2) dup = a[i];
    }

    int x = -1, y = -1;
    rep(i, n){
        if(x == -1 && a[i] == dup) x = i;
        else if(a[i] == dup) y = i;
    }

    int z = x + (n-y-1);

    for(int i=1; i<=n; i++){
        ll ans = COM(n, i) - COM(z, i-1) + MOD;
        cout << ans%MOD << endl;
    }
}

Measured memory_bytes: 14720
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll dp[105][2][5];
int main(){
  ll n; cin >> n;
  vector<ll> v(n);
  rep(i,n){
    cin >> v[i];
  }
  ll ans=0;
  for(ll i=1;i<n-1;i++){
    ll s = min(v[i-1],min(v[i],v[i+1]));
    ll t = max(v[i-1],max(v[i],v[i+1]));
    if(v[i]!=s&&v[i]!=t) ans++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
	"math"
)

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func main() {
	var N int
	var S string
	fmt.Scan(&N, &S)

	W, E := make([]int, N), make([]int, N)
	for i := 0; i < N-1; i++ {
		if S[i] == 'W' {
			W[i+1] = W[i] + 1
		} else {
			W[i+1] = W[i]
		}
	}
	for i := N - 1; i > 0; i-- {
		if S[i] == 'E' {
			E[i-1] = E[i] + 1
		} else {
			E[i-1] = E[i]
		}
	}

	ans := N
	for i := 0; i < N; i++ {
		ans = intMin(ans, E[i]+W[i])
	}
	fmt.Println(ans)
}


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

int ok(int n) {
    for (int i = 2; i * (i - 1) <= n * 2; i++) {
        if (i * (i - 1) == n * 2) return i;
    }
    return 0;
}

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

    if (!ok(n)) {
        cout << "No" << endl;
        return 0;
    }

    int size = ok(n);

    vector<vector<int>> s(size, vector<int>());
    
    cout << "Yes" << endl;
    cout << size << endl;
    int num = 1;
    for(int i = 0; i < size - 1; i++)
    {
        for(int j = i + 1; j < size; j++)
        {
            s.at(i).push_back(num);
            s.at(j).push_back(num);
            num++;
        }
    }

    for(int i = 0; i < size; i++)
    {
        cout << s.at(i).size() << " ";
        for(int j = 0; j < (int)s.at(i).size(); j++)
        {
            cout << s.at(i).at(j) << " ";
        }
        cout << endl;
    }
    
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <map>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

string C_rotate(string s){
     return  s.substr(1, s.size() - 1)+s.substr(0, 1) ;
    
}

string J_rotate(string s){
   return s.substr(s.size() - 1, 1) + s.substr(0, s.size() - 1);
}

string E_swap(string s){
    REP(i,(long long int)s.size()/2){
        swap(s[i], s[i + (1 + s.size()) / 2]);
    }
    return s;
}

string A_reverse(string s){
    reverse(s.begin(), s.end());
    return s;
}

string P_increment(string s){
      REP(i,(long long int)s.size()){
        if('1'<=s[i]&&s[i]<='9'){
            s[i]--;
        }else if(s[i]=='0'){
            s[i] = '9';
        }
    }
    return s;
}


string M_decrement(string s){
    REP(i,(long long int)s.size()){
        if('0'<=s[i]&&s[i]<='8'){
            s[i]++;
        }else if(s[i]=='9'){
            s[i] = '0';
        }
    }
  
    return s;
}


int main(){

    long long int n;
    cin >> n;
    string a,b;
    REP(i,n){
        cin >> a >> b;
        DEFOR(j,(long long int)a.size(),0){
            if(a[j]=='C'){
                b = C_rotate(b);
            }else if(a[j]=='J'){
                b = J_rotate(b);
            }else if(a[j]=='E'){
                b = E_swap(b);
            }else if(a[j]=='A'){
                b = A_reverse(b);
            }else if(a[j]=='P'){
                b = P_increment(b);
            }else if(a[j]=='M'){
                b = M_decrement(b);
            }
        }
        cout << b << endl;
    }

    return 0;
}



Measured memory_bytes: 3196
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

template< typename Monoid >
class SegmentTree {
public:
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

int main(){
    init();
    ll N;cin>>N;
    vector<ll>P(N);

    auto f=[](ll a,ll b){return min(a,b);};
    SegmentTree<ll>seg(N,f,INF);
    
    for(int i=0;i<N;i++){
      cin>>P[i];
      seg.set(i,P[i]);
    }
    seg.build();

    ll ans=0;
    for(int i=0;i<N;i++){
      if(seg.query(0,i)>=P[i])ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5888
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,d=mp()
l=[[]for i in range(h*w+1)]
for i in range(h):
    a=lmp()
    for k in range(w):
        l[a[k]]=[i,k]
ans=[0]*(h*w+1)
for i in range(1,d+1):
    for k in range((h*w-i)//d):
        ans[i+(k+1)*d]=ans[i+k*d]+abs(l[i+k*d][0]-l[i+(k+1)*d][0])+abs(l[i+k*d][1]-l[i+(k+1)*d][1])
q=int(input())
for i in range(q):
     l,r=mp()
     print(ans[r]-ans[l])


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

#define ll long long

using namespace std;

bool ask(ll x) {
    cout << "? " << x << endl;
    string ans;
    cin >> ans;
    return ans == "Y";
}

int main() {
#ifdef __APPLE__
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    
    ll tl = 0, tr = 1e9 + 1;
    while (tr - tl > 1) {
        ll tm = (tl + tr) / 2;
        ll x = tm;
        while (x <= (ll)1e9)
            x *= 10;
        if (ask(x)) {
            tr = tm;
        } else {
            tl = tm;
        }
    }
    ll v = tr;
    while (v % 10 == 0) {
        v /= 10;
    }
    ll x = 0;
    if (v == 1) { 
        ll tv = v;
        while (tv) {
            tv /= 10;
            x = x * 10 + 9;
        }
        while (!ask(x) && x <= (ll)1e9) {
            v *= 10;
            x = x * 10 + 9;
        }
        cout << "! " << v << endl;
    } else {
        x = 1;
        ll tv = v;
        while (tv) {
            tv /= 10;
            x *= 10;
        }
        x *= 10;
        while (ask(x) && x <= (ll)1e9) {
            v *= 10;
            x *= 10;
        }
        cout << "! " << v << endl;
    }
    return 0;
}

Measured memory_bytes: 596
N = int(input())
L = list(map(int, input().split()))
L.sort()
res = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[i] + L[j] > L[k]:
                res += 1
print(res)

Measured memory_bytes: 67912
n = int(input())
graph = [[0 for i in range(n)] for j in range(n)]
d = [0] * n
f = [0] * n
g = [0] * n

time = 0

for i in range(n):
   a = list(map(int, input().split()))
   for j in range(0, a[1], 1):
       graph[a[0] - 1][a[2 + j] - 1] = 1

def search(i):
    global time
    time = time + 1
    d[i] = time
    g[i] = 1
    for j in range(n):
        if (graph[i][j] == 1) & (g[j] == 0):
            search(j)
    time = time + 1
    f[i] = time

for i in range(n):
    if g[i] == 0:
        search(i)
[print(i+1, d[i], f[i]) for i in range(n)]


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


string P, R;

int main() {
  cin >> P >> R;

  i64 cnt = 0;
  REP(i, 3) {
    cnt += P[i] == R[i];
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main( ) {
	int x;
	int y;
	int answer;
	int answer2;

	scanf("%d %d",&x ,&y);
	answer = x * y;
	answer2 = x * 2 + y * 2;
	printf("%d %d\n",answer ,answer2);

	return 0;
}

Measured memory_bytes: 596
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define scan(n,v) v.resize(n); rep(i,n){ cin>>v[i];}
#define lim 1000000007ll
#define Yes(flag) cout<<((flag)? "Yes":"No");
#define YES(flag) cout<<((flag)? "YES":"NO");
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template <class T> T 
gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T 
lcm(T a, T b){return a * b / gcd(a, b);}

// header
int n;
void input(){
    cin>>n;
}
void src(){
    ll i=1;
    while(i*(i+1)/2<n){
        i++;
    }
    cout<<i;
}   
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

int main(){
  ll n,k,cnt_negative = 0,memo = LINF,ans = LINF;
  cin >> n >> k;
  ll x[n] = {};

  rep(i,0,n) cin >> x[i];

  rep(i,0,n){
    if(x[i] < 0) cnt_negative++;
  }

  if(cnt_negative == 0)ans = x[k-1];
  rep(i,0,min(cnt_negative,k)+1){
    if(cnt_negative-i < 0 || cnt_negative+(k-i)-1 > n-1) continue;

    if(i != 0 && i != k) memo = min(abs(x[cnt_negative-i])*2 + x[cnt_negative+(k-i)-1],abs(x[cnt_negative-i]) + x[cnt_negative+(k-i)-1]*2);
    else if(i == 0) memo = x[cnt_negative+(k-i)-1];
    else if(i == k) memo = abs(x[cnt_negative-i]);
    ans = min(ans,memo);
    //cout << memo << " " << ans << endl;
  }

  cout << ans << endl;

}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll k, x;
  cin >> k >> x;
  cout << (500 * k >= x ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

 int main(void){
      int a,b,c;
      char dummy;
      int d,e,f;
      
      /*printf("柱の高さを３つ決めてください\n");
      printf("左　中　右\n");*/
      rewind(stdin);
      d = scanf("%d %d %d",&a,&b,&c);
     /* printf("柱の高さを３つ決めてください\n");
      printf("左 ");
      rewind(stdin);
      d = scanf("%d",&a); 
      printf("中 ");
      rewind(stdin);
      e = scanf("%d",&b); 
      printf("右 ");
      rewind(stdin);
      f = scanf("%d",&c); */
       
      if(a<1 || a>100 || b<1 || b>100 || c<1 || c>100){
        printf("柱は　１〜１００　の間で決めてください\n");
        exit(0);
        }
      
      if(b-a == c-b){
        printf("YES\n");
        return 0;
      }else{
        printf("NO\n");
        return 0;
       }
   }
      

Measured memory_bytes: 128
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s = iterator.next().unwrap();

    if s == "Sunny" {
        return "Cloudy".to_string();
    }
    if s == "Cloudy" {
        return "Rainy".to_string();
    }
    return "Sunny".to_string();
}


Measured memory_bytes: 2072
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int n,m,a[800000];
signed main(){
	cin>>n>>m;
	while(m--){
		int x,y;scanf("%lld%lld",&x,&y);
		a[x]^=1,a[y]^=1;
	}
	for(int i=0;i<800000;i++) if(a[i]) {
		puts("NO");return 0;
	}
	
	puts("YES");
	return 0;
}

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

int main(){
  int n;
  scanf("%d",&n);
  map<int, int>  m1,m2;
  int x;
  for(int i=0;i<n;i++){
      
    scanf("%d",&x);
    if(i%2==0)
      m1[x]+=1;
    else
      m2[x]+=1;
  }
  multimap<int, int, greater<int> > m3,m4;
  for(auto  x:m1)
   m3.insert({x.second,x.first});
  for(auto x:m2)
   m4.insert({x.second,x.first});
   

  int s1=0,s2=0,s3=0,s4=0;
  if(m3.size()>1){
   auto it=m3.begin();
   s1=(*it).first;
   it=++it;
   s2=(*it).first;
  }
  else{
    auto it=m3.begin();
   s1=(*it).first;
  }
  if(m4.size()>1){
   auto it=m4.begin();
   s3=(*it).first;
   it=++it;
   s4=(*it).first;
  }
  else{
    auto it=m4.begin();
   s3=(*it).first;   
  }
  //cout<<s1<<" "<<s2<<" "<<s3<<" "<<s4<<endl;
  auto it1=m3.begin(),it2=m4.begin();
  //cout<<(*it1).second<<" "<<(*it2).second<<endl;
  if((*it1).second!=(*it2).second)
   printf("%d\n",(n-s3-s1));
  else {
      int max=0;
      if(s1+s4>=s2+s3)
       max=s1+s4;
      else
       max=s2+s3;
      printf("%d\n",(n-max)); 
  }
  return 0;
}

Measured memory_bytes: 9600
#include <algorithm>
#include <vector>
#include <cstdio>
#include <queue>
using namespace std;
int a,b,c;
int main() {
	scanf("%d%d%d",&a,&b,&c);
	if (a+b+c >= 22) puts("bust");
	else puts("win");
	return 0;
}

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


def main():
    k = int(input())

    if k % 2 == 0:
        print(-1)
        return

    rest = [7 % k]

    for i in range(k):
        rest.append(rest[-1] * 10 % k)

    tmp = 0
    for i in range(k):
        if (tmp + rest[i]) % k == 0:
            print(i + 1)
            return
        else:
            tmp = (tmp + rest[i]) % k
    else:
        print(-1)
main()

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

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

	int m = max(a, max(b,c));

	int ans = (3*m - (a+b+c)) / 2;

	if(m % 2 == (a+b+c)%2) cout << ans << endl;
	else{
		ans = (3*(m+1) - (a+b+c)) / 2;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<algorithm>
using namespace std;
int n;
long long h[100010];
stack<long long> sa;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	int sum=0;
	int maxx=0;
	for(int i=n-2;i>=0;i--){
		if(h[i]>=h[i+1]){
			sum++;
		}
		else{
			maxx=max(maxx,sum);
			sum=0;
		}
	}
	maxx=max(maxx,sum);
	cout<<maxx<<endl;
	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

// #define int long long // debug
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int x[51];
ll dp[51][51][2501];

int main()
{
	int n, a;
	cin >> n >> a;
	rep(i,0,n) cin >> x[i];
	dp[0][0][0] = 1;
	rep(i,0,n) rep(j,0,n) rep(k,0,n*50) {
		dp[i+1][j+1][k+x[i]] += dp[i][j][k];
		dp[i+1][j][k] += dp[i][j][k];
	}
	ll ans = 0;
	rep(i,1,n+1) ans += dp[n][i][i*a];
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 50048
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> t(n), x(n), y(n);
    rep(i, 0, n){
        cin >> t[i] >> x[i] >> y[i];
    }
    int nx = 0, ny = 0, nt = 0;
    bool f = true;
    rep(i, 0, n){
        int tmp = abs(nx - x[i]) + abs(ny - y[i]);
        int len = t[i] - nt;
        if(tmp > len || (len - tmp) % 2) f = false;
        nx = x[i];
        ny = y[i];
        nt = t[i];
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

const int N = 1e5+7;

int n;
int a[N], b[N];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        b[a[i]] = i;
    }
    for (int i = 1; i <= n; ++i) {
        cout << b[i] << " \n"[i==n];
    }
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

long long a, b, c;

long long lcm(long long a, long long b){
    if (b == 0){
        return a;
    }
    return lcm(b, a%b);
}

int main(){

    cin >> a >> b;

    cout << (a*b)/lcm(a, b);







}

//g++ -std=c++14 comp.cpp -o b; ./b.exe

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

int main(){
  int A , B , C , D , R , L;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if(R > L)
    cout << "Right" << endl;
  else if(R == L)
    cout << "Balanced" << endl;
  else
    cout << "Left" << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (ll i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll x;
    cin >> x;
    srep(a,-1000,1001){
        srep(b,-1000,1001){
            if(a*a*a*a*a-b*b*b*b*b == x){
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }
    return 0;
}




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

typedef long long int ll;

int digit(char c) {
    switch(c) {
        case '0':
            return 0;
         case '1':
            return 1;
         case '2':
            return 2;
         case '3':
            return 3;
         case '4':
            return 4;
         case '5':
            return 5;
         case '6':
            return 6;
         case '7':
            return 7;
         case '8':
            return 8;
         case '9':
            return 9;

    }
    return -1;


}

int z(bool a) {
    if(a) return 1;
    return -1;
}
char c(bool a) {
    if(a) return '+';
    return '-';
}

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

    string s;
    cin >> s;
    int n[4];
    n[0] = digit(s[0]);
    n[1] = digit(s[1]);
    n[2] = digit(s[2]);
    n[3] = digit(s[3]);
    int sum;
    for(int i=0; i < 8; i++) {
        sum = n[0];
        sum += z(i%2)*n[1];
        sum += z((i%4-i%2)==2)*n[2];
        sum += z((i%8-i%4)==4)*n[3];
        if(sum == 7) {
            cout << n[0] << c(i%2) << n[1] << c((i%4-i%2)==2) << n[2] << c((i%8-i%4)==4) << n[3] << "=7" << endl;
            break;
        }
    }


}

Measured memory_bytes: 256
def e_polynominal_divisors(N, A):
    # 参考: http://drken1215.hatenablog.com/entry/2019/04/21/004100
    from fractions import gcd

    def prime_factorization_dict(n):
        """nを素因数分解したときの素数とその指数の辞書"""
        i, table = 2, {}
        while i**2 <= n:
            table[i] = 0
            while n % i == 0:
                table[i] += 1
                n //= i
            if table[i] == 0:
                table.pop(i)
            i += 1
        if n > 1:
            table[n] = 1
        return table

    def prime_table(n):
        """n以下の素数のリスト(エラトステネスの篩)"""
        if n == 0:
            return []
        is_prime = [True] * (n + 1)
        is_prime[0] = is_prime[1] = False  # 0と1は素数でない
        for j in range(2, int(n**0.5) + 1):
            if not is_prime[j]:
                continue
            for k in range(j * 2, n + 1, j):
                is_prime[k] = False  # jの倍数は素数でない
        return [i for i in range(n + 1) if is_prime[i]]

    # f(x) % p == 0 のとき、f(x)の係数はすべてpの倍数。よって、f(x)の各係数の
    # GCDを求め、それを素因数分解して得られる素数が解である。
    # ただし、係数が0の項は考慮しない。
    g = abs(A[N])
    for a in A:
        if a != 0:
            g = gcd(g, abs(a))
    ans = list(prime_factorization_dict(g).keys())

    a = A[::-1]  # Aは係数が最高次から格納されているが、それを最低次からにする
    # p<=N である素数pについて、f(x)がx**p-xで割れるか？
    # それには、f(x)≡h(x) (mod p) を満たすようなp-1次以下の多項式h(x)について、
    # h(x)≡0 (mod p) ⇔ h(x)の係数がすべてpの倍数である
    # を満たすか判定する
    for p in prime_table(N):
        c = [0] * p
        for d in range(p):
            c[d] = a[d] % p
        # x**p≡x (mod p) なので、インデックスはp-1の周期でループする
        for d in range(p, N + 1):
            r = d % (p - 1)
            if r == 0:
                r = p - 1
            c[r] = (c[r] + a[d]) % p

        for factor in c:
            if factor != 0:
                break
        else:
            # h(x) の係数がすべてpの倍数である。f(x)はx**p-xで割りきれる
            ans.append(p)
    ans = sorted(set(ans))
    return '\n'.join(map(str, ans))

N = int(input())
A = [int(input()) for _ in range(N + 1)]
print(e_polynominal_divisors(N, A))

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007
#define MAX 510000

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

ll	myPow(ll x, ll n) {
	ll r=1;
	while(n>0)
		if (0==n%2) {
			x *=x;
			x %=MOD;
			n /=2;
		} else {
			r *=x;
			r %=MOD;
			n--;
		}
	return r;
}

ll	MPl(ll x, ll y) {
	return (x+y)%MOD;
}

ll	MMi(ll x, ll y) {
	return (x-y+MOD)%MOD;
}

ll	MMul(ll x, ll y) {
	return ((x*y)%MOD+MOD)%MOD;
}

// Array
vector<ll> fac(MAX, 0);
vector<ll> finv(MAX, 0);
vector<ll> inv(MAX, 0);

void	DivInit() { // fac, finv, inv
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i=2; i<MAX; i++) {
		fac.at(i) = (fac.at(i-1)*i) %MOD;
		inv.at(i) = MOD - (inv.at(MOD%i)*(MOD/i)) %MOD;
		finv.at(i) = (finv.at(i-1)*inv.at(i)) %MOD; 
	}
}

ll	MDiv(ll x, ll y) {
	if (1!=inv.at(1))
		DivInit();
	return (x*inv.at(y))%MOD;
}

ll	MComb(ll N, ll K) {
	if (1!=inv.at(1))
		DivInit();
	if (N<K)
		return 0;
	if ((N<0)||(K<0))
		return 0;
	return (fac.at(N) * ((finv.at(K)*finv.at(N-K)) %MOD)) %MOD;
}

int	main() {
	ll N, K;
	cin >>N >>K;
	ll MI=0;
	ll Z=0;
	vector<ll> A(N, 0);
	vector<ll> APL;
	vector<ll> AMI;
	Rep0(i, N) {
		cin >>A.at(i);
		if (A.at(i)<0)
			AMI.push_back(A.at(i));
		else if (A.at(i)>0)
			APL.push_back(A.at(i));
	}
	if (APL.size()+AMI.size()<K) {
		cout <<0 <<endl;
		return 0;
	}
	if (APL.size()+AMI.size()==K) {
		ll S=1;
		for (auto AA:APL)
			S =MMul(S, AA);
		for (auto AA:AMI)
			S =MMul(S, AA);
		if (K==N) // no 0
			cout <<S <<endl;
		else
			cout <<max(S, (ll)0) <<endl;
		return 0;
	}
	if (APL.size()==0) {
		Sort(AMI);
		ll S=1;
		if (0==K%2) {
			Rep0(i, K)
				S=MMul(S, AMI.at(i));
		} else if (AMI.size()==N) { // Only negative and result will be negative
			Rev(AMI);
			Rep0(i, K)
				S=MMul(S, AMI.at(i));
		} else {
			S=0;
		}
		cout <<S <<endl;
		return 0;
	}
	// else,  APL + AMI >K, so there must be positive choice
	Sort(APL);
	Sort(AMI);
	Rev(AMI);
	ll S=1;
	int I=K;
	for(int I=K;I>0;) {
		if (I>=2) {
			if (AMI.size()>=2) {
				if (APL.size()>=2) {
					if (AMI.back()*AMI.at(AMI.size()-2)>=APL.back()*APL.at(APL.size()-2)) {
						S =MMul(S, AMI.back());
						AMI.pop_back();
						S =MMul(S, AMI.back());
						AMI.pop_back();
						I -=2;
					} else {
						S =MMul(S, APL.back());
						APL.pop_back();
						I--;
					}
				} else { // No choice for APL
					S =MMul(S, AMI.back());
					AMI.pop_back();
					S =MMul(S, AMI.back());
					AMI.pop_back();
					I -=2;
				}
			} else { // No choice for AMI
				S =MMul(S, APL.back());
				APL.pop_back();
				I--;
			}
		} else {
			S =MMul(S, APL.back());
			APL.pop_back();
			I--;
		}
	}
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 18884
#include<stdio.h>

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

int lcm(int a, int b){
  return a / gcd(a, b) * b;
}

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) != EOF){
    printf("%d %d\n", gcd(x, y), lcm(x, y));
  }
  return 0;
}

Measured memory_bytes: 1024
n=int(input())
l=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ans=[]
while n>26:
  x=n%26
  if x==0:
    ans.append("z")
    n=(n//26)-1
  else:  
    ans.append(l[x-1])
    n=n//26
ans.append(l[n-1])
ans.reverse()
Ans=""
for i in range(len(ans)):
  Ans=Ans+ans[i]
print(Ans)

Measured memory_bytes: 9148
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,0,-1};
const static int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int main(){
  int N,T,L,B;

  while(~scanf("%d %d %d %d",&N,&T,&L,&B)){
    if(N==0) break;
    char stage[101];
    double dp[101][101][2] = {0.0};

    memset(stage,'.',sizeof(stage));

    for(int i=0;i<L;i++){
      int pos;
      scanf("%d",&pos);
      stage[pos] = 'L';
    }
    for(int i=0;i<B;i++){
      int pos;
      scanf("%d",&pos);
      stage[pos] = 'B';
    }

    //dp[pos][turn][stop_flag]
    dp[0][0][0] = 1.0;
    for(int turn=1;turn<=T;turn++){
      for(int from=0;from<N;from++){
	for(int spots=1; spots<=6;spots++){
	  int to = (from + spots > N ? 
		    N - (from + spots - N) 
		    : from+spots);

	  if(stage[to] == 'B'){
	     dp[0][turn][0]
	       += dp[from][turn-1][0] * 1.0/6.0;
	  }
	  
	  else if(stage[to] == 'L'){
	    //rest
	    dp[to][turn][1]
	      += dp[from][turn-1][0] * 1.0/6.0;
	  }
	  else if(stage[to] == '.'){
	    dp[to][turn][0]
	      += dp[from][turn-1][0] * 1.0/6.0;
	  }
	}
	dp[from][turn][0]
	  += dp[from][turn-1][1];
      }
    }

    double sum = 0;
    for(int turn=1;turn<=T;turn++){
      sum += dp[N][turn][0];
      sum += dp[N][turn][1];
    }
    printf("%.7lf\n",sum);
  }
}

Measured memory_bytes: 1388
<?php
  $n=+fgets(STDIN);
  $a=explode(' ',fgets(STDIN));
  $c=0;
  for($i=0;$i<$n;$i++)
  {
    $c+=$a[$i]%2;
  }
  echo $c%2==0 ? "YES" : "NO","\n";

Measured memory_bytes: 22516
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}


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

    if ((a+b+c)/2 == a||(a+b+c)/2 == b||(a+b+c)/2 == c)
    {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

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

using namespace std;

int h, w, d, q;
int a[305][305];
int b[900005], c[900005];
int e[900005];

int abs(int p){return (p > 0) ? p : -p;}

int main()
{
    scanf("%d%d%d", &h, &w, &d);
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            scanf("%d", &a[i][j]);
            b[a[i][j]] = i, c[a[i][j]] = j;
        }
    }
    for(int i = d + 1; i <= h * w; i++)
    {
        e[i] = e[i - d] + abs(b[i] - b[i - d]) + abs(c[i] - c[i -  d]);
    }
    scanf("%d", &q);
    for(int i = 0; i < q; i++)
    {
        int l, r;
        int sum = 0;
        scanf("%d%d", &l, &r);
        printf("%d\n", e[r] - e[l]);
    }
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

const int N = 1e5 + 5;

int n, m, deg[N], dp[N];

vector<int> graph[N];

queue<int> q;

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        graph[u].pb(v);
        deg[v]++;
    }
    for(int i = 1; i <= n; i++) {
        if(!deg[i])
            q.push(i);
    }
    while(!q.empty()) {
        int u = q.front();
        q.pop();
        for(int i = 0; i < graph[u].size(); i++) {
            int v = graph[u][i];
            dp[v] = max(dp[u] + 1, dp[v]);
            deg[v]--;
            if(deg[v] == 0)
                q.push(v);
        }
    }
    int mx = 0;
    for(int i = 1; i <= n; i++)
        mx = max(mx, dp[i]);
    cout << mx;
}


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

int main()
{
int N,M;
cin >> N >> M;


int s[M],c[M];
vector<int> ans(N);
for (int i = 0; i < M; i++){
    cin >> s[i] >> c[i];
    if (s[i] == 1 && c[i] == 0 && N > 1){
        cout << -1 << endl;
        return 0;
    }
    ans[s[i]-1] = c[i];
}

//重複チェック
for (int i = 1; i < M; i++){
    for(int k = 0; k < i; k++){
        if(s[i] == s[k] && c[i] != c[k]){
            cout << -1 << endl;
            return 0;
        }
    }
}

//最上位のケタ数チェック
if(N > 1 && ans[0]==0) ans[0]=1;

int A;
for (int i = 0; i < N; i++){
    A += ans[i]*pow(10,(N-i-1));
}
cout << A << endl;
return 0;

}

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

long long n, k;

double get_probability(long long x) {
  long long cur = x, step = 0;
  while (cur < k) {
    step++;
    cur <<= 1;
  }
  return pow(0.5, step);
}

int main() {
  double ans = 0.0;
  scanf("%lld %lld", &n, &k);
  for (long long i = 1; i <= n; i++) {
    ans += get_probability(i) / n;
  }
  printf("%.12lf\n", ans);
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;

int b[30];
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,c;
    cin >> n >> m >> c;
    rep(i,m) cin >> b[i];
    int x,cnt = 0,w=0;
    bool flg = true;
    rep(i,n){
        w = 0;
        rep(j,m){
            cin >> x;
            w += x * b[j];
        }
        if(w + c > 0) cnt++;
    }   
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	string S;
	cin >> S;
	if (S == "SUN") {
		cout << 7 << endl;
	}
	else if (S == "MON") {
		cout << 6 << endl;
	}
	else if (S == "TUE") {
		cout << 5 << endl;
	}
	else if (S == "WED") {
		cout << 4 << endl;
	}
	else if (S == "THU") {
		cout << 3 << endl;
	}
	else if (S == "FRI") {
		cout << 2 << endl;
	}
	else if (S == "SAT") {
		cout << 1 << endl;
	}
}

Measured memory_bytes: 256
s = input()
if 'hi'== s:
    print('Yes')
elif 'hihi'==s:
    print('Yes')
elif 'hihihi'==s:
    print('Yes')
elif 'hihihihi'==s:
    print('Yes')
elif 'hihihihihi'==s:
    print('Yes')
else:
    print("No")


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

void cout_vec(vector<int> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

void cout_mat(vector<vector<int>> &mat){
    for(int i=0; i<mat.size(); i++){
        vector<int> vec = mat[i];
        cout_vec(mat[i]);
    }
}

int ans=0;
vector<vector<int> > d(10,vector<int>(10,0));
vector<int> p(10,0);
int search(int n, vector<int> s){
    int size = s.size();
    if (size==n){
        for(int i=0; i<10; i++){
            int sum_=0;
            for(int j=0; j<10; j++){
                sum_+=s[d[i][j]];
            }
            if((sum_%2)!=p[i]){
                return 0;
            }
        }
        //cout_vec(s);
        ans++;
        return 0;
    }
    s.push_back(0);
    search(n, s);
    s.pop_back();
    s.push_back(1);
    search(n, s);
}

int main(){
    int N,M;
    cin >> N >> M;

    for(int i=0; i<M; i++){
        int k;
        cin >> k;
        for(int j=0; j<k; j++){
            int x;
            cin >> x;
            x;
            d[i][j]=x;
        }
    }
    for(int i=0; i<M; i++){
        int x;
        cin >> x;
        p[i]=x;
    }
    search(N+1, {0});

    //cout_mat(d);
    cout << ans << endl;
}

Measured memory_bytes: 256