akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main()
{
	int i, j, N, M, C, A[21][21], B[21];
	scanf("%d %d %d", &N, &M, &C);
	for (j = 1; j <= M; j++) scanf("%d", &(B[j]));
	for (i = 1; i <= N; i++) {
		for (j = 1; j <= M; j++) scanf("%d", &(A[i][j]));
	}
	
	int count = 0, sum;
	for (i = 1; i <= N; i++) {
		sum = C;
		for (j = 1; j <= M; j++) sum += A[i][j] * B[j];
		if (sum > 0) count++;
	}
	
	printf("%d\n", count);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<int> v;
int main()
{
	string s;int n,q,a,b;
	cin>>n>>q;
	cin>>s;
	rep(i,n-1){
		if(s.substr(i,2)=="AC") v.pb(i);
	}
	rep(i,q){
		cin>>a>>b;a--;b--;
		int x=lower_bound(All(v),b)-v.begin(),y=lower_bound(All(v),a)-v.begin();
		cout<<x-y<<endl;
	}
}


Measured memory_bytes: 1276
n = int(input())
a = [int(v) for v in input().split()]

field = {}
for v in a:
    if not v in field:
        field[v] = 1
    else:
        field[v] += 1

all_ans = 0
for k,v in field.items():
    all_ans += ((v*(v-1))/2)


for i in a:
    ans = all_ans
    if i in field:
        n = field[i]
        ans -= (n*(n-1))/2
        n = n - 1
        ans += (n*(n-1))/2
    
    print(int(ans))


Measured memory_bytes: 26268
#include<bits/stdc++.h>
using namespace std;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define all(obj) (obj).begin(),(obj).end()
typedef long long ll;
ll mod=ll(1e9)+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d;cin>>a>>b>>c>>d;
  int s=a/d;
  if(a%d!=0)s++;
  int t=c/b;
  if(c%b!=0)t++;
  if(s>=t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3664
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 20:47:07 2020

@author: ezwry
"""
import math

n=int(input())
a=list(map(int,input().split()))

a.sort(reverse=1)

ans=[]

for i in range(n-1):
    jyun=math.ceil(i/2)
    ans.append(a[jyun])

answer=sum(ans)
print(answer)

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

using namespace std;

const int INF = numeric_limits<int>::max() / 2;

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

	string s; cin >> s;
	int res = INF;
	for (int i = 0; i < 26; i++) {
		string pre = s;
		for (int j = 0; j < s.length(); j++) {
			bool flag = true;
			//sをすべて'a'+iにするのにかかるステップ
			for (int k = 0; k < pre.length(); k++) {
				if (pre[k] != 'a' + i) flag = false;
			}
			if (flag) {
				res = min(res, j);
				break;
			}
			string next = "";
			for (int k = 0; k < pre.length() - 1; k++){
				if (pre[k] == 'a' + i || pre[k + 1] == 'a' + i) next += (char)('a' + i);
				else next += pre[k];
			}
			pre = next;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

main(){
	int W, H, x, y, r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if((x+r <= W) && (y+r <= H) && (x-r >= 0) && (y-r >= 0)){
		printf("Yes\n");}
		
	else{
		printf("No\n");}
		
	return 0;
		
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ll a=ii(), b=ii();
    oie(a*b);


    return 0;
}

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

using namespace std;

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

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

void setIO(string name = ""){
    freopen((name+".in").c_str(), "r", stdin); 
    freopen((name+".out").c_str(), "w", stdout);
}

vector<ll> a(1<<18);
int main(){
 	ios_base::sync_with_stdio(0); cin.tie(0); 
	// setIO();
    ll n,k; cin >> n >> k;
    for(int i{1}; i<=n; i++)
        cin >> a[i];

    for(ll i{k+1}; i<=n; i++){
        if(a[i-k]<a[i]) cout << "Yes" << "\n";
        else cout << "No" << "\n";
    }


}


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

#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define t_times int t; cin >> t; while(t--)
#define _parr(a, n) for(int __i = 0; __i < (int )n; __i++) cout << a[__i] << ' '; cout << '\n'
#define fr(i, p, n) for(int i = (int )p; i < (int )n; i++)
#define frn(i, p, n) for(int i = (int )p; i <= (int )n; i++)
#define rev(i, n, p) for(int i = (int )n; i >= (int )p; i--)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).begin(), (c).end()
#define sci(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define prin(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define mp make_pair
#define F first
#define S second
#define pb push_back

typedef long long int LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef pair< int, int> ii;
typedef vector< int> vi;

const int mod = 1e9 + 7;
const LL INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 2e5 + 22;
const double eps = 1e-10;

int n, m;

void _solve() {
    cin >> n;
    int ans = 0, cnt = 0, prev = -inf, x;
    fr(i, 0, n) {
        cin >> x;
        if(x <= prev) cnt++;
        else cnt = 0;
        prev = x;
        ans = max(ans, cnt);  
    }
    cout << ans;
}
int main() {
    fastio;
    //t_times
    _solve();
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // input : N A1 A2 ... An
        // An がすべて、奇数か、偶数かつ 3 か 5 で割り切れるなら APPROVED
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        String retStr = "APPROVED";
        for(int i = 0; i < num; i++){
            int testNum = sc.nextInt();
            if(testNum % 2 == 0 && (testNum % 3 != 0 && testNum % 5 != 0)){
                retStr = "DENIED";
            }
        }
        System.out.println(retStr);
    }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
long double X[200100];
int N;
long long Count(long double len)
{
  long long Ans=0;
  for(int i=0;i<N;i++)
  {
    Ans+=(long long)(X[i]/len);
    //Ans+= (ceil(X[i])-1/len);
  }
  return Ans;
}
int main()
{
  long long K;
  cin>>N>>K;
  for(int i=0;i<N;i++)
{
	cin>>X[i];
	//X[i]-=0.1;
}
  long double l=1,r=1e9;
  //while(l<r-0.1)
	for(int i=0;i<33;i++)
  //while(((long long)(r)-(long long)(l)) > 1)
  //while(!((ceil(r)-ceil(l)) == 0))
  {
    //long double mid=(l+r+0.1)/2;
    long double mid=(l+r)/2;
  //  cout<<l<<" "<<r<<" "<<mid<<endl;
    if(Count(mid)<=K) r=mid;
    else	l=mid;
    //else	l=mid+0.01;
  }
  cout<<(long long)(l+0.999)<<endl;
  return 0;
}

Measured memory_bytes: 6820
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		for ( int i = 0 ; i < N ; i++ ) {
			A[i] = sc.nextInt();
			B[i] = sc.nextInt();
		}
		sc.close();

		int[][] dp = new int[2][T + 1];
		int[][] dpo = new int[2][T + 1];
		Arrays.fill(dp[N % 2], 0);
		Arrays.fill(dpo[N % 2], 0);
		for ( int i = N - 1 ; i >= 0 ; i-- ) {
			for ( int t = 0 ; t <= T ; t++ ) {
				if ( t < A[i] ) {
					dp[i % 2][t] = dp[(i+1) % 2][t];
					dpo[i % 2][t] = Math.max(dpo[(i+1) % 2][t], dp[(i+1) % 2][t] + B[i]);
				} else {
					dp[i % 2][t] = Math.max(dp[(i+1) % 2][t], dp[(i+1) % 2][t - A[i]] + B[i]);
					dpo[i % 2][t] = Math.max(Math.max(dpo[(i+1) % 2][t], dp[(i+1) % 2][t] + B[i]),
							dpo[(i+1) % 2][t - A[i]] + B[i]);
				}
			}
		}
		System.out.println(Math.max(dp[0][T], dpo[0][T - 1]));
	}
}


Measured memory_bytes: 27812
#include <stdio.h>

int main(){
  int D = 0;
  int T = 0;
  int S = 0;
  scanf("%d %d %d", &D, &T, &S);
  
  if((double)D / S <= T)
    printf("Yes");
  else
    printf("No");
  
return 0;
}

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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = list(map(int, input().split()))

# 2* x_0 = A[0] + A[N-1] + (A[2] + A[4] + ... (偶数項) ) - (A[1] + A[3] + ... (奇数項))
# あとは順次x_1, x_2, を求めていけば良い

even = 0
odd = 0
for i in range(N):
    if i % 2:
        odd += A[i]
    else:
        even += A[i]

X = [0] * N
X[0] = even - odd

for i in range(1, N):
    X[i] = 2*(A[i-1] - X[i-1]//2)

X = [str(x) for x in X]
print(" ".join(map(str, X)))




Measured memory_bytes: 23916
#include <stdio.h>
int main(){
	int a,b,t;
	a=b=0;
	for(int i=0;i<4;i++){
		scanf("%d",&t);
		a+=t;
	}
	for(int i=0;i<4;i++){
		scanf("%d",&t);
		b+=t;
	}
	if(a>b) printf("%d\n",a);
	else printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int k; cin>>k;
	queue<ll> q;
	rep(i,1,10){
		q.push(i);
	}
	ll ans=0;
	rep(i,0,k){
		ll x=q.front(); q.pop();
		if(i==k-1){
			ans=x;
			break;
		}
		if(x%10!=0) q.push((10*x)+(x%10)-1);
		q.push(10*x+(x%10));
		if(x%10!=9) q.push((10*x)+(x%10)+1);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5092
import math

a,b,h,m=map(int,input().split())
if(5*(h+m/60)<=m):
    s=m-5*(h+m/60)
else:
    s=5*(h+m/60)-m
cc=a*a+b*b-2*a*b*math.cos(s/60*2*math.pi)
c=cc**0.5
print(c)

Measured memory_bytes: 62436
#include <bits/stdc++.h>
using namespace std;
static const int hoge = 1000;
int C[1000][1000];
int lc(string F, string S){

    fill(C[0],C[hoge],0);
    int m = F.size(), n = S.size();
    int len=0;
    for(int i=0; i<m; i++){
        for (int j = 0; j < n; ++j) {
            if (F[i] == S[j]) {
                if (i - 1 >= 0 && j - 1 >= 0)
                    C[i][j] = C[i - 1][j - 1] + 1;
                else
                    C[i][j] = 1;
            } else if (i - 1 < 0) {
                if(j-1 < 0){
                    C[i][j] = 0;
                }else{
                    C[i][j] = C[i][j - 1];
                }
            }else if(j-1 < 0) {
                C[i][j] = C[i - 1][j];
            }else{
                C[i][j] = max(C[i-1][j], C[i][j - 1]);
            }
            len = max(len, C[i][j]);
        }
    }
    return len;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string ar1,ar2;
    for (int i = 0; i < n; ++i) {
        cin >> ar1 >> ar2;
        cout << lc(ar1,ar2) << endl;
    }
    return 0;
}

Measured memory_bytes: 7144
import sys
input = sys.stdin.buffer.readline
from bisect import bisect_right
N = int(input())
li_a = []
for _ in range(N):
    a = int(input())
    li_a.append(a)
INF = 10**15
dp = [INF]* N
for i in range(N-1, -1, -1):
    a = li_a[i]
    k = bisect_right(dp, a)
    dp[k] = a
check = INF-1
print(bisect_right(dp, check))

Measured memory_bytes: 45276
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, x, y, t;
    cin >> n;
    vector<vector<int>> arr;
    int x0 = 0, y0 = 0, t0 = 0;
    for(int i = 0; i < n; i++) {
        cin >> t >> x >> y;
        arr.push_back({t, x, y});
    }
    for(auto vec: arr) {
        int dis = abs(vec[1]-x0) + abs(vec[2]-y0);
        if (dis > (vec[0]-t0) || (vec[0]-t0-dis) % 2 == 1) {
            // cout << dis << " " << (vec[0]-t0-dis) << endl;
            cout << "No" << endl;
            return 0;
        }
        t0 = vec[0];
        x0 = vec[1];
        y0 = vec[2];
    }
    cout << "Yes" << endl;
    return 0;
}




Measured memory_bytes: 6324
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int N = 26;

int main() {
  map<char, int> m;
  REP(i, N) m['a' + i] = m['A' + i] = 0;
  string s; cin >>s;
  REP(i, s.length()) ++m[s[i]];
  cout <<min(m['K'], min(m['U'], min(m['P'], m['C']))) <<endl;
  return 0;
}

Measured memory_bytes: 1196
import java.util.*;
/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long D = sc.nextLong();

        long l = lcm(C,D);
        long val1 = B - (B/C + B/D) + B/l;
        long val2 = (A-1) - ((A-1)/C + (A-1)/D) + (A-1)/l;
        System.out.println(val1-val2);
        sc.close();
    }

    //b < a
    static long gcd(long a, long b) {
        if (a == 0 || b == 0) return b+a;
        else return gcd(b,a%b);
    }

    static long lcm(long a, long b) {
        if(a <= b) {
            long tmp = a;
            a = b;
            b = tmp;
        }
        return a*b/gcd(a,b);
    }
}

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

int main()
{
    string a, b;
    cin >> a >> b;
    if (a==b) {
        cout << "EQUAL\n";
        return 0;
    }
    if(a.length() < b.length()) {
        cout << "LESS\n";
        return 0;
    }
    else if(a.length() > b.length()) {
        cout << "GREATER\n";
        return 0;
    }
    for(int i=0; i<a.length(); i++){
        if(a[i]-b[i]>0) {
            cout << "GREATER\n";
            return 0;
        }
        else if(a[i]-b[i]<0) {
            cout << "LESS\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
signed main() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    int g = a[0];
    for (int i = 1; i < n; i++) {
        g = __gcd(g, a[i]);
    }
    if (k % g == 0 && k <= a[n - 1]) {
        cout << "POSSIBLE\n";
    } else {
        cout << "IMPOSSIBLE\n";
    }
}


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

int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n>>k;
	pair<long long,int> a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i].second>>a[i].first;
		--a[i].second;
	}
	sort(a,a+n);
	reverse(a,a+n);
	long long ans=0LL;
	int memo[n+5]={},x=0;
	for (int i = 0; i < k; ++i)
	{
		ans+=a[i].first;
		if (memo[a[i].second]==0)
		{
			++x;
		}
		++memo[a[i].second];
	}
	ans+=(long long)x*x;
	int del=k-1,ins=k;
	long long tmp=ans;
	while (del>=0&&ins<n)
	{
		while (del>=0&&memo[a[del].second]<=1)
		{
			--del;
		}
		if (del<0)
		{
			break;
		}
		tmp-=a[del].first;
		--memo[a[del].second];
		while (ins<n&&memo[a[ins].second]>0)
		{
			++ins;
		}
		if (ins>=n)
		{
			break;
		}
		tmp+=a[ins].first;
		++memo[a[ins].second];
		++x;
		tmp-=(long long)(x-1)*(x-1);
		tmp+=(long long)x*x;
		ans=max(ans,tmp);
		--del;
		++ins;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2176
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 2005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1e9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	// cases
	{
		ll x[5];
		ain(x, 5);
		loop(i, 5)
		{
			if (x[i] == 0)
			{
				cout << i + 1 << END;
				return 0;
			}
		}
	}



	return 0;
}

Measured memory_bytes: 3512
#!/usr/bin/env python
# coding: utf-8

import sys
import re


def get_answer(s):
    encodeds = re.findall(r"@\d.", s)
    for encoded in encodeds:
        n = int(encoded[1])
        c = encoded[2]
        s = s.replace(encoded, c * n)
    return s


def main():
    params = [line.rstrip() for line in sys.stdin.readlines()]
    for param in params:
        print get_answer(param)


if __name__ == '__main__':
    main()

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

int main(){
    int n;
    cin >> n;
    
    for(int i = 1; i <= n; i++){
        if(i%3==0) cout << " " << i;
        else{
            int x = i;
            while(x){
                if(x%10==3) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
}





Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#include<bitset>
#include<map>
#include<deque>
#include<cmath>
#include<random>
#include<string.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

int main() {
	makei(N);
	cout << "ABC" << N << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint64 x, y;
	std::cin >> x >> y;
	uint32 ans = 0;
	while (x <= y) {
		x <<= 1;
		++ans;
	}
	std::cout << ans << "\n";
	return 0;
}

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

int h,w,a[32][32],c;

int main(){
	c=9999999;
	cin>>h>>w;
	f(i,h)f(j,w)cin>>a[i][j];
	
	f(i,h)f(j,w){
		int s=0;
		f(k,h)f(l,w){
			s+=min(abs(i-k),abs(j-l))*a[k][l];	
		}
	
		c=min(s,c);
	}cout<<c<<endl;}




Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n;
    cin>>n;
    ll a[n];
    rep(i,n)cin>>a[i];
    unordered_map<ll,ll> mp;
    rep(i,n){
        mp[a[i]]++;
    }
    int res=0;
    for(auto x:mp){
        DEBUG{cout << " first : "<<x.first << " second : "<<x.second << endl;}
        if(x.second%2)res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 5156
#include <stdio.h>
int main()
{
	int r;
	scanf("%d",&r);
	if(r<=1199){
		printf("ABC\n");
	}else if(r>=1200 && r<=2799){
		printf("ARC\n");
	}else{
		printf("AGC\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
vector<long long>v[500];
long long vis[500];
long long cnt=0;
long long res=0;
long long n,e;
void dfs_go(long long x,long long y,long long node)
{
  //  cout << "dhukse";
    vis[node]=1;
    cnt++;
    for(long long i=0;i<v[node].size();i++)
    {
        if((node==x or node==y) and (v[node][i]==x or v[node][i]==y)) continue;
        if(vis[v[node][i]]==-1)
        {

            dfs_go(x,y,v[node][i]);
        }
    }
}

void dfs(long long x,long long y)
{
    cnt=0;
    memset(vis,-1,sizeof(vis));
    dfs_go(x,y,1);
    if(cnt == n)    res++;

}

int main()
{

    cin >> n >> e;

    vector<pair<long long,long long> > edges;
    for(long long i=0;i<e;i++)
    {
        long long x,y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
        edges.push_back({x,y});
    }
    for(long long i=0;i<e;i++)
    {
        dfs(edges[i].first,edges[i].second);
    }
    cout << e-res << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int a,b; cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<map>
#include<iostream>
#include<queue>
using namespace std;
map<string,int>f;
map<string,bool>ff;
queue<string>Q;
int main()
{
	string s,t;
	int ans=0;
	int a,b;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) {
		cin>>s;
		f[s]++;
		if(!ff[s]) {
			ff[s]=1;
			Q.push(s);
		}
	}
	scanf("%d",&b);
	for(int i=1;i<=b;i++) {
		cin>>t;
		f[t]--;
		if(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ff[t]) {
			ff[t]=1;
			Q.push(t);
		}
	}
	while(!Q.empty()) {
		string fff=Q.front();
		Q.pop();
		ans=max(ans,f[fff]);
	}
	printf("%d",ans);//
}

Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	char s[7];
	scanf("%s", s);
	
	if(strcmp(s, "SUN") == 0) puts("7");
	if(strcmp(s, "MON") == 0) puts("6");
	if(strcmp(s, "TUE") == 0) puts("5");
	if(strcmp(s, "WED") == 0) puts("4");
	if(strcmp(s, "THU") == 0) puts("3");
	if(strcmp(s, "FRI") == 0) puts("2");
	if(strcmp(s, "SAT") == 0) puts("1");
	return 0;
}


Measured memory_bytes: 128
s = input()
s = s.replace('BC', 'X')

cnt = 0
ans = 0

# AとXが連続している限り、Xより左のAは右にスキップしていける
for x in s:
    if x == 'A':
        cnt += 1
    elif x == 'X':
        ans += cnt
    else:
        cnt = 0

print(ans)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N;
  
  cin >> N ;
   
  char S;
  
  int d=0;
 
  
  for(int i=0;i<N;i++){
 	cin >> S;
    
    if(S=='Y'){d=1;}
    
  }
 
  if(d>0){
  	cout << "Four" << endl; 
  }else{
  	cout << "Three" << endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int ans=0;
  int B;
  int C;
  int E,F;
  vector<int> A(N);
  for(int i=0; i<N ; i++)
  {
    cin >> A.at(i);
  }
  for(int j=0; j<N ; j++)
  {
  
      C=A.at(j);
      C--;
      B=A.at(C);
      B--;

      if(B==j)
      {
        ans++;
      }
    
  }
  cout << (ans/2) << endl;
}


Measured memory_bytes: 3696
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, n, x, t, ans=0, po=0;
    char s[200001];
    memset(s, '\0', 200001);
    scanf("%s", s);
    for(i=0; s[i]!='\0'; i++){
        po += s[i]-48;
        po = po%9;
    }
    if(po == 0) printf("Yes");
    else printf("No");
    
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

namespace IO {
    #define gc getchar()
    template <typename T>
    inline void read(T& x) {
        x = 0; bool f = 1; char ch;
        for (ch = gc; ch < '0' || '9' < ch; ch = gc) if (ch == '-') f ^= 1;
        for (; '0' <= ch && ch <= '9'; ch = gc) x = (x << 3) + (x << 1) + (ch ^ 48);
        x = f ? x : -x;
    }
    #undef gc
}

typedef long long ll;

const int MAXN = 1e6 + 10;

int n, k, nxt[MAXN], len[MAXN];
ll val[MAXN], sum[MAXN << 1], f[MAXN << 1], arr[MAXN << 1], fans = -LONG_LONG_MAX;

bool vis[MAXN];

int m;

void work(int st) {
    m = 0;
    int cur = nxt[st];
    while (1) {
        arr[++m] = val[cur], vis[cur] = true;
        if (cur == st) break;
        cur = nxt[cur];
    }
    rep(i, 1, m) arr[++m] = arr[i];
    rep(i, 1, m) sum[i] = sum[i - 1] + arr[i];
    int mxlen = min(m >> 1, k);
    ll mxval = -LONG_LONG_MAX; int mxval_len = 0;
    rep(i, 1, m) {
        f[i] = -LONG_LONG_MAX;
        rep(j, max(i - mxlen, 0), i - 1) {
            f[i] = max(sum[i] - sum[j] + 1ll * max(sum[m >> 1], 0ll) * ((k - i + j) / (m >> 1)), f[i]);
        }
        mxval = max(f[i], mxval);
    }
    fans = max(fans, mxval);
}

int main() {
    IO::read(n), IO::read(k);
    rep(i, 1, n) IO::read(nxt[i]);
    rep(i, 1, n) IO::read(val[i]);
    rep(i, 1, n) if (!vis[i]) {
        work(i);
    }
    printf("%lld\n", fans);
    return 0;
}

Measured memory_bytes: 4072
/* ex9_1
   nabe9393 */

#include<stdio.h>
#include<stdlib.h>
#define SIZE 11
//構造体
typedef struct stack{
  int size;
  int count;
  char data[SIZE];
  char *top;
} stack;

//関数
void initialize_stack(stack *stk);
void print_stack(stack *stk);
void push(stack *stk, char elem);
char pop(stack *stk);

int main(void){
  //スタックの定義
  stack stk;
  int i;
  char str[11];
  //初期化
  initialize_stack(&stk);
  //入力
  for(i=0;i<10;i++){
    scanf("%c",&str[i]);
  }
  for(i=0;i<10;i++){
    if(str[i]=='1' || str[i]=='0'){
      //1or0でスタックにデータを追加
      push(&stk, str[i]);
    }
    if(str[i]=='B'){
      if(stk.count>0){
        //Bかつ、データがある場合はスタックからデータを取り出す
        pop(&stk);
      }
    }
  }
  //結果の出力
  print_stack(&stk);
  return 0;
}

//初期化の関数
void initialize_stack(stack *stk){
  stk->count = 0;
  stk->size = SIZE;
  stk->top = &(stk->data[SIZE]);
}

void push(stack *stk, char elem){
  if(stk->count >= stk->size){
    printf("Error: stack overflow. (x=%c)\n", elem);
    exit(1);
  }
  else{
    stk->top--;
    *(stk->top) = elem;
    stk->count++;
  }
}

char pop(stack *stk){
  char elem;
  if(stk->count <= 0){
    printf("Error: stack underflow.\n");
    exit(1);
  }
  else{
    elem = *(stk->top);
    stk->top++;
    stk->count--;
    return elem;
  }
}

void print_stack(stack *stk){
  //出力用の配列
  char output[11], *ptr_out;
  ptr_out = stk->top;
  for(int i=stk->count;i>0;i--){
    //逆順にする
    output[i-1] = *ptr_out;
    ptr_out++;
  }
  printf("%s\n",output);
}


Measured memory_bytes: 1592
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
    string str;
    cin >> str;
    lli ans=0,sum=0;
    if(str[0]=='A'||str[1]=='A'||str[2]=='A')   ans=1;
    if(str[0]=='B'||str[1]=='B'||str[2]=='B')   sum=1;
    if(sum&ans) cout << "Yes" << endl;
    else    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int station_num;
int cost_map[100][100];
int time_map[100][100];

int main(void) {
	int senro_num;
	int senro_from,senro_to;
	int senro_cost,senro_time;
	int query_num;
	int query_from,query_to,query_type;
	int i,j,k;
	while(1) {
		scanf("%d%d",&senro_num,&station_num);
		if(station_num==0 && senro_num==0)break;
		for(i=0;i<station_num;i++) {
			for(j=0;j<station_num;j++) {
				cost_map[i][j]=0x20000000;
				time_map[i][j]=0x20000000;
			}
			cost_map[i][i]=0;
			time_map[i][i]=0;
		}
		for(i=0;i<senro_num;i++) {
			scanf("%d%d%d%d",
				&senro_from,&senro_to,
				&senro_cost,&senro_time);
			senro_from--;senro_to--;
			if(senro_cost<cost_map[senro_from][senro_to]) {
				cost_map[senro_from][senro_to]=senro_cost;
			}
			if(senro_cost<cost_map[senro_to][senro_from]) {
				cost_map[senro_to][senro_from]=senro_cost;
			}
			if(senro_time<time_map[senro_from][senro_to]) {
				time_map[senro_from][senro_to]=senro_time;
			}
			if(senro_time<time_map[senro_to][senro_from]) {
				time_map[senro_to][senro_from]=senro_time;
			}
		}
		for(k=0;k<station_num;k++) {
			for(i=0;i<station_num;i++) {
				for(j=0;j<station_num;j++) {
					if(cost_map[i][j]>cost_map[i][k]+cost_map[k][j]) {
						cost_map[i][j]=cost_map[i][k]+cost_map[k][j];
					}
					if(time_map[i][j]>time_map[i][k]+time_map[k][j]) {
						time_map[i][j]=time_map[i][k]+time_map[k][j];
					}
				}
			}
		}
		scanf("%d",&query_num);
		for(i=0;i<query_num;i++) {
			scanf("%d%d%d",&query_from,&query_to,&query_type);
			query_from--;query_to--;
			if(query_type) {
				printf("%d\n",time_map[query_from][query_to]);
			} else {
				printf("%d\n",cost_map[query_from][query_to]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 492
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int dep[100005];
vector<int> ch[100005];
int par[100005];
void f(int v) {
  for(int to : ch[v]){
    par[to] = v;
    dep[to] = dep[v] + 1;
    f(to);
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;cin>>N;
  bool isRoot[N];
  FOR(i,0,N) isRoot[i] = true;
  FOR(i,0,N){
    int id, k;
    cin>>id>>k;
    FOR(j,0,k){
      int c;
      cin>>c;
      ch[id].push_back(c);
      isRoot[c] = false;
    }
  }
  int root = 0;
  FOR(i,0,N) {
    if(isRoot[i]) {
      root = i;
      break;
    }
  }
  par[root] = -1;
  f(root);
  FOR(i,0,N){
    string type;
    if(i == root) type = "root";
    else if(ch[i].size()==0) type = "leaf";
    else type = "internal node";
    cout<<"node "<<i<<": parent = "<<par[i]<<", depth = "<<dep[i]<<", "<<type<<", [";
    FOR(j,0,ch[i].size()){
      if(j) cout<<", ";
      cout<<ch[i][j];
    }
    cout<<"]"<<endl;
  }
}


Measured memory_bytes: 7100
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

template <typename Monoid>
struct SegmentTree
{
    using F = function<Monoid(Monoid, Monoid)>;

private:
    int n;
    vector<Monoid> node;
    Monoid E;
    F f;

public:
    SegmentTree(vector<Monoid> &v, Monoid e, const F func) : f(func), E(e)
    {
        int sz = v.size();
        n = 1;
        while (n < sz)
        {
            n *= 2;
        }
        node.resize(2 * n - 1, E);
        for (int i = 0; i < sz; i++)
        {
            node[i + n - 1] = v[i];
        }
        for (int i = n - 2; i >= 0; i--)
        {
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void update(int i, Monoid val)
    {
        i += (n - 1);
        node[i] = val;
        while (i > 0)
        {
            i = (i - 1) / 2;
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    Monoid query(int a, int b, int i = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = n;
        }
        if (r <= a || b <= l)
        {
            return E;
        }
        if (a <= l && r <= b)
        {
            return node[i];
        }
        Monoid vl = query(a, b, 2 * i + 1, l, (l + r) / 2);
        Monoid vr = query(a, b, 2 * i + 2, (l + r) / 2, r);
        return f(vl, vr);
    }

    Monoid operator[](const int &i) const
    {
        return node[i + n - 1];
    }
};

// dp[i][j]:=i番目まで見て、最後の高さがjである時のmax
// dp[i+1][j]:=max(dp[i][j],max(dp[i][k]|0<=k<j))

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> h(n), a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<ll> dp(n + 1, 0);
    SegmentTree<ll> seg(dp, -LLINF, [](ll b, ll c) { return max(b, c); });
    for (ll i = 0; i < n; i++)
    {
        ll tmp = seg.query(0, h[i]);
        seg.update(h[i], tmp + a[i]);
    }
    cout << seg.query(0, n + 1) << endl;
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	string st;
	cin >> st;
	vector<int> pred(n+1, 0);
	vector<int> post(n+1, 0);
	
	for(int i=0; i<=n; ++i){
		if(st[i]=='0') pred[i] = i;
		else pred[i] = pred[i-1];
	}
	for(int i=n; i>=0; --i){
		if(st[i]=='0') post[i] = i;
		else post[i] = post[i+1];
	}
	vector<int> path;
	int pos = 0;
	while(pos<n){
		path.push_back(pos);
		if(n-pos<=m){
			path.push_back(n);
			break;
		}
		int k = pred[pos+m];
		if(k==pos){
			cout << -1 << endl;
			return 0;
		}
		pos = k;
	}
	stack<int> q;
	for(int i=1; i<len(path)-1; ++i)
		q.push(i);

	while(not q.empty()){
		int i = q.top(); q.pop(); 
		int dr = path[i+1]-path[i];
		int d = min(m-dr, path[i]-path[i-1]-1);
		//cout << path[i] << " " << d << endl;
		int new_pos = post[path[i]-d];
		if(path[i]==new_pos) continue;
		//cout << path[i] << " became " << new_pos << endl; 
		path[i] = new_pos;
		q.push(i);
		if(i-1!=0) q.push(i-1);
		if(i+1!=len(path)-1) q.push(i+1);
	}
	for(int i=1; i<len(path); ++i)
		cout << path[i]-path[i-1] << " ";
	cout << endl;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std; 
typedef long long ll;
typedef unsigned long long int ull;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>  
#define ff first
#define ss second
#define pb push_back
#define Inf  1e18
#define inf -1e18
#define mod 1000000007
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll,ll>;
using umll = unordered_map<ll,ll>;
using sll = set<ll>;
using msll = multiset<ll>;
 
 
ll MUL(ll A,ll B){
  return (A%mod*B%mod)%mod;
}
 
ll ADD(ll A,ll B){
  return (A%mod+B%mod)%mod;
}
 
ull power(ll A,ll B) { 
    ull RES = 1;      
    while (B > 0) 
    { 
        if (B & 1) 
            RES = RES*A;  
        B = B>>1;  
        A = A*A;  
    } 
  return RES; 
}

 
void testcases(int cases){
  
  ll N;
  cin >> N;
  string S = "";
  while(N!=0){
    if(N==26){
      S+='z';
      break;
    }
    ll rem = N%26;
    if(rem==0)
      rem = 26;
    char ch =(char)(96 + rem);
    S+=ch;
    N-=rem;
    N/=26;
  }
  reverse(S.begin(),S.end());
  cout << S << "\n";
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
    ll t;
    t = 1;
   // cin >> t;
    ll Case =1 ;
    while(t--)
    {
      testcases(Case++);
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

ll gcd(ll a, ll b){
  if(a<b)swap(a,b);
  if(b==0)return a;
  return gcd(b,a%b);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll A,B;cin >> A >> B;
  ll g = A*B/gcd(A,B);
  cout << g << endl;
  return 0;
}


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

int main()
{
    int n, k=1, i;
    char cPrec, c;
    cin>>n>>cPrec;
    for(i=2; i<=n; i++)
    {
        cin>>c;
        if(c!=cPrec)
        {
            cPrec=c;
            k++;
        }
    }
    cout<<k;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::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 trace(...)
#endif
 


#define M 100010


int main(){
	IOS;
	tihs;

	ll a,b,c,d;cin>>a>>b>>c>>d;
	ll ans=0,f=0;
	while(1){
		if(!f){
			c-=b;
			if(c<=0){ans=1;
			break;}	
		}
		else {
			a-=d;
			if(a<=0){ans=2;
			break;}
		}
		f=!f;
	}
	if(ans==1)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3652
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// stringToInt はstring型のスライスをint型のスライスにキャストする関数
func stringToInt(tSlice []string) (rSlice []int) {
	for _, str := range tSlice {
		num, _ := strconv.Atoi(str)
		rSlice = append(rSlice, num)
	}
	return
}

// sumSlice はint型のスライスの要素の和を返す関数
func sumSlice(tSlice []int) int {
	var sumNum int = 0
	for _, num := range tSlice {
		sumNum += num
	}
	return sumNum
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	// Aの要素数
	var lenAstr string = scanner.Text()
	lenA, _ := strconv.Atoi(lenAstr)

	scanner.Scan()
	var B []int = stringToInt(strings.Split(scanner.Text(), " "))

	var A []int
	for i := 0; i < lenA-1; i++ {
		// 最初は固定で
		// A[i] = B[i]
		// A[i+1] = B[i]
		if i == 0 {
			A = append(A, B[i])
			A = append(A, B[i])
			// fmt.Printf("%d %d\n", A[i], B[i])
		} else {
			// fmt.Printf("%d %d\n", A[i], B[i])
			// A[i] が B[i] より大きかった場合プログラムが成り立たない！
			if A[i] > B[i] {
				A[i] = B[i]
				// fmt.Printf("→ %d %d\n", A[i], B[i])
			}
			A = append(A, B[i])
		}
	}

	fmt.Println(sumSlice(A))
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 510000
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < n; ++i)

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string, ll> mp;
    rep(i, 0, n)
    {
        string tmp;
        cin >> tmp;
        mp[tmp]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3652
n = int(input())
a = [int(i) for i in input().split()]

a.sort()

ai = a[-1]

aj = a[0]
for i in a[:-1]:
    if abs(ai//2 + ai % 2- aj) > abs(ai//2 + ai % 2 - i):
        aj = i

print(ai, aj)

Measured memory_bytes: 14060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

const long long MOD = 1000000007LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long slow_mult(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; 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);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    long long n; cin >> n;
    long long best = n;

    for(long long i = 1; i * i <= n; ++i){
        if(n % i == 0) best = min(best, i - 1 + max(0ll, n / i - 1));
    }

    cout << best;

    return 0;

}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
	int batas,target,ans=0;
	cin>>batas>>target;
	for(int i=0;i<=batas;i++)
	{
		for(int j=0;j<=batas;j++)
		{
			int k=target-i-j;
			ans+=(k>=0&&k<=batas);
		}
	}
	cout<<ans<<endl;
}

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

const int inf = 1e9;
const ll linf = 1e18;

ll C(int n, int k)
{
    ll res = 1;
    for (int i = 0; i < k; i++) res *= (n - i);
    for (int i = 1; i <= k; i++) res /= i;
    return res;
}

int pow(int n, int k)
{
    int res = 1;
    for (int i = 0; i < k; i++) res *= n;
    return res;
}

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

    string n; cin >> n;
    int k; cin >> k;

    int len = n.length();
    if (len < k) {
        cout << 0 << endl;
    } else {
        ll ans = 0;
        int pos = 0;
        while (pos < len && k > 0) {
            int head = n[pos] - '0';
            if (len - pos - 1 >= k) ans += (ll)pow(9, k) * C(len - pos - 1, k);
            if (len - pos - 1 >= k - 1) ans += (ll)pow(9, k - 1) * (head - 1) * C(len - pos - 1, k - 1);
            while (++pos < len && n[pos] == '0') ;
            k--;
        }
        if (!k) ans++;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256