akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int n;
  cin >> n;
  
  map <int,int>m;
  
  REP(i,n){
    int a;
    cin >> a;
    m[a]++;
  }
  
  int ans = 0;
  for(auto i : m) {
    if(i.second - i.first >= 0) ans += i.second - i.first;
    else						ans += i.second;
  }
  
  cout << ans << endl;
  

 return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

typedef vector<ll> vecll;
typedef vector<ld> vecld;
typedef vector<vector<ll> > matll;
typedef vector<vector<ld> > matld;
#define mp make_pair;

const ll prime = 1000000000 + 7;
const ld PI = 2 * acos(0.0);

/*
cout << fixed << setprecision(10);
*/

bool my_comp(pll a, pll b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}

	return a.second < b.second;
}

int main() {

	ll a1, a2, a3;
	cin >> a1 >> a2 >> a3;
	if (a1 + a2 + a3 >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}

	return 0;
}


Measured memory_bytes: 888
n, k = map(int, input().split())
# a = [int(x) for x in input().split()]
# f = [int(x) for x in input().split()]
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
lx = -1
rx = a[-1] * f[0]
while rx-lx>1 :
    cx = (lx + rx) // 2
    kk = 0
    for j in range(n):
        kk += max(0, a[j] - cx//f[j])
    if kk <= k:
        rx = cx
    else:
        lx = cx
print(rx)

Measured memory_bytes: 119500
#include"bits/stdc++.h"
using namespace std;

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

    int H, W, D;
    cin >> H >> W >> D;
    vector<pair<int, int>> r(H * W + 1);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int A;
            cin >> A;
            r[A] = { i, j };
        }
    }

    vector<int> cost(H * W + 1, -1);
    for (int i = 1; i <= D; i++) {
        pair<int, int> curr_sq = r[i];
        cost[i] = 0;

        int as = 0;
        for (int j = i + D; j <= H * W; j += D) {
            cost[j] = abs(r[j].first - curr_sq.first) + abs(r[j].second - curr_sq.second) + as;
            as = cost[j];
            curr_sq = r[j];
        }
    }

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int L, R;
        cin >> L >> R;
        cout << cost[R] - cost[L] << endl;
    }
}

Measured memory_bytes: 2176
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (3e9)

using namespace std;
typedef long long int ll;

int A, B;
int main(void){
    cin >> A;
    cin >> B;
    if(A+B==4) cout << 2 << endl;
    else if(A+B==5) cout << 1 << endl;
    else cout << 3 << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;


bool comp(pii a, pii b)
{
    if (a.second == b.second)
    {
        return a.first > b.first;
    }
    else
        return a.second < b.second;
}
int main()
{
    int n, m;
    cin >> n >> m;

    vector<pii> ab;
    rep(i, 0, n)
    {
        int a, b;
        cin >> a >> b;
        ab.emplace_back(a, b);
    }
    sort(ab.begin(), ab.end(), comp);
    reverse(ab.begin(), ab.end());
    
    vector<int> ok(m);
    rep(i, 0, m) ok[i] = i;
    
    ll ans = 0;
    for (auto a_b : ab)
    {
        int a, b;
        a = a_b.first;
        b = a_b.second;
        // cout << "*" << (a <= ok[ok.size() - 1])<< ' ' << ok[ok.size() - 1] << ' ' << a << ' ' << b << endl;

        if (ok.size() > 0)
        {
            vector<int>::iterator itr = upper_bound(ok.begin(), ok.end(), m - a);
            if (itr == ok.begin()) continue;
            ok.erase(itr - 1);
            ans += (ll)b;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1400
import java.util.*;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int D = sc.nextInt();
    
    int m = D*2+1;
    int ans = N/m;

    if(N%m==0){
        System.out.println(ans);
    }else{
        System.out.println(ans+1);
 }
}
}

Measured memory_bytes: 35692
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

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

Measured memory_bytes: 256
/*
Author- Aasav Badera
Time- Sun Apr 12 17:43:38 2020
*/
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define ll                 long long    
#define int                long long                        
#define pb                 push_back                                                     
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                1e18L+1
#define endl               '\n' 
#define N                  200005
ll n, m, k, a[N];


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    ll tests = 1;
    // cin >> tests;
    while(tests--)
    {
        cin >> n;
        ll sum = 0;
        rep(i ,1 ,n+1)
        {
        	if(i%3 and i%5)sum += i;
        }
        cout << sum << endl;
    }
    return 0;
}



Measured memory_bytes: 3620
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        public class lower_bound<T> : IComparer<T> where T : IComparable<T>
        {
            public int Compare(T x, T y) => 0 <= x.CompareTo(y) ? 1 : -1;
        }
        public class upper_bound<T> : IComparer<T> where T : IComparable<T>
        {
            public int Compare(T x, T y) => 0 < x.CompareTo(y) ? 1 : -1;
        }
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var L = Slist();
            L.Sort();
            
            var lb = new lower_bound<long>();
            var ub = new upper_bound<long>();

            var ans = 0L;
            for (var i = 0; i < N - 2; ++i)
            {
                var a = L[i];
                for (var j = i + 1; j < N - 1; ++j) 
                {
                    var b = L[j];
                    var cl = Max(a - b, b - a);
                    var cu = a + b - 1;
                    var num = ~L.BinarySearch(cl, lb);
                    if (N <= num) continue;
                    num = Max(j + 1, num);
                    var num2 = (~L.BinarySearch(cu, ub)) - 1;
                    if (num2 <= j) continue;
                    ans += num2 - num + 1;
                }
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13408
#include "bits/stdc++.h"
using namespace std;

int Solve( int N ){
	int Ans = 0;
	int Pos = 1;

	while( N ){
		if( ( N % 10 ) == 1 ) Ans = Ans + 9 * Pos;
		else if( (N % 10) == 9 ) Ans = Ans + 1 * Pos;
		else Ans = Ans + ( N % 10 ) * Pos;
		Pos *= 10;
		N /= 10;
	}

	return Ans;
}

int main(){
	int N;
	scanf( "%d" , &N );
	printf( "%d\n" , Solve(N) );
	return 0;
}

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

int main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    priority_queue< ll > P;
    priority_queue< ll > Q;
    priority_queue< ll > R;
    rep(i, A) {
        ll p;
        cin >> p;
        P.push(p);
    }
    rep(i, B) {
        ll q;
        cin >> q;
        Q.push(q);
    }
    rep(i, C) {
        ll r;
        cin >> r;
        R.push(r);
    }

    priority_queue< ll, vector< ll >, greater< ll > > arev;
    priority_queue< ll, vector< ll >, greater< ll > > brev;
    ll asum = 0L;
    ll bsum = 0L;
    rep(i, X) {
        ll a = P.top();
        P.pop();
        arev.push(a);
        asum += a;
    }
    rep(i, Y) {
        ll b = Q.top();
        Q.pop();
        brev.push(b);
        bsum += b;
    }
    while (R.size() > 0 && (arev.size() > 0 || brev.size() > 0)) {
        ll r = R.top();
        ll a = 0L;
        ll b = 0L;
        if (arev.empty()) {
            a = 1000000005L;
        } else {
            a = arev.top();
        }
        if (brev.empty()) {
            b = 1000000005L;
        } else {
            b = brev.top();
        }
        if (a <= b && a < r) {
            asum -= a;
            asum += r;
            arev.pop();
            R.pop();
        } else if (b < a && b < r) {
            bsum -= b;
            bsum += r;
            brev.pop();
            R.pop();
        } else {
            break;
        }
    }
    cout << asum + bsum << endl;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ff first
#define ss second
 
#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif
 
const int inf = 2e18;
const int ninf = -2e18-5;
const int mod = 1e9 + 7;

signed main(){
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	string s; cin>>s;
	int cur = 0;
	int m = 0;
	for(int i=0; i<3; i++){
		if(s[i]=='R') {
			cur+=1;
			m = max(m, cur);
		}
		else cur = 0;
	}
	cout<<m<<endl;
	return 0;
}

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

int main() {
    int d, t, s;
    cin >> d >> t >> s;
    if (s*t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-


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

    def f(n):
        if n < 2:
            return 1
        else:
            return n * f(n - 2)

    def count_tail_zero(s):
        cnt = 0
        for i in range(len(s) - 1, 0, -1):
            if s[i] == '0':
                cnt += 1
            else:
                break
        return cnt

    print(count_tail_zero(str(f(N))))


def correct():
    N = int(input())

    if N % 2 == 1:
        print(0)
        return

    denominator = 10
    ans = 0
    while denominator <= N:
        ans += N // denominator
        denominator *= 5

    print(ans)


if __name__ == "__main__":
    correct()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define first fi
#define second se
#define MOD 1000000007
#define MAXN 1000006
#define endl "\n"
#define readln(x) getline(cin, x);
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
ll fpow(ll x, ll n, ll mod){if (n==0) return 1%mod; ll u = fpow(x, n/2, mod); u = (u*u)%mod; if (n%2==1)u = (u*x)%mod;return u;}
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int K;
int main(){
    //freopen("data.txt","r",stdin);
    ll s = 0;
    cin >> K;
    for (int i = 1; i<=K; i++){
        for (int j = 1; j<=K; j++){
            for (int z = 1; z<=K; z++){
                s += gcd(i, gcd(j, z));
            }
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3644
import math
A,B,C,K = map(int,input().split())
count = 0
ans =0
if A>=K:
  ans = K
  print(K)
  exit()
elif A<K:
  count = K-A
  ans += A
  if count <= B:
    print(ans)
    exit()
  elif count > B:
    count = count-B
    ans += (-1)*count
    print(ans)
    exit()

Measured memory_bytes: 9140
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (100006)
ll n,m,A[MAXN],colour[MAXN],cost[MAXN*2];
bitset<MAXN>vis;
vector<pi>v[MAXN];
int main(){
	FAST
	cin>>n>>m;
	FOR(i,1,n)cin>>A[i];
	FOR(i,1,m){
		ll a,b;cin>>a>>b;
		v[a].eb(b,i),v[b].eb(a,i);
	}
	FOR(i,1,n){ll mi=LLINF;for(auto j:v[i])mi=min(mi,A[j.f]);if(mi>A[i]){cout<<"-1\n";return 0;}}
	vector<pi> D;
	FOR(i,1,n)D.eb(A[i],i);
	sort(all(D),greater<>());
	int co=0;
	while(D.size()){
		ll deal=D.back().f;
		vector<int> cur;
		cur.eb(D.back().s),D.pop_back();
		while(D.size() && D.back().f == deal) cur.eb(D.back().s), D.pop_back();
		function<void(ll)>dfs=[&](ll x){
			if(vis[x])return;
			vis[x]=1;
			for(auto i:v[x]) if(cost[i.s]==0) {
				if(colour[i.f]){
					assert(vis[i.f]);
					if(colour[i.f]==colour[x]) cost[i.s]=max(1ll,A[x]-A[i.f]);
					else cost[i.s]=A[x];
				}else if(A[i.f] == deal){
					assert(!vis[i.f]);//since colour==0
					colour[i.f]=3-colour[x];
					cost[i.s]=A[x];
					dfs(i.f);
				}
			}
		};
		for(auto&i:cur)if(!vis[i])colour[i]=(co&1)+1,dfs(i);
		++ co;
	}
	FOR(i,1,n)if(colour[i]==1)cout<<'W';else cout<<'B';
	cout<<'\n';
	FOR(i,1,m)cout<<cost[i]<<'\n';
}


Measured memory_bytes: 21424
($x,$y,$z,$k)=glob<>;
@a=sort {$b<=>$a} glob<>;
@b=sort {$b<=>$a} glob<>;
@c=sort {$b<=>$a} glob<>;
for$xx(0..$x-1){
    for$yy(0..$y-1){
        for$zz(0..$z-1){
            if(($xx+1)*($yy+1)*($zz+1)<=$k){
                $q[$i++]=$a[$xx]+$b[$yy]+$c[$zz]
            }
            else{last}
        }
    }
}
@q=sort{$b<=>$a}@q;
print$q[$_].$/for(0..$k-1);

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
	cin>>a>>b;
	for(double i=1.0;i<=20000.0;i+=1.0)
	{
		double x=i*0.08,y=i*0.1;
		x=floor(x);
		y=floor(y);
		if(x==a && y==b)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}

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

int main()
{
	int N,K;
	cin >> N >> K;
	cout << min(N%K,1) << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

n=int(input())
# n=100000
tree=[set() for i in range(n)]
edges=[tuple(map(int,input().split())) for i in range(n-1)]
edge_color={}
for a,b in edges:
    a-=1
    b-=1
    tree[a].add(b)
    tree[b].add(a)
k = 0
for i in range(n):
    k = max(k,len(tree[i]))

for a,b in edges:
    edge_color[(a-1,b-1)] = 0

def colorize(u,v,c,init=False):
    if not init:
        edge_color[(min(u,v),max(u,v))] = c
    cc = c+1
    if cc > k:
        cc = 1
    for x in tree[u]:
        if edge_color[(min(x,u),max(x,u))] == 0:
            colorize(x,u,cc)
            cc += 1
            if cc > k:
                cc = 1

colorize(0,1,1,True)
print(k)
for a,b in edges:
    print(edge_color[(a-1,b-1)])

Measured memory_bytes: 101800
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

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

    ll N, K, x, mod = 1e9 + 7;
    cin >> N >> K;
    vector<ll> plus, minus;
    ll zero = 0;
    REP(_, 0, N)
    {
        cin >> x;
        if (x == 0)
            ++zero;
        else if (x > 0)
            plus.emplace_back(x);
        else
            minus.emplace_back(x);
    }

    if (N == K)
    {
        if (zero > 0)
        {
            cout << 0 << endl;
            return 0;
        }
        ll ans = 1;
        for (auto x : plus)
            ans = ans * x % mod;
        for (auto x : minus)
            ans = ans * x % mod;
        ans = (ans + mod) % mod;
        cout << ans << endl;
        return 0;
    }
    if (plus.size() + minus.size() == K)
    {
        if ((minus.size() & 1) == 1 && zero > 0)
        {
            cout << 0 << endl;
            return 0;
        }
        ll ans = 1;
        for (auto x : plus)
            ans = ans * x % mod;
        for (auto x : minus)
            ans = ans * x % mod;
        cout << (ans + mod) % mod << endl;
        return 0;
    }
    if (plus.empty() && K % 2 == 1)
    {
        if (zero > 0)
        {
            cout << 0 << endl;
            return 0;
        }

        sort(minus.rbegin(), minus.rend());
        ll ans = 1;
        REP(i, 0, min(K, (ll)minus.size()))
        ans = (ans * minus[i] + mod) % mod;
        cout << ans << endl;
        return 0;
    }
    if ((plus.size() + minus.size()) < K)
    {
        cout << 0 << endl;
        return 0;
    }

    cerr << "main" << endl;
    sort(plus.rbegin(), plus.rend());
    sort(minus.begin(), minus.end());
    ll pn = plus.size(), mn = minus.size();
    plus.insert(plus.begin(), 1);
    minus.insert(minus.begin(), 1);
    vector<ll> plus_acc(pn + 1, 1);
    REP(i, 1, pn + 1)
    plus_acc[i] = plus[i] * plus_acc[i - 1] % mod;

    ll minus_acc = 1, ans = 0;
    ll pi = min(K, pn);
    ll mi = K - pi;
    if (mi % 2 == 1)
    {
        --pi;
        ++mi;
    }
    cerr << pi << "," << mi << endl;
    REP(i, 1, mi + 1)
    {
        minus_acc = minus_acc * minus[i] % mod;
    }
    cerr << plus_acc[pi] << "," << minus_acc << endl;
    ans = (plus_acc[pi] * minus_acc + mod) % mod;
    while (pi >= 2 && mi + 2 <= mn)
    {
        if (plus[pi] * plus[pi - 1] > minus[mi + 1] * minus[mi + 2])
            break;
        minus_acc = (minus_acc * minus[mi + 1]) % mod;
        minus_acc = (minus_acc * minus[mi + 2]) % mod;
        pi -= 2;
        mi += 2;
        ans = (plus_acc[pi] * minus_acc) % mod;
    }

    cout << (ans + mod) % mod << endl;
}


Measured memory_bytes: 6256
#include<stdio.h>

int main(){
  int s , i;
  scanf("%d" ,&s);
  long long a[s+1];
  for( i = 0; i <= s ; i++ ){
    if( i < 3 )
      a[i] = 0;
    else if( i == 3)
      a[i] = 1;
    else
      a[i] = a[i-1] + a[i-3];
    a[i] %= 1000000007;
  }
  printf("%lld\n",a[s]);
  return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
#define ll long long

int main(){

    int n; cin >> n;
    long long a[n];

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

    cout << accumulate(a, a+n, 0LL);


    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    for w in range(1, int(3*N/4)+1):
        a = 4 * w - N
        b = N * w
        if a == 0:
            continue
        for n in range(w, int(2*b/a)+1):
            if a*n - b != 0 and (b*n) % (a*n - b) == 0:
                h = b * n // (a*n - b)
                if h > 0:
                    print(h, n, w)
                    return
main()


Measured memory_bytes: 3060
import string
N = int(input())
ANS =[]
while N>0:
    M=int(N%26)
    if M==0:
        M=26
    ANS.insert(0,string.ascii_lowercase[M-1])
    N=N-M
    N=N/26
    # print(ANS)
map = map(str,ANS)
print(''.join(map))

Measured memory_bytes: 71928
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600
typedef pair<int, int> P;

int main(){
  int n,m;
  cin>>n>>m;
  vector<P> vec(n);
  rep(i,n) vec[i] = mp(i,i);
  vector<P> mac(m);
  rep(i,m){
    int a,b;
    scanf("%d %d", &a, &b);
    mac[i] = mp(a,--b);
  }

  sort(all(mac));

  for(auto p : mac){
    int d = p.se;
    vec[d].se = vec[d+1].se;
    vec[d+1].fi=vec[d].fi;
  }

  rep(i,n){
    printf("%d%c", vec[i].se-vec[i].fi+1, ((i==n-1)?'\n':' '));
  }

  return 0;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

  int k, x;
  cin >> k >> x;
  REP(i, x - k + 1, x + k) {
    cout << i << " ";
  }
  return 0;
}


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

string w;
int a[30];
int main(){
  cin>>w;
  for(int i=0;i<w.size();i++){
    a[w[i]-'a']++;
  }
  for(int i=0;i<30;i++){
    if(a[i]%2!=0){cout<<"No"<<endl;return 0;}
  }
  cout<<"Yes"<<endl;
  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll s = 0;
  ll n;std::cin >> n;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0) s += i;
  }
  std::cout << s << '\n';
  return 0;
}


Measured memory_bytes: 3164
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>

#define int long long

using namespace std;

const int N = 6e5;
const int INF = 2100000000;

int n, m, ec, a, b, c, q, fir;
int f[N], fa[N], way[N];

struct Edge
{
	int u, v, w, nxt, id;
	bool operator < (const Edge &b) const
		{ return w < b.w; }
}e[N << 1];

inline void Addedge(int a, int b, int c)
{
	++ec;
	e[ec].u = a;
	e[ec].v = b;
	e[ec].w = c;
	e[ec].nxt = f[a];
	f[a] = ec;
}

inline void read(int &x)
{
	int k = 1; x = 0;
	char c = getchar();
	while (!isdigit(c))
		if (c == '-') c = getchar(), k = -1;
		else c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ 48),
		c = getchar();
	x *= k;
}

int Find(int x)
{
	return (x == fa[x]) ? x : fa[x] = Find(fa[x]);
}

signed main()
{
	read(n), read(m);
	memset(f, -1, sizeof(f));
	for (int i = 1; i <= n; ++i) way[i] = INF;
	for (int i = 1; i <= m; ++i)
		read(a), read(b), read(c), ++a, ++b, Addedge(a, b, c), 
		way[a] = min(way[a], c + 1), way[b] = min(way[b], c + 2);
	for (int i = 1; i <= n; ++i)
		way[i] = min(way[i], way[(i == 1) ? n : i - 1] + 2);
	for (int i = 1; i <= n; ++i)
		way[i] = min(way[i], way[(i == 1) ? n : i - 1] + 2);
	for (int i = 1; i <= n; ++i)
		Addedge(i, (i == n) ? 1 : i + 1, way[i]), fa[i] = i;
	sort(e + 1, e + ec + 1);
	for (int i = 1; i <= ec; ++i)
	{
		if (way[0] >= n - 1) break;
		if (Find(e[i].u) != Find(e[i].v) && e[i].w != INF)
			fa[Find(e[i].u)] = Find(e[i].v), ++way[0], q += e[i].w;
	}
	printf("%lld", q);
	return 0;
}

Measured memory_bytes: 28672
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string S=in<string>();
	
	if(S[0]!='A'){
		cout << "WA" << endl;
		return 0;
	}
	bool flag = false;
	for(int i=1,ei=S.size();i<ei;i++){
		char c = S[i]-'A';
		if(c==2){
			if(i==1 || i==(ei-1)){
				cout << "WA" << endl;
				return 0;
			}
			else{
				if(!flag) flag = true;
				else{
					cout << "WA" << endl;
					return 0;
				}
			}
		}
		else if(c<('a'-'A')){
			cout << "WA" << endl;
			return 0;
		}
	}
	if(!flag) cout << "WA" << endl;
	else cout << "AC" << endl;
	return 0;
}


Measured memory_bytes: 256
A=Int[]
for _=1:3
	for a=parse.(split(readline()))
		push!(A,a)
	end
end
ok=zeros(Int,9)
for _=1:parse(readline())
	b=parse(readline())
	for i=1:9
		if A[i]==b
			ok[i]=1
		end
	end
end
println(ok[1]*ok[2]*ok[3]+ok[4]*ok[5]*ok[6]+ok[7]*ok[8]*ok[9]+ok[1]*ok[4]*ok[7]+ok[2]*ok[5]*ok[8]+ok[3]*ok[6]*ok[9]+ok[1]*ok[5]*ok[9]+ok[3]*ok[5]*ok[7]>0 ? "Yes" : "No")


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    vl s(n+1);
    rep(i,n)s[i+1] = s[i] + a[i];
    ll res = 0;
    rep(i,n-1){
      if(s[i+1]*2 < a[i+1]){
        res = i+1;
      }
    }
    out(n-res);
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.buffer.readline

import bisect
N, M, K = map(int, input().split())
A = list(map(int, (input().split())))
B = list(map(int, (input().split())))
cumA, cumB = [0], [0]
for a in A:
    cumA.append(cumA[-1]+a)
for b in B:
    cumB.append(cumB[-1]+b)
ans = 0
for i in range(N, -1, -1):
    if cumA[i] > K: continue
    j = bisect.bisect_right(cumB, K-cumA[i])
    ans = max(ans, i+j-1)
print(ans)

Measured memory_bytes: 48256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

class UnionFind:
    def __init__(self, size):
        self.table = [-1 for _ in range(size)]

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

    def subsetall(self):
        a = []
        for i in range(len(self.table)):
            if self.table[i] < 0:
                a.append((i, -self.table[i]))
        return a

def main():
    random.seed(42)
    rr = []

    def f(n, m):
        qa = [LS() for _ in range(m)]
        d = collections.defaultdict(lambda: collections.defaultdict(int))
        for i in range(n+1):
            d[i][i] = random.randrange(1,100)
        r = []
        uf = UnionFind(n+1)
        for q in qa:
            if q[0] == '!':
                a,b,w = map(int, q[1:])
                fa = uf.find(a)
                fb = uf.find(b)
                if fa == fb:
                    continue
                uf.union(a,b)
                # print('a,b',a,b)
                # print('dfa', d[fa])
                # print('dfb', d[fb])
                if fa == uf.find(a):
                    sa = w + (d[fa][a] - d[fb][b])
                    for k in d[fb].keys():
                        d[fa][k] = d[fb][k] + sa
                else:
                    sa = (d[fa][a] - d[fb][b]) + w
                    for k in d[fa].keys():
                        d[fb][k] = d[fa][k] - sa
                # print('sa',sa)
                # print('dfa', d[fa])
                # print('dfb', d[fb])
            else:
                a,b = map(int , q[1:])
                fa = uf.find(a)
                if fa != uf.find(b):
                    r.append('UNKNOWN')
                else:
                    r.append(d[fa][b] - d[fa][a])
        # for k in d.keys():
        #     print('k,d',k,d[k])

        return r

    while 1:
        n,m = LI()
        if n == 0 and m == 0:
            break
        rr.extend(f(n,m))

    return '\n'.join(map(str,rr))


print(main())



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

int main() {
	long n,m,i,j,k,ans,cur,c;
	cin >> n;
	
	ans=0;
	for(i=1; i*i<=n-1; i++){
		if((n-1)%i==0){
			ans++;
			if(i*i<n-1){
				ans++;
			}
		}
	}
	ans--; // delete i==1
	
	for(i=2; i*i<=n; i++){
		if(n%i==0){
			k=n;
			while(k%i==0){
				k/=i;
			}
			if(k%i==1){
				ans++;
			}
			
			if(i*i<n){
				k=n;
				while(k%(n/i)==0){
					k/=(n/i);
				}
				if(k%(n/i)==1){
					ans++;
				}
			}
		}
	}
	ans++; // add i=n;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
        static void Main(string[] args)
        {
          //入力を受け取る
          var NK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
          int N = NK[0];
          N = N-1;
          int K = NK[1];
          var A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
          var L = K-1;
          var min = 1;
          var point1 = 0;
          var count = 0;
          var res = 0;
          
          if(N%L == 0){
            res = N/L;
          }else{
            res = N/L+1;
          }

          Console.WriteLine(res);
        }
  
}


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

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 main() {
    int n;
    ll x;
    cin >> n >> x;
    vector<ll> towns{x};
    rep(i, n) {
        ll xi;
        cin >> xi;
        towns.push_back(xi);
    }

    sort(towns.begin(), towns.end());
    ll prev = towns[1], ans = towns[1] - towns[0];
    rep(i, n - 1) {
        ll dist = towns[i + 2] - prev;
        ans = gcd(ans, dist);
        prev = towns[i + 2];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include <set>
#include <stdio.h>
using namespace std;
char s[15];
set<string> st;
int main() {
    int n, r = 0;
    scanf("%d", &n);
    while (n--) {
        scanf("%s", s);
        if (st.find(s) != st.end()) continue;
        st.insert(s);
        r++;
    }
    printf("%d\n", r);
    return 0;
}


Measured memory_bytes: 18936
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,1,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)
#define pb push_back

template<typename T> 
void chmax(T &a,T b){ a = max(a, b);};
template<typename T> 
void chmin(T &a,T b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
ll n,p;
map<ll,ll> primes;
ll ans = 1;
void update(ll num){
	if(primes[num]%n==0){
		ans*=num;
	}
}
void factorize(ll num){
	bool is_roop=true;
	while(is_roop){
		is_roop=false;
		for(ll i=2;i*i<=num;i++)
			if(num%i==0){
				is_roop=true;
				num/=i;
				primes[i]++;
				update(i);
				break;
			}
	}
	primes[num]++;
	update(num);
}

void solve(){
	factorize(p);
	cout<<ans<<endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 9 && b <= 9) cout << a*b << "\n";
    else puts("-1");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b;
    int flag=0;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"OK"<<endl;
    }
    else if(flag==0)
    {
        cout<<"NG"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3564
A = gets.chomp.scan(/./).map &:to_i
[false, true].product([false, true], [false, true]).each do |op|
  s = A[0]
  for i in 0...3
    if op[i]
      s += A[i+1]
    else
      s -= A[i+1]
    end
  end
  if s==7
    print A[0]
    for i in 0...3
      print (op[i] ? '+' : '-')
      print A[i+1]
    end
    puts '=7'
    exit
  end
end



Measured memory_bytes: 1788
let input = require("fs").readFileSync("/dev/stdin","utf-8");

let lines = input.split("\n");
let count = parseInt(lines.shift());
let x = lines.shift().split(" ").map(item=>parseInt(item));
let y = lines.shift().split(" ").map(item=>parseInt(item));

function dit(p){
    let put = 0;
    for(let i=0;i<count;i++){
        put+= Math.pow(Math.abs(x[i]-y[i]),p);
    }
    return Math.pow(put,(1/p));
}

for(let i=1;i<4;i++){
    console.log(dit(i));
}
let max =0;
for(let i=0;i<count;i++){
    let diff = Math.abs(x[i]-y[i]);
    if(diff>max){
        max = diff;
    }
}
console.log(max);


Measured memory_bytes: 15652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, x, y;
	cin >> n >> x >> y;
	//print(n)
	ll dst[n+1][n+1];
	rep(i, 1, n){
		rep(j, 1, n){
			dst[i][j] = abs(i-j);
		}
	}
	
	rep(i, 1, n){
		rep(j, 1, n){
			dst[i][j] = min(dst[i][j], dst[i][x]+1+dst[y][j]);
			dst[i][j] = min(dst[i][j], dst[i][y]+1+dst[x][j]);
		}
	}
	
	ll ans[n+1];
	memset(ans, 0, sizeof(ans));
	rep(i, 0, n){
		rep(j, 1, i-1){
			ans[dst[i][j]]++;
		}
	}
	//print(n)
	rep(i, 1, n-1){
		print(ans[i])	
	}
	return 0;
}

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

#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;

ull poww(ull a, int b)
{
	if (b <= 0)
		return 1;
	ull ans = 1;
	while (b--)
		ans *= a;
	return ans;
}

void solve()
{
	ull n;
	cin >> n;
	ull x = 26;
	ull curr = 1;
 


	string result = "";
    while (n > 0)
    {
    	n-=1;
        result = (char)('a' + n % x ) + result;
        n /= 26;
    }
    cout << result ;
}

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}




Measured memory_bytes: 3636
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     __gcd((a),(b))
#define     lcm(a,b)     ((a)*(b))/gcd((a),(b))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,MOD=1e9+7;

void solve()
{
 int a,p;
 cin>>a>>p;

 int tot=a*3+p;
 cout<<tot/2;
}

int32_t main()
{
 fast();

 int t=1;
 //cin>>t;
 while(t--)
 {
  solve();
 }

 return 0;
}



Measured memory_bytes: 256
n , k = map(int,input().split(' '))
s = [list(map(int,input().split(' '))) for i in range(n)]
x = [i*0 for i in range(k+1)]
s.append(x)
temp = 0
for i in range(n):
    ans = 0
    for v in range(k):
        ans += s[i][v]
        s[n][v] += s[i][v]
    s[i].append(ans)
    temp += ans
s[n][k] = temp
for i in s:
    print(*i)



Measured memory_bytes: 6236
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;


char prime[60000] = { 0 };

signed main() {
	int N;
	cin >> N;

	for (auto& p : prime) p = true;

	int cnt = 0;
	for (int n = 2; n < 55556; n++) {
		if (prime[n]) {
			if (n % 5 == 1) {
				cout << n << ' ';
				cnt++;
				if (cnt == N) 
					return 0;
			}
			for (int i = n + n; i < 55556; i += n) {
				prime[i] = false;
			}
		}
	}


	return 0;
}



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

int n;
int x[2][110];

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

    for(i=n-1;i>=1;i--)
        x[1][i]=x[1][i]+x[1][i+1];

    for(i=2;i<=n;i++)
        x[0][i]=x[0][i]+x[0][i-1];

    int sol=-10;
    for(i=1;i<=n;i++)
        sol=max(sol,x[0][i]+x[1][i]);

    cout<<sol<<'\n';
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
d = {'p': S, 's': R, 'r': P}
flag = [0] * K
for n in range(N):
    q = n % K
    ans += d.get(T[n])
    if n >= K:
        if T[n] == T[n - K] and n < N - K:
            flag[q] += 1
        elif (flag[q] != 0 and T[n] != T[n - K]) or n >= N - K:
            if n >= N - K and T[n] == T[n - K]:
                flag[q] += 1
            ans -= d.get(T[n - K]) * ((flag[q] + 1) // 2)
            flag[q] = 0
print(ans)

Measured memory_bytes: 3956
#include<iostream>
#include<vector>


using namespace std;

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

  vector<int> p(n);

  int ans = 0;
  for( int i =0; i < n ; ++i  )cin >> p[i] ;
  for( int i =1; i < n -1; ++i  ){
    if(( (p[i]  < p[i - 1]  ) && (p[i] > p[i + 1])) || ( (p[i]  > p[i - 1]  ) && (p[i] < p[i + 1]) )) ++ ans;
  }

  cout << ans << endl;

}


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

const ll infll=9223372036854775806;
const int inf=2147483646;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	if (a*c<=b){
		cout<<c;
	}
	else {
		cout<<(int)b/a;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0};
const int INF = 1e9+101;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(ll i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}
int main() {
    int A,P;
    cin >> A >> P;
    A *= 3;
    cout <<(A+P)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#define mem(a,b) memset(a,b,sizeof (a))
#define endl '\n'
#define pb push_back
typedef long long ll;
const int maxn=200010;
const int inf=1e9;
const ll mod=998244353;
const double pi=acos(-1.0);
using namespace std;
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=n/(a+b)*a;
    ans+=min(n%(a+b),a);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll h, w;
  cin >> h >> w;
  ll count = 0;
  rep(i, h)
  {
    string a;
    cin >> a;
    rep(j, w){
      if(a[j] == '#'){
        count++;
      }
    }
  }
  cout<<(count==h+w-1 ? "Possible":"Impossible");
}


Measured memory_bytes: 3640