akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Pi;
int par[100002];
int rk[100002];
 
void init(int n){
    for(int i=0; i<n; i++){
        par[i]=i; rk[i]=0;
    }
}
 
int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}
 
void unite(int x, int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rk[x]<rk[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(rk[x]==rk[y]) rk[x]++;
    }
}
 
bool same(int x, int y){
    return find(x)==find(y);
}
int n, m;
ll w[200001];
int a[200001], b[200001];
vector<P> e;
vector<P> g[100001];
bool ok[200001];
vector<int> ed[100001];
bool used[100001];
ll ans[200001];
typedef set<P> SP;
SP* merge(SP* st1, SP* st2){
    if(st1->size()>st2->size()){
		while(!st2->empty()){
			P p=*st2->begin();
			st2->erase(st2->begin());
            auto itr=st1->find(p);
            if(itr!=st1->end()) st1->erase(itr);
            else st1->insert(p);
        }
        return st1;
    }else{
        while(!st1->empty()){
			P p=*st1->begin();
			st1->erase(st1->begin());
            auto itr=st2->find(p);
            if(itr!=st2->end()) st2->erase(itr);
            else st2->insert(p);
        }
        return st2;
    }
}
SP st[100001]; int c;
SP* dfs(int x){
    used[x]=1;
    c++;
	SP* st0=&st[c];
    for(auto p:g[x]){
        int j=p.second, y=p.first;
        if(used[y]) continue;
        SP* st1=dfs(y);
        if(st1->empty()){
            ans[j]=-1;
        }else{
            ans[j]=(*st1->begin()).first;
        }
        st0=merge(st0, st1);
    }
    for(auto j:ed[x]){
        P p=P(w[j], j);
        auto itr=st0->find(p);
        if(itr!=st0->end()){
            st0->erase(itr);
        }else{
            st0->insert(p);
        }
    }
    return st0;
}
int main()
{
    cin>>n>>m;
    for(int i=0; i<m; i++){
        cin>>a[i]>>b[i]>>w[i]; a[i]--; b[i]--;
        e.push_back(P(w[i], i));
    }
    sort(e.begin(), e.end());
    init(n);
    ll sum=0;
    int ct=0;
    for(int i=0; i<m; i++){
        int j=e[i].second;
        int x=a[j], y=b[j];
        if(!same(x, y)){
            unite(x, y);
            ct++;
            sum+=e[i].first;
            g[x].push_back(P(y, j));
            g[y].push_back(P(x, j));
        }else{
            ok[j]=1;
            ed[x].push_back(j);
            ed[y].push_back(j);
        }
    }
    if(ct<n-1){
        for(int i=0; i<m; i++){
            cout<<-1<<endl;
        }
        return 0;
    }
    dfs(0);
    for(int i=0; i<m; i++){
        if(ok[i]){
            cout<<sum<<endl;
        }else if(ans[i]==-1){
            cout<<-1<<endl;
        }else{
            cout<<sum-w[i]+ans[i]<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 44368
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) //
#endif
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
const int p = 998244353;
const int maxv = 1000001;
int n;
const int maxn = 200001;
int cnt[maxv];
int w[maxv];
ll inv[maxv];
void init(){
	static int minf[maxv], pnum[maxv], plen;
	inv[1] = inv[0] = 1;
	for(int i = 2;i < maxv;++i)inv[i] = (p-p/i) * inv[p % i] % p;
	for(int i = 2;i < maxv;++i){
		if(!minf[i])pnum[plen++] = i, minf[i] = i;
		for(auto &v : pnum){
			if(i * v >= maxv)break;
			minf[i * v] = v;
			if(i % v == 0)break;
		}
	}
	for(int i = 1;i < maxv;++i){
		w[i] = (w[i] + inv[i]) % p;
		for(int j = i + i;j < maxv;j += i)w[j] = (w[j] + p - w[i]) % p;
	}
}
ll res;
void cal(int v){
	static ll pref[maxn], len;
	len = 0;
	for(int i = v;i < maxv;i += v)for(int j = 0;j < cnt[i];++j, ++len)pref[len+1] = (pref[len] + i) % p;
	for(int i = 1;i < len;++i){
		res = (res + (p + pref[i]-pref[i-1]) % p * (pref[len] - pref[i]) % p * w[v]) % p;
	}
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	init();
	cin >> n;
	for(int v, i = 0;i < n;++i){
		cin >> v;
		++cnt[v];
	}
	for(int i = 1;i < maxv;++i)cal(i);
	cout << res % p << '\n';
}

Measured memory_bytes: 23168
s = input()

index = 0
thanS = s[0]
count = 1
a = []
for i in range(1, len(s)):
    if thanS == s[i]:
        count += 1

    else:
        a.append(s[index: index + count])
        thanS = s[i]
        index = index + count
        count = 1

a.append(s[index:])
b = 0
add = 0

for i in range(len(a)):
    diff = len(a[i])
    if a[i][0] == "<":
        add += diff * (diff + 1) / 2
        b = diff
    else:
        if b < diff:
            add = add + diff * (diff + 1) / 2 - b
        else:
            add = add + (diff - 1) * diff / 2
        b = 0

print(int(add))


Measured memory_bytes: 13212
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int N,Q;

int main(){
  scanf("%d%d", &N,&Q);
  vector<int>c(N);
  rep(i,N) scanf("%d", &c[i]);
  sort(c.begin(), c.end());
  int res,q;
  rep(i,Q){
    res = 0;
    scanf("%d",&q);
    for(int x=q;x<=300000;x+=q){
      vector<int>::iterator it = lower_bound(c.begin(), c.end(), x); --it;
      res = max(res, (*it)%q);
      if(x>c[N-1]) break;
    }
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 2320
/**
 *   author: sahushivam
 *   created: 26 January 2020 (Sunday)  17:53:05
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

void solve(){
	int m,n; cin>>m>>n;
	vector<vector<int>> dp(10*m+1,vector<int> (n+1));
	vector<int> C(n);
	vector<int> B(n);
	for(int i=0;i<n;i++)
	{
		cin>>B[i]>>C[i];
	}
    for(int i=0;i<=10*m;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==0)
            {
                  dp[i][j]=0;  
            }
            else if(j==0) dp[i][j]=1000000000;
            else
            {
                if(i >= B[j-1]){
                    dp[i][j] = min(dp[i][j-1], dp[i-B[j-1]][j] + C[j-1]);
                }
                else dp[i][j] = dp[i][j-1];
            }
        }
    }
    int ans=INF;
  	for(int i=m;i<10*m;i++){
   		ans=min(ans,dp[i][n]);
  	}
  	cout<<ans;
   	
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int t=1; while(t--) solve();
    return 0;
}	

Measured memory_bytes: 785408
import sys
sys.setrecursionlimit(10000)

N, X = map(int, input().split())

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n, x):
    if n == 0:
        if x <= 0:
            return 0
        else:
            return 1
    med = (a[n]+1) // 2
    if x < med:
        return f(n-1, x-1)
    elif x == med:
        return p[n-1] + 1
    elif x > med:
        return p[n-1] + 1 + f(n-1, x-med)
print(f(N, X))

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

//#pragma GCC optimize ("O3")
//#pragma GCC optimize ("Ofast")

#define F first
#define S second
#define MT make_tuple
#define SZ(a) ((int)(a).size())
#define PB push_back
#define LBS 20
#define MOD ((long long)1e9+7) //1e9+9
#define LEFT(i) (2*(i))
#define RIGHT(i) (2*(i)+1)
#define PAR(i) ((i)/2)

using namespace std;

typedef long long ll;
typedef double rat;
typedef long long bi;
typedef pair<int, int> ii;
typedef std::vector<ii> vii;
typedef std::map<int, int> mii;
typedef bitset<LBS> bis;
typedef std::vector<bis> vbs;

template<class T>
void vin(std::vector<T> &a){
  for(auto &x: a)
    cin >> x;
}

template<class T>
void vout(std::vector<T> &a){
  for(auto x: a)
    cout << x << " ";
  cout << endl;
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;  cin >> n;
  cout << n*n*n<<"\n";
}


Measured memory_bytes: 256
/*package whatever //do not write package name here */

import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
	public static void main (String[] args)throws IOException{
		//code
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String[]s=br.readLine().split("\\s+");
		
            int n=Integer.parseInt(s[0]);
            int k=Integer.parseInt(s[1]);
		    int []ar=new int[n];
		    s=br.readLine().split("\\s+");
		    for(int i=0;i<n;i++){
		        ar[i]=Integer.parseInt(s[i]);
            }
            int dp[]=new int[n];
            Arrays.fill(dp,Integer.MAX_VALUE);
            dp[0]=0;
            for(int i=1;i<n;i++){
                for(int j=i-1;j>=0&&j>=i-k;j--){
                    dp[i]=Math.min(Math.abs(ar[i]-ar[j])+dp[j],dp[i]);
                }
            }
            System.out.print(dp[n-1]);
		
		    
	
		
	}
}


Measured memory_bytes: 35876
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    if(a+b==0)
    cout<<0<<endl;
    else
    cout<<( ((n)/(a+b))*a + min((n%((a+b))),a)     )<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  string S, T;
  cin >> S >> T;

  int Ns = S.length();
  int Nt = T.length();

  vector<vector<int> > dp(Ns + 1, vector<int>(Nt + 1, 0));

  for (int i = 1; i <= Ns; i++) {
    for (int j = 1; j <= Nt; j++) {
      if (S[i - 1] == T[j - 1]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
      } else {
        dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
      }
    }  // j
  }    // i

  string ans = "";
  int sp = Ns, tp = Nt;
  while (dp[sp][tp] > 0) {
    if (S[sp-1] == T[tp-1]) {
      ans = S[sp - 1] + ans;
      sp--;
      tp--;
    } else if (dp[sp][tp] == dp[sp][tp - 1]) {
      tp--;
    } else {
      sp--;
    }
    // if (dp[sp][tp] == dp[sp - 1][tp]) {
    //   sp--;
    // } else if (dp[sp][tp] == dp[sp][tp - 1]) {
    //   tp--;
    // } else {
    //   ans = S[sp - 1] + ans;
    //   sp--;
    //   tp--;
    // }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 35584
target,n = map(int,input().split())
if n == 0:
  	print(target)
else:
    ary = list(map(int,input().split()))
    count = 0
    while True:
        if target - count not in ary:
            print(target - count)
            break
        elif target + count not in ary:
            print(target + count)
            break
        else:
            count += 1

Measured memory_bytes: 9188
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int t = sc.nextInt();
    if (n % x == 0) {
      System.out.println(n / x * t);
    } else {
      System.out.println(n / x * t + t);
    }
  }
}

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

int main()
{
	int n,t,a;
	int ans;
	float min=100000;
	cin>>n>>t>>a;

	for(int i=1;i<=n;i++)
	{
		int h;
		float temp;
		cin>>h;
		temp=(float)t-0.006f*(float)h;
		temp=abs(temp-(float)a);
		if(temp<min)
		{
			min=temp;
			ans=i;
		}		
	}
	cout<<ans<<endl; 
	
	return 0;
}


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

class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       int[] t= {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
       Arrays.sort(t);
       System.out.println(Math.max(sc.nextInt(),sc.nextInt())+t[1]+t[2]+t[3]);
    }
}


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

int main() {
  int s, s1, s2, s3;
  cin >> s;
  s1 = s/100;
  s2 = (s - 100*s1)/10;
  s3 = s - 100*s1 - 10*s2;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
N = int(input())
B = [int(x) for x in input().split()]
A = []
count = 0
A.append(B[0])
for i in range(N-2):
  if B[i] > B[i+1]:
    A.append(B[i+1])
  else:
    A.append(B[i])
A.append(B[N-2])
print(sum(A))

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

B = [0 for i in range(N)]

for i in range(N-1, -1, -1):
  count = 0
  for j in range(i, N, i+1):
    count += B[j]
    if count%2 == A[i]:
      B[i] = 0
    else:
      B[i] = 1

sum = sum(B)
if sum == 0:
  print(0)
else:
  print(sum)
  ans = []
  for i in range(N):
    if B[i] == 1:
      ans.append(i+1)
  print(*ans)

Measured memory_bytes: 14136
N,Y = map(int, input().split())

def f():
  for i in range(N+1):
    for j in range(N+1-i):
      k = N-i-j
      if Y == 10000*i + 5000*j + 1000*k:
        return i,j,k
  return -1,-1,-1

a,b,c = f()
print(a,b,c)


Measured memory_bytes: 3060
#include <iostream>
#include<algorithm>
#include<array>


int main(void) {

	int result1 = 0, result2 = 0,result3 = 0, result4 = 0;
	int result = 0;

	std::array<int, 3>arr = {};
	for (int i = 0; i < 3; i++) {
		std::cin >> arr[i];
	}
	std::sort(arr.begin(), arr.end());
	result1 = arr[2] - arr[1];
	result2 = (arr[2] - (arr[0] + result1)) / 2;
	result3 = (arr[2] - (arr[0] + result1)) % 2;
	if (result3 == 1) {
		result4 = 2;
	}

	result = result1 + result2 + result4;
	std::cout << result << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;

  rep(i, 1, 50001) {
    int x = i * 1.08L;
    if (x == n) {
      cout << i << endl;
      return 0;
    }
  }

  cout << ":(" << endl;
}


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

int main(){

	int c=0, i;
	char w[11], t[1001];
	char *pt;

	scanf( "%s", w );
	for( i=0; i<strlen(w); i++ ) w[i] = tolower(w[i]);
	
	while(1){
		
		scanf( "%s", t );
		if( strstr(t,"END_OF_TEXT")  ) break;

		for( i=0; i<strlen(t); i++ ) t[i] = tolower(t[i]);


		pt = strtok( t, " ");
		do{
			if( strlen(pt) == strlen(w) &&
			    strncmp( pt, w, strlen(w) ) == 0 ) c++;
			

		}while( (pt=strtok(NULL, " ")) != NULL );
			
		


	}

	printf( "%d\n", c );

	return 0;

}

Measured memory_bytes: 564
from collections import deque

K = int(input())
adjL = [[] for i in range(K)]
for i in range(K):
    adjL[i].append(((i + 1) % K, 1))  # i→(i+1) に、重み1の辺を張る
    adjL[i].append(((i * 10) % K, 0)) # i→(i*10)に、重み0の辺を張る

# 【01BFS】
cost = [K] * K
cost[1] = 0
Q = deque([(1, 0)]) # 1からスタート
while Q:
    vNow, cNow = Q.popleft()

    if vNow == 0: break # 0に到達したら終了
    if cNow > cost[vNow]: continue

    for v2, wt in adjL[vNow]:
        c2 = cNow + wt
        if c2 < cost[v2]:
            cost[v2] = c2
            if wt == 1:
                # 重み1の辺ならば、キューの末尾に追加する
                Q.append((v2, c2))
            else:
                # 重み0の辺ならば、キューの先頭に追加する
                Q.appendleft((v2, c2))

# 「1→0への最短経路長」+1が求める答え
print(cost[0] + 1)


Measured memory_bytes: 38388
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        double[] p1 = {0, 0};
        double[] p2 = {100, 0};
        print(p1);
        koch(n, p1, p2);
        print(p2);

	}

	static void koch(int n, double[] p1, double[] p2) {
		if(n == 0)
			return;

		double[] s = { (2*p1[0]+1*p2[0])/3,  (2*p1[1]+1*p2[1])/3 };
		double[] t = { (1*p1[0]+2*p2[0])/3,  (1*p1[1]+2*p2[1])/3 };
		double[] u = { (t[0]-s[0]) * Math.cos(Math.toRadians(60)) - (t[1]-s[1]) * Math.sin(Math.toRadians(60)) + s[0]
						,(t[0]-s[0]) * Math.sin(Math.toRadians(60)) + (t[1]-s[1]) * Math.cos(Math.toRadians(60)) + s[1] };

		koch(n-1, p1, s);
		print(s);
		koch(n-1, s, u);
		print(u);
		koch(n-1, u, t);
		print(t);
		koch(n-1, t, p2);
	}

	private static void print(double[] s) {
		System.out.println(s[0] + " " + s[1]);
	}
}



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

using namespace std;

string reverse_string(string p)
{
    int i, sz = p.size();
    for (i = 0; i < sz / 2; i ++)
        swap(p[i], p[sz - i - 1]);
    return p;
}
int main()
{
    int n, k, i = 1;
    string s;
    cin >> n >> k >> s;

    string p = s;
    while(i < k)
    {
        string rev = reverse_string(p);
        string kk = p + rev;
        string opt = rev;
        int j, sz = n * 2;
        for (j = 0; j <= sz - n; j ++)
        {
            string d = kk.substr(j, n);
            string rev_d = reverse_string(d);
            if (rev_d < reverse_string(opt))opt = d;
        }
        if (opt == p)
        {
            cout << opt << endl;
            return 0;
        }
        p = opt;
        i ++;
    }
    string r = p + reverse_string(p);
    string ans = p;
    int sz = n * 2;
    for (i = 0; i <= sz / 2; i ++)
    {
        string d = r.substr(i, n);
        if (d < ans)
            ans = d;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int A, B, C, res; cin >> A >> B >> C;
    if (A != B && B != C && C == A) {
        res = B;
    } else if (A == B && B != C && C != A) {
        res = C;
    } else if (A != B && B == C && C != A) {
        res = A;
    }
	cout << res << 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 a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int cos = a*x + b*y;
    int min = cos;
    int cco = 0;
    int k = max(x, y);
    while(!(x == 0 && y == 0)){
      if(x > 0) x--;
      if(y > 0) y--;
      cco += 2;
      cos = a*x + b*y +c*cco;
      if(cos < min) min = cos;
    }
	cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define _GLIBCXX_DEBUG
using namespace std;
// C - Takahashi's Information
int main() {
    int A,B,C;
    cin >> A >> B >> C;
    int X,Y;
    cin >> X >> Y ;
    // A
    int price ;
    int min_price_A = A*X + B*Y;
    for(int i=0;i<= ( 2*X );i=i+2){
        int y ;
        if( (Y - (i/2) ) >= 0 ){
            y= (Y-(i/2));
        }
        else{
            y =0;
        }
        
        price = A*(X-(i/2)) + B*y + C*i ;
        if( min_price_A > price){
            min_price_A = price;
        }
    }
    // B
    int min_price_B = A*X + B*Y;
     for(int i=0;i<= ( 2*Y );i=i+2){
        int x ;
        if( (X - (i/2) ) >= 0 ){
            x= (X-(i/2));
        }
        else{
            x =0;
        }
        
        price = A*x + B*(Y-(i/2)) + C*i ;
        if( min_price_B > price){
            min_price_B = price;
        }
    }
    // 
    int min_price;
    min_price = min(min_price_A,min_price_B) ;
    cout << min_price << endl;
}

Measured memory_bytes: 3640
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
function unionFind(n){this.a=Array(n+1).fill(-1);}
unionFind.prototype={
  root:function(i){return this.a[i]<0?i:this.a[i]=this.root(this.a[i]);},
  same:function(x,y){return this.root(x)===this.root(y);},
  unite:function(x,y){x=this.root(x);y=this.root(y);if(x===y)return 1;if(this.a[y]<=this.a[x])this.a[y]+=this.a[x],this.a[x]=y;else this.a[x]+=this.a[y],this.a[y]=x;},
  size:function(i){return -this.a[this.root(i)];},
}

function main(){
  var n = o.a();
  var m = o.a();
  if(m&1)return -1;
  var a = o.m(m);
  var uf = new unionFind(n);
  var ans = [];
  var e = xArray("[]",n+1)
  var w = xArray(0,n+1);
  for(var i = 0; i < m; i++){
    var u = a[i][0], v = a[i][1];
    if(uf.unite(u,v)){
      ans.push(u+" "+v);
      w[u] ^= 1;
    }else{
      e[u].push(v);
      e[v].push(u);
    }
  }
  dfs(1,0);
  return ans.join("\n");

  function dfs(v,p){
    for(var V of e[v]){
      if(V === p)continue;
      dfs(V,v);
    }
    if(p === 0)return;
    if(w[v]){
      ans.push(v+" "+p);
    }else{
      ans.push(p+" "+v);
      w[p] ^= 1;
    }
  }
}

if(process.argv.length<3)require("child_process").fork("Main.js",["1"],{execArgv:["--stack-size=240000"]});
else console.log(main());

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

int main() {
	int N,R,m,n,o,p,q,r,s,t,u;
	cin >> N;
	m = N/pow(10,8);
	n = N / pow(10,7) - m * 10;
	o = N / pow(10,6) - m *pow(10,2) - n * 10;
	p = N / pow (10,5) - m * pow(10,3) - n * pow(10 , 2) - o * 10;
	q = N / pow(10 , 4) - m * pow (10 , 4) - n * pow (10 , 3) - o * pow (10 , 2) - p * 10;
	r = N / pow(10 , 3) - m * pow (10 , 5) - n * pow (10 , 4) - o * pow (10 , 3 )- p * pow (10 , 2 )- q * 10;
	s = N / pow (10 , 2) - m * pow  (10 , 6) - n * pow (10 , 5) - o * pow (10 , 4 )- p * pow (10 , 3 )- q * pow(10 , 2) - r * 10;
	t = N / 10       - m * pow (10 , 7) - n * pow (10 , 6) - o * pow (10 , 5 )- p * pow (10 ,4 )- q * pow(10 , 3) - r * pow(10 , 2)-  s  * 10;
	u = N            - m * pow (10 , 8) - n * pow (10 , 7) - o * pow (10 , 6 )- p * pow (10 , 5) - q * pow (10 , 4) - r * pow (10, 3) - s  * pow(10 , 2) - t * 10;
	R = m + n + o + p + q + r + s + t + u;
	if (N%R == 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}



Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if ((x - r) < 0 || (x + r) > W) {
        puts("No");
    }  else if ((y - r) < 0 || (y + r) > H) {
        puts("No");
    } else {
        puts("Yes");
    }

    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

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

    ll a, b, k, max;
    cin >> a >> b >> k;
    rep (i, k)
        if (a + i <= b)
            print(a + i);
        else
            return 0;
    max = a + k - 1;
    rep (i, k)
        if (b - k + i + 1 > max) print(b - k + i + 1);

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

//string s[]だとうまくいかない、未定義動作?
//string s[100];
char s[100][100];

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

//h, w
bool check(int x, int y){
  return (0 <= x && x < h && 0 <= y && y < w);
}

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

  cin >> h >> w;
  REP(i, h) REP(j, w) cin >> s[i][j];
  
  REP(i, h){
    REP(j, w){
      int cnt = 0;
      if(s[i][j] == '#'){
	REP(k, 4){
	  int x = i+dx[k], y = j+dy[k];
	  if(check(x, y)){
	    if(s[x][y] == '#') cnt++;
	  }
	}
	if(cnt == 0){cout << "No" << endl; return 0;}
      }
    }
  }

  cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 256
N, M = gets.split(' ').map(&:to_i)

k = 1
divisor = []
while k ** 2 <= M
  if M % k == 0
    divisor.push(k)
    divisor.push(M / k)
  end
  k += 1
end

divisor.sort!.reverse!
puts divisor.bsearch{|n| n <= M / N}

Measured memory_bytes: 3836
from collections import Counter

N, K = map(int, input().split())

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

C = Counter(A)
v = list(C.values())
v = sorted(v)

div = len(v)
ans = 0
if div <= K:
    ans = 0
else:
    ans += sum(v[0:div-K])
print(ans)


Measured memory_bytes: 32556
#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 RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	LL X;
	cin>>X;
	LL now=100;
	LL cnt=0;
	while(X>now){
		now+=(now/100);
		cnt++;
	}
	//cout<<now<<endl;
	cout<<cnt<<endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize(2)
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define endl "\n"
const int mod=1e9+7;
const int MAX=1e6+7;
int a[MAX];
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0);
   int n,k;cin>>n>>k;
   for(int i=0;i<n;i++)cin>>a[i];
   int l=1,r=mod,ans=mod;
   while(l<=r)
   {
   		int mid=(l+r)/2,cnt=0;
   		for(int i=0;i<n;i++)cnt+=(a[i]-1)/mid;
   		if(cnt<=k) ans=mid,r=mid-1;	
		else l=mid+1;
   }
    cout<<ans;
   return 0;
} 

Measured memory_bytes: 4252
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	cout<<a<<' '<<b<<' '<<3*c-a-b<<endl;
	cout<<4*c-2*a-b<<' '<<c<<' '<<2*a+b-2*c<<endl;
	cout<<a+b-c<<' '<<2*c-b<<' '<<2*c-a<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <cstdio>

using namespace std;

int main() {

	double i;
	deque<double> n;

	while(scanf("%lf", &i)!=EOF)
		n.push_back(i);

	sort(n.begin(), n.end());
	printf("%.1f\n", *n.rbegin()-*n.begin());

	return 0;

}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication32
{
    class Program
    {  
      static void Main()
      {
		  int b =1;
		while(true)
         {
	      int a = int.Parse(Console.ReadLine());
	      if(a==0) 
	        break;
	      Console.WriteLine("Case {0}: {1}",b,a);
	         b+=1;
	       }
		}
	 }
 }

      
      

Measured memory_bytes: 9332
N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
c = [list(map(int, input().split())) for i in range(N)]

cost0 = []
cost1 = []
cost2 = []
indices = [2, 0, 1]
for color in range(C):
  cost = [0, 0, 0]
  for i in range(N):
    idx = indices[i%3]
    for j in range(N):
      cost[idx] += D[c[i][j]-1][color]
      idx = (idx + 1) % 3
  cost0.append([cost[0], color])
  cost1.append([cost[1], color])
  cost2.append([cost[2], color])

cost0.sort()
cost1.sort()
cost2.sort()
ans = float('inf')
for i in range(3):
  for j in range(3):
    for k in range(3):
      if len(set([cost0[i][1], cost1[j][1], cost2[k][1]])) == 3:
        ans = min(ans, cost0[i][0]+cost1[j][0]+cost2[k][0])

print(ans)

Measured memory_bytes: 43612
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
//  Created by conan1024hao on 2019/11/26.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ！llかどうか？？
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    ll n;cin>>n;
    vector<ll>a(n+1);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    a[n]=0;
    ll sum=0;
    ll now=0;
    for(int i=0;i<n+1;i++){
        sum+=abs(max(now,a[i])-min(now,a[i]));
        now=a[i];
        //cout<<now<<endl;
    }
    //cout<<sum<<endl;
    ll pre=0;
    for(int i=0;i<n;i++){
        ll ss=sum;
        if(pre<=a[i]&&a[i]<=a[i+1]){
            cout<<ss<<endl;
        }
        else{
            ss-=abs(max(pre,a[i])-min(pre,a[i]));
            ss-=abs(max(a[i+1],a[i])-min(a[i+1],a[i]));
            ss+=abs(max(pre,a[i+1])-min(pre,a[i+1]));
            cout<<ss<<endl;
        }
        pre=a[i];
    }

    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a * b) % 2) cout << "Odd" << endl;
	else cout << "Even" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
   int a,b,c,x;
   cin>>a>>b>>c>>x;
   int ans=0;
   for(int i=0;i<=a;i++)
   {
       for(int j=0;j<=b;j++)
	   {
	        for(int k=0;k<=c;k++)
			{
				int sum=i*500+j*100+k*50;
			    if(sum==x)
			    {
				   ans++;
			    }
			}	
	   }	
   }
   cout<<ans<<endl;
   return 0;	
} 

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean index[]=new boolean[1000000];
		Arrays.fill(index, true);
		index[0]=false;
		index[1]=false;
		for(int i=0;i<index.length;i++){
			if(index[i]){
				for(int j=i+i;j<index.length;j+=i){
					index[j]=false;
				}
			}
		}
		
		while(true){
			int n=sc.nextInt();
			if(n==0)break;
			int cnt=0,ans=0,num=2;
			while(n!=cnt){
				if(index[num]){
					ans+=num;
					cnt++;
				}
				num++;
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 20832
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const T = parseInt(arg[0].split(" ")[1]);
    const t = arg[1].split(" ");
    
    let answer = 0;
    
    for(let i in t) {
        if(isNaN(t[parseInt(i) + 1] - t[i])) {
            answer += T;   
        } else {
            answer += Math.min(T, t[parseInt(i) + 1] - t[i]);
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<vector<int>> dp(n + 1, vector<int>(3)), a(n, vector<int>(3));
	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (j == k) continue;
				dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k]);
			}
		}
	}
	cout << max(max(dp[n][0], dp[n][1]), dp[n][2]);
}



Measured memory_bytes: 14276
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ANS1 = []
ans = ''
while n > 0:
    n -= 1
    ANS1.append(n % 26)
    n //= 26
for i in ANS1[::-1]:
    ans += s[i]
print(ans)

Measured memory_bytes: 9100
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
inline int count(int x)
{
    int k=0;
    for(int i=1;i<=x;i++)
    {
        if(x%i==0)
        k++;
    }
    return k;
}
int main()
{
    int n,m,ans=0;
    cin>>n;
    for(int i=1;i<=n;i+=2)
    {
        if(count(i)==8)
        ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

H, W, D = map(int, input().split())
L = [[int(v) - 1 for v in input().split()] for _ in range(H)]
Q = int(input())
QL = [[int(v) - 1 for v in input().split()] for _ in range(Q)]

m = [None] * (H * W)
for i in range(H):
    for j in range(W):
        m[L[i][j]] = (i, j)

dp = [None] * (H * W)
for i in range(D):
    dp[i] = 0
    for j in range(i + D, H * W, D):
        x, y = m[j - D]
        nx, ny = m[j]
        
        dp[j] = dp[j - D] + abs(x - nx) + abs(y - ny)

for qx, qy in QL:
    print(dp[qy] - dp[qx])

Measured memory_bytes: 35964
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

    ll x;
    cin>>x;

    ll price = 100;
    ll count = 0;

    while(price < x)
    {
        price = price + price/100;
        count++;
    }

    cout<<count;








    return 0;
}       

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

int main() {
	int n, sum = 0;
	string a, ring;

	cin >> a;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> ring;
		ring += ring;
		if ((int)ring.find(a) >= 0)
			sum++;
	}

	cout << sum << endl;
}

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

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

    int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << a;
    } else if (a < b) {
        cout << a;
    } else if (b < a) {
        cout << a - 1;
    }
}

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

int main(){
    string str;
    int m;
    while(cin>>str,str!="-"){
        cin >> m;
        vector<int> op(m);
        for(int i=0; i<m; i++)
            cin >> op[i];
        int ini=0,len=str.size();
        for(int i=0; i<m; i++){
            for(int j=0; j<op[i]; j++){
                str.push_back(str[ini+j]);
            }
            ini+=op[i];
        }
        for(int i=ini; i<ini+len; i++)
            cout << str[i];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  sort(a.rbegin(), a.rend());
  ll ans = 0;
  int t = n-1;
  rep(i, n){
  	int lim = 2;
    if(i == 0) lim = 1;
    rep(j, lim){
      if(t > 0){
      	ans += a.at(i);
        t--;
      }
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 4032
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n);i++)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
	string s;
	string tenki;
	cin >> s;

	if (s == "Sunny") {
		cout << "Cloudy";
	}
	else if (s == "Cloudy") {
		cout << "Rainy";
	}
	else if (s=="Rainy")
	{
		cout << "Sunny";
	}
	return 0;
}

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

int main() {
	int s;
	cin >> s;
	int n[3];
	n[2] = s % 10;
	s /= 10;
	n[1] = s % 10;
	s /= 10;
	n[0] = s;
	for (int i = 0; i < 3; i++) {
		if (n[i] == 1)
			n[i] += 8;
		else
			n[i] -= 8;
	}
	for (int i = 0; i < 3; i++)
		cout << n[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N,A,B,C,D; cin >> N >> A >> B >> C >> D;
    A--;B--;C--;D--;
    string S; cin >> S;
    bool f=true;

    for(int i=B;i<=D-2;i++){
        if(S[i]=='#' && S[i+1]=='#'){
            cerr << "1";
            f=false;
        }
    }
    for(int i=A;i<=C-2;i++){
        if(S[i]=='#' && S[i+1]=='#'){
            cerr << "2" ;
            f=false;
        }
    }
    if(C>D){
        bool c=false;
        for(int i=B;i<=D;i++){
            if(S[i-1]=='.' && S[i]=='.' && S[i+1]=='.'){
                c=true;
                cerr << "3";
            }
        }
        if(!c) f=false;
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  double r;
  cin >> r;

  cout << r*6.28318530717958623200 << endl;
  
  return 0;
}


Measured memory_bytes: 3808
#include <iostream>
#define MAX_N 50
using namespace std;
int n, m;
int a[MAX_N], b[MAX_N];
bool g[MAX_N][MAX_N];
bool visited[MAX_N];
int ans;
void dfs(int v){
  visited[v] = true;
  for(int i = 0; i < n; i++){
    if((g[v][i] || g[i][v]) && !visited[i]) dfs(i);
  }
}
int main(void){
  ans = 0;
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]][b[i]] = true;
    g[b[i]][a[i]] = true;
  }
  for(int i = 0; i < m; i++){
    g[a[i]][b[i]] = false;
    g[b[i]][a[i]] = false;
    for(int j = 0; j < n; j++) visited[j] = false;
    dfs(0);
    bool bridge = true;
    for(int j = 0; j < n; j++){
      if(!visited[j]) bridge = false;
    }
    if(!bridge) ans++;
    g[a[i]][b[i]] = true;
    g[b[i]][a[i]] = true;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{

    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int X, Y, Z;

        public static void Input()
        {
            var cin = new Solve();
            var input = cin.SplitReader();

            X = input[0];
            Y = input[1];
            Z = input[2];
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            Console.WriteLine((X - Z) / (Y + Z));

            //Console.Out.Flush();
        }

        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }
}

    



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

#define P pair<int, ll>

int main(){
  int X,Y,Z,K;cin>>X>>Y>>Z>>K;
  vll A(X),B(Y),C(Z);
  rep(i,X)cin>>A[i];
  rep(i,Y)cin>>B[i];
  rep(i,Z)cin>>C[i];
  vll bc(1001000,0);
  rep(i,Y)rep(j,Z){
    bc[i*1000+j] = B[i] + C[j];
  }
  sort(all(bc),greater<ll>());
  sort(all(A),greater<ll>());
  auto compare = [&](auto const& a,auto const& b){ return a.second < b.second;};
  priority_queue <P, vector<P>, decltype(compare)> pos_sum{compare};
  rep(i,X){
    int pos = 0;
    ll sum = A[i] + bc[0];
    pos_sum.push(make_pair(pos,sum));
  }
  rep(i,K){
    P p = pos_sum.top();pos_sum.pop();
    cout << p.second << endl;
    if(p.first >= Y * Z) continue;
    p.first += 1;
    p.second -= bc[p.first - 1] - bc[p.first];
    pos_sum.push(make_pair(p.first, p.second));
  }
}

Measured memory_bytes: 8192