akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;


#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); ++i)


int insertionSort(int A[], int N, int g){
    int cnt = 0;
    for(int i = g; i < N; ++i){
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j + g] = A[j];
            j -= g;
            ++cnt;
        }
        A[j + g] = v;
    }
    return cnt;
}

int shellSort(int A[], int N, vector<int> &G){
    int h = 1;
    while(h <= N){
        G.pb(h);
        h = 3 * h + 1;
    }
    
    int cnt = 0;
    for(int i = G.size() - 1; i >= 0; --i)
        cnt += insertionSort(A, N, G[i]);
    
    return cnt;
}

int main(void){
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; ++i) cin >> A[i];
     
    vector<int> G;
    int cnt = shellSort(A, N, G);
    
    cout << G.size() << endl;
    for(int i = G.size() - 1; i > 0; --i){
        cout << G[i] << " ";
    }
    cout << G[0] << endl;
    cout << cnt << endl;
    for(int &v : A) cout << v << endl;
    
    return 0;
}


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

using namespace std;

int main(){
    int N,a;
    vector<int> A = vector<int>();
    cin >> N;
    vector<int> B = vector<int>(N,0);
    A.push_back(0);
    for (int i = 0;i < N - 1; i++){
        cin >> a;
        A.push_back(a);
    }
    for (int i = 1; i < N;i++){
        if(A[i] != 0){
            B[A[i] - 1] += 1;
        }
    }
    for(int i : B){
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 5104
#include <bits/stdc++.h> 
#define F first 
#define S second 
#define MAX 1000003 
using namespace std; 
#define int long long
typedef long long ll; 
const int mod = 1000000007; 

int prime[MAX]; 
unordered_map<int, int> max_map; 

int power(int a, int n) 
{ 
	if (n == 0) 
		return 1; 
	int p = power(a, n / 2) % mod; 
	p = (p * p) % mod; 
	if (n & 1) 
		p = (p * a) % mod; 
	return p; 
} 

void sieve() 
{ 
	prime[0] = prime[1] = 1; 
	for (int i = 2; i < MAX; i++) { 
		if (prime[i] == 0) { 
			for (int j = i * 2; j < MAX; j += i) { 
				if (prime[j] == 0) { 
					prime[j] = i; 
				} 
			} 
			prime[i] = i; 
		} 
	} 
} 

ll lcmModuloM(const int* ar, int n) 
{ 

	for (int i = 0; i < n; i++) { 
		int num = ar[i]; 
		unordered_map<int, int> temp; 
		while (num > 1) { 
			int factor = prime[num]; 
			temp[factor]++; 
			num /= factor; 
		} 

		for (auto it : temp) { 
			max_map[it.first] = max(max_map[it.first], it.second); 
		} 
	} 

	ll ans = 1; 

	for (auto it : max_map) { 

		ans = (ans * power(it.F, it.S)) % mod; 
	} 

	return ans; 
} 

int32_t main() 
{ 
	sieve(); 
	int n ; cin >> n ;
	int a[n] ; 
	for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	int s =  lcmModuloM(a, n);
	int sum = 0 ;
	for(int i = 0 ; i < n ; i++){
		sum = (sum + (s*power(a[i],mod-2)) % mod ) % mod ;
	}
	cout << sum ;
	return 0; 
} 



Measured memory_bytes: 8576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class ASheepAndWolves {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int S = s.nextInt();
            int W = s.nextInt();
            if (S <= W) {
                out.println("unsafe");
            } else {
                out.println("safe");
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32356
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef long long ll;
using namespace std;

const int N=200010,mod=1e9+7;
int n,lst[N],c[N],p[N],f[N];

int main(){
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d",&c[i]);
		lst[i]=p[c[i]]; p[c[i]]=i;
	}
	f[1]=1;
	rep(i,2,n) f[i]=(f[i-1]+((lst[i]&&lst[i]<i-1)?f[lst[i]]:0))%mod;
	printf("%d\n",f[n]);
	return 0;
}

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

long long ans[60];
long long n;

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

	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> ans[i];
	}
	long long op = 0;
	bool found = 1;
	while(found) {
		found = 0;
		for(int i = 0; i < n; ++i){
			if(ans[i] >= n) {
				found = 1;
				long long cur = ans[i]/n;
				ans[i] -= n*cur;
				op += cur;
				for(int j = 0; j < n; ++j) if(j != i) ans[j] += cur;
			}
		}
	}
	cout << op << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;


public class Main {
	public static void main(String args[]) throws InterruptedException {
		    Scanner sc = new Scanner(System.in);	
			
			int n = sc.nextInt();
			int[] a = new int[n];
			int sum = 0;
			int[] dist = new int[n];
			for(int i = 0; i < n; i++){
				a[i] = sc.nextInt();
			}
			for (int i = 0; i < n; i++) {
				sum += a[i];
			}
			for (int i = 0; i < n; i++) {
				dist[i] = Math.abs(sum-a[i] * n);
			}
			int min = 0;
			for (int i = 0; i < n; i++) {
				if(dist[min] > dist[i]){
					min = i;
				}
			}
			System.out.println(min);

		    sc.close(); }
}


Measured memory_bytes: 21844
#include<stdio.h>
bool table[3];
int main(){
	int a,b,c,d,e;
	while(scanf("%d",&a),a){
		table[0]=table[1]=table[2]=false;
		scanf("%d%d%d%d",&b,&c,&d,&e);
		table[a-1]=true;
		table[b-1]=true;
		table[c-1]=true;
		table[d-1]=true;
		table[e-1]=true;
		bool aiko=false;
		if(table[0]&&table[1]&&table[2])aiko=true;
		if(a==b&&b==c&&c==d&&d==e)aiko=true;
		if(aiko)printf("3\n3\n3\n3\n3\n");
		else{
			int in[]={a,b,c,d,e};
			int win;
			if(!table[0])win=2;
			if(!table[1])win=3;
			if(!table[2])win=1;
			for(int i=0;i<5;i++)printf(in[i]==win?"1\n":"2\n");
		}
	}
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define mp make_pair
#define ll long long
#define int long long
#define pii pair<ll,ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(x) (int)x.size()
typedef long double f80;
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;

ll pwr(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while(b) {
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

const int N = 2e5 + 5;

int a[N], b[N];

set<int> s;
int n;

void check(int idx) {
    int i1 = (idx - 1 + n) % n;
    int i2 = (idx + 1 + n) % n;
    if(a[i1] + a[i2] < a[idx] && a[idx] != b[idx])
        s.insert(idx);
}

signed main()
{
    #ifdef LOCAL
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    fr(i, 0, n - 1) {
        cin >> b[i];
    }
    fr(i ,0, n - 1) {
        cin >> a[i];
    }
    fr(i, 0, n - 1) {
        int i1 = (i - 1 + n) % n;
        int i2 = (i + 1 + n) % n;
        if(a[i1] + a[i2] < a[i] && a[i] != b[i]) {
            s.insert(i);
        }
    }
    ll ans = 0;
    while(!s.empty()) {
        int idx = *s.begin();
        s.erase(s.begin());
        if(a[idx] == b[idx]) continue;
        int i1 = (idx - 1 + n) % n;
        int i2 = (idx + 1 + n) % n;
        int val = a[i1] + a[i2];
        if(a[idx] < b[idx]) return cout << -1, 0;
        int rem = a[idx] % val;
        if(b[idx] <= rem) {
            ans += a[idx] / val;
            a[idx] = rem;
        }
        else {
            int k = (a[idx] - b[idx]);
            if(k % val != 0) {
                return cout << -1, 0;
            }
            k /= val;
            ans += k;
            a[idx] -= k * val;
        }
        check(i1);
        check(i2);
    }
    fr(i, 0, n - 1) {
        if(a[i] != b[i]) {
            return cout << -1, 0;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 8064
# coding: utf-8
import string
numbers = "0123456789"
alphabets = string.ascii_letters
chara = numbers + alphabets


def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)
 
    if n < 2 or n > len(chara):
        raise ValueError('Invalid n:', value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = chara[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = chara[idx] + result
    return result


def main():
    n, k = map(int, input().split(' '))

    after = base_cvt(n, k)
    print(len(after))

    return 0


if __name__ == '__main__':
    main()

Measured memory_bytes: 3768
#include<stdio.h>
#include<string.h>

int main()
{
	int N;
	scanf("%d", &N);
	char S[10000];
	scanf("%s", S);
	
	int r;
	int len;
	len = strlen(S);
	char T[len];
	
	for(r=0; r<len; r++){
		T[r] = S[r] + N;
		if(T[r] > 'Z') T[r] = T[r] -26;
        printf("%c", T[r]);
    }
	
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
s = list(input())

ans = [-1, -1]
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        ans = [i + 1, i + 2]
        break
    if i < len(s) - 2 and s[i] == s[i + 2]:
        ans = [i + 1, i + 3]
print(ans[0], ans[1])


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

using namespace std;

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

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

    // dp[i] - who wins with i stones: false: second wins, true: first wins
    vector <bool> dp(k + 1, false);

    for (int i = 0; i <= k; i++) {
        for (int j = 0; j < n && a[j] <= i; j++) {
            if (!dp[i - a[j]]) {
                dp[i] = true;
                break;
            }
        }
    }

    if (dp[k]) {
        cout << "First\n";
        return 0;
    }
    cout << "Second\n";
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

int main(){
    ll n,d,ans=0;
    cin>>n>>d;
    vector<ll> x(n),y(n);
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    rep(i,n){
        if(d*d>=x[i]*x[i]+y[i]*y[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 6424
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

void solve(){
	int k;
	cin >> k;
	vector<string>s;
	for(int i = 1; i < 10; i++){
		s.push_back(to_string(i));
	}
	//for(int i = 0; i < 9; i++)
		//cout << s[i] << endl;
	int curr = 0, total = 9;
	while(total < k){
		string get = s[curr];
		curr++;
		ll z = get.back()-'0';
		string ans;
		if(z - 1 > -1){
			ans = get+char(z-1 + '0');
			s.push_back(ans);
			total++;
		}
		if(z > -1 and z < 10){
			ans = get+char(z + '0');
			s.push_back(ans);
			total++;
		}
		if(z + 1 < 10){
			ans = get+char(z+1+'0');
			s.push_back(ans);
			total++;
		}
	}
	cout << s[k-1] << endl;
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}	
	


Measured memory_bytes: 6900
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}  
int D;
vector<int> c(26);
vector<vector<int>> s;
int score(vector<int> t) {
  int ans = 0;
  vector<int> last(26);
  REP(i, D) {
    ans += s[i][t[i]];
    last[t[i]] = i + 1;
    REP(j, 26) ans -= c[j] * (i + 1 - last[j]);
  }
  return ans;
}
double TIME_LIMIT = 1980;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> D;
  REP(i, 26) cin >> c[i];
  s = vector<vector<int>>(D, vector<int>(26));
  REP(i, D) REP(j, 26) cin >> s[i][j];

  vector<int> t(D);
  REP(i, D) t[i] = i%26;
  
  clock_t start_time = clock();
  int now = score(t);
  int loop = 0;
  double start_temp = 5000, end_temp = 100;
  int max = 0;
  vector<int> tmax(t);
  while(true) {
    loop++;
    clock_t now_time = clock();
    double time = static_cast<double>(now_time - start_time) / CLOCKS_PER_SEC * 1000.0;
    if(time > TIME_LIMIT) break;
    vector<int> tnew(t);
    int mode = rand() % 2;
    if(mode == 0) {
      int idx = rand() % D;
      int type = rand() % 26;
      tnew[idx] = type;
    } else {
      int idx = rand() % (D-1);
      swap(tnew[idx], tnew[idx+1]);
    }
    int next = score(tnew);
    double temp = start_temp + (end_temp - start_temp) * time / TIME_LIMIT;
    double prob = exp((next-now)/temp);
    if(next > now || prob > (rand()%INF)/(double)INF) {
      t = tnew;
      now = next;
    }
    if(now > max) {
      tmax = t;
      max = now;
    }
    //cout << next << "\n";
    //if(next < now) cout << prob << "\n";
  }
  REP(i, D) cout << (tmax[i]+1) << "\n";
  //cout << max << "\n";
  //cout << loop << "\n";
}

Measured memory_bytes: 4340
#include<iostream>
using namespace std;
int main(){
    long int n,m,sum=0;
    cin >> n >> m;
    if(n*2<=m){
        sum=n;
        m-=(n*2);
        sum+=(m/4);
    }
    else{
        sum=m/2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  string yn="YES";
  cin >> n;
  vector<int> a(n);
  vector<bool> d(1000000000);
  for(int i =0;i<n&&yn=="YES";i++){
    cin >> a.at(i);
    if(d.at(a.at(i)-1)){
      yn="NO";
    }else{
      d.at(a.at(i)-1)=true;
    };
  };
  cout << yn <<endl;
}

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

//bool b;
//int xg , yg;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int board[105][105];
int  sc;
/*
void dfs(int x , int y ,int w , int h){
	if(x==xg&&y==yg) {
		b=true;
		return;
	}
	for(int i=0;i<4;++i){
		int tx=x+dx[i];
		int ty=y+dy[i];
		if(tx<=0 || ty<=0 || tx>w || ty>h || board[tx][ty]!=sc || board[tx][ty]==0 || b ) continue;
		dfs( tx , ty , w , h );
	}
}
*/

void dfs(int x , int y , int w , int h){
	if(x<=0 || y<=0 || x>w || y >h) return;
	if(board[x][y]==sc){
		board[x][y]=10;
		for(int i=0;i<4;++i){
			dfs(x+dx[i] , y+dy[i] , w , h);
		}
	}
}
int main(){
	int w , h;
	while(cin >> w >> h , w|h){
		int xs , ys , n;
		int xg , yg;
		memset(board,0,sizeof(board));
		cin >> xs >> ys >> xg >> yg >> n;
		for(int i=0;i<n;++i){
			int c , d , x , y;
			cin >> c >> d >> x >> y;
			if(!d){
				for(int k=y;k<y+2;++k){
					for(int j=x;j<x+4;++j){
						board[j][k]=c;
					}
				}
			} else {
				for(int k=y;k<y+4;++k){
					for(int j=x;j<x+2;++j){
						board[j][k]=c;
					}
				}
			}
		}
		sc=board[xs][ys];
		dfs( xs , ys , w , h );
		cout << ( board[xg][yg]==10 ? "OK" : "NG") << endl;
	}
	return 0;
}

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

// Union Find
int par[100001];
int sz[100001];

void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		sz[i]=1;
	}
}

int find(int x){
	if(par[x]==x)return x;
	return par[x]=find(par[x]);
}

void unite(int x, int y){
	int px=find(x);
	int py=find(y);
	if(px==py)return;
	par[px]=py;
	sz[py]+=sz[px];
}

bool same(int x, int y){
	int px=find(x);
	int py=find(y);
	return px==py;
}

int size(int x){
	return sz[find(x)];
}

int main(){
	long long N,M;
	cin>>N>>M;
	vector<pair<int,int>>bridge;
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		bridge.push_back(make_pair(a,b));
	}
	reverse(bridge.begin(),bridge.end());
	init(N+1);
	vector<long long>ans;
	long long x=N*(N-1)/2;
	ans.push_back(x);
	for(int i=0;i<M-1;i++){
		int a=bridge[i].first;
		int b=bridge[i].second;
		if(!same(a,b)){
			x-=size(a)*size(b);
			unite(a,b);
		}
		ans.push_back(x);
	}
	reverse(ans.begin(),ans.end());
	for(int i=0;i<M;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3828
package main

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

func main() {
	list := getStdinIntArr64()
	N := uint64(list[0])
	divitors := make([]uint64, N+1)

	var i uint64 = 0
	var j uint64 = 0
	for i = 1; i <= N; i++ {
		for j = i; j <= N; j += i {
			divitors[j]++
		}
	}

	var k uint64 = 1
	var ans uint64 = 0
	for ; k <= N; k++ {
		ans += k * divitors[k]
	}
	fmt.Printf("%d\n", ans)
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


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

using namespace std;

int main(void){
    int r,D,x_2000;
    cin>>r>>D>>x_2000;
    for(int i=0;i<10;i++){
        x_2000=r*x_2000-D;
        cout<<x_2000<<endl;
    }
    return 0;
}

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

using namespace std;

const long long m=1e9+7;
vector<long long >v(100005);
long long pow_exp(long long a,long long b)
{
    a%=m;
    long long result=1;
    while(b>0)
    {
        if(b&1)
            result=result*a%m;
        a=a*a%m;
        b>>=1;
    }
return result;
}

int main()
{
    long long n,k;
    cin>>n>>k;
    long long ans=0;
    for(long long i=k;i>=1;i--){
        long long val=k/i;
        v[i]=pow_exp(val,n);
        long long extra=0;
        for(long long j=2*i;j<=k;j+=i){
            extra+=v[j];
            extra%=m;
        }
        v[i]=(v[i]-extra+m)%m;
        ans=(ans+v[i]*i)%m;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <string>
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  int leave = 0;
  rep(i, n){
    int a;
    cin >> a;
    if (a == leave+1) leave++;
  }
  if (leave == 0) cout << -1 << endl;
  else cout << n - leave << endl;
  
  return 0;
}

Measured memory_bytes: 3632
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,K;
    R(N,K);
    VI V(N+1);
    FOR(i,1,N)R(V[i]);
    int an=0;
    FOR(i,0,N)
        FOR(j,i+1,N+1){
            if(i+(N-j+1)>K)continue;
            VI d;
            int now=0;
            FOR(k,1,N){
                if(k<=i||k>=j){
                    d.PB(V[k]);
                    now+=V[k];
                }
            }
            int r=K-i-(N-j+1);
            sort(ALL(d));
            REP(k,min(SZ(d),r)){
                if(d[k]<0)now-=d[k];
            }
            an=max(an,now);
        }
    W(an);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
void S(vector<int>&in){
  int tmp=in[1];
  in[1]=in[0];
  in[0]=in[4];
  in[4]=in[5];
  in[5]=tmp;
}
void E(vector<int>&in){
  int tmp=in[2];
  in[2]=in[0];
  in[0]=in[3];
  in[3]=in[5];
  in[5]=tmp;
}
void T(vector<int>&in){
  int tmp=in[1];
  in[1]=in[2];
  in[2]=in[4];
  in[4]=in[3];
  in[3]=tmp;
}
int main(){
  vector<int>in(6);
  rep(i,6)cin>>in[i];
  vector<int>out(6);
  rep(i,6)cin>>out[i];
  bool h=false;
  rep(i,5){
    S(in);
    if(in[0]==out[0]){h=true;break;}
  }
  if(!h){
    rep(i,5){
      E(in);
      if(in[0]==out[0])break;
    }
  }
  rep(i,5){
    T(in);
    if(in[1]==out[1])break;
  }
  h=true;
  rep(i,6)if(in[i]!=out[i])h=false;
  if(h)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define loop(i, n) for (int i = 0; i < n; i++)
template <typename T>
struct BIT
{
private:
    vector<T> bit;
    int n;
    T sum(int x)
    {
        T ret = 0;
        while (x > 0)
        {
            ret += bit[x];
            x -= x & -x;
        }
        return ret;
    }

public:
    BIT(int n0, vector<T> &A) : bit(n0 + 1, 0), n(n0)
    {
        for (int i = 1; i <= n; i++)
            bit[i] = A[i - 1];
        for (int i = 1; i < n; i++)
            bit[i + (i & -i)] += bit[i];
    }
    T sum(T l, T r)
    {
        return sum(r + 1) - sum(l);
    }
    void add(int i, T x)
    {
        i++;
        while (i <= n)
        {
            bit[i] += x;
            i += i & -i;
        }
    }
};
#define scan(x) scanf("%ld", &x)
#define putout(a) printf("%ld\n", a)
int main()
{
    unsigned int N, Q;
    cin >> N >> Q;
    vector<ll> A(N);
    loop(i, N) scan(A[i]);
    BIT<ll> data(N, A);
    loop(i, Q)
    {
        int a;
        ll b, c;
        scan(a);
        scan(b);
        scan(c);
        if (a == 0)
            data.add(b, c);
        else
            putout(data.sum(b, c - 1));
    }
    return 0;
}


Measured memory_bytes: 12140
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
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 = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

c = INF
B = []

tmp = A[0]

for i, a in enumerate(A):
    if i == 0:
        tmp = A[0]
        B.append(tmp)
    else:
        if tmp >= A[i]:
            B.append(tmp)
        else:
            tmp = A[i]
            B.append(tmp)

print(sum(B) - sum(A))

    # if a <= c:
    #     c = a
    #     B.append(c)
    # else:
    #     B.append(c)
    



Measured memory_bytes: 33376
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll MOD = 1000000007LL;
#include <set>
#include <deque>


int main() {
	ll a, b, c; cin >> a >> b >> c;

	bool y = 4*a*b < (c-a-b)*(c-a-b) && 0<(c-a-b);
	const char* const ans = y ? "Yes" : "No";

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, a;
bitset<1000000005> b;

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

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

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (b[a]){
            cout << "NO\n";
            return 0;
        }
        b[a] = 1;
    }

    cout << "YES\n";
}


Measured memory_bytes: 122368
#include <iostream>
 
using namespace std;
 
int main(void) {
    string temp;
    int aru=0;
    
    cin >> temp;
    
    for(char find:temp){
        if('C' == find&&aru == 0)
            aru++;
        if(aru == 1&&'F' == find){
            cout << "Yes" <<endl;
            aru++;
           }
    }
    if(aru<2)
    cout << "No" <<endl;
}

Measured memory_bytes: 256
N, qms = map(int, input().split())

raw_proc = [input() for i in range(N)]
queue = [{} for i in range(N+1)]
limit = N+1
for i in range(N):
    name, time = raw_proc[i].split()
    time = int(time)
    queue[i] = {"name": name, "time": time}

def enque(tail, p):
    queue[tail] = p
    tail = (tail+1) % limit
    return tail

def deque(head):
    proc = queue[head]
    head = (head+1) % limit
    return proc, head


if __name__ == '__main__':
    head = 0
    tail = N
    total_time = 0
    while head != tail:
        p, head = deque(head)
        t = min(qms, p["time"])
        p["time"] = p["time"] - t
        total_time += t
        if p["time"] > 0:
            tail = enque(tail, p)
        else:
            print("{} {}".format(p["name"], total_time))




Measured memory_bytes: 24316
from sys import stdin

x1, y1, x2, y2 = [int(a) for a in stdin.readline().rstrip().split()]

dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy

print(x3, y3, x4, y4)


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

int main(){
        int i,j,idx,flg;
        string s,t;
        cin >> s;
        cin >> t;
        for(i=0;i<s.length()-t.length()+1;++i){
                flg = 0;
                idx = s.length()-t.length()-i;
                for(j=0;j<t.length();++j){
                        if(s[idx+j]!='?' && s[idx+j]!=t[j]){
                                flg = 1;
                                break;
                        }
                }
                if(flg==1) continue;
                else for(j=0;j<t.length();++j) s[idx+j] = t[j];
                break;
        }
        if(flg==0){
                for(i=0;i<s.length();++i) if(s[i]=='?') s[i] = 'a';
                cout << s << endl;
        }else cout << "UNRESTORABLE" << endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long lli;
const lli N = 1e18;
int main() {
    lli n;
    cin >> n;
    __int128 ans = 1;
    for(lli i=0; i<n; i++) {
        lli t;
        cin >> t;
        __int128 x = t;
        ans = ans*x;
        // cout << ans <<
        if(ans>N or ans < 0) {
            ans = -1;
        }
        
        if(t==0) {
        	ans = 0;
        	break;
        }
    }
    
    cout << lli(ans) << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
ll i,j;
bool heiho(ll x){
   for(ll w=1;w*w<=x;w++){
      if(x%w==0&&w==x/w)return true;
   }
   return false;
}



int main(){
   ll N,D;
   cin>>N>>D;
   vector<V> X(N,V(D));
   rep(i,N)rep(j,D)cin>>X.at(i).at(j);
   ll ans=0;
   for(ll a=0;a<N;a++){
      for(ll b=a+1;b<N;b++){
         ll q=0;
         rep(i,D)q+=(X.at(a).at(i)-X.at(b).at(i))*(X.at(a).at(i)-X.at(b).at(i));
         if(heiho(q))ans++;
      }
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

ll n,x,y,m,k,ans,cnt,mini=N,flag;
ll a[N],vis[N],dp[1005][1003];
vector<ll>v[N];

int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n>>k;
    string b[n];
    for(int i=0;i<n;i++)cin>>b[i];
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<k;j++){
            if (!i && !j) continue;

			if (b[i][j] == '#') continue;
			if (i) dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
			if (j) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
        }
    }
    cout<<dp[n-1][k-1];

return 0;
}


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

 int x,y;
 
 while(x != 0 || y != 0) {
     cin >> x >> y;
     
     if(x == 0 && y == 0) {
         break;
     }
     
     else if(x > y) {
         cout << y << " " << x << endl;
     }
         
    else {
        cout << x << " " << y << endl;
    }
 }
}




Measured memory_bytes: 3032
import fs = require('fs');
if(process.argv[1].match(/Main.js$/)) { console.log(main(fs.readFileSync('/dev/stdin', 'utf8').split(/[\r\n\t ]/))); }

export function main(strings: string[]): string {
	const ret: any[] = [];
	const numbers = strings.map(Number);

	const [A, B] = numbers;
	const answer = xor ( f(A-1), f(B));

	ret.push(answer);
	return ret.join('\n') + '\n';
}

function f(n: number): number {
	switch(n%4) {
	case 0:
		return n;
	case 1:
		return 1;
	case 2:
		return n+1;
	case 3:
		return 0;
	}
	return 0;
}

function xor(a: number, b:number): number {
	const _a = Array.from(a.toString(2)).reverse().map(s => parseInt(s));
	const _b = Array.from(b.toString(2)).reverse().map(s => parseInt(s));

	let _bits: number[] = [];
	for(let i=0; i<Math.max(_a.length, _b.length); i++) {
		_bits.unshift( ((_a[i]||0) + (_b[i]||0)) === 1 ? 1 : 0  )
	}

	return parseInt(_bits.join(''), 2);
}

Measured memory_bytes: 7372
class Graph
  attr_accessor :node
  def initialize(n=nil)
    @node = Array.new(n){Node.new}
  end
  def print
    @node.size.times{|i|
      puts "#{i} #{node[i].cost}"
    }
  end
end

class Node
  attr_accessor :edges_to, :edges_cost, :done, :cost
  def initialize
    @edges_to = []
    @edges_cost = []
    @done = false
    @cost = -1
  end
end

n = gets.to_i
graph = Graph.new(n)

n.times{
  u, k, *vc = gets.split.map(&:to_i)
  k.times{|i|
    graph.node[u].edges_to << vc[2*i]
    graph.node[u].edges_cost << vc[2*i+1]
  }
}

graph.node[0].cost = 0

loop do
  doneNode = nil
  n.times{|i|
    next if graph.node[i].done || graph.node[i].cost < 0
    doneNode = graph.node[i] if doneNode == nil || graph.node[i].cost < doneNode.cost
  }
  break if doneNode == nil

  doneNode.done = true
  doneNode.edges_to.size.times{|i|
    to = doneNode.edges_to[i]
    cost = doneNode.cost + doneNode.edges_cost[i]
    graph.node[to].cost = cost if graph.node[to].cost < 0 || cost < graph.node[to].cost
  }
end

graph.print

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int N;
	cin >> N;
	int ans=0;
	int n;
	rep(i, 3) {
		n = 2*i + 1;
		if (pow(10, n) > N) {
			if (pow(10, n - 1) <= N) {
				ans += N - pow(10, n - 1)+1;
				break;
			}
		}
		else {
			ans += 9 * pow(10, n - 1);
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>

#define rep(i,n) for((i)=0;i<(int)(n);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)

using namespace std;



int main() {
	int N,M;
	long long ans = 0;
	int color[200] ;//0:未探索 1:探索中 2:探索済み
	int S[50][50];
	int aaa, bbb;

	pair<int, int> s[50];
	cin >> N >> M;
	rep(aaa, N)rep(bbb, N)S[aaa][bbb] = 0;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		S[a][b] = 1;
		S[b][a] = 1;
		s[i] = make_pair(a, b);
	}

	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			color[j] = 0;
		}
		//辺を一つなくす
		int ignA, ignB;
		ignA = s[i].first;
		ignB = s[i].second;
		S[ignA][ignB] = 0;
		S[ignB][ignA] = 0;
		queue<int> que;
		que.push(0);
		color[0] = 1;
		while (!que.empty()) {
			int x = que.front();
			que.pop();
			for (int p = 0; p < N; p++) {
				if (S[x][p] != 1)continue;

				//隣接したもので足されてなければ追加
				if (x != p && color[p] == 0) {
					color[p] = 1;
					que.push(p);
				}
			}
			//探索終わり
			color[x] = 2;

		}
		S[ignA][ignB] = 1;
		S[ignB][ignA] = 1;
		int n = 0;
		for(int k=0;k<N;k++) {
			n += (color[k] != 0 ? 1 : 0);
		}
		if (n != N)ans++;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
from sys import exit, stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]
AB.sort(key=lambda ab:ab[0])
total_index = 0
for ab in AB:
    total_index += ab[1]
    if total_index >= K:
        print(ab[0])
        exit()

Measured memory_bytes: 29144
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e6 + 123, MOD = 1e9 + 7;
int k, fact[N], rev[N], inv[N], pw[N];
string s;

int c(int x, int y) {
	if (x > y) return 0;
	return ((ll)fact[y] * rev[x] % MOD) * rev[y - x] % MOD;
}

int bp(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = (ll)res * x % MOD;
		}
		x = (ll)x * x % MOD;
		y /= 2;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	fact[0] = rev[0] = pw[0] = inv[1] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = (ll)fact[i - 1] * i % MOD;
		if (i > 1) {
			int x = (i - MOD % i) % i;
			inv[i] = (ll)inv[x] * ((MOD + x) / i) % MOD;
		}
		rev[i] = (ll)rev[i - 1] * inv[i] % MOD;
		pw[i] = (ll)pw[i - 1] * 25 % MOD;
	}
	cin >> k >> s;
	int sz = s.size();
	int n = sz + k;
	int res = bp(26, n);
	for (int i = 0; i < sz; i++) {
		res -= (ll)c(i, n) * pw[n - i] % MOD;
		if (res < 0) res += MOD;
	}
	cout << res;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  vector<int> v(3);cin >> v;
  sort(v.begin(), v.end());
  int x = 2*v[2]-v[0]-v[1];
  if(x%2)x+=3;
  cout << x / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 100003
#define endl "\n"

#define trace1(x)             	 cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;


using namespace std;

int main() {
	// for fast input output using cin cout
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	// size of array
	// input
	int n, a, b;
	cin >> n >> a >> b;
	
	int winner;
	int gap = max(b, a) - min(b, a) - 1;
	if (gap & 1)
		cout << "Alice\n";
	else
		cout << "Borys\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int K;
	cin >> K;
	
	REP(i, K) {
		if (C <= B) C *= 2;
		else if (B <= A) B *= 2;
	}
	
	if (A < B && B < C) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3632
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

min_value = abs(A - (T - H[0] * 0.006))
min_index = 1
for i in range(1, len(H)):
    if(min_value > abs(A - (T - H[i] * 0.006))):
        min_value = abs(A - (T - H[i] * 0.006))
        min_index = i+1
print(min_index)

Measured memory_bytes: 9244
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int s,w;cin>>s>>w;
    if(w>=s) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}


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

int main() {

  while( true ) {

    int n, w, d;

    cin >> n >> w >> d;

    if ( n == 0 && w == 0 && d == 0 ) break;

    int p, s;

    vector< int > x;
    vector< int > y;
    x.push_back( w );
    y.push_back( d );

    int a, b;

    for ( int i = 0; i < n; i++ ) {

      cin >> p >> s;

      p--;

      s %= ( x[p] * 2 + y[p] * 2 );

      if ( s < x[p] ) {
	a = s;
	b = x[p] - s;
	if ( b < a ) swap( a, b );
	x.push_back( a );
	x.push_back( b );
	y.push_back( y[p] );
	y.push_back( y[p] );
      }else if ( s < x[p] + y[p] ) {
	s -= x[p];
	a = s;
	b = y[p] - s;
	if ( b < a ) swap( a, b );
	x.push_back( x[p] );
	x.push_back( x[p] );
	y.push_back( a );
	y.push_back( b );
      }else if ( s < x[p] * 2 + y[p] ) {
	s -= ( x[p] + y[p] );
	a = s;
	b = x[p] - s;
	if ( b < a ) swap( a, b );
	x.push_back( a );
	x.push_back( b );
	y.push_back( y[p] );
	y.push_back( y[p] );
      }else {
	s -= ( x[p] * 2 + y[p] );
	a = s;
	b = y[p] - s;
	if ( b < a ) swap( a, b );
	x.push_back( x[p] );
	x.push_back( x[p] );
	y.push_back( a );
	y.push_back( b );
      }

      vector<int>::iterator it = x.begin() + p;
      it = x.erase( it );
      it = y.begin() + p;
      it = y.erase( it );

    }

    vector< int > ans;

    for ( int i = 0; i < x.size(); i++ ) {

      ans.push_back( x[i] * y[i] );

    }

    stable_sort( ans.begin(), ans.end() );

    for ( int i = 0; i < ans.size(); i++ ) {

      if ( i != 0 ) cout << " ";
      cout << ans[i];

    }

    cout << endl;

  }

  return 0;

}

Measured memory_bytes: 1232
'use strict';

const main = input => {
    const array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
    console.log(array[parseInt(input) - 1]);
};

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin>>n;
  int cntodd=0;
  REP(i,0,n){
    LL a;
    cin>>a;
    if(a%2)++cntodd;
  }
  if(cntodd%2==1){
    cout<<"NO"<<endl;
  }
  else cout<<"YES"<<endl;

  return 0;
}


Measured memory_bytes: 256
N=int(input())
a=[int(input()) for i in range(N)]
b=[]
j=1
k=1
c=1
if 2 not in a:
    print(-1)
else:
    while j in range(1,N+1):
         c += 1
         if a[k-1]==1:
                 print(-1)
                 break
         elif a[k-1]==2:
                 print(c-1)
                 break
         else:
            j += 1
            k = a[k-1]
    if c>=(N+1):
        print(-1)

Measured memory_bytes: 7192
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_ABC148
{
    class MainClass
    {

        static long[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long m = Gcd(s[0],s[1]);
            //WriteLine(m);
            WriteLine(s[0] * s[1] / m);
        }

        public static long Gcd(long a, long b)
        {
            long tmp;
            if (a >= b)
            {
                tmp = a;
                a = b;
                b = tmp;
            }
            if (a == 0)
            {
                return b;
            }

            tmp = a;
            a = b % a;
            b = tmp;
            return Gcd(a, b);
        }
    }




}


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

int main() {
  ll x;
  cin>>x;
  ll sum=100;
  ll ans=0;
  
  while(sum<x){
    sum=sum+sum/100;
    
    
    
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3632