akhauriyash/Code-Regression huggingface dataset:
L, R = map(int,input().split()) # 複数の数字を変数に格納

min = 2020

if R - L > 673:
    min = 0
else:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            tmp = i * j % 2019
            if tmp < min:
                min = tmp

print(min)

Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <algorithm>

using namespace std;
#define n_max 100000
#define M_max 50
#define N_max 50


int main()
{
    int A, B, C; 

    cin >> A >> B >> C;
    
    if((A <= C) && (C <= B)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int h,n,sum=0;
    cin >> h >> n;
    int a[n];
    fr(i,n){
        cin >> a[i];
        sum += a[i];
    }
    if(sum >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

int main(){
  int H,W;
  cin >> H >> W;
  char C[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> C[i][j];
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout << C[i][j];
    }
    cout << endl;
    for(int j=0;j<W;j++){
      cout << C[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int xx[105], yy[105];
int main(){
	int n, m, x, y;
	scanf("%d%d%d%d", &n, &m, &x, &y);
	for(int i=1;i<=n;i++) scanf("%d", &xx[i]);
	for(int i=1;i<=m;i++) scanf("%d", &yy[i]);
	for(int i=x+1;i<=y-1;i++){
		bool ok = 1;
		for(int j=1;j<=n;j++){
			if(xx[j] < i) continue;
			ok = 0;
		}
		for(int j=1;j<=m;j++){
			if(yy[j] >= i) continue;
			ok = 0;
		}
		if(ok){
			printf("No War\n");
			return 0;
		}
	}
	printf("War\n");
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = 0
for i in range(1, n + 1):
    ans += (i + n - n % i) * (n // i) // 2
print(ans)


Measured memory_bytes: 68620
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    X,Y,Z=map(int,input().split())
    print(Z,X,Y)

if __name__ == '__main__':
    main()


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

main(){
    double x;
    int a;
    double b;

    while(1){
	cin >> x;
	if ( x < 0 ) break;
	a = (int)x;
	b = x - a;
	vector<int> A, B;
	while(a){ A.push_back(a%2); a /= 2; }
	while(b >= 1.0) b /= 10;
	while(b){ 
	    b *= 2;
	    if ( b >= 1.0 ){ B.push_back(1); b -= 1; }
	    else B.push_back(0);
	    if ( B.size() > 4 ) break;
	}
	while( A.size() < 8 ) A.push_back(0);
	while( B.size() < 4 ) B.push_back(0);
	if ( A.size() > 8 || B.size() > 4 ) cout << "NA" << endl;
	else {
	    for ( int i = A.size()-1; i >= 0; i-- ) cout << A[i];
	    cout << ".";
	    for ( int i = 0; i < B.size(); i++ ) cout << B[i];
	    cout << endl;
	}
    }
    
}

Measured memory_bytes: 0
def readinput():
    n,k=list(map(int,input().split()))
    a=list(map(int,input().split()))
    return n,k,a

def main(n,k,a):
    tbl={}
    for i in range(1,n+1):
        tbl[i]=a[i-1]
    machi=1
    for i in range(k):
        machi=tbl[machi]
    return machi

def main2(n,k,a):
    a.insert(0,0)
    #print(a)
    nvisited=[0 for i in range(n+1)]
    #print(nvisited)
    visited=[]
    current=1
    visited.append(current)
    nvisited[current]+=1
    next=a[current]
    #print('next='+str(next))
    while(nvisited[next]==0):
        current=next
        visited.append(current)
        nvisited[current]+=1
        next=a[current]
    loophead=next
    #print('loophead:'+str(loophead))
    #print('visited'+str(visited))
    beforeloop=visited.index(loophead)
    #print('beforeloop:'+str(beforeloop))
    loop=visited[beforeloop:]
    #print('loop:'+str(loop))
    looplen=len(loop)

    if (k<beforeloop):
        return visited[k+1]
    else:
        return loop[(k-beforeloop)%looplen]

def detectloop(a):
        # loopを検出して
        # loopに入る前に訪れた町リスト:head
        # loop内で訪れる町リスト:loop
        # を返す
    nvisit=[0 for i in range(len(a))]
    visited=[]
    n=a[0]
    while(nvisit[n-1]==0):
        nvisit[n-1]+=1
        visited.append(n)
        n=a[n-1]
    #print(visited,n)
    i=visited.index(n)
    #print(i)
    if(i==0):
        loop=visited[:]
        head=[]
    else:
        loop=visited[i:]
        head=visited[:i]
    return head,loop

def main3(n,k,a):
    head,loop=detectloop(a)
    #print(head,loop,k)
    if(k<=len(head)):
        return head[k-1]
    else:
        return loop[(k-len(head))%len(loop) -1]





if __name__=='__main__':
    n,k,a=readinput()
    ans=main3(n,k,a)
    print(ans)


Measured memory_bytes: 32404
n, t = map(int, input().split())
a, b, ab = [], [], []
for _ in range(n):
    ab.append(tuple(map(int, input().split())))
ab.sort(key=lambda x:x[0])
for i in ab:
    a.append(i[0])
    b.append(i[1])

# dp[i][j] = 0~i番目の料理でj分以内に完食できる美味しさの合計の最大値
# 0 <= i <= n-1, 0 <= j <= t-1
dp = [[0 for _ in range(min([t, a[0]]))] + [b[0] for _ in range(t-a[0])]]
for i in range(1, n):
    dp.append([])
    for j in range(min([t, a[i]])):
        dp[i].append(dp[i-1][j])
    for j in range(a[i], t):
        dp[i].append(max([dp[i-1][j], dp[i-1][j-a[i]]+b[i]]))

ans = []
for i in range(1, n):
    ans.append(dp[i-1][t-1] + b[i])
print(max(ans))

Measured memory_bytes: 124248
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

vector<ll> fact(300010,0),ifact(300010,0);


ll mod = 1e9+7;

ll mpow(ll a, ll x){
    ll ret = 1;
    ll tmp = a;
    while(x > 0){
        if((x & 1) == 1){
            ret = (ret * tmp) % mod;
        }
        
        tmp = (tmp * tmp) % mod;
        x = x >> 1;
    }
    return ret;
}

ll comb(ll n, ll k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;

    ll ret = 1;
    ret = (ret * fact[n]) % mod;
    ret = (ret * ifact[k]) % mod;
    ret = (ret * ifact[n-k]) % mod;
    
    return ret;
}

map<ll,ll> prime_factorize(ll n){
    map<ll,ll> ret;
    for(ll i = 2; i * i <= n; i++){
        while(n % i == 0){
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main(){
    ll n,m;
    cin >> n >> m;
    fact[0] = fact[1] = 1;
    ifact[0] = ifact[1] = 1;
    reps(i,2,300010){
        fact[i] = (fact[i-1] * i) % mod;
    }
    ll inv = mpow(fact[300009], mod-2); // (n!)^(-1)
    ifact[300009] = inv;
    

    for(ll i = 300009;i >= 1; i--){
        inv = (inv * i) % mod;
        ifact[i-1] = inv;
    }

    map<ll,ll> mp;
    mp = prime_factorize(m);
    ll ans = 1;
    for(auto e : mp){
        ans = (ans * comb(e.second + n - 1, e.second) ) % mod;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	s = IS()
	t = IS()
	n = len(s)
	m = len(t)
	dp = [[0 for _ in range(m+1)] for _ in range(n+1)]
	for i in range(n):
		for j in range(m):
			if(s[i]==t[j]):
				dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1],dp[i][j]+1)
			else:
				dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

	ans = ''
	while (n>0  and m>0):
	    if dp[n][m] == dp[n-1][m]:
	        n -= 1
	    elif dp[n][m] == dp[n][m-1]:
	        m -= 1
	    else:
	        ans += s[n-1]
	        n -= 1
	        m -= 1
	print(ans[::-1])

if __name__ == '__main__':
	main()

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

using namespace std;

int main()
{
  vector< int > q(3);
  cin >> q[0] >> q[1] >> q[2];
  sort(begin(q), end(q));
  if(q[0] + q[1] == q[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
q = int(input())

num = set()
for _ in range(q):
    query, x = map(int, input().split())
    if query == 0:
        num.add(x)
        print(len(num))
    elif query == 1:
        if x in num:
            print(1)
        else:
            print(0)
    else:
        if x in num:
            num.remove(x)


Measured memory_bytes: 23352
#include<stdio.h>

char calc(int ,int,int *);

int main(){
  int n,A[2000],q,m[2000];
  int i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
   scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&m[i]);

  for(i=0;i<q;i++){
    if(calc(n-1,m[i],A)=='t')
      printf("yes\n");
    else printf("no\n");   
  }
  return 0;
}

char calc(int n,int m,int *A){
  char res[2];
  if(m==0)
    return 't';
  if(n<0)
    return 'f';
  res[0]=calc(n-1,m,A);
  res[1]=calc(n-1,m-A[n],A);
  if(res[0]=='t'||res[1]=='t')
    return 't';
  else return 'f';
}



Measured memory_bytes: 2048
MOD = 2019
"""
def part_count(S):
  B = [0 for _ in range(MOD)]
  C = [0 for _ in range(MOD)]
  L = [0 for _ in range(MOD)]
  R = [0 for _ in range(MOD)]
  
  if len(S) == 1:
    s = S[0]
    B[s] = 1 
    return (B, L, R, C)
  S_L = S[:len(S)//2]
  S_R = S[len(S)//2:]
  
  B1, L1, R1, C1 = part_count(S_L)
  B2, L2, R2, C2 = part_count(S_R)
    
  for j in range(MOD):
    C[j] += C1[j] + C2[j]
    L[j] += L1[j]
    R[j] += R2[j]
    for i in range(MOD):
      B[j] += B1[i] * B2[(-i + j)%MOD]
      L[j] += B1[i] * L2[(-i + j)%MOD]
      R[j] += B2[i] * R1[(-i + j)%MOD]
      C[j] += R1[i] * L2[(-i + j)%MOD]
  
  return (B, L, R, C) #両側隣接、左隣接、右隣接、隣接なしの個数
"""

S = list(input())
S.reverse()
N = len(S)
S = [int(S[i]) for i in range(N)]
MOD = 2019

a = 1
for i in range(N): 
  S[i] *= a
  S[i] %= MOD
  a *= 10 
  a %= MOD
  
#B, L, R, C = part_count(S)
#print(B[0] + L[0] + R[0] + C[0])
T = [0 for _ in range(N+1)]
for i in range(1,N+1):
  T[i] += S[i-1] + T[i-1]
  T[i] %= MOD

#print(T)

C = [0 for i in range(MOD)]  
for i in range(N+1):
  C[T[i]] += 1

#print(C)

ans = 0
for i in range(MOD):
  ans += C[i]*(C[i]-1)//2
  
print(ans)
  

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

using namespace std;

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)

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

  size_t n, k;
  cin >> n >> k;

  vector <int> v;

  rep (i, n)
  {
    int a;
    cin >> a;
    v.emplace_back (a);
  }

  int64_t ans = 0;
  for (auto l = 0u; l <= k; ++ l)
  {
    for (auto r = 0u; r + l <= k; ++ r)
    {
      if (l + r > n) continue;
      auto d = k - l - r;
      int64_t now = 0;
      set <int> s;
      rep (i, l)
      {
        now += v [i];
        s.emplace (v [i]);
      }
      rep (i, r)
      {
        now += v [n - i - 1];
        s.emplace (v [n - i - 1]);
      }
      auto ite = s.begin ();
      rep (i, d)
      {
        if (ite == s.end ()) break;
        if (* ite > 0) break;
        now -= * ite;
        ++ ite;
      }
      ans = max (ans, now);
#ifdef LOCAL
      cerr << "{";
      copy (ite, s.end (), ostream_iterator <int> (cerr, " "));
      cerr << "}" << endl;
#endif
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  int cnt=0;
  rep(i,n-1){
    if(s[i]==s[i+1])++cnt;
  }
  cout<<min(n-1,cnt+2*k);
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 512
//
// Created on 2020/07/15.
//

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int a,b;
    cin>>a>>b;
    if(b % a == 0){
        cout<<a+b<<endl;
    }else{
        cout<<b-a<<endl;
    }
    return 0;
}



Measured memory_bytes: 3644
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        out.println(N + N*N + N*N*N);

        out.flush();
    }

    static final int MOD = 1_000_000_007;
    static long mPow(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if (b % 2 == 1)
                ret = (ret * a) % MOD;
            a = (a * a) % MOD;
            b /= 2;
        }
        return ret;
    }
    static long mInv(long a) {
        return mPow(a, MOD - 2);
    }
    static long mFact(long a) {
        long ret = 1;
        for (long i = 2; i <= a; i++)
            ret = (ret * i) % MOD;
        return ret;
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}



Measured memory_bytes: 32852
// B - Guidebook

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

struct Restaurant {
	int id;
	string city;
	int score;
};

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

	vector<Restaurant> restaurants;
	for (int i=1; i<=N; i++) {
		Restaurant r;
		r.id = i;
		cin >> r.city >> r.score;
		restaurants.push_back(r);
	}

	stable_sort(restaurants.begin(), restaurants.end(), [](const Restaurant &a, const Restaurant &b) {
    	return a.score > b.score;
  	});

  	stable_sort(restaurants.begin(), restaurants.end(), [](const Restaurant &a, const Restaurant &b) {
    	return a.city < b.city;
  	});

	for (auto r : restaurants) {
		cout << r.id << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
 
import sys
import math
# 以下を記述しないとTLEになる, 何故？
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
# ---- ここまで -----------------------

S = input()
T = input()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()

ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1

print(ans)


Measured memory_bytes: 3972
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
   int n;
   cin >> n;
   VI a(n);
   rep(i,n)cin >> a.at(i);
   sort(a.begin(),a.end());
   reverse(a.begin(),a.end());
   if(n%2==0){
      int m=n/2;
      ll sum=0;
      rep(i,m){
         sum+=a.at(i);
      }
      ll ans=sum*2-a.at(0);
      cout << ans << endl;
   }
   else if(n%2==1){
      int m=n/2+1;
      ll sum=0;
      rep(i,m){
         sum+=a.at(i);
      }
      ll ans=sum*2-a.at(0)-a.at(m-1);
      cout << ans << endl;
   }
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int main(){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	long long x=b/c-(a-1)/c,y=b/d-(a-1)/d;
	long long z=c*d;
	long long r=__gcd(c,d);
	z=z/r;
	long long k=b/z-(a-1)/z;
	long long ans=b-a+1-x-y+k;
	printf("%lld\n",ans);
}

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

int main() {
  int N;
  string S;
  
  cin >> N >> S;
  
  for (int i = 0; i < S.length(); i++) {
    if (S[i] + N >= 91) {
      S[i] = S[i] + N - 26;
    } else {
      S[i] = S[i] + N;
    }
  }
  
  cout << S << endl;
  
  return 0;
}




Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return (int(x) for x in input().split())
def LI(): return list(Is())
def TI(): return tuple(Is())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(S())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = I()
a = s//10**9
b = s % 10**9
# s = a*10**9+b = (a+1)*10**9-(10**9-b)
if a+1 > 10**9:
    print(0, 0, 10**9, 0, 0, 10**9)
else:
    print(0, 0, 10**9, 10**9-b, 1, a+1)


Measured memory_bytes: 63340
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int N = int.Parse(Console.ReadLine());
    string res = "";
    while (N != 0) {
      if (N%2 != 0) {
        res += "1";
        N--;
      } else {
        res += "0";
      }
      N /= -2;
    }
    if (res == "") res = "0";
    res = string.Join("", res.ToArray().Reverse().ToArray());
    Console.WriteLine(res);
  }
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()
#define pb push_back


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

struct Info { 
    int node, dist;
};

const int MAXN = 1e5 + 10;
int dp[MAXN][3];


int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin >> n >> m;
    auto graph = vvi(n);
    memset(dp,-1,sizeof(dp));
    for (int i = 0; i < m; ++i) {
        int u, v; cin >> u >> v;
        u--, v--;
        graph[u].pb(v);
    }
    int s, t; cin >> s >> t;
    s--, t--;
    queue<Info> q;
    q.push({s,0});
    dp[s][0] = 0;
    while (!q.empty()) {
        Info& i  = q.front(); q.pop();
        int node = i.node, dist = i.dist;//ith = i.ith, acc = i.acc;
        for (auto neigh: graph[node]) {
            //int nith = (ith+1) % 3, nacc = acc + (ith == 0);
            int D = dist+1;
            if (dp[neigh][D%3] == -1 || dp[neigh][D%3] > D) {
                dp[neigh][D%3] = D;
                q.push({neigh, D});//nith, nacc});
            }
        }
    }

    if (dp[t][0] !=- 1) cout << dp[t][0] / 3 << endl;
    else cout << -1 << endl;



    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;
typedef long long int lli;
typedef long int li;
const int inf = numeric_limits<int>::max();

#define PI 3.14159265358979323846

int main(){
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double H = h*30;
    double M = m*6;
    H = H + (m/2.0);
    double ang = abs(H-M);
    if(ang>180.0){
        ang = 360.0-ang;
    }
    double c = sqrt(a*a + b*b - 2*a*b*cos(ang * PI / 180.0));
    cout<<setprecision(20)<<c;
}



Measured memory_bytes: 4228
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};
struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}



int main(){
    IOS;
    make(ll,n);
    makevec(ll,vec,n);
    unordered_map <ll,ll,c_h> um;
    ll s=0;
    fr(i,n) {um[vec[i]]++; s+=vec[i];}
    make(ll,q);
    while(q--){
        make2(ll,a,b);
        s+=um[a]*(b-a);
        um[b]+=um[a];
        um[a]=0;
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 9428
#include <bits/stdc++.h>
typedef  long long ll;
#define INF 1000000000
using namespace std;
int main(void){
int n;
cin>>n;
vector<int>c(n),s(n),f(n),t(n,0);
if(n==1){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<0<<endl;
return 0;
}
for(int i=0;i<n-1;i++){
    cin>>c[i]>>s[i]>>f[i];
}
for(int i=0;i<n-1;i++){
    for(int j=i;j<n-1;j++){
        if(s[j]>t[i]){
            t[i]+=s[j]-t[i];
        }else{
            if(t[i]%f[j]){
                t[i]+=f[j]-(t[i]%f[j]);
            }
        }
        t[i]+=c[j];
    }
}
for(int i=0;i<n-1;i++){
    cout<<t[i]<<endl;
}
cout<<0<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int maxn = 2e5+10;
int n;
LL T, t, ans, from;
struct Item {
    int t, k;
    bool operator < (const Item &rhs) const {
        return t < rhs.t;
    }
};
vector<Item> v;
int main (void) {
    scanf ("%d%lld", &n, &T);
    for (int i = 0; i < n; i++) {
        scanf ("%d", &t);
        v.push_back ({t, 1});
        v.push_back ({t+T, -1});
    }
    sort (v.begin(), v.end());
    int cnt = 0;
    for (int i = 0; i < v.size(); i++) {
        if (v[i].k == 1) {
            if (cnt == 0) from = v[i].t;
            cnt++;
        }
        else {
            if (cnt == 1) ans += v[i].t-from;
            cnt--;
        }
    }
    printf ("%lld\n", ans);
}


Measured memory_bytes: 4976
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();
        switch(S){
            case "SUN":
                System.out.println(7);
                break;
            case "MON":
                System.out.println(6);
                break;
            case "TUE":
                System.out.println(5);
                break;
            case "WED":
                System.out.println(4);
                break;
            case "THU":
                System.out.println(3);
                break;
            case "FRI":
                System.out.println(2);
                break;                
            case "SAT":
                System.out.println(1);
                break;                
        }
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int x,MAX,a[500005];
int main(){
    cin>>x;
    while(cin>>x) a[x]++,a[x-1]++,a[x+1]++;
    for(int i=0;i<=500000;i++)
        MAX=max(MAX,a[i]);
    cout<<MAX<<endl;
    return 0;
 }

Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
#define MAX 1111111
#define MIN -1111111
typedef pair<int,int> P;
void init(int n);
void update(int k,int x);
P maxx(int k1,int k2);
P dat[4*100001];
int tim[100001]={0};
int N;

int main(){
  int R,L;
  cin >> N >> R >> L;
  int n_tmp = N;
  init(N);
  memset(tim,0,n_tmp+1);
  int now = 0;
  dat[0]=P(MIN,1);
  for(int i=0;i<R;i++){
    int d,t,x;
    cin >> d >> t >> x;
    tim[dat[0].second] += t - now;
    update(d,x);
    now = t;
  }
  tim[dat[0].second] += L - now;
  int *ans = max_element(tim,tim+n_tmp+1);
  cout << ans - tim << endl;
}

void init(int n){
  N=1;
  while(N<n) N*=2;
  for(int i=0;i<2*N-1;i++){
    dat[i]=P(MIN,MAX);
  }
  for(int i=N-1;i<N-1+n;i++){
    dat[i]=P(0,i-(N-2));
  }
  return;
}

void update(int k,int x){
  k += N - 2;
  P p = dat[k];
  int score = p.first;
  int team = p.second;
  //cout << score << " " << team << endl;
  dat[k] = P(score+x,team);
  while(k > 0){
    k = (k - 1) / 2;
    dat[k] = maxx(k*2+1,k*2+2);
    //cout << dat[k].first << " " << dat[k].second << endl;
  }
  return;
}

P maxx(int k1,int k2){
  P p;
  if(dat[k1].first == dat[k2].first){
    p = P(dat[k1].first,min(dat[k1].second,dat[k2].second));
  }
  else {
    p = max(dat[k1],dat[k2]);
  }
  return p;
}

Measured memory_bytes: 4684
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

// type alias
using ll = long long;
using ull = unsigned long long;

// constant value
const ll mod = 1000000007ll;

template<class ll>
inline ll getCeilExponent(ll a)
{
	if (a <= 0)
	{
		throw invalid_argument("vaule equal to or less than 0 should not be valid");
	}

	ll index = 0;
	--a;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
	return index;
}

template<class ll>
inline ll getFloorExponent(ll a)
{
	if (a <= 0)
	{
		throw invalid_argument("vaule equal to or less than 0 should not be valid");
	}

	ll index = 0;
	a >>= 1;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
	return index;
}

// computational complexity: o(log(max(a, b))) 
template<class ll>
inline ll getGcd(ll a, ll b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

// computational complexity: o(log(max(a, b))) 
template<class ll>
inline pair<ll, ll> getBezoutsIdentitySolution(ll a, ll b)
{
	if (b == 0)
	{
		return { 1, 0 };
	}
	auto sol = getBezoutsIdentitySolution(b, a % b);
	return { sol.second, sol.first - (a / b) * sol.second };
}

inline ll getModValue(ll a, ll m)
{
	return (a % m + m) % m;
}

// computational complexity: o(log(max(a, n))) 
inline ll getModInverse(ll a, ll m)
{
	auto sol = getBezoutsIdentitySolution(a, m);
	if (a * sol.first + m * sol.second != 1)
	{
		return -1;
	}
	return getModValue(sol.first, m);
}

ll getModCombinatorialNumber(ll n, ll r, ll m)
{
	ll res = 1;
	for (; n > 0; --n, --r)
	{
		res = (((res * n) % m) * getModInverse(n, m)) % m;
	}
	return getModValue(res, m);
}

ll getModPower(ll base, unsigned t, ll m)
{
	if (t == 0)
	{
		return 1ll;
	}

	auto res = getModPower(base, t >> 1, m);
	res = getModValue(res * res, m);
	if (t % 2 == 1)
	{
		res = getModValue(res * base, m);
	}
	return res;
}

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

	ll A, B, C;
	cin >> A >> B >> C;
	if (A <= B)
	{
		if (A <= C && C <= B)
		{
			cout << "Yes" << endl;
			return 0;
		}
		else
		{
			cout << "No" << endl;
			return 0;
		}
	}
	else
	{
		if (B <= C && C <= A)
		{
			cout << "Yes" << endl;
			return 0;
		}
		else
		{
			cout << "No" << endl;
			return 0;
		}
	}

	return 0;
}

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

int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    string ans;
    int diff_x = tx-sx;
    int diff_y = ty-sy;
    rep(i,diff_x){
        ans+='R';
    }
    rep(i,diff_y){
        ans+='U';
    }
    rep(i,diff_x){
        ans+='L';
    }
    rep(i,diff_y){
        ans+='D';
    }
    ans += 'D';
    rep(i,diff_x){
        ans+='R';
    }
    ans+='R';
    rep(i,diff_y){
        ans+='U';
    }
    ans+='U';
    ans+='L';
    ans+='U';
    rep(i,diff_x){
        ans+='L';
    }
    ans+='L';
    rep(i,diff_y){
        ans+='D';
    }
    ans+='D';
    ans+='R';
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  

int main(){

    ll A, B; cin >> A >> B;

    A -= 2;
    if(A < 0)A += 100;
    B -= 2;
    if(B < 0)B += 100;

    if(A == B){
        cout << "Draw" << endl;
        return 0;
    }
    
    if(A > B){
        cout << "Alice" << endl;
        return 0;
    }else{
        cout << "Bob" << endl;
        return 0;
    }

}

Measured memory_bytes: 256
s = input()
K = int(input())
t = []
for i in range(1,min(6,len(s)+1)):
    for j in range(len(s)-i+1):
        if s[j:j+i] not in t:
            t.append(s[j:j+i])
t.sort()
print(t[K-1])

Measured memory_bytes: 4072
n=int(input())
import copy
a= [int(x) for x in input().split()]
MAX_A = 10 ** 6 + 1
histogram = [0] * MAX_A
for x in a:
  histogram[int(x)] += 1
for divider in range(2, MAX_A):
  count = 0
  for counted in histogram[divider::divider]:
    count += counted
  if count > 1:
    break
else:
  print('pairwise coprime')
  exit()
from math import gcd
g=gcd(a[0],a[1])
if n==2:
  print('setwise coprime' if g==1 else 'not coprime')
  exit()
for i in range(2,n):
  g=gcd(g,a[i])
if g==1:
  print('setwise coprime')
else:
  print('not coprime')


Measured memory_bytes: 133108
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int GCD(int a, int b) {
    if(a<b) {
        long long int tmp=a;
        a = b;
        b = tmp;
    }
    
    if(b==0) {
        return a;
    }
    
    return GCD(b, a%b);
}

int main() {
    int N;
    long long int K;
    cin >> N >> K;
    vector<long long int> A(N);
    for(int n=0; n<N; n++) {
        cin >> A[n];
    }
    
    sort(A.begin(), A.end());
    
    if(K>A[N-1]) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        if(A[0]==1) {
            cout << "POSSIBLE" << endl;
        } else {
            long long gcd=A[0];
            for(int n=1; n<N; n++) {
                gcd = GCD(gcd, A[n]);
            }
            if(K%gcd==0) {
                cout << "POSSIBLE" << endl;
            } else {
                cout << "IMPOSSIBLE" << endl;
            }
        }
    }



    return 0;
    
}

Measured memory_bytes: 1024
N = int(input())
A = [int(x) for x in input().split()]

for k in range(N):
    if k == N - 1:
        print(A[k])
    else:
        print(A[k], end=" ")

for i in range(1, N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v
    for k in range(N):
        if k == N - 1:
            print(A[k])
        else:
            print(A[k], end=" ")



Measured memory_bytes: 5956
import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for b in B:
    a = bisect.bisect_left(A, b) # 挿入点はどの同じ値よりも左
    c = bisect.bisect_right(C, b) # 挿入点はどの同じ値よりも右
    ans += a * (len(C)-c)
print(ans)

Measured memory_bytes: 105572
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    ll s;
    cin >> n >> k >> s;
    rep(i,k) cout << s << " ";
    if(s != 1000000000){
        rep(i,n-k) cout << s+1 << " ";
    }
    else{
        rep(i,n-k) cout << 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next(), 16);
		int b = Integer.parseInt(sc.next(), 16);

		if (a < b){
			System.out.println("<");
		}else if (a == b){
			System.out.println("=");
		}else {
			System.out.println(">");
		}
	}
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> ans(n,0);
    int input;
    for(int i=0;i<m*2;i++){
        cin >> input;
        ans[input-1]++;
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}

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

#define rep(i,s,e) for(int i = (s);i <= (e);i++)

typedef long long i64;

int n;
vector<int> a;

vector<int> edges[100010];

int main()
{
	cin >> n;
	a.resize(n + 1,0);
	rep(i,2,n) cin >> a[i];
	rep(i,2,n) edges[a[i]].push_back(i);
	vector<int> topolo;
	{
		queue<int> que;
		que.push(1);
		while(!que.empty())
		{
			int v = que.front();
			que.pop();
			topolo.push_back(v);
			for(int to : edges[v]){
				que.push(to);
			}
		}
	}
	reverse(topolo.begin(),topolo.end());
	vector<int> node(n + 1,0);
	for(int s : topolo)
	{
		priority_queue<int> vec;
		for(int chi : edges[s])
		{
			vec.push(node[chi]);
		}
		int MA = 0;
		int cou = 1;
		while(!vec.empty())
		{
			MA = max(MA , vec.top() + cou);
			vec.pop();
			cou++;
		}
		node[s] = MA;

	}

	cout << node[1] << endl;
	return 0;
}







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

int main() {
  int num;//
  int dig;//桁
  int count =0;
 
  cin>>num>>dig;
  
  while(num>0){
    num=num/dig;
    count++;
  }
  
  cout<<count<<endl;
  
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  
  int dig = 1;
  int when = 10;
  
  map<int,map<int,int> > m;
  
  long long ans = 0;
  
  for(int i=1;i<=n;i++){
      
      if( i == when){
          dig = dig*10;
          when = when * 10;   
      }
      
      int first = i/dig;
      int last = i%10;
      
      if(first == last)
        ans++;
    
      ans += (2*m[last][first]);
      
      m[first][last] += 1;
      
  }
  
  cout<<ans;
  
}


Measured memory_bytes: 256
import math
from functools import reduce
from itertools import product,combinations_with_replacement

def gcd_(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 3*K*(K-1) + 1

# for i,j,k in product(range(2,K+1),repeat=3):
#     ans += gcd_(i,j,k)
for i,j,k in combinations_with_replacement(range(2,K+1),3):
    if i==j and j==k:
        ans += i
    elif i==j or j==k or k==i:
        ans += gcd_(i,j,k) * 3
    else:
        ans += gcd_(i,j,k)*6
# for i in range(2,K+1):
#     for j in range(2,K+1):
#         for k in range(2,K+1):
#             ans += gcd_(i,j,k)

print(ans)

Measured memory_bytes: 9632
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	cout<<"ABC"<<n<<endl;
	return 0;
}

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

int main() {
  long long n;
  cin >> n;
  deque<string> d;
  //vector<string> c{'0','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  string c = "0abcdefghijklmnopqrstuvwxyz";
  //cout << c[3];
  
  long long a,b;
  
  string res = "";
  
  while(n > 26){
    a = n/26;  
    b = n%26;
    if (b == 0){
      b = 26;
      a -= 1;
    }
    res = c[b]+res;
    
    n = a;
    //cout << a << " " << b << endl;
  }
  
  res = c[n] +res;
  cout<< res;
}


Measured memory_bytes: 3560
n = int(input())
h = list(map(int, input().split()))


count = 0
max_count = 0
for i in range(n-1):
  if h[i]>=h[i+1]:
    count+=1
  else:
    count = 0
  
  if max_count<count:
    max_count=count

print(max_count)

Measured memory_bytes: 14224
N=int(input())
a=list(map(int,input().strip().split()))

dp=[0 for n in range(max(a)+1)]
for n in range(N):
    dp[a[n]]+=1

ans=0
if len(dp)==1:
    ans=dp[0]
else:
    for n in range(1,len(dp)-1):
        ans=max(ans,dp[n-1]+dp[n]+dp[n+1])

print(ans)


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

struct UnionFind {
    UnionFind(int n) {
        parent = vector<int>(n, -1);
        weight = vector<int>(n, 0);
    }
    int find(int x) {
        if (parent[x] < 0)
            return x;
        else
            return parent[x] = find(parent[x]);
    }
    bool isSame(int x, int y) { return find(x) == find(y); }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) {
            weight[x]++;
            return;
        }
        if (parent[x] < parent[y])
            swap(x, y);
        parent[x] += parent[y];
        parent[y] = x;
        weight[x] += weight[y] + 1;
    }
    int getSize(int x) { return -parent[find(x)]; }
    int getWeight(int x) { return weight[find(x)]; }

private:
    vector<int> parent;
    vector<int> weight;
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind f(N);
    vector<vector<int>> friends(N, vector<int>());
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        f.unite(a, b);
        friends[a].push_back(b);
        friends[b].push_back(a);
    }

    vector<int> ans(N, 0);
    for (int i = 0; i < N; i++) {
        ans[i] = f.getSize(i) - friends[i].size() - 1;
    }
    for (int i = 0; i < K; i++) {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        if (f.isSame(c, d)) {
            ans[c]--;
            ans[d]--;
        }
    }

    for (int a : ans) {
        cout << a << " ";
    }
    cout << endl;
}


Measured memory_bytes: 8568
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int n,d;
int inds[114514];
vi a,b;
int main(){
	cin>>n;
	rep(i,n){
		int x;
		cin>>x;
		a.pb(x);
		b.pb(x);
	}
	sort(all(a));
	reverse(all(a));
	if(a[0]==a[1]){
		rep(i,n)cout<<a[0]<<endl;
	}else{
		rep(i,n){
			if(b[i]==a[0])cout<<a[1]<<endl;
			else cout<<a[0]<<endl;
			
		}
		
	}
}

Measured memory_bytes: 3436
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;

int main()
{
    const char *Yes = "Yes";
    const char *No = "No";

    char N[4];

    if (scanf("%s", N) < 1) return 0;

    printf("%s\n", N[0] == N[2] ? Yes : No);
    return 0;
}


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

int main(void){
  int a, b;
  double c;
  scanf("%d %d", &a, &b);
  a += b;
  c = a / 2.0;
  c = ceil(c);
  a = c;
  printf("%d\n", a);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  if (a+b > a-b){
    if(a+b > a*b){
    printf("%d",a+b);
    }
    else printf("%d",a*b);
  }
  else if(a-b > a*b)printf("%d",a-b);
  else printf("%d",a*b);
}

Measured memory_bytes: 128