akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, T;
string S;
signed main(){
  cin >> N >> K;
  vi h(N);
  rep(i,N) cin >> h[i];
  sort(all(h));
  int ans = 1e18;
  rep(i,N-K+1){
    ans = min(ans, h[i+K-1]-h[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4024
#include <iostream>
  
using namespace std;  
  
// 入力  
int a, b;  
  
void solve()  
{  
    int res = 0;  
  
    a += b;  
  
    for (; a; a /= 10)  
        res++;  
  
    cout << res << endl;  
}  
  
int main()  
{  
    while (cin >> a >> b)  
        solve();  
  
    return 0;  
} 


Measured memory_bytes: 3084
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var HW = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var (H, W) = (HW[0], HW[1]);
            var answer = H * W + 1;
            for (var i = 0; i < 2; i++)
            {
                if (i == 1) (H, W) = (W, H);
                for (var h = 1; h < H; h++)
                {
                    var S = new long[3];
                    var y = (H - h);
                    var x = W / 2;
                    S[0] = h * W;
                    S[1] = y * x;
                    S[2] = y * (W - x);
                    var diff = S.Max() - S.Min();
                    answer = Math.Min(answer, diff);

                    x = y / 2;
                    S[1] = x * W;
                    S[2] = (y - x) * W;
                    diff = S.Max() - S.Min();
                    answer = Math.Min(answer, diff);
                }
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 46792
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

n = int(input())

r = []

for i in range(n):
    city, score = input().split()
    score = int (score)
    r.append((i+1, city, score))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

for i in range(n):
    print(r[i][0])


Measured memory_bytes: 9956
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
    	if(i%2==0){
    		char tap=s.at(i);
    		if(tap=='L'){
    			cout<<"No\n";
    			return 0;
			}
		}
		else{
    		char tap=s.at(i);
    		if(tap=='R'){
    			cout<<"No\n";
    			return 0;
			}
		}
	}
	cout<<"Yes\n";
	return 0;
}

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

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for (int i = init; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to;
    int cost;
};

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int N;

    while(cin >> N, N)
    {   
        vector<ll> a(N);
        rep(i, N) cin >> a[i];        

        vector<ll> dp(N, 0);

        dp[0] = a[0];

        rep(i, N - 1)
            dp[i + 1] = max(dp[i] + a[i + 1], a[i + 1]);

        ll ans = -llINF;

        rep(i, N) ans = max(dp[i], ans);

        cout << ans << endl;
        
    }

    return 0;
}


Measured memory_bytes: 3128
n,q =map(int,input().split())
s = input()

d= {}

for k in range(n):
    d[k]=0

total = 0
for j in range(n-1):
    if s[j]=='A' and s[j+1]=='C':
        total+=1
        d[j+1]+=total
    else:
        d[j+1]=total
        
# print(d)

ans = []
for _ in range(q):
    l,r = map(int,input().split())

    ans.append(d[r-1] -d[l-1])


for i in ans:
    print(i)

Measured memory_bytes: 20460
X, K, D = map(int, input().split())

ans = 0
count = X // D



if X >= 0:
    if K <= count:
        ans = X - D * K
    else:
        ans = X - D * count
        if ((K - count) % 2 == 1):
            ans = ans - D
else:
    if K <= (-1) * count:
        ans = X + D * K
    elif X % D == 0:
        ans = X - D * count 
        if ((K + count) % 2 == 1):
            ans = ans + D
    else:
        ans = X - D * (count + 1) 
        if ((K + count + 1) % 2 == 1):
            ans = ans + D

if ans < 0:
    ans = ans * (-1)

print(ans)




Measured memory_bytes: 9216
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i]
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion



int32_t main() {
    make(int, n);
    VVI dp(3, VI(n + 1));
    for (int i = 0; i < n; ++i) {
        make(int, a, b, c);
        dp[0][i + 1] = max(dp[1][i], dp[2][i]) + a;
        dp[1][i + 1] = max(dp[0][i], dp[2][i]) + b;
        dp[2][i + 1] = max(dp[0][i], dp[1][i]) + c;
    }
    cout << max({dp[0][n], dp[1][n], dp[2][n]});


    return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>
#include <string.h>
void replace(char line[]){
    int i=0,a,b,t=0;
    char line1[1001];
    scanf("%d %d %s",&a,&b,line1);
    for(i=a;i<=b;i++)
        line[i]=line1[t++];
}
void reverse(char line[]){
    int a,b,sign,i;
    char temp;
    scanf("%d %d",&a,&b);
    sign=b;
    for(i=a;i<sign;i++,sign--){
        temp=line[i];
        line[i]=line[sign];
        line[sign]=temp;
    }
}
void print(char line[]){
    int a,b;
    scanf("%d %d",&a,&b);
    while(a<=b)
        printf("%c",line[a++]);
    puts("");
}
int main(void){
    char line[1001],ope[8];
    int num,i;
    scanf("%s",line);
    scanf("%d",&num);
    for(i=0;i<num;i++){
        scanf("%s",ope);
        if(!strcmp(ope,"replace"))
            replace(line);
        else if(!strcmp(ope,"reverse"))
            reverse(line);
        else
            print(line);
    }
    return 0;
}

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


int main() {
  long int N,A,B;
  cin >> N >> A >> B;
  long int count;
  if(N >= A+B) count = N/(A+B)*A + min(N%(A+B),A);
  else if(N < A) count = N;
  else count = A;
  cout << count << endl;
  
}
   

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main (){
    int a,b,c,anc;
    scanf("%d %d %d",&a,&b,&c);
    if(a >=b && a >=c) anc =10*a+b +c;
    else if(b >=a && b>=c) anc = 10*b+a+c;
    else anc =10*c +a+b;

    printf("%d",anc);
    

    
       
}
 //chcp 65001 cd contest

Measured memory_bytes: 128
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    s = [0] * N
    t = [0] * N

    for i in range(N):
        s[i], t[i] = map(str, input().split())
        t[i] = int(t[i])

    X = input()
    xi = 0

    for i in range(N):
        if s[i] == X:
            xi = i
            break

    ans = 0

    for i in range(N):
        if xi < i:
            ans += t[i]

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main()
{   
    int a,b;
    cin>>a>>b;
    char c[a][b];
    rep(i,a)rep(j,b)cin>>c[i][j];
    rep(i,a){
        rep(j,b){
            if(c[i][j]<='#')break;
            if(j==b-1) rep(k,b) c[i][k]='a';
        }
    }
    rep(j,b){
        rep(i,a){
            if(c[i][j]<='#')break;
            if(i==a-1) rep(k,a) c[k][j]='a';
        }
    }

    rep(i,a){
        rep(j,b)if(c[i][j]!='a')cout<<c[i][j];
        cout<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
 
int n;
vector<vector<int> > a;
const int MAX = 15;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
 
bool valid(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < n;
}
 
void Rotate() {
    int r, c, size, angle;
    cin >> r >> c >> size >> angle;
    --r; --c;
    angle /= 90;
 
    const int cp = size - 1;
 
    for(int t = 0; t < angle; ++t) {
        vector<vector<int> > tmp(a);
        for(int i = 0; i < size; ++i) {
            for(int j = 0; j < size; ++j) {
                int tx = -i + cp;
                int ty = j;
                tmp[ty + r][tx + c] = a[i + r][j + c];
            }
        }
        a.swap(tmp);
    }
}
 
void Reversal() {
    int r, c, size;
    cin >> r >> c >> size;
    --r; --c;
 
    for(int i = 0; i < size; ++i) {
        for(int j = 0; j < size; ++j) {
            a[i + r][j + c] = !a[i + r][j + c];
		}
	}
}
 
void LeftShift() {
    int r;
    cin >> r;
    --r;
    rotate(a[r].begin(), a[r].begin() + 1, a[r].end());
}
 
void RightShift() {
    int r;
    cin >> r;
    --r;
    rotate(a[r].begin(), a[r].begin() + n - 1, a[r].end());
}
 
void dfs(int y, int x, const int v) {
    if(a[y][x] != v)
        return;
 
    a[y][x] = !a[y][x];
    for(int i = 0; i < 4; ++i) {
        const int nx = x + dx[i];
        const int ny = y + dy[i];
        if(valid(nx, ny)) {
            dfs(ny, nx, v);
        }
    }
}
 
void IslandReversal() {
    int r, c;
    cin >> r >> c;
    --r; --c;
 
    dfs(r, c, a[r][c]);
}
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int m;
    cin >> n >> m;  
 
    a.resize(n, vector<int>(n));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> a[i][j];
		}
	}
 
    for(int i = 0; i < m; ++i) {
        int o;
        cin >> o;
 
        switch(o) {
        case 0: Rotate(); break;
        case 1: Reversal(); break;
        case 2: LeftShift(); break;
        case 3: RightShift(); break;
        case 4: IslandReversal(); break;
        }
    }
 
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cout << a[i][j]  << (j + 1 == n ? "\n" : " ");
		}
	}
 
    return EXIT_SUCCESS;
}

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

int main(){
    string str;
    cin >> str;
    int s = 0;
    int e = str.size()-1;
    int ok = 1;

    int ans = 0;

    while(s <= e){
        if(s == e){
            break;
        }
        if(str[s] == str[e]){
            s++;
            e--;
            continue;
        }
        if(str[s] == 'x'){
            s++;
            ans++;
            continue;
        }
        if(str[e] == 'x'){
            e--;
            ans++;
            continue;
        }
        ok = 0;
        break;
    }
    if(ok == 0){
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

#define In_(x) scanf("%lld",&(x))

using int64 = long long;
int64 w, h;
int64 n;
int64 x[123456], y[123456];
vector<pair<int64, int64>>point;

int64 arx, ary, arw, arh;

int64 ans = 0;
pair<int64, int64> diff()
{
	double centx, centy;
	centx = arx + arw / 2.0;
	centy = ary + arh / 2.0;
	int64 dist = 0;
	pair<int64, int64>ret = make_pair(12345678901234, 12345678901234);
	for (auto thp : point)
	{
		int64 cand = 0;
		if (thp.first <= centx && thp.second <= centy)
		{
			cand = abs(arx + arw - thp.first) + abs(ary + arh - thp.second);
			if (cand > dist)
			{
				dist = cand;
				ret = make_pair(arx + arw, ary + arh);
			}
			if (cand == dist)
			{
				if (ret > make_pair(arx + arw, ary + arh))
				{
					ret = make_pair(arx + arw, ary + arh);
				}
			}
		}
		else if (thp.first <= centx && thp.second >= centy)
		{
			cand = abs(arx + arw - thp.first) + abs(ary - thp.second);
			if (cand > dist)
			{
				dist = cand;
				ret = make_pair(arx + arw, ary);
			}
			if (cand == dist)
			{
				if (ret > make_pair(arx + arw, ary))
				{
					ret = make_pair(arx + arw, ary);
				}
			}
		}
		else if (thp.first >= centx && thp.second <= centy)
		{
			cand = abs(arx - thp.first) + abs(ary + arh - thp.second);
			if (cand > dist)
			{
				dist = cand;
				ret = make_pair(arx, ary + arh);
			}
			if (cand == dist)
			{
				if (ret > make_pair(arx, ary + arh))
				{
					ret = make_pair(arx, ary + arh);
				}
			}
		}
		else
		{
			cand = abs(arx - thp.first) + abs(ary - thp.second);
			if (cand > dist)
			{
				dist = cand;
				ret = make_pair(arx, ary);
			}
			if (cand == dist)
			{
				if (ret > make_pair(arx, ary))
				{
					ret = make_pair(arx, ary);
				}
			}
		}
	}
	ans -= dist;
	return ret;
}

int main(void)
{
	In_(w);In_(h);
	In_(n);
	for (int64 i = 0; i < n; ++i)
	{
		In_(x[i]); In_(y[i]);
		point.emplace_back(x[i],y[i]);
	}
	sort(x, x + n);
	sort(y, y + n);
	if (n % 2)
	{
		//odd
		arx = x[n / 2];
		ary = y[n / 2];
		arw = arh = 0;
	}
	else
	{
		//even
		arx = x[n / 2 - 1];
		ary = y[n / 2 - 1];
		arw = x[n / 2] - arx;
		arh = y[n / 2] - ary;
	}
	auto pp = diff();
	for (int64 i = 0; i < n; ++i)
	{
		ans += abs(x[i] - pp.first) * 2;
		ans += abs(y[i] - pp.second) * 2;
	}
	printf("%lld\n%lld %lld\n", ans, pp.first, pp.second);
	return 0;
}

Measured memory_bytes: 6208
while 1:
    h = input()
    if h == 0:
        break
    M = [map(int, raw_input().split()) for i in xrange(h)]
    ans = 0
    update = 1
    while update:
        update = 0
        for i in xrange(h):
            prev = 0; cnt = 0
            for j in xrange(5):
                if prev != M[i][j]:
                    if cnt >= 3:
                        M[i][j-cnt:j] = [0]*cnt
                        ans += prev * cnt
                        update |= prev
                    cnt = 1
                else:
                    cnt += 1
                prev = M[i][j]
            if cnt >= 3:
                M[i][5-cnt:5] = [0]*cnt
                ans += prev * cnt
                update |= prev
        for j in xrange(5):
            cur = h-1
            for i in xrange(h-1, -1, -1):
                if M[i][j]:
                    if cur != i:
                        M[cur][j] = M[i][j]
                        M[i][j] = 0
                    cur -= 1
    print ans

Measured memory_bytes: 6456
S = input()
Q = int(input())
flag = 0   #"1" represents inversion
head = ""
tail = ""
for i in range(Q):
    quary = list(map(str, input().split()))
    if quary[0] == "1":
        if flag == 0:
            flag = 1
        else:
            flag = 0
    else:
        if flag == 1:
            if quary[1] == "1":
                tail = tail+quary[2]
            else:
                head = quary[2]+head
        else:
            if quary[1] == "1":
                head = quary[2]+head
            else:
                tail = tail+quary[2]
S = head+S+tail
if flag == 1:
    S = S[::-1]
print(S)

Measured memory_bytes: 4476
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
long long brojac=0;
for(int i=0;i<=x;i++)
{
for(int j=0;j<=x;j++)
{
if(y-(i+j)>=0&&y-(i+j)<=x)
brojac++;
}
}
cout<<brojac<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    if(a%b==0){
        return b;
    }
    else gcd(b,a%b);
}
int main(){
    int x,y;
    cin>>x>>y;
    int c;
    if(x<y) {
        int a=x;
        x=y;
        y=a;
    }
    c = gcd(x,y);
    cout<<c<<endl;
}



Measured memory_bytes: 3104
#include <stdio.h>
#include<string.h>
int main(int argc, const char * argv[]) {
    char str[1001];
    char assign[21];
    char change[1001];
    char tmp[1001];
    int q=0,i,n1,n2,j;
    scanf("%s",str);
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%s",assign);
        if(strcmp(assign,"replace")==0){
            scanf("%d %d",&n1,&n2);
            for(j=n1;j<=n2;j++){
                scanf("%c",&change[j]);
                str[j]=change[j];
                if(change[j]==' '){
                    j--;
                }

            }
            
        }if(strcmp(assign,"print")==0){
            scanf("%d %d",&n1,&n2);
            for(j=n1;j<=n2;j++){
                printf("%c",str[j]);
                if(j==n2){
                    printf("\n");
                }
            }

            
        }if(strcmp(assign,"reverse")==0){
            scanf("%d %d",&n1,&n2);
            for(j=0;j<=(n2-n1)/2;j++){
                tmp[j]=str[n1+j];
                str[n1+j]=str[n2-j];
                str[n2-j]=tmp[j];
            }
        }
                
    }
    
    return 0;
}

Measured memory_bytes: 1760
#include <bits/stdc++.h>
using namespace std;
int A, B;
int main() {
    cin >> A >> B;
    vector<int> power(13, 0);
    for(int i = 0; i < 13; ++i) {
        if(i == 0) {
            power.at(i) = 13;
        }else {
            power.at(i) = i;
        }
    }

    if(power.at(A-1) > power.at(B-1)) {
        cout << "Alice" << endl;
    }else if(power.at(A-1) < power.at(B-1)) {
        cout << "Bob" << endl;
    }else {
        cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

static const ll MOD = 1e9 + 7;

int n;
char s[100005];
uint64_t dp[101010][13];

int main()
{
    int i, j, ki;
    uint64_t res = 0;

    scanf("%s", s);
    n = strlen(s);

    dp[0][0] = 1;
    for (i = 0; i < n; i++) {
        int c;
        if (s[i] == '?') c = -1;
        else c = s[i] - '0';

        for (j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (ki = 0; ki < 13; ki++) {
                dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
            }
        }
        for (j = 0; j < 13; j++) dp[i + 1][j] %= MOD;
    }
    res = dp[n][5];

    printf("%llu\n", res);
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 100001
const ll mod = 1e9+7;
int GetDigit(int num){
    return to_string(num).length();
}

int main() {
    int n, ans=0;
    cin >> n;
    for(int i=1; i<=n; ++i) {
        if (GetDigit(i) % 2 == 1) ++ans;
    }

    cout << ans << endl;

}



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define Ans(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

int main()
{
	int a;
	cin >> a;
	cout << "ABC" << a << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (s.equals("Cloudy")) {
            System.out.println("Rainy");
        } else {
            System.out.println("Sunny");
        }
        sc.close();
    }
}

Measured memory_bytes: 21716
#![allow(unused_imports)]

#[macro_use]
mod _input {
    use std::fmt;
    use std::io::{self, Read};
    use std::str::{self, FromStr};

    macro_rules! input {
        ($($name:ident : $t:tt), *,) => {
            input!($($name: $t),*)
        };
        ($($name:ident : $t:tt), *) => {
            let ($($name, )*) = {
                let mut _scanned = ::_input::Scanned::new(::std::io::stdin(), 1024);
                $(let $name = _read_value!(_scanned, $t);)*
                ($($name, )*)
            };
            $(let _ = &$name;)*
        };
    }

    macro_rules! _read_value {
        ($scanned:expr, ($($t:tt), *)) => {
            ($(_read_value!($scanned, $t)), *)
        };
        ($scanned:expr, [$t:tt; $n:expr]) => {
            (0..$n).map(|_| _read_value!($scanned, $t)).collect::<Vec<_>>()
        };
        ($scanned:expr, _bytes) => {
            _read_value!($scanned, String).into_bytes()
        };
        ($scanned:expr, _index) => {
            _read_value!($scanned, usize) - 1
        };
        ($scanned:expr, $t:ty) => {
            $scanned.next::<$t>()
        };
    }

    #[derive(Default)]
    pub struct Scanned {
        buf: Vec<u8>,
        pos: usize,
    }

    impl Scanned {
        pub fn new<R: Read>(mut input: R, estimated: usize) -> Self {
            let mut buf = Vec::with_capacity(estimated);
            let _ = io::copy(&mut input, &mut buf).unwrap();
            // if buf.last() != Some(&b'\n') {
            //     buf.push(b'\n');
            // }
            // assert!(buf.iter().all(|&b| b <= 0x7f));
            Scanned { buf: buf, pos: 0 }
        }

        #[inline]
        pub fn next<T: FromStr>(&mut self) -> T
        where
            T::Err: fmt::Debug,
        {
            let mut start = None;
            loop {
                match (self.buf[self.pos], start.is_some()) {
                    (b' ', true) | (b'\n', true) => break,
                    (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                    (_, false) => start = Some(self.pos),
                }
            }
            let target = &self.buf[start.unwrap()..self.pos];
            unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
        }
    }
}

#[allow(dead_code)]
mod output {
    use std::io::{self, BufWriter, StdoutLock, Write as _Write};

    pub fn with_stdout<F: FnMut(&mut BufWriter<StdoutLock>)>(mut f: F) {
        let stdout = io::stdout();
        let mut stdout = BufWriter::new(stdout.lock());
        f(&mut stdout);
        stdout.flush().unwrap();
    }
}

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::Write;
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, thread, u16, u32, u64, u8};

fn main() {
    input! {
        a: u32,
        b: u32,
    }
    if a * b % 2 == 0 {
        println!("No");
    } else {
        println!("Yes");
    }
}


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

  int main() {
    long long N, A[1000000], count = 0, res = 0;
    cin >> N;

    for (int i = 0; i < 100000; i++) {
      A[i] = abs((N - count)%long(pow(2.0, i + 1)))/(long(pow(2.0, i)));
      count += A[i] * long(pow(-2.0, i));
      if (count == N) {
        res = i + 1;
        break;
      }
    }

    for (int i = 0; i < res; i++) cout << A[res - i - 1];
    cout << endl;

    return 0;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言
//int myfunc(int, vvec);

//グローバル変数
//int N, M;
//vvec data(N, vec(M));
const int MX_N = 100005;
int mod = 998244353;

//関数：
int gcd(int mx, int mn) {
	if(mn == 0) return(mx);
	else gcd(mn, mx%mn);
}

/* yにxをn回乗じmodで割った余りを返す。
（素数pに対して x**p = x (mod p) が成り立つ。）*/
int mod_pow(int y, int x, int n, int mod) {
	int ans = y;
	rep(i, n) {
		ans *= x;
		ans %= mod;
	}
	return ans;
}


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

	int n; cin >> n;
	vector<int> d(n);
	
	vector<int> ct(MX_N, 0);
	int mx = 0;
	rep(i, n) {
		cin >> d[i];
		ct[d[i]]++;
		if(d[i] > mx) mx = d[i];
	}
	
	if(d[0] != 0 || ct[0] != 1) {
		cout << 0 << endl;
		return 0;
	}
	
	int ans = 1;
	for(int i=1; i<mx; i++) {
		ans = mod_pow(ans, ct[i], ct[i+1], mod);
	}
	
	cout << ans << endl;
	return 0;
}
//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';

Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vector<int>>;

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

vb seen;

void dfs(const Graph &G, int v) {
    seen[v] = true;
    for(auto next_v : G[v]) {
        if (seen[next_v]) continue;
        dfs(G, next_v);
    }
}

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

    int w, h;
    while(cin >> w >> h, w*h) {
        int map[h+1][w+1];
        REP(j, w+1) {
            map[0][j] = 0;
        }
        REP(i, h) {
            map[i+1][0] = 0;
            REP(j, w) {
                cin >> map[i+1][j+1];
            }
        }
        
        Graph G(w*h);
        FOR(i, 1, h+1) {
            FOR(j, 1, w+1) {
                if (map[i][j] == 1) {
                    int p1 = (i-1)*w+(j-1);
                    int p2;
                    if (map[i][j-1] == 1) {
                        p2 = (i-1)*w+(j-2);
                        G[p1].push_back(p2);
                        G[p2].push_back(p1);
                    }
                    if (map[i-1][j-1] == 1) {
                        p2 = (i-2)*w+(j-2);
                        G[p1].push_back(p2);
                        G[p2].push_back(p1);
                    }
                    if (map[i-1][j] == 1) {
                        p2 = (i-2)*w+(j-1);
                        G[p1].push_back(p2);
                        G[p2].push_back(p1);
                    }
                    if (map[i-1][j+1] == 1) {
                        p2 = (i-2)*w+j;
                        G[p1].push_back(p2);
                        G[p2].push_back(p1);
                    }
                }
            }
        }

        seen.assign(w*h, false);
        int cnt = 0;
        REP(i, w*h) {
            if (seen[i]) continue;
            if (map[i/w+1][i%w+1] == 0) {
                seen[i] = true;
                continue;
            }
            cnt++;
            dfs(G, i);
        }
        cout << cnt << "\n";
    }
}


Measured memory_bytes: 3432
#include <bits/stdc++.h>
#define MAX 100
using namespace std;

int n;
int E[MAX][MAX];

int main()
{
	int n;
	cin >> n;
	for (int i = 0, u, k; i < n; i++) {
		cin >> u >> k;
		for (int j = 0, v; j < k; j++) {
			cin >> v;
			E[u - 1][v - 1] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		cout << E[i][0];
		for (int j = 1; j < n; j++) {
			cout << ' ' << E[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());
        int[][] arr = new int[N][3];

        for (int i=0; i<N; i++){
            st = new StringTokenizer(br.readLine());
            arr[i][0] = Integer.parseInt(st.nextToken());
            arr[i][1] = Integer.parseInt(st.nextToken());
            arr[i][2] = Integer.parseInt(st.nextToken());
        }
        int[][] dp = new int[N][3];
        dp[0][0] = arr[0][0];
        dp[0][1] = arr[0][1];
        dp[0][2] = arr[0][2];

        for (int i = 1; i < N; i++) {
            dp[i][0] = arr[i][0]+Math.max(dp[i-1][1],dp[i-1][2]);
            dp[i][1] = arr[i][1]+Math.max(dp[i-1][0],dp[i-1][2]);
            dp[i][2] = arr[i][2]+Math.max(dp[i-1][1],dp[i-1][0]);
        }

        System.out.println(Math.max(dp[N-1][0],Math.max(dp[N-1][1],dp[N-1][2])));

    }
}


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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5 , mod = 2019;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int L , R;

void solve(){
    scanf("%d %d" , &L , &R);
    if(R - L + 1 >= mod){
            printf("0\n");
            return;
    }


    int mn = 2e9 + 5;
    for(int i = L ; i <= R ; i ++){
            for(int j = i+1 ; j <= R ; j ++){
                mn = min(mn , ((i%mod) * (j%mod) )%mod);
            }
    }
    printf("%d\n" , mn);
}

main(){
    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
            solve();
    }

    return 0;
}



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

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

		if (N == 0 && M == 0) {
			break;
		}

		vector<pair<int, int>> pairs(N);
		long long int sum = 0;

		for (int i = 0; i < N; i++) {
			cin >> pairs[i].second >> pairs[i].first;
			sum += pairs[i].first*pairs[i].second;
		}

		sort(pairs.rbegin(), pairs.rend());

		int cur = 0;
		
		while (true) {
			if (M >= pairs[cur].second) {
				sum -= pairs[cur].first*pairs[cur].second;
				M -= pairs[cur].second;
				cur++;
			}
			else {
				sum -= M*pairs[cur].first;
				M = 0;
			}

			if (cur == N || M == 0) {
				break;
			}
		}

		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 3116
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
#define PI acos(-1)
typedef long long ll;
const long long mod = 1e9 + 7;
const long long maxn = 1e5 + 5; 
using namespace std;

int main() 
{ 
	int n;
	map<string, int> s;
	scanf("%d",&n);
	for (int i = 0; i < n; i++)
	{
		string ss;
		cin >> ss;
		s[ss] ++;
	}
	int ans = 0;
	for (map<string, int>::iterator it = s.begin(); it != s.end(); it++)
	{
		if (it->second != 0) ans++;
	}
	
	printf("%d\n",ans);
	return 0;
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define test 1
#define TEST if(test)

using namespace std;

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

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 1;

int N, K;
vector<int> v;
vector<int> sum;
map<int, int> mp;
ll ans;

int main(){
	scanf("%d%d", &N, &K);
	v.pb(0);
	mp[0] = 1;
	for(int i=1; i<=N; i++){
		if(i-K>=0){
			mp[v[i-K]]--;
		}
		int a;
      	scanf("%d", &a);
		v.pb((v.back() + a - 1) % K);
		ans += (ll)mp[v[i]];
		mp[v[i]]++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 10356
import java.util.*;
class Main{
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int n=getInt();
		dist=new long[n];
		for(int i=0;i<n;++i)
			edges.add(new TreeMap<>());
		for(int i=0;i<n-1;++i){
			int a=getInt()-1,b=getInt()-1;
			long c=getInt();
			edges.get(a).put(b,c);
			edges.get(b).put(a,c);
		}
		int q=getInt();
		dfs(-1,getInt()-1,0);
		for(int i=0;i<q;++i)
			System.out.println(dist[getInt()-1]+dist[getInt()-1]);
	}
	static ArrayList<TreeMap<Integer,Long>>edges=new ArrayList<>();
	static long[]dist;
	static void dfs(int from,int to,long l){
		dist[to]=l;
		TreeMap<Integer,Long> m=edges.get(to);
		m.remove(from);
		m.forEach((k,v)->dfs(to,k,l+v));
	}
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int f = 0;
  
  while (A <= B){
      if (A / 10000 == A % 10){
          if (A / 1000 - A / 10000 * 10 == (A % 100 - A % 10) / 10){
              f++;
          }
      }
      A++;
  }
  cout << f << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#define inf 1000000
#define ll unsigned long long 
#define boostUP ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fsr(i,n) for(ll i=0;i<n;i++)
#define fcr(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define sz(arr) sizeof(arr)/sizeof(arr[0])

using namespace std;

int main(){
    int n, count = 0; cin >> n;
    string str; cin >> str;

    stack<char>stk;
    for(int i = 0; i < n; i++){
        if(stk.empty())
            stk.push(str[i]);
        if(stk.top() != str[i])
            stk.push(str[i]);
        else
            continue;
    }

    cout << stk.size() << endl;
}




Measured memory_bytes: 3852
import itertools

def amida_counter(H_i_amida_list):
    counter = 0

    for amida_bin in range(2**len(H_i_amida_list)):
        if (("11" in format(amida_bin, "b")) == False):
            counter += 1

    return counter

def amida_number(left_amida, right_amida):
    left_counter = amida_counter(left_amida) if(len(left_amida) > 0) else 1
    right_counter = amida_counter(right_amida) if(len(right_amida) > 0) else 1

    return (left_counter * right_counter)

def X_amida_number(W, W_i):
    x_amida = "0" * (W - 1)
    left_x_amida = x_amida[:(W_i-2)] if(W_i-2 >= 0) else ""
    right_x_amida = x_amida[(W_i+1):]

    return amida_number(left_x_amida, right_x_amida)

def Y_amida_number(W, W_i):
    y_amida = "0" * (W - 1)
    left_y_amida = y_amida[:W_i-1] if(W_i-1 >= 0) else ""
    right_y_amida = y_amida[W_i+1:]

    return amida_number(left_y_amida, right_y_amida)

def Z_amida_number(W, W_i):
    z_amida = "0" * (W - 1)
    left_z_amida = z_amida[:W_i-1] if(W_i-1 >= 0) else ""
    right_z_amida = z_amida[W_i+2:]

    return amida_number(left_z_amida, right_z_amida)

H, W, K = map(int, input().split())
seed_dp_array = [0 for i in range(W)]
dp_array = [list(seed_dp_array) for i in range(H + 1)]
dp_array[0][0] = 1

for H_i, W_i in itertools.product(range(1, H + 1), range(W)):
    if (W_i == 0):
        if(W == 1):
            dp_array[H_i][0] = dp_array[H_i - 1][W_i] * Y_amida_number(W, W_i)
        else:
            dp_array[H_i][0] = dp_array[H_i - 1][W_i] * Y_amida_number(W, W_i) + dp_array[H_i - 1][W_i + 1] * Z_amida_number(W, W_i)
    elif (W_i == (W - 1)):
        dp_array[H_i][W - 1] = dp_array[H_i - 1][W_i - 1] * X_amida_number(W, W_i) + dp_array[H_i - 1][W_i] * Y_amida_number(W, W_i)
    else:
        dp_array[H_i][W_i] = dp_array[H_i - 1][W_i - 1] * X_amida_number(W, W_i) + dp_array[H_i - 1][W_i] * Y_amida_number(W, W_i) + dp_array[H_i - 1][W_i + 1] * Z_amida_number(W, W_i)

print(dp_array[H][K - 1] % 1000000007)

Measured memory_bytes: 3192
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll a,b,c,d; cin >> a >> b >> c >> d;
  ll cmin = (a-1)/c;
  ll cmax = b/c;
  ll dmin = (a-1)/d;
  ll dmax = b/d;
  ll cd = (c*d)/__gcd(c,d);
  ll cdmin = (a-1)/cd;
  ll cdmax = b/cd;
  ll ans = (b-a+1) - (cmax-cmin) - (dmax-dmin) + (cdmax-cdmin);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    if(n%k == 0) {
        out(0);
        re0;
    }

    if(n < k) {
        out(min(n, k - n));
        re0;
    }

    // 以下、n > k
    ll x = n%k;

    out(min(x, k - x));
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
/* Uncomment only if you are not using GNU compiler->
*/
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
/**/ 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()

//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    ll n;
    cin>>n;
    ll y=26;
    ll x=1;
    while(n>y)
    {
        y+=power(26,x+1);
        x++;
    }
    // cout<<x<<endl;
    y=0;
    rep(i,x)
        y+=power(26,i);
    string s;
    repd(i,x,1)
    {
        char ch='a';
        repu(j,1,26)
        {
            y+=power(26,i-1);
            ch++;
            if(y>n)
            {
                y-=power(26,i-1);
                ch--;
                break;
            }
        }
        s=s+ch;
    }
    cout<<s<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3816
#!/usr/bin/env python3

import numpy as np

n, m, c = list(map(int, input().split()))
b = np.array(list(map(int, input().split())))


ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.sum(a*b)+c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 12488
using System;

namespace AOJ.Volume0
{
    class Integral
    {
        public static void Main()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }
                // 計算回数を取得
                int d = int.Parse(input);
                int cnt = 600 / d;  // dは600の約数なのでcntは必ずintになる

                int integral = 0;
                for (int i = 0; i < cnt; i++)
                {
                    // 面積計算
                    integral += d * (i * d) * (i * d);
                }
                Console.WriteLine(integral);
            }
        }
    }
}

Measured memory_bytes: 5596
n, k = map(int,input().split())
ans = 0

if k == 0:
    ans = n ** 2
else:
    for b in range(k + 1, n + 1):
        q, r = n // b, n % b
        ans += q * (b - k) + max((r - k + 1), 0)
            
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,a,i,k;
    vector<int>v,v1;
    cin >> n >> k;
    for(i=0; i<n; i++)
    {
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    for(i=0; i<v.size()-k+1; i++)
    {
        a=v[i+k-1]-v[i];
        v1.push_back(a);
    }
    sort(v1.begin(),v1.end());
    cout << v1[0] << "\n";


    return 0;
}


Measured memory_bytes: 1400
fun main(args: Array<String>) {
    val s         = readLine()!!.toString()
    val day = arrayOf("SUN", "MON", "TUE", "WED", "THU", "FRI")
    val ans = when {
        (s == day[0]) -> 7
        (s == day[1]) -> 6
        (s == day[2]) -> 5
        (s == day[3]) -> 4
        (s == day[4]) -> 3
        (s == day[5]) -> 2
        else          -> 1
    }
    println(ans)
}

Measured memory_bytes: 31660
N, K = map(int, input().split())
p = list(map(int, input().split()))
for i in range(1, N):
    p[i] = p[i] + p[i - 1]
p = [0] + p
ans = 0
for i in range(N - K + 1):
    ans = max(ans, p[i + K] - p[i])
print((ans + K) / 2)

Measured memory_bytes: 25060
#include<stdio.h>
int main(void){
  double W,H,x,y,ans;
  scanf("%lf %lf %lf %lf",&W,&H,&x,&y);
  ans=W*H/2;
  printf("%lf ",ans);
  if(x==W/2 && y==H/2){
    printf("1");
  }
  else{
    printf("0");
  }
  return 0;
}

Measured memory_bytes: 128
S = input()#文字列
minsa = None
for i in range(len(S)-2):
    a = S[i] + S[i+1] + S[i+2]
    a = int(a)
    sa = abs(753-a)
    if minsa == None:
        minsa = sa
    else:
        if minsa > sa:
            minsa = sa
print(minsa)

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

struct S {mint v; int size;};

S op(S a, S b) {return S{a.v + b.v ,a.size + b.size};}

S e() {return S{0,0};}

struct F {mint a, b;};

S mapping(F f, S x) {return S{f.a*x.v+x.size*f.b,x.size};}

F composition(F f, F g) {return F{f.a*g.a, g.b*f.a + f.b};}

F id() {return F{1,0};}

int main(){
  int n, q;
  cin >> n >> q;
  vector<S> a(n);
  rep(i,n) {
    ll v;
    cin >> v;
    a[i] = S{v,1};
  }
  lazy_segtree<S,op,e,F,mapping,composition,id> seg(a);
  while(q--) {
    int t;
    cin >> t;
    if(t == 0) {
      int l, r; ll b, c;
      cin >> l >> r >> b >> c;
      seg.apply(l,r,F{b,c});
    } else {
      int l, r;
      cin >> l >> r;
      cout << seg.prod(l,r).v.val() << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 19360
#include<algorithm>
#include<cstdio>
using namespace std;

int n;
int p[3][2];
long dp1[5001];
long dp2[30000000];

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

int main() {
    scanf("%d", &n);
    int ga, sa, ba, gb, sb, bb;
    scanf("%d %d %d", &ga, &sa, &ba);
    p[0][0] = ga; p[1][0] = sa; p[2][0] = ba; 
    scanf("%d %d %d", &gb, &sb, &bb);
    p[0][1] = gb; p[1][1] = sb; p[2][1] = bb; 

    for (int i = 0; i <= n; i++) {
        if (i != 0 && dp1[i] == 0) continue;
        for (int j = 0; j < 3; j++) {
            if (p[j][0] < p[j][1] && i + p[j][0] <= n) {
                dp1[i + p[j][0]] = max(dp1[i + p[j][0]],
                dp1[i] + p[j][1] - p[j][0]);
            }
        }
    }
    long res = 0;
    for (int i = 0; i <= n; i++) res = max(res, dp1[i]);
    res += n;
   
    /*long l = 1;
    for (int i = 0; i < 3; i++) {
        if (p[i][0] > p[i][1]) l = l * p[i][1] / gcd(l, p[i][1]);
    } */
    
    long ans = 0; 
    /*for (int i = 0; i < 3; i++) {
        if (p[i][0] > p[i][1]) ans = max(ans, res / l * l / p[i][1] * p[i][0]);
    }
    res -= res / l * l;*/
    
    for (int i = 0; i <= res; i++) {
        if (i != 0 && dp2[i] == 0) continue;
        for (int j = 0; j < 3; j++) {
            if (p[j][0] > p[j][1] && i + p[j][1] <= res) {
                dp2[i + p[j][1]] = max(dp2[i + p[j][1]],
                dp2[i] + p[j][0] - p[j][1]);
            }
        }
    }
    long aa = 0;
    for (int i = 0; i <= res; i++) aa = max(aa, dp2[i]);
    printf("%ld\n", ans + res + aa);
    return 0;
} 


Measured memory_bytes: 196864