akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int H, W;
    cin >> H >> W;
    auto maze = make_vec<char>(H, W);
    auto n = make_vec<int>(H, W);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) cin >> maze[i][j];
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (maze[i][j] == '#') continue;  // 障害物があればスルー
            int dy[8] = {0, 0, 1, -1, 1, 1, -1, -1};
            int dx[8] = {1, -1, 0, 0, -1, 1, 1, -1};
            for (int k = 0; k < 8; k++) {
                int ny = i + dy[k];
                int nx = j + dx[k];
                if (ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
                if (maze[ny][nx] == '.') continue;  // 障害物があればスルー
                n[i][j]++;
            }
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (maze[i][j] == '.')
                cout << n[i][j];
            else
                cout << "#";
        }
        cout << "\n";
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC116A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, n;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            n = a * b / 2;
            Console.WriteLine(n);
            Console.ReadKey();
        }
    }
}

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

//ABC 081 B
int main()
{
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1; i<=n; i++){
		cin>>a[i];
	}
	int x=0,f=1;
	while(f==1){
		for(int i=1; i<=n; i++){
			if(a[i]%2==0){
				a[i]/=2;
			}else{
				f=0;
				break;
			}
		}
		if(f==1){
			x++;
		}
	}
	cout<<x<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	ll n, m, x; cin >> n >> m >> x;
	vl a(m);
	ll candidate = 0;
	for (ll i = 0; i < m; ++i){
		ll t; cin >> t;
		if (t > x) candidate++;
	}cout << min(candidate, m - candidate) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>
 
using namespace std;
using experimental::any;
 
#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
#define BitFOR(N) REP(Bit,1<<(N))
 
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) (f)? cout<<"true ":cout<<"false ";
#define FORDEB(n,X) for(int i=0;i<(n);i++)ARDEB(i,X)
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define ARDEB(i,X) {}
#define TFDEB(f) {}
#define FORDEB(n,X) {}
#define END {}
#endif
 
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
//struct edge{int from,cost,to;};
struct P2{int x,y;};
#define BIT(Bit,n) bitset<n>(Bit)
#define Endl endl
 
const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000; 

int main(){
	int n;
	cin>>n;
	cout<<(24-n)+24<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <ctime> 
using namespace std;

#define pb push_back
#define All(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define rep1(i, l, r) for(int i = l; i <= r; ++i)
#define rep2(i, l, r) for(int i = l; i < r; ++i) 
#define per(i, r, l) for(int i = r; i >= l; --i)
typedef long long ll;
typedef double db;
typedef long double ldb;
const int NIL = -1;
const int oo = 0x3f3f3f3f;
const ll INF = 2e18;
const db eps = 1e-8;
const db PI = acos(-1.0);
const int maxn = 1e5 + 7;

struct node
{
	int u, v, w;
}G[100];

inline int read(void)
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{ if(ch == '-') f = -1; ch = getchar(); } 
	while(ch >= '0' && ch <= '9') {	x = (x << 1) + (x << 3) + ch - '0';	ch = getchar();	}
	return x * f;
}

inline void write(int x)
{
	if(x < 0) { putchar('-'); x = -x; }
    if(x >= 10) write(x/10); 
	putchar(x%10+'0'); 
}

int main(void)
{
	int L = read();
	L--;
	int sum = 0, x = 1;
	int n = 1, m = 0;
	while(sum + x <= L)
	{
		sum += x;
		G[m].u = n;
		G[m].v = n+1;
		G[m++].w = 0;
		G[m].u = n;
		G[m].v = n+1;
		G[m++].w = x;
		n++;
		x *= 2;
	}
	while(sum < L)
	{
		sum++;
		int val = sum;
		x = 1;
		int idx = 1;
		while(sum + x <= L)
		{
			sum += x;
			idx++;
			x *= 2;
		}
		G[m].u = idx;
		G[m].v = n;
		G[m++].w = val;
	}
	printf("%d %d\n", n, m);
	rep2(i, 0, m)
	{
		printf("%d %d %d\n", G[i].u, G[i].v, G[i].w);
	}
	
	
	return 0;
} 

Measured memory_bytes: 256
using System;
class c
{
    static void Main()
    {
        var ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        if (ab[0] > 0) Console.WriteLine("Positive");
        else if (ab[0] <= 0 && ab[1] >= 0) Console.WriteLine("Zero");
        else Console.WriteLine((ab[1] - ab[0]) % 2 == 0 ? "Negative" : "Positive");
    }
}

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

long long diff(long long a, long long b){
	if(a>b)
		return a-b;
	else
		return b-a;
}

long long solve(long long arr[], long long n){
	int dp[n];
	dp[0]=0;
	dp[1]=diff(arr[1],arr[0]);
	for(int i=2;i<n;i++){
		long long a = diff(arr[i],arr[i-1])+dp[i-1];
		long long b = diff(arr[i],arr[i-2])+dp[i-2];
		dp[i]=min(a,b);
	}
	return dp[n-1];
}

int main(int argc, char **argv)
{
	long long N;
	cin>>N;
	long long arr[N];
	for(int i=0;i<N;i++){
		cin>>arr[i];
	}
	cout<<solve(arr,N)<<endl;
	return 0;
}


Measured memory_bytes: 1408
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    T, X = il()
    print(T/X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t T, X;

	scanf("%zu %zu", &T, &X);

	printf("%lf\n", (double)T/(double)X);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  ll ans = 0;
  for (ll i = 0; i < S.size(); ++i) {
    if (S.at(i) != T.at(i)) {
      ans += 1;
    }
  }
  cout << ans << "\n";
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    ll n,m; cin >> n >> m;
    priority_queue<ll> a;
    rep(i, n) {
        ll tmp; cin >> tmp;
        a.push(tmp);
    }

    rep(i, m) {
        ll tmp = a.top();
        a.pop();
        tmp /= 2;
        a.push(tmp);
    }

    ll ans = 0;
    while(!a.empty()) {
        ans += a.top();
        a.pop();
    }

    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef uint64_t u64;
typedef int64_t i64;

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

void run (void) {
    const u64 n = read_int();
    const u64 w = read_int();
    const u64 mod = 998244353;
    u64 *dp = ALLOC (w + 1, u64);
    u64 ans = 0;
    u64 batch = 22;
    for (u64 i = 0; i < n; i += batch) {
        for (u64 j = i; j < i + batch && j < n; ++j) {
            const u64 a = read_int();
            dp[0] += 1;
            u64 *x = dp + w;
            u64 *y = dp + w - a;
            for (u64 i = a; i <= w; ++i) {
                *x += *y;
                --x;
                --y;
            }
            ans += dp[w];
        }
        u64 *v = dp;
        for (u64 i = 0; i <= w; ++i) {
            *v %= mod;
            ++v;
        }
    }
    printf ("%" PRIu64 "\n", ans % mod);
}

int main (void) {
    run();
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define ll long long

using namespace std;
int mod = 1000000007;

int N;
int main() {
  cin >> N;
  int ans = 0;
  rep(i, N) {
    int now;
    cin >> now;
    ans += now-1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import numpy as np
from itertools import permutations
from math import hypot

n = int(input())
cnt = 0
dis = 0

li = []
for _ in range(n):
    i, j = map(int, input().split())
    li.append(np.array([i, j]))

ptn = list(range(n))

for a in permutations(ptn):
    cnt += 1
    for i, j in zip(a,a[1:]):
        x1, y1 = li[i]
        x2, y2 = li[j]
        dis += hypot(x1-x2, y1-y2)

print(dis/cnt)

Measured memory_bytes: 12504
#include <iostream>
using namespace std;
using ll = long long;

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

	int cnt_one;
	char c;
	cnt_one = 0;

	for(int i=0; i<s.length(); i++){
		if(s[i]=='1'){
			cnt_one++;
			continue;
		}else{
			c = s[i];
			break;
		}
	}

	if(cnt_one >= k){
		cout << '1' << endl;	
		return 0;
	}

	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);
    LL Takahashi = 1LL,aoki = 1LL;
    for(int a = 0;a < N;a++){
        LCIN(b);LCIN(c);
        LL n = max((Takahashi+b-1)/b,(c+aoki-1)/c);
        Takahashi = n*b;
        aoki = n*c;
    }
    cout<<aoki+Takahashi<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                             it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

struct Edge{
    int from,to,cost,time;
    Edge(int from,int to,int cost,int time)
        : from(from),to(to),cost(cost),time(time) {};
};

int main(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n == 0 and m == 0) break;
        vector<vector<Edge> > V(m);

        for(int i=0;i<n;i++){
            int a,b,cost,time;
            cin >> a >> b >> cost >> time;
            a--;b--;
            V[a].push_back(Edge(a,b,cost,time));
            V[b].push_back(Edge(b,a,cost,time));
        }
        int k;
        cin >> k;
        for(int i=0;i<k;i++){
            int p,q,r;
            cin >> p >> q >> r;
            p--,q--;
            vector<char> visited(m,false);
            //                 cost,where
            priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > Q;
            Q.push(make_pair(0,p));
            while(!Q.empty()){
                int cost,where;
                cost = Q.top().first;
                where = Q.top().second;
                Q.pop();
                if(visited[where]) continue;
                if(where == q){
                    cout << cost << endl;
                    break;
                }
                visited[where] = true;
                for(int j=0;j<(int)V[where].size();j++){
                    if(r == 0){
                        Q.push(make_pair(V[where][j].cost+cost,V[where][j].to));
                    }else{
                        Q.push(make_pair(V[where][j].time+cost,V[where][j].to));
                    }
                }
            }
        }
    }
    return 0;
}

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

int main(){
	int m,n;
	cin>>n>>m;
	vector<int> items(n);
	int total = 0;
	for (int i = 0; i<n; i++){
		cin>>items[i];
		total+=items[i];
	}
	int maxval = (total-1)/(4.0*m);
	//cout<<maxval<<endl;
	int cnt = 0;
	for (int i = 0; i<n; i++){
		if (items[i]>maxval){
			cnt++;
		}
	}
	cout<<((cnt>=m)?string("Yes"):string("No"))<<endl;
}

Measured memory_bytes: 256
using System;
class Program
{
    public static void Main()
    {
        string[] import1 = Console.ReadLine().Split(' ');
        int h, w;
        h = int.Parse(import1[0]);
        w = int.Parse(import1[1]);
        char[] import2;
        char[,] s = new char[h, w];
        for (int i = 0; i < h; i++)
        {
            import2 = Console.ReadLine().ToCharArray();
            for (int j = 0; j < w; j++)
                s[i, j] = import2[j];
        }
        string[,] ans = new string[h, w];
        int count = 0;
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (s[i, j] == '#')
                    ans[i, j] = "#";
                else
                {
                    for (int x = -1; x <= 1; x++)
                    {
                        for (int y = -1; y <= 1; y++)
                        {
                            if (!(x == 0 && y == 0))
                            {
                                try
                                {
                                    if (s[i + x, y + j] == '#')
                                        count++;
                                }
                                catch { continue; }
                            }
                        }
                    }
                    ans[i, j] = count.ToString();
                    count = 0;
                }
            }
        }
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
                Console.Write(ans[i, j]);
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 11220
while True:
    (n, m) = tuple(map(int, input().split()))
    if n == 0:
        break
    arr = list(map(int, input().split()))
    arr.sort()
    
    res = -1
    for i, e in enumerate(arr[:-1]):
        d = i + 1
        if e + arr[i + 1] > m:
            break
        u = n
        while u - d > 1:
            medi = int((u + d) / 2)
            if e + arr[medi] > m:
                u = medi
            else:
                d = medi
        res = max(res, e + arr[d])
    if res < 0:
        print("NONE")
    else:
        print(res)



Measured memory_bytes: 5620
#include <cstdio>
int N;
char c;
int main() {
  scanf("%d",&N);
  bool flag=false;
  for(int i = 0; i < N; i++) {
    scanf("%c",&c);
    if(c == 'Y') flag = true;
  }
  
  if(flag)
    puts("Four");
  else
    puts("Three");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
using vec_i=vector<int>;
const int INF = 1e9;

int main(){
  int r,D,x;cin>>r>>D>>x;
  REP(i,2,12){
    print(r*x-D)
    x=r*x-D;
  }
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    ll r, c;
    cin >> r >> c;
    if(r == 1 || c == 1) cout << 1 << endl;
    else cout << (r*c + 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;

    string output;
    
    while(n > 0){

        int curr = n%26;
        if(curr == 0)
            curr = 26;
        output += (char)(96+curr);
        bool check = false;
        if( n%26 == 0) check = true;
        n/=26;
        if(check) n--;
    }

    reverse(output.begin() , output.end());


    cout<<output<<endl; 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;


int main()
{

	int N;

	cin >> N;

	//int min_a = 10000000000;
	//int max_a = 0;
	int a;
	cin >> a;
	int min_a = a;
	int max_a = a;
	for (int ni = 1; ni < N; ni++) {
		cin >> a;
		if (a < min_a) {
			min_a = a;
		}
		else if (a > max_a) {
			max_a = a;
		}
		//min_a = min(min_a, a);
		//max_a = max(max_a, a);
	}

	printf("%d", max_a - min_a);

    return 0;
}



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

int main(){
  string s;
  cin >> s;
  string ans;
  int xmin = 999;
  for(int i=0; i<s.size()-2 ; i++){
    if(abs(753-stoi(s.substr(i,3)))<xmin){
      xmin = abs(753-stoi(s.substr(i,3)));
    }
  }
  cout << xmin << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  long long N,a[200005],b[200005];

  scanf("%lld",&N);
  for(int i=2;i<=N;i++){
    scanf("%lld",&a[i]);
  }
  for(int k=1;k<=N;k++){
    b[k]=0;
  }
  for(int k=1;k<=N;k++){
    b[a[k]]++;
  }
  for(int k=1;k<=N;k++){
    printf("%lld\n",b[k]);
  }

  return 0;
  }

Measured memory_bytes: 4808
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::BinaryHeap;

const MOD: i64 = 1e9 as i64 + 7; 

fn main(){
    let s: Vec<char> = read::<String>().chars().collect();
    let t: Vec<char> = read::<String>().chars().collect();
    let mut ans = 0;
    for i in 0..3{
        if s[i] == t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int N;
int a[210];

int main() {
  while (cin >> N) {
	for (int i = 0; i < N; ++i) cin >> a[i];
	sort(a, a+N);
	cout << a[N-1] - a[0] << endl;
  }
}















Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char s[10];
  scanf("%s",s);
  int flag = 0;
  for(int i=0;i<3;i++){
    if(s[i] == s[i+1]){
      printf("Bad\n");
      flag = 1;
      break;
    }
  }
  if(flag == 0) printf("Good\n");
  return 0;
}

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

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var p = Array.ConvertAll(line, int.Parse);
        getAns(n, p);
    }
    static void getAns(int n, int[] p)
    {
        var count = 0;
        var imax = 1 << n;
        for (int i = 1; i < imax; i++)
        {
            var a = new List<int>();
            var b = new List<int>();
            for (int j = 0; j < n; j++)
            {
                if (((i >> j) & 1) == 1) a.Add(p[j]);
                else b.Add(p[j]);
            }
            var t = aLcm(a);
            if (check(t, b)) count++;
        }
        Console.WriteLine(count);
    }
    static bool check(long t, List<int> b)
    {
        foreach (var x in b)
            if (t % x == 0) return false;
        return true;
    }
    static long aLcm(List<int> a)
    {
        var acount = a.Count();
        if (acount == 1) return a[0];
        if (acount == 2) return Lcm(a[0], a[1]);
        var Lcm0 = Lcm(a[0], a[1]);
        var res = 0L;
        for (int i = 2; i < acount; i++)
        {
            res = Lcm(Lcm0, a[i]);
            Lcm0 = res;
        }
        return res;
    }
    static long Lcm(long a, long b) => a * b / gcd(a, b);
    static long gcd(long a, long b)
    {
        if (a < b) return gcd(b, a);
        while (b != 0)
        {
            var w = a % b;
            a = b;
            b = w;
        }
        return a;
    }
}


Measured memory_bytes: 20324
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int A,B;
    cin >> A >> B;
    int ans = 0;
    if (A > B)
    {
        ans += A;
        A--;
    } else {
        ans += B;
        B--;
    }
        if (A > B)
    {
        ans += A;
        A--;
    } else {
        ans += B;
        B--;
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
#define ll long long
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
	fastio();
	ll n,a,b;
	cin>>n>>a>>b;
	ll k = (n/(a+b));

	ll ans = k * a;

	n-=(k*(a+b));

	ans+=min(a,n);
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int T[5];
    for(int i=0;i<5;i++)
        cin >> T[i];
    
    int ans = 0, m, min = 999, index = -1;
    for(int i=0;i<5;i++){
        m = T[i] % 10;
        if(m > 0 && m < min){
            min = m;
            index = i;
        }
    }

    for(int i=0;i<5;i++){
        ans += T[i];
        if(i != index && (T[i] % 10) != 0){
            ans += 10 - (T[i] % 10);
        }
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 256
d=int(input())
c=list(map(int,input().split()))
ss=[list(map(int,input().split())) for i in range(d)]
ts=[int(input())for i in range(d)]
ans=0

from collections import defaultdict
las=defaultdict(int)

for i in range(d):
    t=ts[i]-1
    ans+=ss[i][t]
    las[t]=i+1
    ans-=sum(c[j]*(i+1-las[j])for j in range(26))
    print(ans)


Measured memory_bytes: 9840
#include <cstdio>
#include <cassert>
#include <queue>
#include <deque>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <set>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long int lli;
typedef pair<int, int> pii;
typedef unsigned char byte;
typedef unsigned int uint;
typedef unsigned long long int ulli;

vector<int> ll[1010];
vector<pii> edges;
bool reachable[1010][1010];
int removed[2][1010][1010];

void dfs(int st, int now) {
    for (int u : ll[now]) {
        if (!reachable[st][u]) {
            reachable[st][u] = true;
            dfs(st, u);
        }
    }
}

void removed_dfs(int rm, int v, int now, int k) {
    if (rm == now) return;
    for (int u : ll[now]) {
        if (!removed[k][rm][u]) {
            removed[k][rm][u] = v;
            removed_dfs(rm, v, u, k);
        }
    }
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    while (m--) {
        int a, b;
        scanf("%d%d", &a, &b);
        ll[a].push_back(b);
        edges.emplace_back(a, b);
    }
    int i;
    for (i=1; i<=n; ++i) {
        reachable[i][i] = true;
        dfs(i, i);
    }
    for (i=1; i<=n; ++i) {
        int j = 1;
        for (int u : ll[i]) {
            if (!removed[0][i][u]) {
                removed[0][i][u] = j;
                removed_dfs(i, j, u, 0);
            }
            ++j;
        }
        for (auto it = ll[i].rbegin(); it != ll[i].rend(); ++it) {
            int u = *it;
            --j;
            if (!removed[1][i][u]) {
                removed[1][i][u] = j;
                removed_dfs(i, j, u, 1);
            }
        }
    }
    for (pii u : edges) {
        if (reachable[u.second][u.first]) {
            puts(removed[0][u.first][u.second] == removed[1][u.first][u.second] ? "diff" : "same");
        } else {
            puts(removed[0][u.first][u.second] == removed[1][u.first][u.second] ? "same" : "diff");
        }
    }
    return 0;
}


Measured memory_bytes: 13296
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    int n = in.nextInt();

    int max = 0;
    int sum = 0;

    for (int i = 0; i < n; i++) {
      int p = in.nextInt();
      sum += p;
      max = Math.max(max, p);
    }

    out.println((sum - max) + max / 2);

    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  static void print(int[] arr) {
    Arrays.stream(arr).forEach(i -> System.out.print(i + " "));
    System.out.println();
  }

}



Measured memory_bytes: 21332
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	private static final Pattern pattern = Pattern.compile("(A)tCoder\\s([A-Z])[a-z]*\\s(C)ontest");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			System.out.println(pattern.matcher(s).replaceFirst("$1$2$3"));
		}
	}
}


Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int n,x,cur,ans;
int main()
{
	ans=cur=1;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		ans*=3;
		if (x%2==0) cur*=2; 
	}
	cout<<ans-cur<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define iss istringstream
#define sst stringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

ll t,a[1000010],x;

int main(){
	cin>>t;
	rep(i,1000001)a[i]=i;
	rep2(i,2,1000001)if(a[i]==i)for(int j=i;j<1000001;j+=i)a[j]=a[j]/i*(i-1);
	a[0]=1;
	rep2(i,1,1000001)a[i]+=a[i-1];
	rep(i,t)cin>>x,cout<<a[x]<<endl;
}

Measured memory_bytes: 0
x,k,d = map(int,input().split())
if k % 2 == 0:
    evenk = True
else:
    evenk = False
if abs(x)//d%2 == 0:
    even = True
else:
    even = False
if k*d < abs(x):
    ans = abs(x)-k*d
elif (evenk == True and even == True) or (evenk == False and even == False):
    ans = abs(x)%d
else:
    ans = abs(abs(x)%d-d)
print(ans)

Measured memory_bytes: 61680
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  vector<long long> b(n+1,0);
  map<long long,long long> nums;
  for(int i=0;i<n;i++){
     b[i+1]=b[i]+a[i];
  }
  for(int i=0;i<n+1;i++) nums[b[i]]++;
  
  long long res=0;
  for(auto it:nums){
    long long num=it.second;
    res+=num*(num-1)/2;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int n;
cin >> n;

vi a(n),b(n);
rep(i,n) cin >> a[i] >> b[i];
sort(a.begin(), a.end(), greater<int>());  
sort(all(b));

cout << a[0] + b[0] << endl;

return 0;
}

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

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a) < abs(x-b))cout << 'A' << endl;
    else cout << 'B' << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a,b,maxs=0;
int main(){
	scanf("%d%d",&a,&b);
	maxs=a*b;
	maxs=a-b<maxs?maxs:a-b;
	maxs=a+b<maxs?maxs:a+b;
	printf("%d",maxs);
	return 0;
} 

Measured memory_bytes: 256
S = input()

N = len(S)
dp = [[0 for _ in range(13)] for _ in range(10 ** 5 + 1)]
mod = 10 ** 9 + 7
dp[0][0] = 1

for i in range(N):
    s = S[i]
    for j in range(10):
        if s != "?" and s != str(j):
            continue
        for r in range(13):
            dp[i+1][(r * 10 + j) % 13] += dp[i][r]
    for j in range(13):
        dp[i+1][j] %= mod

print(dp[N][5])


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

using namespace std;

int main() {
    int n, a;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i<n; ++i) {
        v[i] = 0;
    }
    for (int i=0; i<n-1; ++i) {
        cin >> a;
        v[a-1] += 1;
    }
    for (int i=0; i<n; i++) cout << v[i] << '\n';
}


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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        char[] a=fsc.next().toCharArray();
        char[] b=fsc.next().toCharArray();
        char[] c=fsc.next().toCharArray();
        fsc.close();
        System.out.println(a[0]+""+b[1]+""+c[2]);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 22356
/**
 * Title:
 * Url:
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    int n, k; cin >> n >> k;
    if(n<=k) {
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    int q = n;
    while(q>0) {
        q = q/k;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;


int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    int now=1, ans=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(now==A[i]){
            now++;
        }else{
            ans++;
        }
    }
    if(ans==N) ans=-1;
    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b==0) return a;
	else return gcd(b,a%b);
}

//約数列挙
template <class T>
vector<T> divisor(T x){
	vector<T> res;
	for(T i=1;i*i<=x;i++){
		if(x%i==0){
			res.push_back(i);
			if(i!=x/i){
				res.push_back(x/i);
			}
		}
	}
	return res;
}

//素数判定
template <class T>
bool is_prime(T x){
	for(T i=2;i*i<=x;i++){
		if(x%i==0){
			return false;
		}
	}
	return x!=1;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll x=gcd(a,b);
	vector<ll> ret=divisor(x);
	ll ans=0;
	for(auto num:ret){
		if(is_prime(num)){
			ans++;
		}
	}
	cout<<ans+1<<endl;
}

Measured memory_bytes: 384
a, b, k = [int(i) for i in input().split(" ")]

def euclid(a, b):
    c = 1
    big = max(a, b)
    small = min(a, b)
    while (c != 0):
        c = big % small
        big = small
        small = c
    return big

c = euclid(a, b)
if k == 1:
    print(c)
    exit()
else:
    a_list = [i for i in range(1,c) if (c%i == 0)]
    print(a_list[-k+1])

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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define pii					pair<int, int> pii;
#define pll					pair<ll, ll>
#define si					set<int>
#define mp					make_pair
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL); 
const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N = 1e6 + 7;

int main() {_
	int n;

	cin >> n;
	
	int p[n], q[n];
	for(int i = 0; i < n; ++i)
		cin >> p[i];

	for(int i = 0; i < n; ++i)
		cin >> q[i];

	vi data(n);
	for(int i = 0; i < n; ++i)
		data[i] = i+1;
	int a, b, pos = 1;
	
	do {
		for(int i = 0; i < n; ++i)
			if(p[i] != data[i])
				goto nop;
		a = pos;
		nop:;

		for(int i = 0; i < n; ++i)
			if(q[i] != data[i])
				goto noq;
		b = pos;
		noq:;

		pos++;
	} while(next_permutation(ALL(data)));

	cout << abs(a - b) << "\n";
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N=190;
using std::max;
using std::min;
int n,m,a[N][N],sum[N][N],dp[N][N][N][15];
char c[N][N];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%s",c[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if (c[i][j]=='.') a[i][j]=1;
			else a[i][j]=0;
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
		}
	for (int i=1;i<=n;i++)	
		for (int j=1;j<=m;j++)
			for (int k=j;k<=m;k++){
				int l=i,r=n,ans=i-1;
				while (l<=r){
					int mid=(l+r)>>1;
					int s=sum[mid][k]-sum[mid][j-1]-sum[i-1][k]+sum[i-1][j-1];
					if (s==0 || s==(mid-i+1)*(k-j+1))
						ans=mid,l=mid+1;
					else r=mid-1;
				}
				dp[i][j][k][0]=ans;
			}
	int k=1;
	for (k=1;dp[1][1][m][k-1]<n;k++)
	for (int h=1;h<=m;h++)
		for (int i=1;i<=n;i++)
			for (int j1=1,j2=j1+h-1;j2<=m;j1++,j2++){
					if (dp[i][j1][j2][k-1]==n){
						dp[i][j1][j2][k]=n;
						continue;
					}
					dp[i][j1][j2][k]=dp[dp[i][j1][j2][k-1]+1][j1][j2][k-1];//横
					if(dp[i][j1][j2][k]==n) continue; 
					int l=j1,r=j2-1,ans=0;//竖 
					while (l<=r){
						int mid=(l+r)>>1;
						int x=dp[i][j1][mid][k-1],y=dp[i][mid+1][j2][k-1];
						ans=max(ans,min(x,y));
						if (x<y) r=mid-1;
						else l=mid+1;
					}
	
					dp[i][j1][j2][k]=max(dp[i][j1][j2][k],ans);
				}
	printf("%d\n",k-1);
}

Measured memory_bytes: 393856
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    // length N
    val squares = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    var strictlyIncreasing = true

    var min = if (squares[0] == 1) 0 else squares[0] -1

    for (i in 1 until N) {
        if (squares[i] < squares[i - 1] - 1 || squares[i] < min) {
            strictlyIncreasing = false
            break
        } else {
            min = Math.max(squares[i] - 1, min)
        }
    }

    if (strictlyIncreasing) {
        println("Yes")
    } else {
        println("No")
    }
}



Measured memory_bytes: 61332