akhauriyash/Code-Regression huggingface dataset:
#include<string.h>
#include<stdio.h>

#define M 1000000
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
    if ( ch == 'A') return 1;
    else if ( ch == 'C') return 2;
    else if ( ch == 'G') return 3;
    else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){

    long long key, ha;
    int k = 0;
    key = getKey(str);
    while(1){
        ha = ( h1(key) + k * h2(key) ) % M;
        if ( strcmp(H[ha], str) == 0 ) return 1;
        if ( strlen(H[ha]) == 0 ) return 0;
        k++;
    }
    return 0;
}

int insert(char str[]){

    long long key, ha;
    long long k = 0;
    key = getKey(str);
    while(1){
        ha = ( h1(key) + k * h2(key) ) % M;
        if ( strcmp(H[ha],str) == 0) return 1;
        if ( H[ha][0] == '\0'){
            for ( int j = 0; j < strlen(str); j++ ){
                H[ha][j] = str[j];
            }
            return 0;
        }
        else k++;
    }
    return 0;

}

int main(){
    int i, n;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	    scanf("%s %s", com, str);
	
	    if ( com[0] == 'i' ){
	        insert(str);
	    } else {
	        if (find(str)){
	  	        printf("yes\n");
	        } else {
		        printf("no\n");
	        }
	    }
    }

    return 0;
}



Measured memory_bytes: 16428
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll x;
    cin >> x;
    ll y = 100;
    ll z = 0;
    while (y < x) {
        z++;
        y += y / 100;
    }
    cout << z << endl;
}


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

#define ll long long
#define inf 1e18

ll dp[401][401];
ll n, k, arr[401], pre[401];


int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	pre[0] = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		pre[i] = arr[i] + (i == 0 ? 0 : pre[i - 1]);
	}
	for (int len = 0; len < n; len++) {
		for (int i = 0; i + len < n; i++) {
			if (len == 0) {
				dp[i][i] = 0;
				continue;
			}
			dp[i][i + len] = inf;
			ll sum = pre[i + len] - (i == 0 ? 0 : pre[i - 1]); // sum(i, i+len)
			for (int k = 1; k <= len; k++) {
				dp[i][i + len] = min(dp[i][i + len], dp[i][i + len - k] + dp[i + len - k + 1][i + len] + sum);
			}
		}
	}
	cout << dp[0][n - 1];
	return 0;
}


Measured memory_bytes: 1536
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))


Measured memory_bytes: 266576
N = int(input())
A1= list(map(int,input().split()))
A2= list(map(int,input().split()))
sum2 = sum(A2)
ans = A1[0]+sum2
value = A1[0]+sum2
for i in range(1,N):
    value = value + A1[i] - A2[i-1]
    ans = max(ans,value)
print(ans)

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

public class Program
{
    public static void Main()
    {
        int N = int.Parse(ReadLine());

        if(N <= 999)
        {
            WriteLine("ABC");
        }
        else
        {
            WriteLine("ABD");
        }
    }
}

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    using uint = unsigned int;

    string      in;
    stack<uint> downPoint;  // 下り坂の地点を覚える
    deque<pair<uint, uint> >
        puddles;  // 水たまりの始点位置と面積の組
                  // stackとqueueを使いたいため，dequeで実装
    uint sum = 0;

    // 入力
    cin >> in;

    // 計算
    for (uint i = 0; i < in.size(); i++) {
        if (in[i] == '\\') {
            downPoint.push(i);
        }
        // のぼり坂の場合，総面積の更新と水たまりの更新(結合)を行う．
        // ただし，対応する下り坂がない場合はこの計算を行わない．
        else if (in[i] == '/' && !downPoint.empty()) {
            // 対応する坂との間の部分面積を求める．
            uint j = downPoint.top(), p = i - j;
            downPoint.pop();
            // 総面積に加算する．
            sum += p;

            // 水たまりをまとめる．
            while (!puddles.empty() && puddles.front().first > j) {
                p += puddles.front().second;
                puddles.pop_front();
            }
            puddles.push_front(make_pair(j, p));
        }
    }

    // 出力
    cout << sum << endl;
    cout << puddles.size();
    while (!puddles.empty()) {
        cout << ' ' << puddles.back().second;
        puddles.pop_back();
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3284
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int N, A, B;
	cin >> N >> A >> B;
	if(A * N <= B){
		cout << A * N << endl;
	}
	else{
		cout << B << endl;
	}
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


struct BinaryIndexedTree{
	int n;
	vector<int>dat;
	BinaryIndexedTree(int n=0):n(n){
		dat.resize(n+1);
	}
	void add(int k,int x){
		for(k++;k<=n;k+=k&-k)dat[k]+=x;
	}
	int sum(int k){
		int ret=0;
		for(k++;k;k-=k&-k)ret+=dat[k];
		return ret;
	}
};

int N;
int A[111111],B[111111],C[111111];

bool check(double X){
    BinaryIndexedTree bit(N+114);

    vector<pair<double,int>>v;
    rep(i,N){
        v.pb(pair<double,int>((-A[i]*X+C[i])/B[i],i));
    }
    sort(all(v));

    int ret=0;
    rep(i,N){
        int k=v[i].se;
        ret+=bit.sum(k);
        bit.add(k,1);
    }

    int a=N*(N-1)/2;
    return ret>=(a+1)/2;
}


double solve(){
    vector<pair<double,int>>v;
    rep(i,N)v.pb({-1.0*A[i]/B[i],i});
    sort(all(v));

    vint AA(N),BB(N),CC(N);
    rep(i,N){
        AA[i]=A[v[i].se];
        BB[i]=B[v[i].se];
        CC[i]=C[v[i].se];
    }
    rep(i,N){
        A[i]=AA[i];
        B[i]=BB[i];
        C[i]=CC[i];
    }

    double lb=-1e9;
    double ub=1e9;

    rep(i,70){
        double mid=(ub+lb)/2;
        if(check(mid))ub=mid;
        else lb=mid;
    }
    return ub;
}

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i]>>B[i]>>C[i];

    double x=solve();
    rep(i,N)swap(A[i],B[i]);
    double y=solve();

    printf("%.20f %.20f\n",x,y);
    return 0;
}


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

int main() {
  string s; cin >> s; int count=0;
  for(int i=0;i<3;i++) {
    if(s.at(i)=='a') count++;
    else if(s.at(i)=='b') count+=2;
    else if(s.at(i)=='c') count+=3;
    else count--;
  }
  if(count==6) cout << "Yes" << endl;
  else cout << "No" << endl;
  }


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

using namespace std;

long long n,k;
vector<bool> f;
vector<int> a;

void Enter()
{
    //freopen("INPUT.TXT","r",stdin);
    //freopen("OUTPUT.TXT","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n>>k;
    a.resize(n+1); f.resize(k+1,false);
    for(int i=1; i<=n; ++i) cin>>a[i];
}

int main()
{
    Enter();
    for(int i=0; i<=k; ++i) {
        for(int j=1; j<=n; ++j)
            if (f[i]==false&&i+a[j]<=k) f[i+a[j]]=true;
    }
    //for(auto v : f) cout<<(v)<<" ";
    cout<<((f[k]==true)? "First":"Second");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
const int MAX = 510000;
const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
  
int main(){
    COMinit();
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    rep2(1,i,k+1){
        ans=((COM(k-1,i-1)%MOD)*(COM(n-k+1,i)%MOD))%MOD;
        cout<<ans<<endl;
    }

    
    return 0;
}

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

int main(){
    int n, ans=0;
    cin >> n;
    for(int i=1; i<=n; i++){
        int count = 0;
        if(i%2!=0){
            for(int j=1; j<=i; j++){
                if(i%j==0) count++;
            }
        }
        if(count==8)ans++;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; i--) {
        if (a % i == 0 && b % i == 0) k--;
        if (k == 0) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define N_MAX (50)

DWORD adwNum[N_MAX + 1];
void solve_main()
{
	DWORD N;
	DWORD dwSwapNum = 0;
	cin >> N;

	REP (i, 1, N + 1) {
		cin >> adwNum[i];
		if (adwNum[i] != i) {
			dwSwapNum++;
		}
	}

	if (dwSwapNum <= 2) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 256
N,H = map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A +=[a]
  B +=[b]
A=sorted(A,reverse=True)
B=sorted(B,reverse=True)
C=A[0]
count=0
for i in range(N):
  if B[i]>=C:
    H -=B[i]
    count +=1
    if H<=0:
      print(count)
      exit()
answer=count-(-H//C)
print(answer)


Measured memory_bytes: 12112
n = int(input())
ppp = list(map(int, (input() for _ in range(n))))

tmp_f = {}
for p in ppp:
    if p - 1 in tmp_f:
        tmp_f[p] = tmp_f[p - 1] + 1
    else:
        tmp_f[p] = 1

# tmp_b = {}
# for p in ppp[::-1]:
#     if p + 1 in tmp_b:
#         tmp_b[p] = tmp_b[p + 1] + 1
#     else:
#         tmp_b[p] = 1

cnt = max(tmp_f.values())
print(n - cnt)


Measured memory_bytes: 34912
n = int(input())
S = [input() for i in range(n)]
for i in range(n):
  S[i] = sorted(S[i])
S = sorted(S)
c = 0
i = 0
while i < n - 1:
  j = i + 1
  while j < n:
    if S[i] == S[j]:
      j += 1
    else:
      break
  c += (j-i) * (j-i-1) // 2
  i = j  
print(c)

Measured memory_bytes: 25556
/**
 *     author: qodjf
 *     created: 04.12.2020 15:51:31
 */
#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;

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

int N;
ll C;
const int MAXN = 2e5 + 5;
ll h[MAXN];
vector<ll> dp;

struct Point {
  int idx;
  ll x, y;
  Point(int i_, ll x_, ll y_) : x(x_), y(y_), idx(i_) {}
};

// dp[i] = min(dp[j] + (hi - hj) ^ 2 + C)
// dp[i] - hi^2 - C + 2 * hi * hj = dp[j] + hj^2
// b + kx = y
// b -> dp[i] - hi^2 - C
// k -> 2 * hi
// (x, y) -> (hj, dp[j] + hj ^ 2)

Point getP(int idx) { return Point(idx, h[idx], dp[idx] + h[idx] * h[idx]); }

bool kGreater(const Point &p1, const Point &p2, const Point &p3) {
  return (p2.y - p1.y) * (p3.x - p2.x) > (p3.y - p2.y) * (p2.x - p1.x);
}

bool better(const Point &p1, const Point &p2, const int k) {
  return k * (p2.x - p1.x) > p2.y - p1.y;
}

vector<Point> convex;

void solve() {
  dp.resize(N);
  dp[0] = 0;
  convex.emplace_back(getP(0));

  int start = 0;
  for (int i = 1; i < N; i++) {
    while (convex.size() - start >= 2 &&
           better(convex[start], convex[start + 1], 2 * h[i])) {
      start++;
    }
    int j = convex[start].idx;
    dp[i] = dp[j] + (h[i] - h[j]) * (h[i] - h[j]) + C;
    Point p = getP(i);
    while (convex.size() - start >= 2 &&
           kGreater(*(convex.rbegin() + 1), *(convex.rbegin()), p)) {
      convex.pop_back();
    }
    convex.emplace_back(p);
  }

  printf("%lld\n", dp[N - 1]);
}

int main() {
  cin >> N >> C;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  solve();
}


Measured memory_bytes: 11632
n=int(input())

list=list(map(int,input().split()))
for i2 in range(len(list)):
    if i2!=len(list)-1:
        print(list[i2],end=' ')
    else :
        print(list[i2])

for i in range(1,n):
    v=list[i]
    j=i-1
    while j>=0 and list[j]>v:
        list[j+1]=list[j]
        j=j-1
    list[j+1]=v
    for i2 in range(len(list)):
        if i2!=len(list)-1:
            print(list[i2],end=' ')
        else :
            print(list[i2])



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

int main() {
	long long A, B, C, D;

	cin >> A >> B >> C >> D;

	long long com = C / __gcd( C, D ) * D;
	long long n1 = B / C - (A - 1) / C;
	long long n2 = B / D - (A - 1) / D;
	long long n3 = B / com - (A - 1) / com;
	long long ans = B - A + 1 - n1 - n2 + n3;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n, t, ax[10000], ay[10000], bx[10000], by[10000], J[3][10007];
int mx, my;
pair<int, int> solve(int row) {
	for (int i = 0; i < 3; i++) { for (int j = 0; j < my + 4; j++)J[i][j] = 0; }
	for (int i = 0; i < 3; i++) {
		int Plus = i - 1 + row;
		for (int j = 0; j < n; j++) {
			if (ax[j] <= Plus && Plus < bx[j]) { J[i][ay[j]]++; J[i][by[j]]--; }
		}
		for (int j = 1; j < my + 4; j++)J[i][j] += J[i][j - 1];
		for (int j = 1; j < my + 4; j++) { if (J[i][j] >= 1)J[i][j] = 1; }
	}
	int sum1 = 0; for (int i = 0; i < my + 4; i++)sum1 += J[1][i];
	int sum2 = 0;
	for (int i = 0; i < my + 4; i++) { if (i >= 1 && J[1][i] + J[1][i - 1] == 1) { sum2++; } if (i < my + 3 && J[1][i] + J[1][i + 1] == 1) { sum2++; } }
	for (int i = 0; i < my + 4; i++) { if (J[0][i] + J[1][i] == 1)sum2++; if (J[1][i] + J[2][i] == 1)sum2++; }
	return make_pair(sum1, sum2);
}
int main() {
	while (true) {
		cin >> n >> t; if (n == 0 && t == 0)break; my = 0; mx = 0;
		for (int i = 0; i < n; i++) { cin >> ax[i] >> ay[i] >> bx[i] >> by[i]; ax[i]++; ay[i]++; bx[i]++; by[i]++; }
		for (int i = 0; i < n; i++) { mx = max(mx, bx[i]); my = max(my, by[i]); }
		int s1 = 0, s2 = 0; for (int i = 0; i <= mx + 3; i++) { pair<int, int>F = solve(i); s1 += F.first; s2 += F.second; }
		if (t == 1)cout << s1 << endl;
		if (t == 2)cout << s1 << endl << s2 / 2 << endl;
	}
	return 0;
}

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

#define ll long long
#define pb push_back
#define INF 1e9+7
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	ll n=5;
	ll a[n];
	rep(i,0,n){
		cin>>a[i];
	}
	ll k;
	cin>>k;
	ll flag=0;
	rep(i,0,n){
		rep(j,i+1,n){
			if(abs(a[i]-a[j])>k){
				flag=1;
				break;
			}
		}
		if(flag)
			break;
	}

	if(flag)
		cout<<":(";
	else
		cout<<"Yay!";
	
	
	return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<cstring>
#include<iostream>
#define RI register int
#define CI const int&
using namespace std;
const int N=200005,INF=1e9;
struct edge
{
	int to,nxt,v;
}e[N<<2]; int n,x,y,cnt=1,head[N],frm[N],pre[N],q[N],s,t;
inline void addedge(CI x,CI y,CI z)
{
    e[++cnt]=(edge){y,head[x],z}; head[x]=cnt;
    e[++cnt]=(edge){x,head[y],0}; head[y]=cnt;
}
#define to e[i].to
namespace NF //Network Flow
{
    int cur[N],q[N],dep[N];
    inline bool BFS(CI s,CI t)
    {
        RI H=0,T=1; memset(dep,0,t+1<<2); q[dep[s]=1]=s;
        while (H<T)
        {
            int now=q[++H]; for (RI i=head[now];i;i=e[i].nxt)
            if (to!=1&&e[i].v&&!dep[to]) dep[to]=dep[now]+1,q[++T]=to;
        }
        return dep[t];
    }
    inline int DFS(CI now,CI tar,int dis)
    {
        if (now==tar) return dis; int ret=0;
        for (RI& i=cur[now];i&&dis;i=e[i].nxt)
        if (to!=1&&e[i].v&&dep[to]==dep[now]+1)
        {
            int dist=DFS(to,tar,min(dis,e[i].v));
            dis-=dist; ret+=dist; e[i].v-=dist; e[i^1].v+=dist;
        }
        if (!ret) dep[now]=0; return ret;
    }
    inline int Dinic(CI s,CI t,int ret=0)
    {
        while (BFS(s,t)) memcpy(cur,head,t+1<<2),ret+=DFS(s,t,INF);	return ret;
    }
};
int main()
{
	RI i,j; for (scanf("%d",&n),i=1;i<n;++i)
	for (scanf("%d",&x),j=1;j<=x;++j) scanf("%d",&y),addedge(y,n+i,1);
	for (s=0,t=n<<1,i=1;i<=n;++i) addedge(s,i,1); for (i=1;i<n;++i) addedge(n+i,t,1);
	if (NF::Dinic(s,t)!=n-1) return puts("-1"),0;
	for (j=2;j<=n;++j) for (i=head[j];i;i=e[i].nxt) if (to>n&&!e[i].v) frm[to-n]=j;
	RI H=0,T=1; q[1]=1; while (H<T)
	{
		int now=q[++H]; for (i=head[now];i;i=e[i].nxt)
		if (to>n&&!pre[to-n]) pre[to-n]=now,q[++T]=frm[to-n];
	}
	if (T!=n) return puts("-1"),0;
	for (i=1;i<n;++i) printf("%d %d\n",pre[i],frm[i]);
	return 0;
}

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

int main(void)
{
	int k;
	int slen;
	int sover;
	int i;
	char s[200];
	
	scanf("%d",&k);
	scanf("%s",&s);
	
	slen = strlen(s);
	//printf("%d\n",slen);
	//printf("%d\n",k);
	
	if(slen <= k){
		printf("%s\n",s);
	}
	else{
		sover = slen - k;
		for(i=0; i<k; i++){
			printf("%c",s[i]);
		}		
			printf("...\n");
	}
	
	
	return 0;
}

Measured memory_bytes: 1612
#include <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  
  int num = 0;
  for(int i=1;i<=n;i++){
    if((i%2)==0) continue;
    if(calc_odd(i) == 8) num++;
  }
  printf("%d",num);
}

int calc_odd(int n){
  int yakusu = 0;
  for(int i=1;i<=n;i++){
    if((n%i) == 0) yakusu++;
  }
  return yakusu;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

ll inv(ll a) {

	ll res = 1;
	int p = MOD - 2;
	while (p > 0) {
		if ((p & 1) == 1) { res *= a; res %= MOD; }
		a = a * a % MOD;
		p >>= 1;
	}
	return res;
}

int main()
{
	int N;
	cin >> N;
	vec(A);
	fx(N) {
		vecp(A)
	}
	
	ll ans = 0;
	set<int> all;
	map<int, int> K;
	fx(N) {
		int i = 2;
		bool flag = true;
		int B = A[x];
		vector<int> L;
		map<int, int> P;
		while (true) {
			if (B%i==0) {
				while (B%i==0) {
					B /= i;
					P[i]++;
				}
				L.push_back(i);
				flag = false;
				if (B==1) {
					break;
				}
			}
			else {
				i++;
				if (flag&&i*i>B) {
					break;
				}
			}
		}
		if (flag) {
			L.push_back(B);
			P[B]++;
		}

		for (int p : L) {
			all.insert(p);
			if (K[p]<P[p]) {
				K[p] = P[p];
			}
		}

	}

	ll sum = 1;
	for (int p: all) {
		sum *= (ll)pow(p, K[p])%MOD;
		sum %= MOD;
	}

	fx(N) {
		ans += sum * inv(A[x]) % MOD;
		ans %= MOD;
	}
	ce(ans)


    return 0;
}



Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * クリスマスもあと半年となり、トナカイのAtCoDeer君はプレゼントを配る計画を立てることにしました。
 * TopCoDeer通りには N 個の家が並んでいます。i 個目の家は座標 a_i にあります。彼はこのすべての家にプレゼントを配ることにしました。
 * 好きな場所から開始し好きな場所で終了することができる時、最小の移動距離を求めなさい。
 */

public class Main {
	public static void main(String[] args) throws IOException{
		// input
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[] anArray = new int[n];
		String[] s = br.readLine().split(" ");
		for (int i = 0; i < n; i++){
			anArray[i] = Integer.parseInt(s[i]);
		}

		Arrays.sort(anArray);
		System.out.println(anArray[n-1]-anArray[0]);
	}

}

Measured memory_bytes: 20308
a,b,c,x,y=map(int,input().split())

if a+b>2*c:
    if (x<y and b>2*c) or (x>y and a>2*c) :
        nc=2*max(x,y)
        print(c*nc)
    else:
        mi=min(x,y)
        print(c*2*mi+(x-mi)*a+(y-mi)*b)
else:
    print(a*x+b*y)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n; cin >> n;
   map<ll, ll> m;
   rep(i,n){
      int a; cin >> a;
      m[a]++;
   }
   ll ans = 0;
   for (auto &&i : m)
      ans += i.first * i.second;
   int q; cin >> q;
   while(q--){
      int b, c; cin >> b >> c;
      ans += m[b] * (c-b);
      m[c] += m[b];
      m[b] = 0;
      cout << ans << endl;
   } 
   
}

Measured memory_bytes: 9564
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int n, v[100100];
P num1[100100], num2[100100];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < 100100; i++){
		num1[i].second = i;
		num2[i].second = i;
	}
	for(int i = 0; i < n; i++){
		scanf("%d", &v[i]);
		if(i % 2 == 0){
			num1[v[i]].first++;
		}
		else{
			num2[v[i]].first++;
		}
	}
	sort(num1, num1 + 100100);
	reverse(num1, num1 + 100100);
	sort(num2, num2 + 100100);
	reverse(num2, num2 + 100100);
	if(num1[0].second == num2[0].second) printf("%d\n", n - max(num1[1].first + num2[0].first, num1[0].first + num2[1].first));
	else printf("%d\n", n - num1[0].first - num2[0].first);
	return 0;
}


Measured memory_bytes: 2176
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1000000000;

int main() {
  //
  string s;
  cin >> s;
  ll k;
  cin >> k;
  rep(i, s.size()) {
    if (s[i] == 'a') continue;
    int add = 26 - (s[i] - 'a');
    // cout << add << endl;
    if (add <= k) {
      k -= add;
      s[i] = 'a';
    }
  }
  // cout << k << endl;
  if (k > 0) {
    k = k % 26;
    s[s.size() - 1] = s[s.size() - 1] + k;
  }
  cout << s << endl;
  return 0;
}


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

const int INF = 1e9;

void dfs(const vector<vector<int>>& G, const vector<int>& A, vector<int>& L, vector<int>& R, int v, int p){
  int lb = lower_bound(L.begin(), L.end(), A[v]) - L.begin();
  int old = L[lb];
  L[lb] = A[v];
  
  R[v] = lower_bound(L.begin(), L.end(), INF) - L.begin();
  for(auto v_ : G[v]){
    if(v_ == p) continue;
    dfs(G,A,L,R,v_,v);
  }
  L[lb] = old;
}

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i)
    cin >> A[i];
  vector<vector<int>> G(N);
  for(int i = 1; i < N; ++i){
    int u, v;
    cin >> u >> v;
    --u,--v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  vector<int> L(N+1,INF), R(N);
  dfs(G,A,L,R,0,-1);
  for(auto e : R)
    cout << e << "\n";
}


Measured memory_bytes: 33832
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
const int N=1e5+10;

int main(){
    //freopen("a.txt", "r", stdin);
    //freopen("answers.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a,b,c; ll k;
    cin>>a>>b>>c>>k;
    if(k&1)
        cout<<b-a<<endl;
    else
        cout<<a-b<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
V = [int(i) for i in input().split()] # 配列で数字
C = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    if V[i] - C[i] > 0:
        ans += V[i] - C[i]
print(ans)

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll seica(vector<ll> &v, ll ave){
    ll ret = 0;
    REP(i, v.size())ret += (ave - v[i]) * (ave - v[i]);
    return ret;
}

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

    ll n;cin >> n;
    ll ave = 0;
    vector<ll> v(n);
    REP(i, n) {
        cin >> v[i];
        ave += v[i];
    }

    ave /= n;
    ll ans = LLINF;
    ans = min(ans, seica(v, ave));
    ans = min(ans, seica(v, ave + 1));
    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
D = lr()
D.sort()
border = N // 2 -1
left = D[border]
right = D[border+1]
answer = right - left
print(answer)
    
# 33

Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

int main() {
    int N; cin >> N;
    vector<int> H(N); cin >> H;

    int ans = H[0];
    rep(i, N - 1) if(H[i] < H[i + 1]) ans += H[i + 1] - H[i];

    cout << ans << endl;
    return 0;
}


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


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define vint vector<int>
#define INF 1e9

using namespace std;
typedef long long  ll;

typedef pair<string, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second > secondElof.second;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> h(n);
    REP(i, 0, n){
        cin >> h[i];
    }

    vint ans(n, 1);

    int a, b;
    REP(i, 0, m){
        cin >> a >> b;
        if(h[a-1] > h[b-1]){
            ans[b-1] = 0;
        } else if (h[a-1] < h[b-1]) {
            ans[a-1] = 0;
        } else {
            ans[b-1] = 0;
            ans[a-1] = 0;
        }
    }

    p(accumulate(ans.begin(), ans.end(), 0LL));

    return 0;
}


Measured memory_bytes: 4580
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    //cout << ans << endl;
    REP(i, n - 1) {
        ll u, v;
        cin >> u >> v;
        if (u < v) swap(u, v);
        //ll sub = u - v;
        ll a = v - 1 + 1, b = n - u + 1;
        ans -= a * b;
        //cout << ans << endl;
    }
    FOR(i, 1, n + 1) { ans += i * (n - i + 1); }
    cout << ans << endl;
}

Measured memory_bytes: 3608
H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]


left = [[0]*W for _ in range(H)]
right = [[0]*W for _ in range(H)]
top = [[0]*W for _ in range(H)]
bottom = [[0]*W for _ in range(H)]

for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j] == '#':
            cnt = 0
        else:
            cnt += 1
            top[i][j] = cnt
            
for j in range(W):
    cnt = 0
    for i in reversed(range(H)):
        if S[i][j] == '#':
            cnt = 0
        else:
            cnt += 1
            bottom[i][j] = cnt
            
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j] == '#':
            cnt = 0
        else:
            cnt += 1
            left[i][j] = cnt
            
for i in range(H):
    cnt = 0
    for j in reversed(range(W)):
        if S[i][j] == '#':
            cnt = 0
        else:
            cnt += 1
            right[i][j] = cnt
                        
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans,left[i][j]+right[i][j]+top[i][j]+bottom[i][j]-3)
        
print(ans)




            
            

Measured memory_bytes: 308360
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	string s,s1,t;
	int flag=1;
	int ilook;
	cin>>s1>>t;
	if(s1.size()<t.size()){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for(int i=s1.size()-t.size();i>=0;i--){
		ilook=i;
		flag=1;
		for(int j=0;j<t.size();j++){
			if(s1[ilook]==t[j]||s1[ilook]=='?'){
				ilook++;
			}else{
				flag=0;
			}
		}
		if(flag==1){
			ilook=i;
			break;
		}else{
			ilook=-1;
		}
	}
	if(ilook==-1){
		cout<<"UNRESTORABLE"<<endl;
	}else{
		int it=0;
		for(int i=ilook;i<ilook+t.size();i++){
			s1[i]=t[it];
			it++;
		}
		for(int i=0;i<s1.size();i++){
			if(s1[i]=='?'){
				s1[i]='a';
			}
		}
		cout<<s1<<endl;
	}
	
}


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

int main() {
	int N;
  	cin >> N;
  
  	if(N == 1) {
    	cout << "Hello World" << endl;
    }else {
    	int A , B;
      	cin >> A >> B;
      	cout << A + B << endl;
    }
}

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

int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int t=n,s=0;
	while(t!=0) s+=t%10,t/=10;
	if(n%s==0) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
k=int(input())
L=[]
def f(d,now,L):
  L.append(now)
  
  if d==10:
    return
  
  for j in range(-1,2):
    v=now%10+j
    if 0<=v<=9:
      f(d+1,now*10+v,L)

for l in range(1,10):
  f(1,l,L)
L.sort()
print(L[k-1])

      

Measured memory_bytes: 19332
def main():
    from builtins import int, str, map, list, dict, float, print, len, sorted, max, min
    from itertools import accumulate, permutations, combinations
    from collections import deque, defaultdict, Counter
    from operator import itemgetter
    from bisect import bisect_left, bisect_right, bisect
    from heapq import heappop, heappush
    from fractions import gcd
    import sys, re, math, copy
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, M = input_number_list()
    k = []
    s = []
    p = []
    for i in range(M):
        ls = input_number_list()
        k.append(ls[0])
        s.append(ls[1:])
    p = input_number_list()
    switch_max = 2 ** N
    ans = 0
    for i in range(switch_max):
        cnt_if = 0
        for j, switchs in enumerate(s):
            cnt = 0
            for sw in switchs:
                h = 1 << (sw - 1)
                if h & i:
                    cnt += 1
            if cnt % 2 == p[j]:
                cnt_if += 1
        if cnt_if == M:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


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

// in-short-use macros

#define all(c) (c).begin(),(c).end()
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define PI 3.14159265
#define sizes 1000010



//main function here

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ld x;
    cin>>x;
    x=x/100;
    // cout<<x<<"\n";
    ld f=1.00,m=1.0100000;
    ll ans=0;
    while(f<x)
    {
        f=f*m;
        f=f*100;
        f=truncl(f);
        f=f/100;
        ans+=1;
    }
    // cout<<f<<"\n";
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
 
#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L
 
#define long long long int
 
 
long MOD;
 
long sum (long a, long b) { 
   return (a + b) % MOD; 
 
}
 
long mult (long a, long b) { 
   return (a * b) % MOD;
 }
 
int main() {
 
    int N, K;
    cin >> N >> K >> MOD;
 
    vector<vector<long>> q(N, vector<long>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            if (i == j) {
                q[i][j] = 1;
            }
            if (j < i) {
                q[i][j] += q[i - 1][j];
            }
            if (i > 0 && j > 0) {
                q[i][j] += q[i - 1][j - 1];
            }
            q[i][j] %= MOD;
        }
    }
 
 
    vector<vector<long>> d(N + 1, vector<long>(K + 1));
    for (int n = 0; n <= N; n++) {
        for (int k = 0; k <= K; k++) {
            if (n == 0) {
                d[n][k] = 1;
            } else if (k == 0) {
                d[n][k] = 0;
            } else {
                d[n][k] = d[n][k - 1];
                for (int i = 0; i < n; i++) {
                    d[n][k] = sum(d[n][k],
                                  mult(d[n - i - 1][k],
                                       mult(d[i][k - 1], q[n - 1][i])));
                }
            }
        }
    }
    cout << d[N][K];
    return 0;
}

Measured memory_bytes: 1664
// #pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") // ???
#pragma GCC optimize("Ofast") // 常に聞くっぽい？
// #pragma GCC optimize("unroll-loops") // 小さいnの多重ループに有効

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<int> A(N);
	map<int,int> mp;
	rep(i,N){
		cin >> A[i];
		mp[A[i]]++;
	}
	sort(A.begin(), A.end());
	bool ans[1000010]{};
	int cnt = 0;
	rep(i,N){
		if(A[i] == 1 && mp[1] > 1){
			cout << 0 << endl;
			return 0;
		}
		if(A[i] == 1 && mp[1] == 1){
			cout << 1 << endl;
			return 0;
		}
		if(ans[A[i]]) continue;
		++cnt;
		for(int j=A[i];j<=1000010;j+=A[i]){
			ans[j] = true;
		}
		if(mp[A[i]] > 1) --cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 18248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int a,b,s = 0, c = 0;
  cin >> a >> b;
  if(b > 1)
  {
      s += a;
      c++;
      while(b > s)
      {
        s += a - 1;
        c++;
      }
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
	char o[51], e[51];
	scanf ("%s", o);
	scanf ("%s", e);
	int idx = 0;
	while (o[idx]!='\0') {
		putchar (o[idx]);
		if (e[idx]!='\0')
			putchar (e[idx]);
		idx ++;
	}
	putchar ('\n');
	return 0;
}


Measured memory_bytes: 128
#include  <stdio.h>
int main(void)
{
    int h,m,s,S;
    scanf("%d",&S);
    h=S/3600;
    S=S-(h*3600);
    m=S/60;
    S=S-(m*60);
    s=S/1;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 2736
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200)cout << s << endl;
    else cout << "red" << endl;

    return 0;
}

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

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

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

        static long findDivisors(int n)
        {
            long[] div = new long[n + 1];
            for (int i = 1; i <= n; i++)
            {
                for (int j = 1; j * i <= n; j++)
                    div[i * j]++;
            }
            long sum = 0;
            for (int i = 1; i <= n; i++)
                sum += i * div[i];

            return sum;
        }

    }
}



Measured memory_bytes: 106808
#include<stdio.h>
int ta[200010],nt[400010],to[400010],p[200010],d[200010];
void f(int a,int b,int c){
  int i;
  d[a]=c+p[a];
  for(i=ta[a];i+1;i=nt[i]){
    if(to[i]==b)continue;
    f(to[i],a,d[a]);
  }
}
int main(){
  int n,m,a,b,i;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)ta[i+1]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[i+n-1]=a];
    nt[i+n-1]=ta[to[i    ]=b];
    ta[b]=i+n-1;
    ta[a]=i;
  }
  for(i=0;i<m;i++){
    scanf("%d %d",&a,&b);
    p[a]+=b;
  }
  f(1,0,0);
  for(i=0;i<n;i++)printf("%d%c",d[i+1],i+1-n?' ':'\n');
  return 0;
}
      


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

typedef pair<int,int> P;
P mem[1111][2];
vector<P> G[1111];
vector<P> rG[1111];
int N,M;

struct state {
  int id,f,c,e;
  state(){}
  state(int id,int f,int c,int e=-1):id(id),f(f),c(c),e(e){}
  bool operator<(const state& p) const {
    if( c == p.c ) return e > p.e;
    return c > p.c;
  }
};

void init(){
  fill(mem[0],mem[N+1],P((1<<29),-1));
  for(int i=0;i<N;i++) G[i].clear();
  for(int i=0;i<N;i++) rG[i].clear();
}

P solve(int s,int t){
  priority_queue<state> q;
  q.emplace(s,0,0);
  mem[s][0] = P(0,0);
  while( !q.empty() ){
    state p = q.top(); q.pop();
    // cout << p.id << " "<< p.f << " "<< p.c << " "<< p.e << endl;
    if( mem[p.id][p.f] < P(p.c,p.e) ) continue;
    P np = P(p.c + 1, p.e);    
    for( P e : G[p.id] ){
      //cout << " -> " << e.first << " " << p.f << endl;
      if( mem[e.first][p.f] > np ){
        mem[e.first][p.f] = np;
        q.emplace( e.first, p.f, np.first, np.second );
      }
    }
    if( p.f ) continue;
    for( P e : rG[p.id] ){
      np = P(p.c+1,e.second);
      //cout << "R -> " << e.first << " " << 1 << endl;
      if( mem[e.first][1] > np ){
        mem[e.first][1] = np;
        q.emplace( e.first, 1, np.first, np.second );
      }
    }
  }
  //cout << mem[t][0].first << " "<< mem[t][0].second << endl;
  //cout << mem[t][1].first << " "<< mem[t][1].second << endl;
  if( mem[t][0] < mem[t][1] )
    return mem[t][0];
  else
    return mem[t][1];
}

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

  while( cin >> N && N ){
    init();
    int s,t; cin >> s >> t; --s; --t;
    cin >> M;
    for(int i=0;i<M;i++){
      int a,b; cin >> a >> b; --a; --b;
      G[a].emplace_back( b, i );
      rG[b].emplace_back( a, i );
    }
    
    P res = solve(s,t);
    cout << res.first << " " << res.second+1 << endl;
  }

}

Measured memory_bytes: 3740
//ABC043B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	string s;
	cin >> s;
	string ans = "";
	for(int i=0;i<s.size();i++){
		if(s.at(i) == 'B'){
			if(ans.size() != 0){
				ans.erase(ans.end()-1);
			}
		}else{
			char c = s.at(i);
			ans += s.at(i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
 int n;
 int p=0; int y=0;int z=0; int b=0;
 cin >> n;
 vector<string>a(n);
 for(int i=0;i<n;i++) cin >> a[i];
 for(int i=0;i<n;i++){
   if(a[i]=="AC") p++;
   if(a[i]=="WA") y++;
   if(a[i]=="TLE") z++;
   if(a[i]=="RE") b++;
 }
   cout << "AC" << ' ' << 'x' << ' ' << p << endl;
   cout << "WA" << ' ' << 'x' << ' ' << y << endl;
   cout << "TLE" << ' ' << 'x' << ' ' << z << endl;
   cout << "RE" << ' ' << 'x' << ' ' << b << endl;
 return 0;
}

Measured memory_bytes: 6424