akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int n;
int p[23456];
map<int, int>dict;

int main(void)
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", p + i);
		dict[p[i] - 1] = i;
	}
	for (int i = 0; i < n; ++i)
	{
		printf("%d",i * 23456 + 1);
		if (i != n - 1)printf(" ");
	}
	printf("\n");
	for (int i = 0; i < n; ++i)
	{
		printf("%d", (n - 1 - i) * 23456 + 1 + dict[i]);
		if (i != n - 1)printf(" ");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define hell  1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb   push_back

int main()
{
	ios;
	ll n,m,sum=0;
	cin>>n>>m;
	ll arr[m+10];
	for(ll i=0;i<m;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
	}	
	if(sum>n)cout<<"-1";
	else cout<<n-sum;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
 
vector<int> pa[100005];
int dp[100005];
 
int dfs(int a){
  if(dp[a]>=0) return dp[a];
  if(pa[a].size()==0) return dp[a]=0;
  int ans=0;
  rep(i,pa[a].size()){
    ans=max(ans,dfs(pa[a][i])+1);
  }
  return dp[a]=ans;
}
 
int main(){
  int n,m; cin >> n >> m;
  rep(i,m){
    int x,y; cin >> x >> y;
    pa[x].push_back(y);
  }
  rep(i,n+1){
    dp[i]=-1;
  }
  int ac=0;
  for(int i=1; i<=n; i++) ac=max(ac,dfs(i));
  cout << ac << endl;
return 0;
}

Measured memory_bytes: 8192
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
double Cross(pair<double, double> a, pair<double, double> b){
	return a.first*b.second - a.second*b.first;
}

int main() {
	int n;
	int count = 1;
	while (cin >> n, n){
		double ans=0.0;
		vector<pair<double, double>> pos(n);
		REP(i,n){
			cin >> pos[i].first >> pos[i].second;
		}
		REP(i,n){
			ans += Cross(pos[i], pos[(i + 1 + n) % n]) / 2.0;
		}
		printf("%d %.1f\n", count, -ans);
		count++;
	}
}

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

int main(){
    int n, d;
    cin >> n >> d;
    int score = 0;
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        score += max(0, x-d);
    }
    if(score == 0)  cout << "kusoge" << endl;
    else            cout << score << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,Y,t=0;
    cin >> N >> Y;
    for (int i=0;i<N+1;i++){
        for (int I=0;I<N-i+1;I++){
            if (i*10000+I*5000+(N-i-I)*1000==Y) {
                t=1;cout << i << " " << I << " " << N-i-I << endl;break;
            }
            
        }
        if (t==1) break;
    }
    if (t==0) cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
main(z,Z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
for(A=99999999,f=i=0;!f;i++)
	for(j=0;j<=i;j++)
		if(z=a*j-b*(i-j),(Z=a*j+b*(i-j))==c||z==c||z==-c)
			if(f=1,A>Z)A=Z,X=j,Y=i-j;
exit(0);}

Measured memory_bytes: 600
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		PriorityQueue<Path> queue = new PriorityQueue<>();
		for (int i = 0; i < m; i++) {
		    queue.add(new Path(sc.nextInt(), sc.nextInt(), sc.nextInt()));
		}
		UnionFindTree uft = new UnionFindTree(n);
		long total = 0;
	    while (queue.size() > 0) {
	        Path p = queue.poll();
	        if (!uft.same(p)) {
	            total += p.value;
	            uft.unite(p);
	        }
	    }
		System.out.println(total);
	}
	
	static class UnionFindTree {
	    int[] parents;
	    
	    public UnionFindTree(int size) {
	        parents = new int[size];
	        for (int i = 0; i < size; i++) {
	            parents[i] = i;
	        }
	    }
	    
	    public int find(int x) {
	        if (parents[x] == x) {
	            return x;
	        } else {
	            return parents[x] = find(parents[x]);
	        }
	    }
	    
	    public boolean same(int x, int y) {
	        return find(x) == find(y);
	    }
	    
	    public boolean same(Path p) {
	        return same(p.left, p.right);
	    }
	    
	    public void unite(int x, int y) {
	        if (!same(x, y)) {
	            parents[find(x)] = find(y);
	        }
	    }
	    
	    public void unite(Path p) {
	        unite(p.left, p.right);
	    }
	}
	
	static class Path implements Comparable<Path> {
	    int left;
	    int right;
	    int value;
	    
	    public Path(int left, int right, int value) {
	        this.left = left;
	        this.right = right;
	        this.value = value;
	    }
	    
	    public int compareTo(Path another) {
	        return value - another.value;
	    }
	}
}



Measured memory_bytes: 105220
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {

	int w;
	int n;
	int number[30] = {0};
	int kari;
	int a, b;
	char c;

	cin >> w;
	cin >> n;

	for(int i = 0; i < w; i++) {
		number[i] = i + 1;
	}

	for(int i = 0; i < n; i++) {
		cin >> a >> c >> b;
		kari = number[a-1];
		number[a-1] = number[b-1];
		number[b-1] = kari;
	}

	for(int i = 0; i < w; i++) {
		printf("%d\n", number[i]);
	}

	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MOD = 1e9+7;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<ll>> dp(n+1, vector<ll>(2));
  dp[0][0] = 1;
  rep(i, n) rep(j, 2) {
    dp[i][j] %= MOD;
    if (j)
      dp[i+1][1] += dp[i][j]*3;
    else {
      if (s[i] == '1') {
        dp[i+1][0] += dp[i][j]*2;
        dp[i+1][1] += dp[i][j];
      } else
        dp[i+1][0] += dp[i][j];
    }
  }
  int ans = (dp[n][0]+dp[n][1])%MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8744
#include<stdio.h>

#define N 100
#define INF 99999999
#define NIL 0;
void dijkstra(int n,int w[N][N],int r){
  int v,i,u,mincost;
  int d[n];
  int pi[n];
  char color[n];

  for(v=0;v<n;v++){
    d[v]=INF;
    pi[v]=NIL;
    color[v]='W';
  }
  d[r]=0;
  while(1){
    mincost=INF;
    for(i=0;i<n;i++){

      if (color[i] != 'B' && d[i] < mincost){
        mincost = d[i];
        u = i;
      }
    }
    if (mincost == INF)
      break;
    color[u] = 'B';
    for(v=0;v<n;v++){
      if (color[v] != 'B' && d[u] + w[u][v] < d[v]&&w[u][v]!=-1){
        pi[v] = u;
        d[v] = d[u] + w[u][v];
      }
    }
  }

  for(i=0;i<n;i++)
    printf("%d %d\n",i,d[i]);
  return;
}

int main(){
  int n;
  int i,j;
  int a[N][N];
  int k;
  int t;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      a[i][j]=-1;
    }
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&t);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&t);
      scanf("%d",&a[i][t]);
    }
  }
  dijkstra(n,a,0);
  return 0;
}


Measured memory_bytes: 2056
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
a, b = map(int, input().split())

print(a//b, a%b, "{:.5f}".format(a/b))






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

int a[405];
long long dp[405][405];
long long p[405];

long long rek(int l, int r){
    if(l == r)
        return 0;
    if(dp[l][r])
        return dp[l][r];

    long long rz = LLONG_MAX;
    for(int k = l + 1; k <= r; ++k){
        rz = min(rz, rek(l, k - 1) + rek(k, r) + p[r] - (l ? p[l - 1] : 0));
    }

    return dp[l][r] = rz;
}

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        if(i)
            p[i] += p[i - 1];
        p[i] += a[i];
    }

    rek(0, n - 1);
    cout << dp[0][n - 1] << "\n";
    return 0;
}


Measured memory_bytes: 1536
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

int main() {
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << (double)(w * h) / 2.0 << " ";
    if (w == x * 2 && h == y * 2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
import Control.Monad

matchAll :: String -> [String] -> Bool
matchAll _ [] = False
matchAll snum (x:xs)
   | match snum x = True
   | otherwise    = matchAll snum xs

match :: String -> String -> Bool
match [] _ = False
match snum@(_:xs) xa
   | take len snum == xa = True
   | otherwise          = match xs xa
   where len = length xa 

answer :: Int -> [String] -> Int
answer n d
  | matchAll (show n) d = answer (n+1) d
  | otherwise           = n

main = do
   [n,k] <- map (read :: String -> Int) . words <$> getLine
   d <- words <$> getLine
   putStrLn . show $ answer n d

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    
    for(int p=0;p<testcase;p++){
    double a,b=0;
    cin>>a>>b;
    if(a==1)
    cout<<"0";
    else
    {
    double x=ceil((b-1)/(a-1));
    cout<<x;}
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, A, B;
	scanf("%d %d %d", &N, &A, &B);
	if (A + B > N + 1 || B < (N + A - 1) / A) {
		printf("-1\n");
		fflush(stdout);
		return 0;
	} else if (B == 1) {
		for (i = 1; i < N; i++) printf("%d ", i);
		printf("%d\n", N);
		fflush(stdout);
		return 0;
	}
	
	int j, C = (N - A) / (B - 1) + 1, D = (N - A) % (B - 1);
	printf("%d", N - A + 1);
	for (i = 2; i <= A; i++) printf(" %d", N - A + i);
	for (j = 1; j <= D; j++) {
		for (i = 1; i <= C; i++) printf(" %d", N - A - j * C + i);
	}
	for (; j <= B - 1; j++) {
		for (i = 1; i < C; i++) printf(" %d", N - A - D * C - (j - D) * (C - 1) + i);
	}
	printf("\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 2284
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	for(int i = 1; i <= 100; i++){
		if((i * a) % b == c){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

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

using namespace std;

int main() {
    char buf[1<<11];
    scanf("%s", buf);
    string W(buf);
    transform(W.begin(), W.end(), W.begin(), [](char c)->char {
        return c |= 0x20;
    });

    int res=0;
    string T;
    for (char c; scanf("%c", &c)!=EOF;) {
        if (((c|0x20)>='a'&&(c|0x20)<='z') || c=='-' || c=='_') {
            T += c;
            continue;
        }

        if (T == "END_OF_TEXT") break;
        if (!T.length()) continue;

        transform(T.begin(), T.end(), T.begin(), [](char c)->char {
            return c |= 0x20;
        });

        if (W == T)
            ++res;

        T = "";
    }

    printf("%d\n", res);
    return 0;
}       

Measured memory_bytes: 2808
#include<bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(ll i=0;i<((ll)n);i++)
#define rep1(i,n) for(ll i=1;i<=((ll)n);i++)
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define F first
#define S second
#define maxn 100005
using namespace std;
typedef pair<long long,long long> pii;
typedef vector<pii> vii;
typedef long long ll;
ll n,m;
vii graph[maxn];
ll visited[maxn];
ll color[maxn];
void dfs(int node)
{
    for(auto i:graph[node])
    {
        if(!visited[i.F])
        {
            visited[i.F]=1;
            if(i.S%2==0) color[i.F]=color[node];
            else color[i.F]=!color[node];
            dfs(i.F);
        }
    }
}
int main()
{

  //IOS;
    while(cin>>n)
    {
      memset(visited,0,sizeof(visited));
      memset(color,0,sizeof(color));
      ll u,v,w;
      rep(i,n-1)
      {

          cin>>u>>v>>w;
          graph[u].pb(mp(v,w));
          graph[v].pb(mp(u,w));
      }
      dfs(1);
      rep1(i,n) cout<<color[i]<<"\n";

    }

}


Measured memory_bytes: 10240
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const ll INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> line(n);
	foreach(i, line)cin>>i;
	int count = 1;
	vector<bool> sorted(n, false);
	repa(i, n){
		if(line[i-1]<line[i]){
			++count;
			if(count>=k){
				sorted[i-k+1] = true;
			}
		}else{
			count = 1;
		}
	}

	set<int> s;
	int ans = !sorted[0];
	rep(i, k){
		s.insert(line[i]);
	}
	bool flag = sorted[0];
	for(int i=k;i<n;++i){
		s.insert(line[i]);
		int nmin = *s.begin();
		int nmax = *s.rbegin();
		s.erase(line[i-k]);
		if(nmin!=line[i-k]||nmax!=line[i]){
			if(sorted[i-k+1])flag=true;
			else ++ans;
		}
	}

	ans += flag;

	cout << ans << endl;


	return 0;
}


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

#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    long long M, N;
    long long *A;
    long long count = 0;
    long long whole = 0;
    double threshould;
    cin >> N >> M;
    A = new long long[N];
    for(long long i = 0;i < N;i++) {
        cin >> A[i];
        whole += A[i];
    }
    threshould = (double)whole / (4.0 * M);
    for(long long i = 0;i < N;i++) {
        if(A[i] >= threshould) count += 1;
    }
    if(count >= M) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,N;
  string S;
  cin >> N >> S >> K;
  
  for (int i = 0; i < N; i++) {
    if (S.at(i) != S.at(K-1)){
      S.at(i) = '*';
    }
  }
  cout << S << endl;
}
 

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int a[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		scanf("%d", &a[i]);
	}
	for(int i = n - 1; i >= 0; i -= 2) {
		printf("%d ", a[i]);
	}
	for(int i = n & 1; i < n; i += 2) {
		printf("%d ", a[i]);
	}
	putchar('\n');
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 2944
from sys import stdin


def ans():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S = _in[0]  # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    if S[-1] == 's':
        S += 'es'
    else:
        S += 's'
    ans = S
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S = list(_in[0])  # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    ans = 0
    if S[-1] == 's':
        S[-1] += 'es'
    else:
        S[-1] += 's'
    ans = ''.join(S)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    #main()
    ans()


Measured memory_bytes: 61984
/*input
6
4 6 0 0 3 3
0 5 6 5 0 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#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())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

int a[maxn],b[maxn];

vector<int> v;

int main()
{
	//IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>a[i];
	REP(i,n) cin>>b[i];

	int ans=0;

	REP(i,29){
		v.clear();
		REP(j,n) v.pb(a[j]&((1<<(i+1))-1));
		sort(ALL(v));

		ll cnt=0;
		REP(j,n){
			ll cur=b[j]&((1<<(i+1))-1);
			ll l=(1<<i)-cur,r=(1<<(i+1))-1-cur;
			if(l<0){
				l+=(1<<(i+1));
				r+=(1<<(i+1));
			}
			//cout<<l<<' '<<r<<'\n';
			if(r>=(1<<(i+1))){
				cnt+=v.end()-lower_bound(ALL(v),l);
				cnt+=upper_bound(ALL(v),r-(1<<(i+1)))-v.begin();
			}
			else{
				cnt+=upper_bound(ALL(v),r)-lower_bound(ALL(v),l);
			}
			//cout<<cnt<<'\n';
		}
		//cout<<i<<' '<<cnt<<'\n';
		if(cnt&1) ans|=(1<<i);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 2936
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

// n以上の最小の10の倍数
int f(int n) {
	if (n % 10 == 0) return n;
	else return (n / 10 + 1) * 10;
}

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

	int a[5];
	for (int i = 0; i < 5; i++) cin >> a[i];
	sort(a, a + 5);
	int ans = INF;

	do {
		int tmp = 0;
		for (int i = 0; i < 4; i++) tmp += f(a[i]);
		tmp += a[4];
		ans = min(ans, tmp);
	}while (next_permutation(a, a + 5));

	cout << ans << endl;

	return 0;
}

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

int main() {
	int N;
	
	cin >> N;
	
	vector <int> a(N);
	
	for(int i=0;i<N;i++){
		cin >> a.at(i);
	}
	
	int count=0;
	
	for(int i=0;i<N;i++){
		
		int j=0;
		
		while(true){
			
		if(a.at(i)%2==0){
			a.at(i)/=2;
			 count++;
		}
		
		else {
			break;
		}
		j++;
	}
}
	
	cout<<count<<endl;
	

		
		
}

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

using namespace std;

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  vector<int> v(3);
  for(int i=0;i<n;i++){
    int p;
    cin>>p;
    v[(p<=a)+(p<=b)]++;
  }
  cout<<*min_element(v.begin(),v.end())<<"\n";
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int main(){
    int r, d, x;
    cin >> r >> d >> x;
    int ans=r*x-d;
    for(int i=0;i<10;i++){
        cout << ans << endl;
        ans=r*ans-d;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

    int i;

    int a, b, c;

    int cnt = 0;

    scanf("%d %d %d", &a, &b, &c);

    for(i = a; i <= b; i++){

        if(c%i == 0){

            cnt++;

        }

    }

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

    return 0;

}

Measured memory_bytes: 596
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

int can(int k,int a,int b,int *h,int n){
  int64 cnt=0;
  int i;
  for(i=0;i<n;i++){
    if((int64)k*b>=h[i]) continue;
    int v=h[i]-k*b;
    int d=a-b;
    cnt+=(v+d-1)/d;
  }
  return cnt<=k;
}

void run(void){
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  int *h=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) scanf("%d",h+i);
  int l=0;
  int r=1000000000;
  while(r-l>1){
    int m=(l+r)/2;
    if(can(m,a,b,h,n)){
      r=m;
    } else {
      l=m;
    }
  }
  printf("%d\n",r);
  return;
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
  int n=1000 ,m ,coin=0;
  while( true ){
    cin >> m;

    if( m == 0 ){
      break;
    }
    n -= m;
    if( n >= 500 ){
      coin += n / 500;
      n %= 500;
    }
    
    if( n >= 100 ){
      coin += n / 100;
      n %= 100;
    } 
    
    if( n >= 50 ){
      coin += n / 50;
      n %= 50;
    } 
    
    if( n >= 10 ){
      coin += n / 10;
      n %= 10;
    } 
    
    if( n >= 5 ){
    coin += n / 5;
    n %= 5;
    }
    
    if( n >= 1 ){
      coin += n;
    }
  
    cout << coin << endl;
    n = 1000;
    coin = 0;
  }
}

Measured memory_bytes: 1160
from collections import deque

def bfs(start):
    queue = deque([start])
    visited = []

    while queue:
        label = queue.pop()

        #if label not in visited:
        visited.append(label)

        for v in d[label]:
            if dist[v[0]] == float("inf"):
                dist[v[0]] = dist[label] + v[1]
                queue.appendleft(v[0])

    return

n = int(input())
d = [[] for _ in range(n)]
for _ in range(n - 1):
	a, b, c = map(int, input().split())
	d[a - 1].append([b - 1, c])
	d[b - 1].append([a - 1, c])

q, k = map(int, input().split())
dist = [float("inf") for _ in range(n)] # nは頂点数
dist[k - 1] = 0

bfs(k - 1)

for _ in range(q):
	x, y = map(int, input().split())
	print(dist[x - 1] + dist[y - 1])


Measured memory_bytes: 52116
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1)
    {
        c = c-b;
        if(c<=0){cout<<"Yes"<<endl;break;}
        a = a-d;
        if(a<=0){cout<<"No"<<endl;break;}
       

    }
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int imp = int.Parse(Console.ReadLine());
            if (imp < 1200)
            {
                Console.Write("ABC");
            }
            else if (imp < 2800)
            {
                Console.Write("ARC");
            }
            else
            {
                Console.Write("AGC");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
#include<stdlib.h>

int main(){
  int s,i=0,j,x=1;
  scanf("%d",&s);
  int a[1000001]={s};

  while(x){
    a[i+1]=a[i]%2==0 ? a[i]/2 : 3*a[i]+1;
    for(j=0;j<i;j++){
      if(a[i]==a[j]){
        printf("%d\n",i+1);
        x=0;
        break;
      }
    }
    i++;
  }
  return 0;
}

Measured memory_bytes: 4096
#include<stdio.h>

int main(void){
  long long x,c=0;
  scanf("%lld",&x);
  while(x>=500){
    c+=1000;
    x-=500;
  }
  while(x>=5){
    c+=5;
    x-=5;
  }
  printf("%lld",c);
  return 0;
}


Measured memory_bytes: 1696
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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 (b<a) { a=b; return 1; } return 0; }

int main() {
	int n;
	cin >> n;
	ll ans=0;
	rep(i,n) rep(j,n) rep(k,n) {
		int t1 = i+1,t2=j+1,t3=k+1;
		int t4 = __gcd(__gcd(t1,t2), t3);
		ans += t4;
	}
	cout << ans << endl;


  return 0;
}


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


const string YES = "YES";
const string NO = "NO";
bool flags[4];

void solve(vector<long long> N){
    flags[0]=find(N.begin(),N.end(),1)!=N.end();
    flags[1]=find(N.begin(),N.end(),9)!=N.end();
    flags[2]=find(N.begin(),N.end(),7)!=N.end();
    flags[3]=find(N.begin(),N.end(),4)!=N.end();
    for(auto i:flags){
        if(i==false){
            goto no;
        }
    }
    cout<<YES<<endl;
    return;
    no:
    cout<<NO<<endl;
    return ;
}

int main(){
    vector<long long> N(4);
    for(int i = 0 ; i < 4 ; i++){
        scanf("%lld",&N[i]);
    }
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
using namespace std;


int main()
{
    int H,W,h,w;
    
    cin>>H>>W>>h>>w;
    
    cout<<H*W-h*W-w*H+h*w<<endl;
    
    
}


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

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N;
  cin >> N;
  ll sum = 0;

  rep(i, N){
    int k = i + 1;
    if (k % 5 == 0 || k % 3 == 0) continue;
    else sum += k;
  }
  
  cout << sum << endl;

}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args){

    Scanner scan = new Scanner(System.in);
    Integer k = scan.nextInt();
    String s = scan.next();

    if(s.length()<=k){
        System.out.println(s);
    } else {
        System.out.println(s.substring(0,k)+"...");     
    }  

    scan.close();
    }    
}

Measured memory_bytes: 38580
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <queue>

using namespace std ;

const int MAXN=1e5+100;

int a[MAXN];
int p[MAXN];
int n ;

int main ()
{
	int i , j , k ;
	scanf("%d",&n);
	for ( i=1 ; i<=n ; i++ ) scanf("%d",p+i);
	sort(p+1,p+n+1);
	long long res=0,ans=0;
	int flag=1;
	a[(n+1)>>1]=p[n];
	for ( k=1 , i=1 , j=n-1 ; i<j ; k++ ) 
	{
		if ( flag ) a[((n+1)>>1)-k]=p[i],a[((n+1)>>1)+k]=p[i+1],i+=2;
		else a[((n+1)>>1)-k]=p[j-1],a[((n+1)>>1)+k]=p[j],j-=2;
		flag=1-flag;
	}
	if ( ~n&1 ) a[n]=p[(n+1)>>1];
	for ( i=2 ; i<=n ; i++ ) res+=(long long)abs(a[i]-a[i-1]);
	// printf("%lld\n",res);
	flag=0;
	a[(n+1)>>1]=p[1];
	for ( k=1 , i=2 , j=n ; i<j ; k++ )
	{
		if ( flag ) a[((n+1)>>1)-k]=p[i],a[((n+1)>>1)+k]=p[i+1],i+=2;
		else a[((n+1)>>1)-k]=p[j-1],a[((n+1)>>1)+k]=p[j],j-=2;
		flag=1-flag;
	}
	if ( ~n&1 ) a[n]=p[(n+1)>>1];
	for ( i=2 ; i<=n ; i++ ) ans+=(long long)abs(a[i]-a[i-1]);
	res=max(res,ans);
	printf("%lld\n",res);
	return 0 ;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<deque>

using namespace std;

bool ok;
vector<int> A[205];
int Viz[205];
int Val[205];

void dfs(int nod, int val)
{
    Viz[nod]=val;

    for(vector<int>::iterator it=A[nod].begin(); it!=A[nod].end(); it++)
    {
        if(!Viz[*it])
            dfs(*it,-val);
        else
            if(Viz[*it]==val)
                ok=false;
    }
}


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

    int n;
    cin>>n;

    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
        {
            char c;
            cin>>c;
            if(c=='1')
                A[i].push_back(j);
        }

    ok=true;
    dfs(1,1);
    if(!ok)
        cout<<"-1\n";
    else
    {
        int rez=1;
        for(int beg=1; beg<=n; beg++)
        {
            for(int i=1; i<=n; i++)
                Val[i]=0;
            deque<int> Q;
            Q.push_back(beg);
            Val[beg]=1;

            while(!Q.empty())
            {
                int vf=Q.front();
                Q.pop_front();
                for(vector<int>::iterator it=A[vf].begin(); it!=A[vf].end(); it++)
                    if(!Val[*it])
                    {
                        Val[*it]=1+Val[vf];
                        rez=max(rez,Val[*it]);
                        Q.push_back(*it);
                    }
            }
        }
        cout<<rez<<"\n";
    }
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    unordered_set<int> st;
    int x;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        if (st.count(x)) {
            st.erase(x);
        } else {
            st.insert(x);
        }
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 4388
#include<iostream>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int len=s.length();
	int temp=0;
	for(int i=0;i<len;i++) 
	{
		if(s[0]==t[i]) {
			int x=i;
			for(int j=0;j<len;j++)
			{
				if(x==len)x=0;
				if(s[j]!=t[x]) {
					temp=0;
					break;
				}
				else temp=1;
				x++;
			}
		}
		if(temp==1)break;
	}
	if(temp==1)cout<<"Yes";
	else cout<<"No";
 } 

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
vector<pair<int,int>> E[100050];
vector<ll> dist(100050,infl);
void dfs(int u,int pre){
    for(auto v : E[u]){
        if(v.second == pre)continue;
        if(dist[v.second] > dist[u] + v.first){
            dist[v.second] = dist[u] + v.first;
            dfs(v.second,u);
        }
    }
}
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n-1;++i){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        E[a].push_back({c,b});
        E[b].push_back({c,a});
    }
    int q,k;
    cin>>q>>k;
    k--;
    dist[k] = 0ll;
    dfs(k,-1);
    for(int i=0;i<q;++i){
        int u,v;
        cin>>u>>v;
        u--;v--;
        cout << dist[u] + dist[v] << endl;
    }
    return 0;
}



Measured memory_bytes: 12800
#include<iostream>
using namespace std;
#define PI 3.141592653589

int main()
{
	int i,j,H,W;
	while(1)
	{
		cin >> H >> W ;
		if((H == 0)&& (W == 0)) break;

		for(i=0;i<H;i++)
		{
			for(j=0;j<W;j++)
			{
				if((i%2)==0)
				{
					if((j%2)==0) cout << '#' ;
					else cout << '.' ;
				}

				else
				{
					if((j%2)==0) cout << '.' ;
					else cout << '#' ;
				}
			}
			cout << endl ;
		}

		cout << endl ;

	}

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> start[301][4];
long long dp[301][301][301];
const long long MOD = 1e9+7;

bool check(int i, int v1, int v2){
    for(auto s : start[i][1]){
        if(!(v1<s && v2<s)) return false;
    }
    for(auto s : start[i][2]){
        if(!((v1<s) ^ (v2<s))) return false;
    }
    for(auto s : start[i][3]){
        if(!(v1>=s && v2>=s)) return false;
    }
    return true;
}

void add(long long&a, long long b){
    a = (a+b) % MOD;
}

void update(int i, int r, int g, int b){
    if(check(i, g, b)) add(dp[i][g][b], dp[r][g][b]);
    if(check(i, r, b)) add(dp[r][i][b], dp[r][g][b]);
    if(check(i, r, g)) add(dp[r][g][i], dp[r][g][b]);
}

int main(){
    int i, j, k, r, g, b;
    cin >> N >> M;
    for(i=0; i<M; i++){
        int l, x;
        cin >> l >> r >> x;
        start[r][x].push_back(l);
    }
    if(!check(1, 0, 0)){
        cout << 0 << endl;
        return 0;
    }
    dp[1][0][0] = 1;
    dp[0][1][0] = 1;
    dp[0][0][1] = 1;
    long long ans = 0;
    for(i=1; i<=N; i++){
        r = i-1;
        for(g=0; g<i-1; g++){
            for(b=0; b<i-1; b++){
                update(i, r, g, b);
            }
        }
        g = i-1;
        for(r=0; r<i-1; r++){
            for(b=0; b<i-1; b++){
                update(i, r, g, b);
            }
        }
        b = i-1;
        for(g=0; g<i-1; g++){
            for(r=0; r<i-1; r++){
                update(i, r, g, b);
            }
        }
    }

    r = N;
    for(g=0; g<N; g++){
        for(b=0; b<N; b++){
            add(ans, dp[r][g][b]);
        }
    }
    g = N;
    for(r=0; r<N; r++){
        for(b=0; b<N; b++){
            add(ans, dp[r][g][b]);
        }
    }
    b = N;
    for(g=0; g<N; g++){
        for(r=0; r<N; r++){
            add(ans, dp[r][g][b]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n, k, s, g, dist, ret = INT_MAX;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
        cin >> x.at(i);

    for (int i = 0; i < n - k + 1; i++)
    {
        s = x.at(i);
        g = x.at(i + k - 1);
        if (g < 0)
            dist = -s;
        else if (s < 0)
            dist = g - s + min(-s, g);
        else
            dist = g;
        ret = min(ret, dist);
    }
    cout << ret << endl;
}

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

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s ^= a[i];
  }

  for (int i = 0; i < n; i++)
    printf("%d%c", s ^ a[i], " \n"[i + 1 == n]);

  return 0;
}

Measured memory_bytes: 4024
fun main (args : Array<String>) {
	val n = readLine()!!
	val (s, t) = readLine()!!.split(" ")
	var sList : MutableList<String> = mutableListOf()
	var tList : MutableList<String> = mutableListOf()
	var result : String = ""
	for (i in s) {
		sList.add(i.toString())
	}
	for (i in t) {
		tList.add(i.toString())
	}
	for (i in 0..(n.toInt() * 2) - 1) {
		if ((i % 2) == 0) {
			result += sList[0]
			sList.removeAt(0)
		} else {
			result += tList[0]
			tList.removeAt(0)
		}
	}
	println("${result}")
}

Measured memory_bytes: 38156
n = int(input())
xy = [tuple(int(x) for x in input().split()) for _ in range(n)]

mod = (xy[0][0] + xy[0][1]) % 2
for x, y in xy:
    if (x + y) % 2 != mod:
        print(-1)
        exit()

print(33 - mod)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
    D.append(1)

print(" ".join(map(str, D)))

for x, y in xy:
    temp = []
    for d in D:
        if x >= y and x + y >= 0:
            temp.append("R")
            x -= d
        elif x < y and x + y >= 0:
            temp.append("U")
            y -= d
        elif x >= y and x + y < 0:
            temp.append("D")
            y += d
        else:
            temp.append("L")
            x += d
    print(''.join(temp))




Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> x(n + 1), y(m + 1);
	cin >> x[0] >> y[0];
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	for (int i = 1; i <= m; i++) {
		cin >> y[i];
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	if (y[0] - x[n] >= 1) {
		cout << "No War" << endl;
		return 0;
	}
	cout << "War" << 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 lint=long long;

int main(){
	lint x; cin>>x;
	lint a=100;
	for(int i=0;;i++){
		if(a>=x){
			printf("%d\n",i);
			break;
		}
		a*=1.01;
	}
	return 0;
}


Measured memory_bytes: 3764
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, k = map(int, input().split())
  ds = set(input().split())
  for x in range(n, 10*n+1):
    if len(set(list(str(x))) & ds) == 0:
      print(x)
      break
    

if __name__=='__main__':
  main()



Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

ll n;
vll d; 

ll f(ll a, ll b){
  return min(abs(a-b),24-abs(a-b));
}  

void solve(){
 cin >> n;
 d.resize(n);
 rep(i,0,n) cin >> d[i];
 ++n;
 d.eb(0);
 sort(all(d));
 rep(i,0,n) if(i%2) d[i]=24-d[i]; 
 sort(all(d)); 
  
 ll res=f(d[0],d.back());
 rep(i,0,n-1) chmin(res,f(d[i],d[i+1])); 
  
 cout << res << endl; 
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

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

int main(){
    string s,t,u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if (s == u){
        a--;
    } else {
        b--;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int X, Y, Z, temp;
    cin>>X>>Y>>Z;
    temp = X;
    X = Y;
    Y = temp;
    temp = Z;
    Z = X;
    X = temp;

    cout<<X<<" "<<Y<<" "<<Z<<endl;

    return 0;

}

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

#define ll long long
#define fi first
#define sec second

ll n,m,k,x,x2,y,y2,sol=0,rep,cnt,sad;
char c;
string s;
vector <ll> V;

int main()
{
    cin >> x;
    cout << x+x*x+x*x*x;
}



Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

template<typename t1, class t2>
void input(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cin >> array[i];
	}
}

template<typename t1, class t2>
void output(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cout << array[i];
		if(i != count - 1) cout << " ";
	}
	cout << endl;
}

int n,s[100000],t[50000],q,c;

bool exists(int x) {
	unsigned int m[2] = {0,(unsigned)n};
	unsigned int w;
	while(m[0] ^ m[1]) {
		w = (m[0] + m[1]) >> 1;
		if(s[w] > x) m[1] = w;
		else if(s[w] < x) m[0] = w + 1;
		else return true;
	}
	return false;
}

int main(int argc,char** argv) {
	cin >> n;
	input(n,s);
	cin >> q;
	input(q,t);
	for(int i = 0;i < q;i++) {
		if(exists(t[i]))c++;
	}
	cout << c << endl;
}



Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T, class F>
T LowerBound(T i0, T i1, F f) {
    while (i0 < i1) {
        T i = i0 + (i1 - i0) / 2;
        if (f(i)) i1 = i; else i0 = i + 1;
    }
    return i0;
}

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

    int n;
    cin >> n;

    ll k;
    cin >> k;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    auto x = LowerBound<ll>(-(1LL << 60), 1LL << 60, [&](auto x) {
        ll s = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] < 0) {
                s += LowerBound<int>(0, n, [&](auto j) {
                    return (ll)a[i] * a[n - 1 - j] > x;
                });
            } else {
                s += LowerBound<int>(0, n, [&](auto j) {
                    return (ll)a[i] * a[j] > x;
                });
            }
            if ((ll)a[i] * a[i] <= x) s--;
        }
        return s / 2 >= k;
    });

    cout << x << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
	string S;
	cin >> S;
	int z = 0, o = 0;
	for (size_t i = 0; i < S.size(); i++)
	{
		if (S.at(i) == '0')
		{
			z++;
		}
		else o++;
	}
	cout << min(o, z) * 2;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define f(a, n) for (int a=0; a<n; a++)
#define F(a, n) for (int a=1; a<=n; a++)
using namespace std;
/*
query 10 digit numbers
But 1xxxxxxxx will always be smaller. (yes)
query 1e10. Determine if it starts with 1.
If not, 
*/

struct node{
	int par1=-1, par2=-1, d1=0, d2=0;
	vector<int> nei;
};

node T[100005];
int n, x, y;
void dfs1(int nd, int d){
	T[nd].d1=d;
	for (int x: T[nd].nei) if(x!=T[nd].par1){
		T[x].par1=nd;
		dfs1(x, d+1);
	}
}
void dfs2(int nd, int d){
	T[nd].d2=d;
	for (int x: T[nd].nei) if(x!=T[nd].par2){
		T[x].par2=nd;
		dfs2(x, d+1);
	}
}

int main() {
	cin.tie(NULL);
	ios::sync_with_stdio(0);
	cin>>n;
	F(i, n-1) {
		cin>>x>>y;
		T[x].nei.push_back(y);
		T[y].nei.push_back(x);
	}
	int count = 0;
	dfs1(1, 0);
	dfs2(n, 0);
	F(i, n) if (T[i].d1<=T[i].d2) count++; else count--;
	if (count<=0) cout<<"Snuke"<<endl; else cout<<"Fennec"<<endl;
	
	
}




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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		int n, m;
		cin >> n >> m;
		vector<int> p(m, 0);
		vector<string> s(m);
		for(int i=0; i < m; i++)cin >> p[i] >> s[i];
		vector<int> tr(n+1, 0);
		int ac = 0, wa = 0;
		for(int i=0; i < m; i++){
			if(s[i] == "AC"){
				if(tr[p[i]]!=-1){
					wa += tr[p[i]];
					ac++;
					tr[p[i]] = -1;
				}
			}else if(s[i] == "WA"){
				if(tr[p[i]] != -1){
					tr[p[i]]++;
				}
			}
		}
		cout << ac << " " << wa << "\n";
		
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>

using namespace std;

int main(){
    int n;
    string a;
    cin>>n>>a;

    int count=0;

    for(int i=0;i<a.length()-2;i++){
        if(a[i]=='A' && a[i+1]=='B' && a[i+2]=='C') count++;
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e6;
const ll mod=1e9+7;
vector<pair<ll,ll> >v;
map<pair<ll,ll> ,bool>visited;
set<ll>s[10];
bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,x;
    cin>>n;
    ll arr[n+5];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    ll dp[n+5];
    ll ans=1e16,a,b;
    dp[1]=0;
    dp[2]=abs(arr[1]-arr[2]);
    for(int i=3;i<=n;i++){
            a=abs(arr[i-1]-arr[i]);
    b=abs(arr[i-2]-arr[i]);
        dp[i]=min(a+dp[i-1],b+dp[i-2]);
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1792