akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
typedef tuple<ll,int,int> T;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
int main(){
int n;
cin>>n;
vector<int> a(n),res;
for(int i=0;i<n;i++){cin>>a[i];a[i]--;}
for(int i=0;i<n;i++){
    int tmp=-1;
    for(int j=a.size()-1;j>=0;j--){
        if(a[j]==j){tmp=j;break;}
    }
    if(tmp==-1){
        cout<<-1<<endl;
        return 0;
    }
    res.push_back(tmp+1);
    a.erase(a.begin()+tmp);
}
reverse(all(res));
for(int i=0;i<n;i++)cout<<res[i]<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
bool check(int n,vector<int>d)
{
	vector<int>a;
	while(n)
	{
		a.push_back(n%10);
		n/=10;
	}
	for(int i=0;i<a.size();i++)for(int j=0;j<d.size();j++)if(a[i]==d[j])return false;
	return true;
}
main()
{
	int c=0,a,n,k,i=0;
	vector<int>d;
	for(cin>>n>>k;i++<k;d.push_back(a))cin>>a;
	while(!check(n,d))n++;
	cout<<n<<endl;
}


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

int main() {
  int n, sum = 0;
  bool m = false;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
    sum += a.at(i);
    if (a.at(i) % 10 != 0) {
      m = true;
    }
  }

  if (sum % 10 != 0) {
    cout << sum << endl;
  } else if (!m) {
    cout << 0 << endl;
  } else {
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i ++) {
      if (a.at(i) % 10 != 0) {
        sum -= a.at(i);
        cout << sum << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,M,K,a[200000]={},res=0,sum=0,dp[1005][20005]={};
char ch;

int main() {
	cout<<setprecision(10);
	cin>>ch;
	cout<<(char)(ch+1);
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf =1 << 30;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,x,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);
 
int MAX = 2 * 1e5;

int main(void){
    int n; cin >> n;
    vi a(n);
    for(auto & e : a) cin >> e;

    vector<vector<double>> dp(n + 1, vector<double>(MAX, inf));
    dp[0][1] = 0;

    rep(i, 1, n + 1){
        int cur_a = a[i - 1];

        rep(j, 1, MAX){
            rep(k, 1, sqrt(j) + 1){
                if(j % k != 0){
                    continue;
                }

                int cur_b = j;
                double ratio = 1.0 * abs(cur_a - cur_b) / cur_a;

                chmin(dp[i][j], max(min(dp[i - 1][k], dp[i - 1][j / k]), ratio));
            }
        }
    }

    cout.precision(12);
    cout << fixed << *min_element(_all(dp[n])) << endl;

    return 0;
}

Measured memory_bytes: 37148
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

d, n = MAP()
ans = n * (100 ** d)
if n == 100:
    ans += (100 ** d)
print(ans)

Measured memory_bytes: 59856
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func strSprit(str string) []string {
	cols := strings.Split(str, " ")
	return cols
}

func parseInt(str string) int {
	n, _ := strconv.Atoi(str)
	return n
}

func intSprit(str string) []int {
	strs := strSprit(str)
	cols := make([]int, len(strs))
	for i, v := range strs {
		cols[i] = parseInt(v)
	}
	return cols
}

func bitCount(n uint) int {

	x := uint64(n)

	const m = 1<<64 - 1
	const m0 = 0x5555555555555555
	const m1 = 0x3333333333333333
	const m2 = 0x0f0f0f0f0f0f0f0f

	x = x>>1&(m0&m) + x&(m0&m)
	x = x>>2&(m1&m) + x&(m1&m)
	x = (x>>4 + x) & (m2 & m)
	x += x >> 8
	x += x >> 16
	x += x >> 32

	return int(x) & (1<<7 - 1)
}

func bitExist(n, i int) bool {
	return ((n >> uint(i)) & 1) == 1
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
	line := nextLine()

	s := parseInt(line)

	oddf := func(n int) int {
		return 3*n + 1
	}
	evenf := func(n int) int {
		return n / 2
	}

	m := make(map[int]int, 1000001)

	i := 1
	m[s] = i
	bef := s
	for {
		i++
		n := 0
		if bef%2 == 0 {
			n = evenf(bef)
		} else {
			n = oddf(bef)
		}
		if _, ok := m[n]; !ok {
			m[n] = i
		} else {
			fmt.Println(i)
			return
		}
		bef = n
	}
}


Measured memory_bytes: 38656
#include <iostream>

using namespace std;

int ch[] = {0, 1, 2, 3, 5, 7, 8, 9};

void dfs(long long n) 
{
    if (n >= 8)
        dfs(n / 8);
    cout << ch[n % 8];
}

int main()
{
    long long n;

    while (cin >> n, n) {
        dfs(n);
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
string s="a";
void dfs(char a){
    if(s.size()==n) {cout<<s<<endl;return;}
    for(char c='a';c<=char(a+1);c++){
        s+=c;
        dfs(max(c,a));
        s.erase(s.end()-1);
    }
}

int main(){
    cin>>n;
    dfs('a');
}


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    int n , m;

    cin >> n >> m;

    char c = (char)(m);

    string v;

    for(int i=0; i<n; i++)
    {
        v.pb(m+'0');
    }


    string s1;

    for(int i=0; i<m; i++)
    {
        s1.pb(n+'0');
    }

    if(v<s1)
    {
        cout << v << endl;
    }
    else
    {
        cout << s1 << endl;
    }




    return 0;
}



Measured memory_bytes: 256
import Control.Arrow ((&&&))
import Data.List

isDream, isDreamer, isErase, isEraser :: String -> Bool
[(isDream,   restOfDream),
 (isDreamer, restOfDreamer),
 (isErase,   restOfErase),
 (isEraser,  restOfEraser)] = map (isPrefixOf . reverse &&& drop . length) ["dream", "dreamer", "erase", "eraser"]

exist :: String -> Bool
exist sna
  | null sna = True
  | isDream sna = exist $ restOfDream sna
  | isDreamer sna = exist $ restOfDreamer sna
  | isErase sna = exist $ restOfErase sna
  | isEraser sna = exist $ restOfEraser sna
  | otherwise = False

main :: IO ()
main = do
  ans <- getLine
  putStrLn $ if exist (reverse ans) then "YES" else "NO"


Measured memory_bytes: 7548
def ALDS1_3B():
    n, q = map(int, input().split())
    PQ = [[l[0], int(l[1])] for l in  [input().split() for i in range(n)]  ]
    times = 0
    while PQ:
        p = PQ.pop(0)
        if p[1] <= q:
            times += p[1]
            print('%s %d' %(p[0], times))
        else:
            times += q
            PQ.append([p[0], p[1]-q])


if __name__ == '__main__':
    ALDS1_3B()

Measured memory_bytes: 24324
n = int(input())
pl = list(map(int,input().split()))

before = False
ans = 0
for idx, p in enumerate(pl):
    if idx+1 == p and before == False:
        ans += 1
        before = True
    elif idx+1 == p and before == True:
        before = False
    elif idx+1 != p:
        before = False

print(ans)


Measured memory_bytes: 52908
str = input()
cnt = 0
if str[0]=="R" and str[1]=="R" and str[2]=="R":
  cnt = 3
elif (str[0]=="R" and str[1]=="R") or (str[1]=="R" and str[2]=="R"):
  cnt = 2
elif str[0]=="R" or str[1]=="R" or str[2]=="R":
  cnt = 1
print(cnt)

Measured memory_bytes: 9052
#include<bits/stdc++.h>
#define int long long int
#define fr(i,x,y) for(int i=x;i<y;i++)
#define f(n) for(int i=0;i<n;i++)
#define ff(m) for(int j=0;j<m;j++)
#define F(x) for(auto it:x)
#define in insert
#define pb push_back
#define pi pair<int,int>
#define si second
#define fi first
#define show_(x) cerr<<"-> "<<#x<<endl;F(x){cerr<<it<<" ";}cout<<endl;
#define show(x) cerr<<#x<<"-> "<<x<<endl;
//#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
//#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0;
#define FILEIO freopen("F:\\inout\\input.txt", "r", stdin); freopen("F:\\inout\\output.txt", "w", stdout);
using namespace std;
void print(int a[],int n){f(n){cout<<a[i]<<" ";}cout<<endl;}
int m(int x){return x%1000000007;} 
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int p(int a,int b){if(b==0)return 1;int t=p(a,b/2); if(b%2==0)return t*t; else return a*t*t; } 
//strlen(s.c_str());  set <int, greater<int>> s; numeric_limits<double>::max()
//---------------------------------------------------------------------------------------------------------------------------------------------
 int t[100000];


signed main(){
	//FILEIO
	//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	map<pi,int > m;
	int a[n];
	int b[n];
	vector <pi> v;
	f(n){
		cin>>a[i]>>b[i];
		v.pb({a[i],b[i]});
	}
	sort(v.begin(),v.end());
	f(n){
		for(int j=i+1;j<n;j++){
			if(m.find({v[j].fi-v[i].fi,v[j].si-v[i].si})==m.end()){
				m.in({{v[j].fi-v[i].fi,v[j].si-v[i].si},1});
			}
			else{
				m[{v[j].fi-v[i].fi,v[j].si-v[i].si}]++;
			}
		}
	}
	int mx=0;
	F(m){
		if((it.fi).fi==0 && (it.fi).si==0){
			continue;
		}
		if(mx<it.si){
			mx=it.si;
		}
	}
	cout<<n-mx<<endl;


	

	
	
	






	return 0;
}



Measured memory_bytes: 384
# Two Switches
A = list(map(int, input().split()))
time = 0

if A[1] >= A[2] or A[3] >= A[0]:
    # Aliceが先に押した場合
    if A[1] >= A[3] >= A[2] >= A[0]:
        time = A[3] - A[2]
    elif A[3] >= A[1] >= A[2] >= A[0]:
        time = A[1] - A[2]
    # Bobが先に押した場合
    elif A[3] >= A[1] >= A[0] >= A[2]:
        time = A[1] - A[0]
    elif A[1] >= A[3] >= A[0] >= A[2]:
        time = A[3] - A[0]
    else:
        time = 0    
else:
    time = 0

print(time)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <math.h>

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

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

//void Main() {
//    double N, K; cin >> N >> K;
//    double pwin1 = max(N-K+1.0,0.0)/N;
//    double pcnt1 = 1.0 - pwin1;
//
//    double pres = pwin1;
//    double pwin2 = 0.0;
//    rep(i, N) {
//        if (i+1 > static_cast<int>(K)) break;
//        double pcwin2 = 1.0/N;
//        double cscore = i + 1.0;
//        while (cscore < K) {
//            cscore *= 2.0;
//            pcwin2 *= 0.5;
//        }
//        pwin2 += pcwin2;
//    }
//
//    cout << pwin1 + pcnt1 * pwin2 <<endl;
//}

void Main() {
    double N, K; cin >> N >> K;

    double pret = 0.0;
    rep(i, N) {
        if (i + 1 >= static_cast<int>(K)) {
            pret += 1.0/N;
            continue;
        }
        double ptmp = 1.0/N;
        double cscore = i + 1.0;
        while (cscore < K) {
            cscore *= 2.0;
            ptmp *= 0.5;
        }
        pret += ptmp;
    }

    cout << pret <<endl;
}

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

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n, k;
	cin >> n >> k;
	cout << n - k + 1 << endl;
	return 0;
}

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

int main() {
    int H, N;
    cin >> H >> N;
    int sum = 0;
    while (N--)
    {
        int A;
        cin >> A;
        sum += A;
    }
    if (sum >= H)
    {
        cout << "Yes" << endl;
    } else
    {
        cout << "No" << endl;
    }
    
    

  return 0;
}


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

void trace(vector<int> a,int n){
  for(int i=0;i<n;++i){
    if(i!=n-1) cout << a[i] <<" ";
    else cout << a[i];
  }
  cout << endl;
}

void InsertionSort(vector<int>a,int n){
  for(int i=1;i<n;++i){
    int v=a[i],j;
    for(j=i-1;j>=0&&a[j]>v;--j) a[j+1]=a[j];
    a[j+1]=v;
    trace(a,n);
  }
}

int main() {
    int N; cin >> N; vector<int> A(N);
    for(int i=0;i<N;++i) cin >> A[i];
    trace(A, N);
    InsertionSort(A, N);
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int k,x;
    cin >> k >> x;
    if(500*k>=x){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
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;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	
	int tmp,i,n,k,ans=0;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>tmp;
		ans+=min(tmp,k-tmp)*2;
	}
	cout<<ans<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <queue>
#include <limits.h>
#include <cmath>

using namespace std;

#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    vector<int> da(12,0);
    int x;
    rip(i,n,0){
        cin >> x;
        if(x==0){
            cout << 0 << endl;
            return 0;
        }
        da[x-1]++;
    }
    vector<bool> time(24,false);
    time[12]=true;
    int ju=1;
    rip(i,11,0){
        if(da[i]>2){
            cout << 0 << endl;
            return 0;
        }
        else if(da[i]==2){
            time[11-i]=true;
            time[13+i]=true;
        }
        else if(da[i]==1){
            if(ju){
                time[12+ju*(i+1)]=true;
                ju*=-1;
            }
        }
    }
    if( da[11]>1){
        cout << 0 << endl;
        return 0;
    }
    if(da[11]){
        time[0]=true;
    }
    int ans=30,now=12,div=13;
    while(div!=12){
        if(time[div]){
            ans=min(ans,min(abs(div-now),24-abs(div-now)));
            now=div;
        }
        div=(div+1)%24;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	vector<int> A;
	int tmp;
	for (int i = 0; i < 3; i++) {
		cin >> tmp;
		A.push_back(tmp);
	}
	sort(A.begin(), A.end());
	cout << abs(A[0] - A[1]) + abs(A[1] - A[2]) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll long long


int n,q;
const int N=222222;
vector<int> G[N];
int beg[2*N],en[2*N];
int k=0;
int rui[N*2];
vector<int>et;

void dfs(int v,int p){
    beg[v]=k;
    et.pb(v);
    k++;
    for(int i=0;i<G[v].size();i++){
        if(G[v][i]!=p){
            dfs(G[v][i],v);
            et.pb(v);
            k++;
        }
    }
    en[v]=k;
}

int main(){
    cin>>n>>q;
    
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    
    dfs(0,-1);
    
    rep(i,q){
        int a,b;
        cin>>a>>b;
        a--;
        rui[beg[a]]+=b;
        rui[en[a]]-=b;
    }
    //rep(i,et.size()+1)cout<<rui[i]<<" ";cout<<endl;
    rep(i,et.size())rui[i+1]+=rui[i];
    //rep(i,et.size())cout<<et[i]+1<<" ";cout<<endl;
    
   // rep(i,et.size())cout<<et[i]<<" ";cout<<endl;
    //rep(i,et.size())cout<<rui[i]<<" ";cout<<endl;
    rep(i,n)cout<<rui[beg[i]]<<endl;
    
	return 0;
}

Measured memory_bytes: 29940
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
LL x,y;

int main()
{
	scanf("%lld %lld",&x ,&y);
	LL h = x;
	LL s = 0;
	while(h <= y)
	{
		s = s + 1;
		h = h * 2;
	}
	printf("%lld\n",s);
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int m,f,r,goukei;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1) break;
		goukei=m+f;
		if(m==-1||f==-1) printf("F\n");
		else if(goukei>=80) printf("A\n");
		else if(goukei>=65) printf("B\n");
		else if(goukei>=50 || r>=50) printf("C\n");
		else if(goukei>=30) printf("D\n");
		else printf("F\n");
		
	}
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];
    
    int minj;
    int cnt=0;
    for(int i=0; i<n; i++){
        minj = i;
        for(int j=i+1; j<n; j++){
            if(v[minj] > v[j]){
                minj = j;   
            }
        }
        if(i!=minj){
            int tmp = v[i];
            v[i] = v[minj];
            v[minj] = tmp;
            cnt++;
        }
    }
    /*
    for(int i=0; i<n; i++){
        if(i!=n-1)
            printf("%d ",v[i]);
        else
            printf("%d\n",v[i]);
    }
    printf("%d\n",cnt);
    */
    for(int i=0; i<n; i++)
        cout << v[i] << ( (i!=n-1) ? " " : "\n");
    cout << cnt << endl;
    return 0;
}


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

#ifdef LOCAL
	#define D(a) cerr << #a << " = " << a << endl
#else
	#define D(a)
	#define cerr false && cerr
#endif
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) dforsn(i,0,n)
#define forn(i,n) forsn(i,0,n)
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first
#define endl '\n'
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}

int main() {
	fastio;
	
	int n,X;
    cin >> n >> X;

    int res=0;
    forn(i,n){
        int xi;
        cin >> xi;
        res = (!i ? abs(X-xi): gcd<int>(res,abs(X-xi)));
    }

    cout << res << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            int res = cnt_753(n, 0);


            out.println(res);
        }

        public static int cnt_753(int n, long x) {
            int res = 0;
            int[] _753 = {7, 5, 3};
            int[] cnt = new int[3];
            if (x > n) {
                return 0;
            }
            for (int i = 0; i < Integer.toString((int) x).length(); i++) {
                if (Integer.toString((int) x).charAt(i) == '3') {
                    cnt[0]++;
                }
                if (Integer.toString((int) x).charAt(i) == '5') {
                    cnt[1]++;
                }
                if (Integer.toString((int) x).charAt(i) == '7') {
                    cnt[2]++;
                }
            }
            if (cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0) {
                res++;
            }

            for (int i = 0; i < 3; i++) {
                res += cnt_753(n, x * 10 + _753[i]);
            }
            return res;
        }

    }
}



Measured memory_bytes: 62196
n = int(input())
a = input().split()
int_a =[]
for i in range(len(a)):
    int_a.append(int(a[i]))
if n % 2 == 0:
    kakeru = n
else:
    kakeru = n + 1

if sum(int_a) == kakeru * (n // 2):
    syou = n // 2
    answer = 2 ** syou
    print(answer % ((10 ** 9) + 7))
else:
    print("0")


Measured memory_bytes: 13940
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll knapscak(ll a[], ll b[], ll n, ll w ){
    ll t[n+2][w+2];
    for(ll i=0; i<=n; i++){
        for(ll j=0; j<=w; j++){
            if(i==0||j==0)
                t[i][j]=0;
            }
        }
        for(ll i=1; i<=n; i++){
            for(ll j=1; j<=w; j++){
                if(a[i-1]<=j){
                    t[i][j]=max(b[i-1]+t[i-1][j-a[i-1]], t[i-1][j]);
                }
                else
                t[i][j]=t[i-1][j];
            }
        }
        return t[n][w];
    }
int main(){
    ll n,w;
    cin>>n>>w;
  ll  a[n+1],b[n+1];
    for(ll i=0; i<n; i++){
        cin>>a[i]>>b[i];
    }
    ll k;
    k=knapscak(a,b,n,w);
    cout<<k<<endl;
    return 0;
    
}

Measured memory_bytes: 82468
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int k = sc.nextInt();
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int h = sc.nextInt();
      if (k <= h) ans++;
    }
    os.println(ans);
  }
}

Measured memory_bytes: 49288
n=gets.to_i
r = 0
10.times.each do |i|
  next if i.even?
  if 10**i-1 <= n
    r += (10**i-1)-(10**(i-1)-1)
  else
    r += [n - (10**(i-1)-1), 0].max
  end
end
puts r

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main() {
    int n, a, b; cin >> n >> a >> b;
    while (1) {
        if (a + 1 != b) {
            a++;
        } else if (a - 1 != -1) {
            a--;
        } else {
            cout << "Borys" << endl;
            return 0;
        }
        if (b - 1 != a) {
            b--;
        } else if (b + 1 != n + 1) {
            b++;
        } else {
            cout << "Alice" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1};

int main () {
    int n; cin >> n;
    ll ans = 0;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    if (n == 2) {
        cout << max(a[0], a[1]) << endl;
        return 0;
    }
    sort(allr(a));
    int cnt = 1;
    ans += a[0];
    for (int i = 1; i < n; i++) {
        ans += a[i];
        cnt++;
        if (cnt == n-1) break;

        ans += a[i];
        cnt++;
        if (cnt == n-1) break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4840
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int a[maxn],b[maxn];
int n,k;
int main()
{
	n=read(); k=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=1;i<=n;i++)
		b[i]=inf;
	ll ans=1ll<<60;
	for(int i=0;i<n;i++){
		for(int j=1;j<=n;j++){
			int last=j-i;
			if(last<=0)last+=n;
			b[j]=std::min(b[j],a[last]);
		}
		ll cur=(ll)i*k;
		for(int i=1;i<=n;i++)
			cur+=b[i];
		ans=std::min(ans,cur);
	}
	writeln(ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;
const int N_MAX = 2*pow(10,5);

// factorial(階乗)の計算

ll fac[N_MAX+1] ={};

ll c_fac(int n) {
  if (fac[n]!=0) return fac[n];
  if (n==0) return fac[n]=1;
  return fac[n] = (c_fac(n-1)*n)%MOD;
}

// inverse(逆元)の計算

ll inv(ll a,ll m) {
  ll b = m, x = 1, y = 0;
  while (b!=0) {
    ll d = a/b;
    a -= b*d; swap(a, b);
    x -= y*d; swap(x, y);
  }
  return x>=0 ? x : x+m;
}

// combinataionの計算

ll nck(ll n, ll k) { 
  if (n<k) return 0;
  ll nume = fac[n];
  ll deno = ( inv(fac[n-k],MOD) * inv(fac[k],MOD) ) % MOD;
  return ( nume * deno ) % MOD;
}

int main() {
  ll N, M, K; cin >> N >> M >> K;

  c_fac(N_MAX+1);

  ll result = 0;
  ll part = 0;
  rep(i, N) { part += i*(N-i)*2*pow(M,2); part%=MOD; }
  rep(i, M) { part += i*(M-i)*2*pow(N,2); part%=MOD; }
  result += nck(K, 2) * part;
  result %= MOD;
  result *= nck(N*M-2, K-2);
  result %= MOD;
  result *= fac[K-2];
  result %= MOD;
  result *= inv(fac[K], MOD);
  result %= MOD;

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 4992
import itertools as itr
n, w = list(map(int, input().split()))
warr = [0]*(n+1)
varr = [0]*(n+1)
for i in range(n):
    wi, vi = list(map(int, input().split()))
    warr[i+1] = wi
    varr[i+1] = vi
    
dp = [[0]*(w+1) for _ in range(n+1)]

for i, j in itr.product(range(1,n+1), range(1,w+1)):
        jw = j-warr[i]
        if jw <0:
            dp[i][j] = dp[i-1][j]
            continue
        dp[i][j] = max(dp[i-1][jw] + varr[i], dp[i-1][j])
        
print(dp[n][w])

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

int n;

typedef long long i64;

vector<i64> a;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int main()
{
	cin >> n;
	a.resize(3 *n);
	rep(i,0,3 * n - 1) cin >> a[i];
	sort(a.begin(),a.end());
	int l = 0;
	int r =  3 * n - 1;
	i64 result = 0;
	rep(c,0,n - 1)
	{
		result += a[r - 1];
		r -= 2;
	}
	cout << result << endl;
	return 0;
}


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

const int MAXN = 2001;
const int MAXX = 2000*MAXN;

bitset<MAXX> D;

int A[MAXN];

int N, Sum, Oh;

int main() {
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		Sum += A[i];
	}
	Oh = Sum;

	D[0] = true;
	for(int i = 0; i < N; i++)
		D |= (D << A[i]);
	
	for(Sum = (Sum+1) >> 1; !D[Sum]; Sum--);
	Sum = Oh-Sum;
	cout << max(Oh-Sum, Sum) << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
inline void read(int &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') {
      flag = 1;
    }
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (flag) {
    x = -x;
  }
}
int main() {
  int n;  
  read(n);
  long long f[3] = {0, -INF, -INF};
  for (int i = 1; i <= n; ++i) {
    int x;
    read(x);
    f[0] += x;
    f[1] -= x;
    f[2] += x;
    f[0] = max(f[0], f[1]);
    f[1] = max(f[1], f[2]);
    if (x < 0) {
      f[2] = max(f[2], f[1]);
      f[1] = max(f[1], f[0]);
    }
  }
  printf("%lld\n", f[0]);
  return 0;
}

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

int main() {
	ll r, g, b, ans;
	ans = 0;
	cin >> r >> g >> b;
	ans = r*100 + g*10 + b;
	
	if (ans % 4 == 0) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    s = list(str(input().rstrip('\n')))
    t = list(str(input().rstrip('\n')))
    s.sort()
    t.sort(reverse=True)
    print("Yes" if s < t else "No")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
using namespace std;
int n,h[M],dp[M];
int main()
{
    scanf("%d", &n);
    REP(i,1,n) scanf("%d", &h[i]);
    
    dp[1] = 0;
    REP(i,2,n) {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if (i>2) dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    printf("%d\n", dp[n]);
    return 0;
}


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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) ((a)<=(x) && (x)<(b))
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

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

int h,w;
V<V<char>> m;

V<V<int>> memo;
int bfs() {
    if(m[0][0] == '#') return -1;
    queue<int> xq, yq, cq;
    xq.push(0); yq.push(0); cq.push(1);
    memo[0][0] = 1;
    while(!xq.empty()) {
        int nx = xq.front(), ny = yq.front(), nc  = cq.front();
        xq.pop(); yq.pop(); cq.pop();
        if(nx == h-1 && ny == w-1) return nc;
        REP(i,4) {
            int cx = nx+dx[i], cy = ny+dy[i];
            if(!IN(0,cx,h) || !IN(0,cy,w)) continue;
            if(memo[cx][cy] == 0 && m[cx][cy] == '.') {
                xq.push(cx); yq.push(cy); cq.push(nc+1);
                memo[cx][cy] = 1;
            }
        }
    }
    return -1;
}

int main(){
    INIT;
    cin >> h; cin >> w;
    int blcnt = 0;
    m.resize(h);
    memo.resize(h);
    REP(i,h) {
        REP(j,w) {
            char c; cin >> c;
            m[i].push_back(c);
            if(c == '#') blcnt++;
            memo[i].push_back(0);
        }
    }
    int whcnt = bfs();
    if(whcnt == -1) cout << -1 << "\n";
    else cout << w*h - whcnt - blcnt << "\n";
}

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

int main()
{
	int count[4][3][10];//入居者数
	int n;//データ数
	int t, r, f, v;
	int i;
	int a, b, c;
	int min, max;

	//Constraints
	min = 0;
	max = 9;

	//データの初期化
	for (a = 0; a < 4; a++) {
		for (b = 0; b < 3; b++) {
			for (c = 0; c < 10; c++) {
				count[a][b][c] = 0;
			}
		}
	}
	
	cin >> n;

	i = 0;
	while (i < n) {
		cin >> t >> r >> f >> v;//入力

		count[t-1][r-1][f-1] += v;
		if (max < count[t-1][r-1][f-1]) {
			count[t-1][r-1][f-1] = max;
		}
		else if (count[t-1][r-1][f-1] < min) {
			count[t-1][r-1][f-1] = min;
		}
		i++;
	}

	//データの可視化
	for (a = 0; a < 3; a++) {
		for (b = 0; b < 3; b++) {
			for (c = 0; c < 10; c++) {
				cout << " " << count[a][b][c];
			}
			cout << endl;
		}
		cout << "####################" << endl;
	}
		for (b = 0; b < 3; b++) {
			for (c = 0; c < 10; c++) {
				cout << " " << count[3][b][c];
			}
			cout << endl;
		}
	

    return 0;
}




Measured memory_bytes: 3092
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class ASeptember9 {
public:
	void solve(istream& in, ostream& out) {
        string s; in >> s;
        if(s[0] == '9' || s[1] == '9') out << "Yes" << endl;
        else out << "No" << endl;
	}
};

int main() {
	ASeptember9 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <list>
#include <climits>
using namespace std;

int main() {
	int n;
	cin>>n;
	vector<int> c={1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049};
	vector<bool> intree(100001);
	sort(c.begin(), c.end());
	list<pair<int, int>> q;
	q.push_back(make_pair(n, 0));
	intree[n]=1;
	while (!q.empty()) {
		pair<int, int> p=q.front(); q.pop_front();
		if (!p.first) {
			cout<<p.second<<endl;
			return 0;
		}
		for (int i=0; i<c.size(); ++i) {
			if (p.first>=c[i] && !intree[p.first-c[i]]) {
				q.push_back(make_pair(p.first-c[i], p.second+1));
				intree[p.first-c[i]]=1;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 896
n=int(input())
x={0:'S',1:'H',2:'C',3:'D'}
c=[[0]*13,[0]*13,[0]*13,[0]*13]
for r in range(n):
    a,b=input().split()
    b=int(b)-1
    if a=='S':
        c[0][b]=1
    elif a=='H':
        c[1][b]=1
    elif a=='C':
        c[2][b]=1
    else:
        c[3][b]=1
for i in range(4):
    for j in range(13):
        if c[i][j]==0:
            print(x[i],j+1)


Measured memory_bytes: 5608
/******************************************
* AUTHOR : SOMU KUMAR *
* INSTITUTION : IIT BHUBANESWAR *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//code here...............//
int k;
cin>>k;
string s="ACL";
for(int i=0;i<k;i++)cout<<s;
return 0;
}

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

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

    int n,k;
    cin >> n >> k;
    vector<int> a_cnt(n);
    set<int> a_type;

    rep(i, n) {
        int a;
        cin >> a;
        --a;
        ++a_cnt[a];
        a_type.insert(a);
    }

    int type_a = a_type.size();

    if(type_a <= k) {
        cout << 0 << endl;
        return 0;
    }
    else {
        for(auto it = a_cnt.begin(); it != a_cnt.end();) {
            if(*it == 0) {
                it = a_cnt.erase(it);
            }
            else {
                ++it;
            }
        }
        sort(a_cnt.begin(), a_cnt.end());
        int j = 0;
        int sum = 0;
        for(int i = 0; i < type_a - k; ++i) {
            while(a_cnt[j] > 0) {
                --a_cnt[j];
                ++sum;
            }
            ++j;
        }
        // cout << type_a - k << endl;
        cout << sum << endl;
        return 0;
    }
}


Measured memory_bytes: 13468
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
const int N = 500005;
int n,m;
map<ii, int> id;
vector<ii> G[N];
int ct = 1;
priority_queue<ii, vector<ii>, greater<ii> > pq;
int dist[N];
int main(){
    scanf("%d%d",&n,&m);
    ct = n+1;
    for (int i = 0; i < m; i++){
        int p,q,c;
        scanf("%d%d%d",&p,&q,&c);
        int a,b;
        if (id.count({p,c})) a = id[ii(p,c)];
        else{
            a = id[ii(p,c)] = ct++;
            G[a].push_back({p,1});
            G[p].push_back({a,1});
        }
        if (id.count({q,c})) b = id[ii(q,c)];
        else{
            b = id[ii(q,c)] = ct++;
            G[b].push_back({q,1});
            G[q].push_back({b,1});
        }
        G[a].push_back({b,0});
        G[b].push_back({a,0});
    }
    memset(dist,-1,sizeof(dist));
    dist[1] = 0;
    pq.push({0,1});
    while (pq.size()){
        int d, u;
        tie(d,u) = pq.top(); pq.pop();
        if (d > dist[u]) continue;
        for (auto v : G[u]){
            int nd = d + v.second;
            if (dist[v.first] == -1 || dist[v.first] > nd){
                dist[v.first] = nd;
                pq.push({nd,v.first});
            }
        }
    }
    if (dist[n] == -1) printf("-1\n");
    else printf("%d",dist[n]/2);




}


Measured memory_bytes: 58108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  vector<int> m(5);
  rep(i,5) cin >> m[i];
  int id = 0;
  int mx = 10 - (m[0] % 10);
  if(mx == 10) mx = 0;
  rep(i,5){
    int temp = 10 - (m[i] % 10);
    if(temp == 10) temp = 0;
    if(temp > mx){
      mx = temp;
      id = i;
    }
  }
  int ans = 0;
  rep(i,5){
    if(i == id) continue;
    if(m[i] % 10 == 0) ans += m[i];
    else{
      int temp = m[i] / 10;
      temp += 1;
      temp *= 10;
      ans += temp;
    }
  }
  ans += m[id];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.is_err() || res.ok().unwrap() == 0 || u8b[0] <= ' ' as u8 {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = std::string::String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}
fn parse<T: std::str::FromStr>(s: &str) -> T { s.parse::<T>().ok().unwrap() }

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { parse(&get_word()) }

const MOD: i64 = 1_000_000_007;

fn powmod(a: i64, b: i64) -> i64 {
    let mut sum = 1_i64;
    let mut cur = a;
    let mut e = b;
    while e > 0 {
        if e % 2 == 1 {
            sum = sum * cur % MOD;
        }
        cur = cur * cur % MOD;
        e /= 2;
    }
    return sum;
}
fn g(u: i64, v: i64, b: i64, cache: &[Vec<i64>]) -> i64 {
    // u^b  .. + v^b
    if b == 0 {
        return v - u + 1;
    }
    let r = cache[b as usize][v as usize] - if u > 0 {cache[b as usize][u as usize-1] % MOD} else { 0};
    (r + MOD) % MOD
}

fn f(n: usize, c: usize, a: &[i64], b: &[i64]) -> i64 {
    let mut dp: Vec<Vec<i64>> = vec![Vec::new(); n + 1];
    let mut cache = vec![Vec::new(); c + 1];
    for i in 0 .. c + 1 {
        cache[i] = vec![0; 401];
        for j in 0 .. 401 {
            cache[i][j] = powmod(j as i64, i as i64) + if j > 1 { cache[i][j - 1]} else {0 };
        }
        
    }
    for i in 0 .. n + 1 {
        dp[i] = vec![0; c + 1];
    }
    dp[0][0] = 1;
    for i in 0 .. n {
        // dp[i + 1] = ...
        for j in 0 .. c + 1 {
            for k in 0 .. j + 1 {
                dp[i + 1][j] += dp[i][k] * g(a[i], b[i], (j - k) as i64, &cache) % MOD;
                dp[i + 1][j] %= MOD;
            }
        }
    }
    return dp[n][c];
}

fn main() {
    let n: usize = get();
    let c: usize = get();
    let a: Vec<i64> = (0 .. n).map(|_| get()).collect();
    let b: Vec<i64> = (0 .. n).map(|_| get()).collect();
    println!("{}", f(n, c, &a, &b));
}


Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= 10; i++) {
		int m = 1000 * i;
		if (n <= m) {
			ans = m - n;
			cout << ans << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3668
#include <stdio.h>

int get_uint() {
  int n = 0;
  int c = getchar_unlocked();
  if(c < 48 || 57 < c) return c;
  while(47 < c && c < 58) {
    n = 10 * n + (c & 0xf);
    c = getchar_unlocked();
  }
  return n;
}
int loadable_num(const int cap, int qty, const int *arr, const int N) {
  int i = 0;
  // while truck exist
  while(qty--) {
    int now = 0;
    // while there is enough capacity for next package
    while(arr[i] + now <= cap) {
      now += arr[i];
      // N -> loaded all package
      if(++i == N) return 1;
    }
  }
  return 0;
}
int main(int argc, char **argv) {
  int n = get_uint();
  int k = get_uint();
  int w[100001];
  for(int i = 0; i < n; ++i) w[i] = get_uint();

  int left = 0;
  // MAX cap
  int right = 10000 * 100000;
  int mid;
  // binary search
  while(right - left > 1) {
    mid = left + (right - left) / 2;
    // enoght cap
    if(loadable_num(mid, k, w, n)) right = mid;
    // couldn't load all
    else left = mid;
  }
  printf("%d\n", right);
}



Measured memory_bytes: 2216
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

ll cnt[100010];
ll d[100010];

ll powmod(ll x, ll k) {
  if (k == 0)     return 1;
  if (k % 2 == 0) return powmod(x*x % mod, k/2);
  else            return x*powmod(x, k-1) % mod;
}

int main(){
  int n;
  cin >> n;
  rep(i,n){
    cin >> d[i];
  }
  rep(i,n){
    cnt[d[i]]++;
  }
  ll ans=1;
  ll temp=1;
  if(cnt[0]!=1 || d[0]!=0){
    cout << 0 << endl;
    return 0;
  }
  for(int i=0;i<=n-1;i++){
    if(cnt[i]==0){
      int index=i;
      for(int j=index+1;j<=n-1;j++){
        if(cnt[j]>0){
          cout << 0 << endl;
          return 0;
        }
      }
      break;
    }
      ans*=powmod(temp,cnt[i]);
      ans%=mod;
      temp=cnt[i];
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 1792