akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Factoring by trial split
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l

def main():
  n=I()
  l=getPrimeList(n)

  mn=len(str(n))
  for i in range(2**len(l)):
    a=n
    b=1
    for j in range(len(l)):
      if ((i>>j)&1):
        a//=l[j]
        b*=l[j]
    mn=min(mn,max(len(str(a)),len(str(b))))

  return mn

# main()
print(main())


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



int main() {
  string S;
  cin >> S;
  int ans = 0;
  int count = 0;
  int gg = 0;
   
  rep(i,S.size()){
      if(S.at(i) == 'A' || S.at(i) == 'C' ||  S.at(i) == 'G' ||  S.at(i) == 'T'){
        ans++;
        if(count <= ans){
            count = ans;
            gg = ans;
        }
      }else{
        ans = 0;
      }
  }
  if(gg == 0){
      cout << 0 << endl;
  }else{
      cout << gg << endl;
  }

}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end



int main(){
   int n; scanf("%d",&n);
   int res=inf;
   rep(a,1,n){
      int b=n-a;
      string s,t; tostr(a,s); tostr(b,t);
      int sub=0;
      rep(i,0,s.size())sub+=(s[i]-'0');
      rep(i,0,t.size())sub+=(t[i]-'0');
      chmin(res,sub);
   } cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    x = [0] * N
    y = [0] * N

    for i in range(N):
        x[i], y[i] = map(int, input().split())

    ans = float('inf')
    for i in range(N):
        for j in range(N):
            for k in range(N):
                for l in range(N):
                    if x[i] < x[j] and y[k] < y[l]:
                        cnt = 0
                        lx = x[i]
                        rx = x[j]
                        by = y[k]
                        uy = y[l]

                        for n in range(N):
                            if lx <= x[n] and x[n] <= rx and by <= y[n] and y[n] <= uy:
                                cnt += 1

                        if cnt >= K:
                            ans = min(ans, (rx - lx) * (uy - by))

    print(ans)

main()

Measured memory_bytes: 45036
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int H,W;
    cin >> H >> W;
    char S[H][W];
    rep(i,H) cin >> S[i];
    rep(i,H+2){
        rep(j,W+2){
            if(i<1 || i>H || j<1 || j>W) cout << '#';
            else cout << S[i-1][j-1];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    ll N,K;
    cin >> N >> K;
    ll ans = K;
    rep(i,1,N){
        ans *= K - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*AOJ-ITP-2-2*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		
		if(!(a >= 0 || b >= 0 || c >= 0 || a <= 100 || b <= 100 || c <= 100)){System.exit(1);}
		
		if(a < b && b < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
	}
}

Measured memory_bytes: 24392
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};

bool between(ll a, ll b, ll x){
    if(a > b) return b <= x && x <= a;
    else return a <= x && x <= b;
}

int main(){
    ll n,K; cin >> n >> K;
    vpl p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    ll ans = linf;
    rep(i,n){
        REP(j,i+1,n){
            REP(k,j+1,n){
                REP(l,k+1,n){
                    ll cnt = 0;
                    ll x = min({p[i].first,p[j].first,p[k].first,p[l].first});
                    ll X = max({p[i].first,p[j].first,p[k].first,p[l].first});
                    ll y = min({p[i].second,p[j].second,p[k].second,p[l].second});
                    ll Y = max({p[i].second,p[j].second,p[k].second,p[l].second});
                    rep(m,n){
                        if(between(x,X,p[m].first) && between(y,Y,p[m].second)) cnt++;
                    }
                    if(cnt >= K) ans = min(ans, (X-x)*(Y-y));
                }
            }
        }
    }
    rep(i,n){
        REP(j,i+1,n){
            REP(k,j+1,n){
            ll cnt = 0;
            ll x = min({p[i].first,p[j].first,p[k].first});
            ll X = max({p[i].first,p[j].first,p[k].first});
            ll y = min({p[i].second,p[j].second,p[k].second});
                ll Y = max({p[i].second,p[j].second,p[k].second});
                rep(m,n){
                    if(between(x,X,p[m].first) && between(y,Y,p[m].second)) cnt++;
                }
                if(cnt >= K) ans = min(ans, (X-x)*(Y-y));
            }
        }
    }
    rep(i,n) {
        REP(j, i + 1, n) {
            ll cnt = 0;
            ll x = min(p[i].first, p[j].first);
            ll X = max(p[i].first, p[j].first);
            ll y = min(p[i].second, p[j].second);
            ll Y = max(p[i].second, p[j].second);
            rep(m, n) {
                if (between(x, X, p[m].first) && between(y, Y, p[m].second)) cnt++;
            }
            if (cnt >= K) ans = min(ans, (X - x) * (Y - y));
        }
    }
    cout << ans << endl;
}


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

int a[100000];
int main()
{
	int N;
	int i = 1;
	int j =0;
	int ini = 1;
	int flag = 0;
	cin>>N;
	int k = N;

	while(k--)
	{
		cin>>a[i++]; 
	}

	do{
		j++;
		if(a[ini]==2)
		{
			flag=1;
		}
		else
			ini = a[ini];
	
	}while(j<=N&&flag==0);
	if(flag==0)
		cout<<-1<<endl;
	else
		cout<<j<<endl;
	return 0;
}

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

int main(){ 
	long long a,b;
	long long ans=0;
	scanf("%lld%lld",&a,&b);
	if(a==1&&b==1)ans=1;
	else if(a==1||b==1)ans=a*b-2;
	else ans=(a-2)*(b-2);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<list>
#include<iostream>
#include<iterator>

using namespace std;

int main(){
    int q,ope,tmp,cursor=0;

    list<int>::iterator it;
    list<int>::iterator a;
    list<int> l;
    it=l.begin();
    
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>ope;
        if(ope==0){
            cin>>tmp;
            l.insert(it,tmp);
            it=next(it,-1);
        }else if(ope==1){
            cin>>tmp;
            it=next(it,tmp);
        }else{
            it=l.erase(it);
        }

        /*
        a=l.begin();
        cout<<"[";
        for(int x:l){
            cout<<(*a)<<" ";
            a=next(a,1);
        }
        cout<<"]\n";
        */
    }

    //cout<<"-------------\n";

    a=l.begin();
    for(int x:l){
        cout<<(*a)<<"\n";
        a=next(a,1);
    }
    return 0;
}



Measured memory_bytes: 18624
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PP;

struct S{
    int val, a, b, c;
    bool operator<(const S &s) const{
        return val < s.val;
    }
};

struct T{
    int a, b, c;
};

signed main(){
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<int> a(x), b(y), c(z);
    for(int i = 0; i < x; i++) cin >> a[i];
    for(int i = 0; i < y; i++) cin >> b[i];
    for(int i = 0; i < z; i++) cin >> c[i];
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    sort(c.rbegin(), c.rend());
    priority_queue<S> pq;
    set<PP> st;
    pq.push({a[0] + b[0] + c[0], 0, 0, 0});
    st.insert(PP(P(0, 0), 0));
    for(int i = 0; i < k; i++){
        S t = pq.top(); pq.pop();
        cout << t.val << endl;
        // cout << t.a << ' ' << t.b << ' ' << t.c << endl;
        if(t.a < x - 1){
            if(!st.count(PP(P(t.a + 1, t.b), t.c))){
                pq.push({a[t.a + 1] + b[t.b] + c[t.c], t.a + 1, t.b, t.c});
                st.insert(PP(P(t.a + 1, t.b), t.c));
            }
        }
        if(t.b < y - 1){
            if(!st.count(PP(P(t.a, t.b + 1), t.c))){
                pq.push({a[t.a] + b[t.b + 1] + c[t.c], t.a, t.b + 1, t.c});
                st.insert(PP(P(t.a, t.b + 1), t.c));
            }
        }
        if(t.c < z - 1){
            if(!st.count(PP(P(t.a, t.b), t.c + 1))){
                pq.push({a[t.a] + b[t.b] + c[t.c + 1], t.a, t.b, t.c + 1});
                st.insert(PP(P(t.a, t.b), t.c + 1));
            }
        }
    }
}

Measured memory_bytes: 896
def main():
  n, = map(int, input().split())
  aa = list(map(int, input().split()))
  
  res_max = 10 ** 18
  
  if any(a == 0 for a in aa):
    print(0)
    exit()

  res = 1
  for a in aa:
    res *= a
    if res > res_max:
      res = -1
      break
  
  print(res)
    


if __name__ == "__main__":
  main()


Measured memory_bytes: 84724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    ll m;
    cin >> m;
    cout << m * m;
}


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

class DSU {
	int n;
	public:
	vector< int > parent;
	vector< int > size;
	int nCC;
	DSU (int len) {
		n = len;
		init();
		nCC = n;
	}
	void init () {
		size.assign(n, 1);
		parent.resize(n);
		for (int i=0; i<n; i++) {
			parent[i] = i;
		}
	}
	int find_set (int v) {
		if (v == parent[v]) return v;
		return parent[v] = find_set(parent[v]);
	}
	void union_sets (int a, int b) {
		a = find_set(a);
		b = find_set(b);
		if (a != b) {
			if (size[a] < size[b]) swap(a,b);
			parent[b] = a;
			size[a] += size[b];
			--nCC;
		}
	}
};
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	DSU d1(n);
	for (int i=0; i<m; i++) {
		int u,v;
		cin >> u >> v;
		--u,--v;
		d1.union_sets(u,v);
	}
	
	int ans = 1;
	for (int i=0; i<n; i++) {
		ans = max(ans,d1.size[i]);
	}
	cout << ans << '\n';

	
	return 0;
}




Measured memory_bytes: 4768
N,M=map(int,input().split())
p=list(map(int,input().split()))
par=[i for i in range(N)]
 
def find(x):
  if par[x]==x:
    return par[x]
  else:
    par[x]=find(par[x])
    return par[x]

def union(x,y):
  fx=find(x)
  fy=find(y)
  if fx!=fy:
    par[fx]=fy

f=lambda x:int(x)-1
for _ in range(M):
  x,y=map(f,input().split())
  union(x,y)

ans=0
for i in range(N):
  if find(p[i]-1)==find(i):
    ans+=1
print(ans)

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

using namespace std;

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

    vector<pair<int, int>> serial(n);

    for (int i = 0; i < n; i++)
    {
        cin >> serial[i].first;
        serial[i].second = i + 1;
    }

    sort(serial.begin(), serial.end());

    for (auto students : serial)
        cout << students.second << " ";

    cout << endl;
    return 0;
}

Measured memory_bytes: 3992
import java.util.*;

public class Main {
	static final long all = (long)1e15;
	static int n,m,s,t;
	static int u[],v[],a[],b[],first[],next[];
	static boolean vis[];
	static long yen[],snuuk[],cost[],mincost = all;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		m = in.nextInt();
		s = in.nextInt();
		t = in.nextInt();
		u = new int[m * 2 + 1];
		v = new int[m * 2 + 1];
		a = new int[m * 2 + 1];
		b = new int[m * 2 + 1];
		first = new int[m * 2 + 1];
	    next = new int[m * 2 + 1];
	    vis = new boolean[n + 1];
	    yen = new long[n + 1];
	    snuuk = new long[n + 1];
	    cost = new long[n + 1];
	    Arrays.fill(first, -1);
	    Arrays.fill(yen,all);
	    Arrays.fill(snuuk, all);
	    for(int i = 0;i < m;i ++) {
	    	u[i] = in.nextInt();
	    	v[i] = in.nextInt();
	    	a[i] = in.nextInt();
	    	b[i] = in.nextInt();
	    	u[i + m] = v[i];
	    	v[i + m] = u[i];
	    	a[i + m] = a[i];
	    	b[i + m] = b[i];
	    	next[i] = first[u[i]];
	    	first[u[i]] = i;
	    	next[i + m] = first[u[i + m]];
	    	first[u[i + m]] = i + m;
	    }
	    yen[s] = 0;
	    int head = 0,tail = 0;
	    int queue[] = new int[n];
	    queue[tail ++] = s;
	    vis[s] = true;
	    while(head != tail) {
	    	int k = first[queue[head]];
	    	while(k != -1) {
	    		if(yen[u[k]] + a[k] < yen[v[k]]) {
	    			yen[v[k]] = yen[u[k]] + a[k];
	    			if(!vis[v[k]]) {
	    				queue[tail] = v[k];
	    			    vis[v[k]] = true;
	    			    tail = (tail + 1) % n;
	    			}
	    		}
	    		k = next[k];
	    	}
	    	vis[queue[head]] = false;
	    	head = (head + 1) % n;
	    }
	    snuuk[t] = 0;
	    head = tail = 0;
	    queue[tail ++] = t;
	    vis[t] = true;
	    while(head != tail) {
	    	int k = first[queue[head]];
	    	while(k != -1) {
	    		if(snuuk[u[k]] + b[k] < snuuk[v[k]]) {
	    			snuuk[v[k]] = snuuk[u[k]] + b[k];
	    			if(!vis[v[k]]) {
	    				queue[tail] = v[k];
	    			    vis[v[k]] = true;
	    			    tail = (tail + 1) % n;
	    			}
	    		}
	    		k = next[k];
	    	}
	    	vis[queue[head]] = false;
	    	head = (head + 1) % n;
	    }
	    for(int i = n;i > 0;i --) {
	    	cost[i] = Math.min(mincost, yen[i] + snuuk[i]);
	    	mincost = Math.min(mincost, cost[i]);
	    	cost[i] = all - cost[i];
	    }
	    for(int i = 1;i <= n;i ++) {
	    	System.out.println(cost[i]);
	    }
	}
}


Measured memory_bytes: 134636
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

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

  ll n, m;
  cin >> n >> m;
  vector<pll> p(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(), p.end());
  ll ans = 0;
  ll i = 0;
  while (m > 0)
  {
    ll reduce = min(m, p[i].second);
    ans += reduce * p[i].first;
    m -= p[i].second;
    i++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 1792
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:String,
    }
    let a=a.chars().collect_vec();
    for i in 1..a.len() {
        if a[i-1]=='A'&&a[i]=='C'{println!("Yes");exit(0)}
    }
    println!("No")
}

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

int main()
{
	int n;
	scanf("%d",&n);
	while(n-->0)
	{
		char a[8];
		int score=0,base=0,out=0;
		while(out<3)
		{
			scanf("%s",&a);
			if(!strcmp(a,"HIT"))
			{
				if(base!=0)
				{
					if(((base<<=1)&8)==8)
						{
							score+=1;
							base&=7;
						}
				}
				base+=1;
			}
			else if(!strcmp(a,"HOMERUN"))
			{
				score+=1;
				while(base!=0)
				{
					score+=1;
					base>>=1;
				}
			}
			else
				out++;
		}
		printf("%d\n",score);
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    long long S,A;
    S = A = 0;
    vector<long long> a(N);
    for(int i = 0; i < N; i++){
        cin >> a[i];
        if(i != N-1) S += a[i];
        else A = a[N-1];
    }
    reverse(a.begin(),a.end());
    long long Min = abs(S-A);
    for(int i = 1; i < N-1; i++){
        S -= a[i];
        A += a[i];
        Min = min(Min,abs(S-A));
    }
    cout << Min << endl;
}

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

int main() {
	int A, B;
	cin >> A >> B;
  	
	for(double i = 1; i <= 1200; i++){
      if( floor(i/100*8) == A && floor(i/100*10) == B){
        cout << i << endl;
        return 0;
      }
    }
	cout << -1 << endl;
}


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

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

    int n[26] = {};
    for(int i = 0; i < s.length(); i++) n[s[i]-'a']++;
    
    for(int i = 0; i < 26; i++){
        if(n[i] == 0){
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll x;
    cin >> x;
    cout << 1 - x << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<long long> a(n);
    long long cnt = 0;
    for (int i = 0;i < n;i++){
        cin >> a[i];
        cnt += a[i];
    }
    long long rep = cnt,ans = cnt,num = 0;
    long long ans_1 = 0,ans_2;
    for (int i = 0;i < n;i++){
        rep = rep - a[i];
        num += a[i];
        if (ans > max(rep,num)-min(rep,num)){
            ans = max(rep,num)-min(rep,num);
            ans_1 = rep;
            ans_2 = num;
        }
    }

    if (ans_1 == ans_2) cout << 0 << endl;
    else cout << max(ans_1,ans_2) - min(ans_1,ans_2) << endl; 
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long llong;
int main(){
    string s, t;
    cin >> s >> t;
    string ans = t + s;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const double PI = acos(-1.0);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    vector<ll> H(N+1);
    rep(i,N) cin >> H[i+1];

    vector<vector<ll>> dp(N+1, vector<ll>(N-K+1,1e18));
    dp[0][0] = 0;
    rep(i,N) {
        rep(j,N-K) {
            rep(k,i+1) {
                chmin(dp[i+1][j+1],dp[k][j] + max(0LL,H[i+1]-H[k]));
            }
        }
    }
    ll ans = 1e18;
    rep(i,N+1) chmin(ans,dp[i][N-K]);
    cout << ans << ln;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)

int n, m, a[10005], dp[10005], p, s, ans;
int main(){
    cin >> n >> m;
    fox1(l, n){cin >> a[l]; a[l]=-a[l];}
    sort(a+1, a+n+1);
    fox1(l, n) a[l]+=a[l-1];
    flood(dp); dp[0]=0;
    fox(l, m){
        cin >> s >> p;
        foxr(l2, n){
            dp[min(n, l2+s)]=min(dp[min(n, l2+s)], dp[l2]+p);
        }
    }
    fox1(l, n){
        //cout << a[l] << ' ' << dp[l] << endl;
        ans=max(ans, -a[l]-dp[l]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3232
function Main(s){
	s=s.split(/\n/);
	s[0]|=0;
	var arr=[];
	var we=0;
	for(var i=s[0]-1;i>=0;i=(i-1)|0){
		arr[i]=we;
		if(s[1][i]=="W"){we++;}
	}
	
	we=0;
	var a=1<<29;
	for(var i=0;i<s[0];i=(i+1)|0){
		arr[i]+=we;
		if(s[1][i]=="E"){we++;}
		if(a>s[0]-arr[i]-1){a=s[0]-arr[i]-1;}
	}
	console.log(a);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
n=gets.chomp.to_i
a=gets.split.map(&:to_i)

b=[]
n.times do |i|
  if (i+n)%2==0
    b.push(a[i])
  else
    b.unshift(a[i])
  end
end

puts b.join(' ')

# 6 4 2 1 3 5
# 7 5 3 1 2 4 6

Measured memory_bytes: 27488
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;

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

	int n;
	cin >> n;
	int* ans = new int[n];
	memset(ans, 0, sizeof(int)*n);
	int a;
	rep(i, n-1) {
		cin >> a;

		++ans[a - 1];
	}

	rep(i, n) {
		cout << ans[i] << "\n";
	}

	return 0;
}


Measured memory_bytes: 4424
use std::io::stdin;
use std::str::FromStr;

fn read_2taple<T: FromStr>() -> (T, T) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let mut iter = buf
        .trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap());
    (iter.next().unwrap(), iter.next().unwrap())
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

use std::collections::BinaryHeap;
fn main() {
    let (_n, k) = read_2taple::<u32>();
    let l: Vec<u32> = read_vec();
    let mut heap = BinaryHeap::from(l);
    let ans = (0..k).fold(0, |ans, _| ans + heap.pop().unwrap());
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
#define repi(i,a,b) for(lint i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) tsort(v); reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif

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() {
cin.tie(0);
ios::sync_with_stdio(0);

    lint n,in,s=0;cin>>n;
    vector<lint>a;
    rep(i,n){
        cin>>in;
        s+=in;
        if(in%10)a.push_back(in);
    }
    tsort(a);
    if(s%10)co(s);
    else if(!siz(a))co(0);
    else co(s-a[0]);
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

template<class T> bool ckmin(T& a, const T& b) {return b < a ? a = b, 1 : 0;}
template<class T> bool ckmax(T& a, const T& b) {return a < b ? a = b, 1 : 0;}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

int main() { FAST
    string s; cin >> s;
    ll val = 0;
    M00(i, sz(s)) val += s[i]-'0';
    if(val%9 == 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}



Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    string s;
    cin >> s;
    int a[4] = {};
    for (int i = 0; i < s.size(); ++i) {
        if(s[i] == 'N') a[0]++;
        if(s[i] == 'S') a[1]++;
        if(s[i] == 'E') a[2]++;
        if(s[i] == 'W') a[3]++;
    }
    int flg = 0;
    if(!a[0] && !a[1] && a[2] && a[3]) flg = 1;
    if(a[0] && a[1] && !a[2] && !a[3]) flg = 1;
    if(a[0] && a[1] && a[2] && a[3]) flg = 1;
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
namespace TYC
{
	const int N = 2e5 + 5;
 
	int n, tot, C[N], Fa[N], M[N], R[N], Q[N][2];
	vector<int> E[N];
	struct node {  int ls, rs, v; } tr[N * 150];
 
	int add(const int p, const int x, const int w, const int l = 1, const int r = n)
	{
		int o = ++tot;
		tr[o] = tr[p];
		if (l == r)
			return tr[o].v += w, o;
		int mid = (l + r) >> 1;
		if (x <= mid)
			tr[o].ls = add(tr[p].ls, x, w, l, mid);
		else
			tr[o].rs = add(tr[p].rs, x, w, mid + 1, r);
		tr[o].v = tr[tr[o].ls].v + tr[tr[o].rs].v;
		return o;
	}
 
	int merge(const int x, const int y, const int l = 1, const int r = n)
	{
		if (!x || !y)
			return x + y;
		int o = ++tot;
		if (l != r)
		{
			int mid = (l + r) >> 1;
			tr[o].ls = merge(tr[x].ls, tr[y].ls, l, mid);
			tr[o].rs = merge(tr[x].rs, tr[y].rs, mid + 1, r);
		}
		tr[o].v = tr[x].v + tr[y].v;
		return o;
	}
 
	int del(const int p, const int v, const int l = 1, const int r = n)
	{
		if (r <= v)
			return 0;
		if (l == r)
			return p;
		int o = ++tot, mid = (l + r) >> 1;
		if (v <= mid)
		{
			tr[o].ls = del(tr[p].ls, v, l, mid);
			tr[o].rs = tr[p].rs;
		}
		else
		{
			tr[o].ls = 0;
			tr[o].rs = del(tr[p].rs, v, mid + 1, r);
		}
		tr[o].v = tr[tr[o].ls].v + tr[tr[o].rs].v;
		return o;
	}
 
	int query(const int o, const int x, const int l = 1, const int r = n)
	{
		if (!o) 
			return 0;
		if (l == r)
			return tr[o].v;
		int mid = (l + r) >> 1;
		if (x <= mid)
			return query(tr[o].ls, x, l, mid);
		else
			return tr[tr[o].ls].v + query(tr[o].rs, x, mid + 1, r);
	}
 
	void dfs(const int u, const int f)
	{
		Fa[u] = f;
		M[u] = max(M[f], f);
		for (int v : E[u])
			if (v != f)
			{
				dfs(v, u);
				R[u] = merge(R[u], R[v]);
			}
		Q[u][0] = query(R[u], M[u]) + 1;
		Q[u][1] = query(R[u], M[f]) + 1;
		int t = query(R[u], u) + 1;
		R[u] = del(R[u], u);
		R[u] = add(R[u], u, t);
	}
 
	void dfs(const int u)
	{
		if (u != 1)
			C[u] = C[Fa[u]] + Q[u][0] - (u < M[Fa[u]] ? Q[u][1] : 0);
		for (int v : E[u])
			if (v != Fa[u])
				dfs(v);
	}
 
	void work()
	{
		scanf("%d", &n);
		for (int i = 1, u, v; i < n; i++)
		{
			scanf("%d%d", &u, &v);
			E[u].push_back(v);
			E[v].push_back(u);
		}
		for (int i = 1; i <= n; i++)
			sort(E[i].begin(), E[i].end());
		dfs(1, 0);
		dfs(1);
		for (int i = 2; i <= n; i++)
			printf("%d ", C[i]);
	}
}
 
int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 141300
let () =
    let calc (x1, y1) (x2, y2) =
        sqrt (float ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)))
    in
    let main () =
        let n = int_of_string (read_line ()) in
        let xy = Array.init n (fun _ ->
            Scanf.sscanf (read_line ()) "%d %d" (fun x y -> x, y))
        in
        let rec loop_i i acc =
            let rec loop_j j acc =
                if j >= n then acc else
                    let acc = calc xy.(i) xy.(j) +. acc in
                    loop_j (j + 1) acc
            in
            if i = n then acc else
                let acc = loop_j (i + 1) acc in
                loop_i (i + 1) acc
        in
        let r = loop_i 0 0. in
        let r = r *. 2. /. float n in
        Printf.printf "%.7f\n" r
    in
    main ()

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

int DFS(vector<vector<int>>&Graph, vector<int>&DP, int node){
	if(DP[node]!=0){
		return DP[node];
	}
	int result=0;
	unsigned int i;
	for(i=0;i<Graph[node].size();i++){
		result=max(result,1+DFS(Graph,DP,Graph[node][i]));
	}
	DP[node]=result;
	//cout<<result<<endl;
	return result;
}

int main(){
	int N,M;
	cin>>N>>M;
	int i;
	vector<vector<int>>Graph(N+1);
	vector<int>DP(N+1,0);
	int x,y;
	for(i=0;i<M;i++){
		cin>>x>>y;
		Graph[x].push_back(y);
	}
	int result=0;
	for(i=1;i<=N;i++){
		result=max(result,DFS(Graph,DP,i));
	}
	cout<<result;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }

  vector<int> dep(n);

  function<void(int, int)> Dfs = [&](int x, int p) {
    for (int u : g[x]) {
      if (u == p) continue;
      dep[u] = dep[x] + 1;
      Dfs(u, x);
    }
  };

  Dfs(0, -1);
  vector<vector<int>> vl(3);
  for (int i = 1; i <= n; ++i) vl[i % 3].push_back(i);
  vector<vector<int>> nd(2);
  for (int i = 0; i < n; ++i) nd[dep[i] % 2].push_back(i);
  if (nd[0].size() > nd[1].size()) nd[0].swap(nd[1]);
  vector<int> ans(n);
  if (nd[0].size() <= vl[0].size()) {
    for (int u : nd[0]) {
      ans[u] = vl[0].back();
      vl[0].pop_back();
    }
    for (int u : nd[1]) {
      if (!vl[0].empty()) {
        ans[u] = vl[0].back();
        vl[0].pop_back();
      } else if (!vl[1].empty()) {
        ans[u] = vl[1].back();
        vl[1].pop_back();
      } else {
        ans[u] = vl[2].back();
        vl[2].pop_back();
      }
    }
  } else {
    for (int u : nd[0]) {
      if (!vl[1].empty()) {
        ans[u] = vl[1].back();
        vl[1].pop_back();
      } else {
        assert(!vl[0].empty());
        ans[u] = vl[0].back();
        vl[0].pop_back();
      }
    }
    for (int u : nd[1]) {
      if (!vl[0].empty()) {
        ans[u] = vl[0].back();
        vl[0].pop_back();
      } else if (!vl[1].empty()) {
        ans[u] = vl[1].back();
        vl[1].pop_back();
      } else {
        ans[u] = vl[2].back();
        vl[2].pop_back();
      }
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << "\n";
}


Measured memory_bytes: 24088
def pal(s):
    n = len(s)
    if len(s)==1:
        return True
    for i in range(len(s)//2):
        if s[i]!=s[n-1-i]:
            # print(s)
            return False
            # break
    else:
        return True
s = input()
n = len(s)
# print(s[:((n-1)//2)],s[(n+1)//2:])
if pal(s) and pal(s[:((n-1)//2)]) and pal(s[(n+1)//2:]):
    print("Yes")
else:
    print("No")
        

Measured memory_bytes: 38256
l = [list(list(input())) for _ in range(3)]
#print(l)
for i in range(3):
    l[i].append('#')
#print(l)

x= 0
while x>=0:
    y=l[x].pop(0)
    if y=='a':
        x=0
    elif y=='b':
        x=1
    elif y=='c':
        x=2
    else:
        if x==0:
            print('A')
            break
        elif x==1:
            print('B')
            break
        else:
            print('C')
            break

Measured memory_bytes: 3064
#include<stdio.h>
main(){

  int a,b,c,d,e,i,tmp;

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

  for(i=0 ; i<5 ; i++){
    if(b > a){
      tmp=a;
      a=b;
      b=tmp;
    }

   if(c > b){
      tmp=b;
      b=c;
      c=tmp;
    }

   if(d > c){
      tmp=c;
      c=d;
      d=tmp;
    }  

    if(e > d){
      tmp=d;
      d=e;
      e=tmp;
    }

  }

  printf("%d %d %d %d %d\n",a,b,c,d,e);

  return 0;

}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
char a,b;
int main(){
    cin>>a>>b;
    if(a=='A'&&b=='A')cout<<"="<<endl;
    if(a=='A'&&b=='B')cout<<"<"<<endl;
    if(a=='A'&&b=='C')cout<<"<"<<endl;
    if(a=='A'&&b=='D')cout<<"<"<<endl;
    if(a=='A'&&b=='E')cout<<"<"<<endl;
    if(a=='A'&&b=='F')cout<<"<"<<endl;
    if(a=='B'&&b=='A')cout<<">"<<endl;
    if(a=='B'&&b=='B')cout<<"="<<endl;
    if(a=='B'&&b=='C')cout<<"<"<<endl;
    if(a=='B'&&b=='D')cout<<"<"<<endl;
    if(a=='B'&&b=='E')cout<<"<"<<endl;
    if(a=='B'&&b=='F')cout<<"<"<<endl;
    if(a=='C'&&b=='A')cout<<">"<<endl;
    if(a=='C'&&b=='B')cout<<">"<<endl;
    if(a=='C'&&b=='C')cout<<"="<<endl;
    if(a=='C'&&b=='D')cout<<"<"<<endl;
    if(a=='C'&&b=='E')cout<<"<"<<endl;
    if(a=='C'&&b=='F')cout<<"<"<<endl;
    if(a=='D'&&b=='A')cout<<">"<<endl;
    if(a=='D'&&b=='B')cout<<">"<<endl;
    if(a=='D'&&b=='C')cout<<">"<<endl;
    if(a=='D'&&b=='D')cout<<"="<<endl;
    if(a=='D'&&b=='E')cout<<"<"<<endl;
    if(a=='D'&&b=='F')cout<<"<"<<endl;
    if(a=='E'&&b=='A')cout<<">"<<endl;
    if(a=='E'&&b=='B')cout<<">"<<endl;
    if(a=='E'&&b=='C')cout<<">"<<endl;
    if(a=='E'&&b=='D')cout<<">"<<endl;
    if(a=='E'&&b=='E')cout<<"="<<endl;
    if(a=='E'&&b=='F')cout<<"<"<<endl;
    if(a=='F'&&b=='A')cout<<">"<<endl;
    if(a=='F'&&b=='B')cout<<">"<<endl;
    if(a=='F'&&b=='C')cout<<">"<<endl;
    if(a=='F'&&b=='D')cout<<">"<<endl;
    if(a=='F'&&b=='E')cout<<">"<<endl;
    if(a=='F'&&b=='F')cout<<"="<<endl;
    return 0;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}

import Control.Monad
import Control.Monad.ST
import Data.List
import Control.Monad.Trans.State.Strict
import Data.Char (isSpace)
import Data.Maybe (fromJust,fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B

import Data.Array.ST
import Data.Array.Unboxed
type Dist s = STUArray s (Int,Int) Int

type Parser a = StateT B.ByteString Maybe a

parseInt :: Parser Int
parseInt = StateT (B.readInt . B.dropWhile isSpace)

parseInt3 :: Parser (Int,Int,Int)
parseInt3 = liftM3 (,,) parseInt parseInt parseInt

parse :: Parser ((Int,Int,Int), [(Int,Int,Int)])
parse = do
    (n,ma,mb)<-parseInt3
    abcs<-replicateM n parseInt3
    return ((n,ma,mb),abcs)

main=do
    ((n,ma,mb),abcs)<-fromJust.evalStateT parse <$> B.getContents
    let dp = fdp n abcs :: UArray (Int,Int,Int) Int
    print $ solve n ma mb dp
--
fdp n abcs = runSTUArray $ do
    dp <- newArray ((0,0,0),(n,10*n,10*n)) 5000 :: ST s (STUArray s (Int,Int,Int) Int)
    writeArray dp (0,0,0) 0
    forM_ [(ii,u,v)|ii<-zip abcs [1..n],u<-[0..10*n],v<-[0..10*n]] $ \(((a,b,c),i),u,v) ->
        if u-a>=0 && v-b>=0 then
            writeArray dp (i,u,v) =<< min <$> ((+c) <$> readArray dp (i-1,u-a,v-b)) <*> readArray dp (i-1,u,v)
        else
            writeArray dp (i,u,v) =<< readArray dp (i-1,u,v)
    return dp
--
solve n ma mb dp
    | ar < 5000 = ar
    | otherwise = -1
    where
        ca = takeWhile (\c->c*ma<=10*n && c*mb<=10*n) [1..]
        ar = minimum $ map (\c -> dp ! (n,c*ma,c*mb)) ca


Measured memory_bytes: 53244
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}


int main(){
    cin.tie(0);

    int sum = 0;
    int ma = -1;
    int N; cin >> N;
    for (int i = 0; i < N; i++){
        int p; cin >> p;
        ma = max(ma, p);
        sum += p;
    }
    cout << sum-ma/2 << endl;
}



Measured memory_bytes: 504
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
long long int modp(lld a,lld p,lld n)
{
   lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

//lld fac[100001]; 
/*
void solve2()
{
   lld p=1000000007;
    fac[0] = 1; 
    for (lld i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}
*/
lld p1=1000000007,p2=998244353;
lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,n1,a,b,n2,h,z,c;
queue<lld> q;
lld d,p=1000000000;
//vector< vector <lld > > v(100001);
/*
void bfs(lld x , vector<lld>& d)
{
    d[x]=0;
    q.pu(x);
    while(!q.empty())
    {
        x=q.front();
        q.pop();
        l=v[x].size();
        for(i=0;i<l;i++)
        {
            y=v[x][i];
            if(d[y]==INF) 
            {
                d[y] = d[x]+1;
                q.pu(y);
            }       
        }
    }

}
/*

lld DFS(lld a ,lld x)
{
    visited[a] =true;
    sub_size[a]=1;
 //   if(a==x) 
   //     cont[a] =true;
    lld l= v[a].size();
    for(lld i=0;i<l;i++)
    {
        if(visited[v[a][i]] == false)
        {
            sub_size[a]+= DFS(v[a][i],b);
//            if(cont[v[a][i]] ==true ) cont[a]=true;
        }
    }
    return sub_size[a];

}
*/

void solve()
{
    lld n;
    cin>>n;
    x=100;
    ans=0;
    for(i=0;i<10000;i++)
    {
        x+=(x/100);
        if(x>=n) 
        {
            cout<<i+1;
            return;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
 //   cin>>t;
 //   solve2();
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }

    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100010];
int main(){
    int n;
    cin>>n;
    map<int,int> mp;
    for(int i=1;i<=n;i++){
        int x;cin>>x;
        mp[x]++;
    }
    if(mp.size()==1){
        if(mp.begin()->first==0){
            puts("Yes");
        }else{
            puts("No");
        }
        return 0;
    }
    if(mp.size()==2){
        if(mp.begin()->first==0){
            if(mp.begin()->second*3==n){
                puts("Yes");
                return 0;
            }
        }
        puts("No");
        return 0;
    }
    vector<ll> v;
    for(auto i:mp){
        v.push_back(i.first);
    }
    if(v.size()!=3){
        return 0*puts("No");
    }
    if((v[0]^v[1]^v[2])!=0){
        return 0*puts("No");
    }
    if(mp[v[0]]!=mp[v[1]]||mp[v[0]]!=mp[v[2]]){
        return 0*puts("No");
    }
    return 0*puts("Yes");

    return 0;
}


Measured memory_bytes: 4988
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<list>

using namespace std;

int solve(int m, int n) {
	if (m < n) {
		int tmp = m;
		m = n;
		n = tmp;
	}
	if (n == 0) return m;

	return solve(n, m%n);
}

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

	int cities[100000];
	for (int i = 0; i < N; i++) {
		cin >> cities[i];
		cities[i] -= X;
		cities[i] = abs(cities[i]);
	}

	int a = cities[0];
	for (int i = 1; i < N; i++) {
		a = solve(a, cities[i]);
	}

	cout << a << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;

int main () {
	ll i, j;
	char n;
	ll m = 1;
	ll ret;
	
	cin >> n;
	
	if ( n >= 65 && 90 >= n ) {
		cout << "A" << endl;
	} else {
		cout << "a" << endl;
	}
		
	return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main{
	public static void main(String[] args){
      	Scanner sc = new Scanner(System.in);
    	long a = sc.nextLong();
      	int v = sc.nextInt();
      	long b = sc.nextLong();
      	int w = sc.nextInt();
      	int t = sc.nextInt();
      	if(a < b){
        	for(int cnt = 0;cnt < t;cnt++){
              a += v;
              b += w;
              if(a >= b){
                  System.out.println("YES");
                  System.exit(0);
              }
          }
        }else{
          for(int cnt = 0;cnt < t;cnt++){
              a -= v;
              b -= w;
              if(a <= b){
                  System.out.println("YES");
                  System.exit(0);
              }
          }
        }
      	System.out.println("NO");
    }
}

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

int main()
{
    int n = 0;
    std::cin >> n;
    
    std::vector<int> pts;
    pts.reserve(n);
    
    for(int i = 0; i < n; ++i)
    {
        int x = 0;
        std::cin >> x;
        pts.emplace_back(x);
    }
    
    long long minCost = 1e18;
    
    for(int p = 1; p <= 100; ++p)
    {
        long long curCost = 0;
        for(int x : pts)
        {
            curCost += (x - p) * (x - p);
        }
        minCost = std::min(minCost, curCost);
    }
    
    std::cout << minCost << std::endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <deque>

using namespace std;

void f(vector<vector<bool>> &maze, pair<int, int> s, vector<vector<int>> &dist) {
    queue<pair<pair<int, int>, int>> q;
    dist[s.second][s.first] = 0;
    q.push({s, 0});
    while (!q.empty()) {
        auto p = q.front();
        int x = p.first.first, y = p.first.second, d = p.second;
        q.pop();
        pair<int, int> ds[4] = {{0, 1}, {0, -1}, {-1, 0}, {1, 0}};
        for (int i = 0; i < 4; ++i) {
            int nx = x + ds[i].first, ny = y + ds[i].second;
            if (!maze[ny][nx]) continue;
            if (dist[ny][nx] != -1) continue;
            dist[ny][nx] = d + 1;
            q.push({{nx, ny}, d + 1});
        }
    }
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<bool>> maze(h + 2, vector<bool>(w + 2));
    for (int y = 0; y < h; ++y) {
        string s;
        cin >> s;
        for (int x = 0; x < w; ++x) {
            maze[y + 1][x + 1] = s[x] == '.';
        }
    }
    int ans = 0;
    for (int sy = 1; sy <= h; ++sy) {
        for (int sx = 1; sx <= w; ++sx) {
            if (!maze[sy][sx]) continue;
            vector<vector<int>> dist(h + 2, vector<int>(w + 2, -1));
            f(maze, {sx, sy}, dist);
            for (int gy = 1; gy <= h; ++gy) {
                for (int gx = 1; gx <= w; ++gx) {
                    ans = max(ans, dist[gy][gx]);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256