akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef string::const_iterator State;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int number(State &begin);
int expression(State &begin);
int factor(State &begin);
int term(State &begin);

int main(){
  int n;
  string s;
  cin>>n;
  rep(i,n){
    cin>>s;
    State begin=s.begin();
    
    int ans=expression(begin);
    cout<<ans<<endl;
  }
  return 0;
}

int number(State &begin){
  int ret=0;
  while(isdigit(*begin)){
    ret*=10;
    ret+=(*begin-'0');
    begin++;
  }
  return ret;
}

int expression(State &begin){
  int ret=term(begin);
  while(1){
    if(*begin=='+'){
      begin++;
      ret+=term(begin); 
    }else if(*begin=='-'){
      begin++;
      ret-=term(begin);
    }else{
      break;
    }
  }
  return ret;
}


int factor(State &begin){
  int ret=0;
  if(*begin == '('){
    begin++;
    ret=expression(begin);
    begin++;
  }else{
    return number(begin);
  }
  return ret;
}


int term(State &begin){
  int ret=factor(begin);
  while(1){
    if(*begin=='*'){
      begin++;
      ret*=factor(begin); 
    }else if(*begin=='/'){
      begin++;
      ret/=factor(begin);
    }else{
      break;
    }
  }
  return ret;
}



Measured memory_bytes: 3144
#include <stdio.h>

int main(void) {
    int w, h, x, y, r;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    printf("%s\n",
      x - r < 0 || y - r < 0 || x + r > w || y + r > h ? "No" : "Yes"
    );
    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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


  ll n;
  cin >> n;
  vector<int> x(n), y(n);
  REP(i, n)
    cin >> x[i] >> y[i];

  vll v(n);
  REP(i, n)
    v[i] = i;

  long double sum = 0;
  do{
    REP1(i, n){
      long double diff = pow(abs(x[v[i]]-x[v[i-1]]), 2) + pow(abs(y[v[i]]-y[v[i-1]]), 2);
      sum += sqrt(diff);
    }
  }
  while(next_permutation(v.begin(), v.end()));

  ll waru = 1;
  REP(i, n)
    waru *= (i+1);

  long double ans = sum/waru;
  cout << Decimal;
  cout << ans << endl;

}


Measured memory_bytes: 256
import itertools
import bisect

n, k = map(int, input().split())
a = [int(input()) for _ in range(n)]

cs = [0] + list(itertools.accumulate(a))

b = [v - k * i for i, v in enumerate(cs)]
# print(b)
#
# import numpy as np
# np.random.seed(1)
# b = list(np.random.randint(10, 20, size=10))

tmp = b.copy()
tmp.sort()
c = [bisect.bisect_left(tmp, v) for v in b]
n = len(c)

BIT = [0] * (n + 2)

up = lambda node: node + (node & (-node))
def add(x, p):
    p += 1
    while p <= n:
        BIT[p] += x
        p = up(p)

def find(p):
    p += 1
    s = 0
    while p:
        s += BIT[p]
        p -= p & (-p)
    return s


# print(c)
s = 0
for v in c:
    s += (find(v))
    add(1, v)
print(s)


Measured memory_bytes: 41508
#include <stdio.h>

int main()
{
    long long n,i,min;
    scanf("%lld",&n);

    for (i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            min = i;
        }
    }
    printf("%lld",min + (n / min) - 2);
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
using namespace std;

const double PI=acos(-1);

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

    vector<int> l(n);
    double ans = 0;
    for(int i = 0; i < n; i++){
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    for(int i = 0; i < n; i++){
        if(i > 1) ans += pow(2,i-1)*l[i];
        else ans += l[i];
    }
    ans /= pow(2, n-1);
    printf("%.5f\n", ans);
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  ll A, B, C; cin >> A >> B >> C;
  if (4*A*B < (C-A-B) * (C-A-B) && C-A-B>=0) Yes();
  else No();

  return 0;
}


Measured memory_bytes: 3632
// #A
// atcoder Mujin Programming Challenge 2017 main.go
//Thanks to user:stonepage, http://mujin-pc-2017.contest.atcoder.jp/submissions/1131539
// and https://atcoder.jp/img/mujin-pc-2017/editorial.pdf
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func factorialWithMod(z, m int) int {
	t := 1
	for i := 1; i <= z; i++ {
		t = (t * i) % m
	}
	return t
}

func solve(in io.Reader, out, err io.Writer) {
	num, MOD7 := 0, int(1e9)+7
	fmt.Fscan(in, &num)

	topGroup, topLine, ans, remain, x := 0, 1, 1, num, 0

	for i := 1; i < num; i++ {
		fmt.Fscan(in, &x)
		if x >= topLine {
			topGroup, topLine = topGroup+1, topLine+2
		} else {
			topGroup++
			ans = (ans * topGroup) % MOD7
			topGroup--
			remain--
		}
	}
	ans = (ans * factorialWithMod(remain, MOD7)) % MOD7

	fmt.Fprintln(out, ans)
}

func main() {
	br := bufio.NewReaderSize(os.Stdin, int(1e7))
	solve(br, os.Stdout, os.Stderr)
}


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

string L;
ll dp[112345][2];

ll dfs(int pos, int ismax) {
	ll &res = dp[pos][ismax];
	if (~res) return res;
	if (pos == L.size()) return 1;
	
	res = 0;
	
	// 10, 01
	if (!(ismax && L[pos] == '0')) res = (res + dfs(pos + 1, ismax) * 2) % MOD;
	// 00
	res = (res + dfs(pos + 1, ismax && L[pos] == '0')) % MOD;
	
	return res;
}

int main() {
	cin >> L;
	
	memset(dp, -1, sizeof(dp));
	ll ans = dfs(0, 1) % MOD;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 8448
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	static class Pair {
		int src, dst;

		Pair(int src, int dst) {
			this.src = src;
			this.dst = dst;
		}
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int K = Integer.parseInt(tokens[1]);

		if (K > (N - 1) * (N - 2) / 2) {
			System.out.println("-1");
			return;
		}

		Deque<Pair> edges = new ArrayDeque<>();
		// まず最低限のedgeを入れる
		for (int i = 1; i < N; ++i) {
			edges.addLast(new Pair(0, i));
		}
		// 残りのedgeを入れる
		for (int src = 1; src + 1 < N; ++src) {
			for (int dst = src + 1; dst < N; ++dst) {
				edges.addLast(new Pair(src, dst));
			}
		}
		// K分削除
		for (int i = 0; i < K; ++i) {
			edges.pollLast();
		}
		System.out.println(edges.size());
		while (!edges.isEmpty()) {
			Pair edge = edges.pollFirst();
			System.out.println((edge.src + 1) + " " + (edge.dst + 1));
		}

		in.close();
	}

}


Measured memory_bytes: 22740
using System;
class Program
{
	static void Main(string[] args)
	{
	   string[] inputs = Console.ReadLine().Split(' ');
	   string[] dislikeNums = Console.ReadLine().Split(' ');
	   int N = int.Parse( inputs[0] );
	   int K = int.Parse( inputs[1] );
	   //string[] likeNums = new string[10-K]      //IndexOfの-1をつかう
	   int[] money = {0, 0, 0, 0, 0, 0};
	   int mL = inputs[0].Length;
	   int minLikeNum = 0;
	   //好きな数字の最小値
	   for(int i = 9; i >= 0; i-- )
	   {
	      if(Array.IndexOf(dislikeNums, i+"") == -1){minLikeNum = i;}
	   }
	   //moneyに数字を入れる
      int kkkkk = 0;
	   for(int i = mL-1; i >= 0; i--)
	   {
	      money[i] = int.Parse( inputs[0].Substring(kkkkk, 1) );
          kkkkk++;
	   }
	   //処理
	   //各桁をチェックする
	   for(int i = 0; i < mL; i++)
	   {
	      if(Array.IndexOf( dislikeNums, money[i]+"") != -1)//i桁目がキライ!
	      {
	         bool done = false;
	         int mi = money[i];
	         for(int j = 9; j > mi; j--)//繰り上がりなしのパターン
	         {
	            if(Array.IndexOf( dislikeNums, j + "") == -1)//jがすき！
	            {
	               money[i] = j;
	               done = true;
	            }
	         }
	         
	         if(!done)//繰り上がりが必要
	         {
	            money[i+1] += 1;
	            int k = 1;
	            while(money[i + k] == 10)
	            {
	               money[i + k] = 0;
	               k++;
	               money[i + k] += 1;
	            }
	            money[i] = minLikeNum;
	         }
	         
	         for(int k = 0; k < i; k++)//下の数を最低値に
	         {
	            money[k] = minLikeNum;
	         }
	      }
	   }
	   
	   if(money[mL] == 1)//繰り上がり発生時
	   {
	      if(Array.IndexOf( dislikeNums, 1+"") != -1)//1がキライ!
	      {
	         
	         money[mL] = minLikeNum;
	         for(int i = 0; i < mL; i++)//下の数を最低値に
	         {
	            money[i] = minLikeNum;
	         }
	      }
	   }
	   string s = "";
	   for(int i = 5; i >= 0; i--){s += money[i] +"";}
	   s = s.TrimStart('0');
	   Console.WriteLine(s);
	}
}



Measured memory_bytes: 13148
#include<iostream>
#include<string>
#include<utility>
#include<vector>
#include<algorithm>
#define MP make_pair
#define INF (1 << 30)
using namespace std;
typedef pair<int, char> P;

int char_count[26];

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) char_count[s[i] - 'a']++;
    vector<P> count_vec;
    for (int i = 0; i < 26; i++) {
        if (char_count[i] == 0) continue;
        count_vec.push_back(MP(char_count[i], 'a' + i));
    }
    sort(count_vec.begin(), count_vec.end());
    reverse(count_vec.begin(), count_vec.end());
    if (count_vec[0].first == 1) {
        cout << s.length() / 2 << endl;
        return 0;
    }
    int ans = INF;
    for (int i = 0; i < count_vec.size(); i++) {
        char max_char = count_vec[i].second;
        int diff_count = 0;
        int sub_ans = 0;
        for (int j = 0; j < s.length(); j++) {
            if (s[j] == max_char) {
                sub_ans = max(sub_ans, diff_count);
                diff_count = 0;
            }
            else diff_count++;
        }
        sub_ans = max(sub_ans, diff_count);
        ans = min(ans, sub_ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int mod = (int)1e9 + 7;
using namespace std;
#define ONLINE_JUDGE 1
#if ONLINE_JUDGE
#define tr(...)
#define endl '\n'
#else
#include "../../tr.h"
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 2*(int)1e5 + 10;

int n, a[N];
vector<long long> v;
map<long long, int> M;

int check(int idx){
   for(auto it: v){
      if(M.count(it-idx) == 0)continue;
      if(M[it-idx] > 0){
         assert(it-idx <= idx);
         M[it-idx]--;
         return it-idx;
      }
   }
   return -1;
}

int32_t main(){_

   cin>>n;
   for (int i = 0; i < n; ++i)
   {
      cin>>a[i];
      M[a[i]]++;
   }
   
   v.pb(1);
   while(1){
      v.pb(v.back()*2LL);
      if(v.back() > 1e12*1LL)break;
   }

   // cout<<v<<endl;

   int ans = 0;
   sort(a, a+n);
   reverse(a, a+n);

   for (int i = 0; i < n; ++i)
   {
      if(M[a[i]] == 0)continue;
      M[a[i]]--;
      int vals = check(a[i]);
      if(vals == -1)continue;
      ans++;
   }

   cout<<ans;
   #warning make sure N size is correct!
   return 0;
}

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

using namespace std;

int main() {
  constexpr long long kInf = 1e16;
  long long N, W;
  cin >> N >> W;
  const int V = 1000 * N;
  vector<int> w(N);
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }
  vector<vector<long long>> dp(N + 1, vector<long long>(V + 1, kInf));
  dp[0][0] = 0;

  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= V; j++) {
      if (j < v[i]) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
      }
    }
  }
  int ans = 0;
  for (int j = 0; j <= V; j++) {
    if (dp[N][j] <= W) ans = j;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
using namespace std;
typedef long long ll;


int main(void) {
	int x1,x2,x3,x4,y1,y2,y3,y4;
	cin >> x1 >> y1 >> x2 >> y2;
	int x, y;
	x = (x2 - x1); y = (y2 - y1);
	x3=x2-y;y3=y2+x;x4=x1-y;y4=y1+x;

	cout<<x3<<" "<<y3 << " "<<x4 << " "<<y4 <<endl;
	
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> t(n);
    int sum = 0;
    rep(i,n) {
        cin >> t[i];
        sum += t[i];
    }
    int m;
    cin >> m;
    vector<int> ans(m);
    rep(i,m) {
        int p,x;
        cin >> p >> x;
        p--;
        ans[i] = sum-(t[p]-x);
    }
    rep(i,m) cout << ans[i] << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char c) {return to_string((string) &c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
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;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

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

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll n = s.size();
    rep(i,n){
        if(s[i] == '?')s[i] = 'D';
        
    }

    cout << s << endl;
}

Measured memory_bytes: 3736
import bisect

n_count = int(input())
n = list(map(int, input().split()))

q_count = int(input())
q = list(map(int, input().split()))

n_and_q = 0

for i in q:
    j = bisect.bisect_left(n, i)
    if i == n[j]:
        n_and_q += 1
        
print(n_and_q)


Measured memory_bytes: 16736
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 2e9;



int main() {
	int n; cin >> n;
	vector<ll> prime(n + 1, 0);
	rep(i, 2, n+1) {
		int m=i,p = 2;
		while (m != 1) {
			while (m % p == 0) {
				prime[p]++;
				m /= p;
			}
			p++;
		}
	}
	int ans = 1;
	rep(i, 1, n + 1) ans = (ans * (prime[i]+1)) % mod;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

void solve() {
	int n; cin >> n;
	int p[4], t[4];
	rep(i, 4)cin >> p[i];
	rep(i, 4)cin >> t[i];
	int ans = mod;
	rep(i, 101) {
		rep(j, 101) {
			rep(k, 101) {
				int sum = i * t[0] + j * t[1] + k * t[2];
				int cost = i * p[0] + j * p[1] + k * p[2];
				if (sum >= n) {
					ans = min(ans, cost); break;
				}
				int dif = n - sum;
				int d = (dif + t[3] - 1) / t[3];
				cost += d * p[3];
				ans = min(ans, cost);
			}
		}
	}
	cout << ans << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 3200
h,w=map(int,input().split());r=[list('#'+'#.'[i%2]*(w-2)+'.')for i in range(h)];b=[list('.'+'.#'[i%2]*(w-2)+'#')for i in range(h)]
for i in range(h):
  t=input()
  for j in range(w):
    if t[j]=='#':r[i][j]=b[i][j]='#'
for t in r:print(''.join(t))
print()
for t in b:print(''.join(t))

Measured memory_bytes: 66796
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(ll i = 0; i < n; i++)
#define Fo(i, k, n) for(ll i = k; i < n; i++)
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
using namespace std;
using namespace __gnu_pbds;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	ll k;
	
	cin >> k >> s;
	if(s.length() <= k)
		cout << s;
	else {
		ll i;
		for(i = 0; i < k; i += 1)
			cout << s[i];
		cout << "...";
	}
	
	return 0;
}










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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int calc(int N,vpint v){
	if(v.size()==0)return N;
	if(v.size()==1){
		int tmp=N/v[0].fi;
		N-=v[0].fi*tmp;
		N+=v[0].se*tmp;
		return N;
	}
	if(v.size()==3){
		int ans=0;
		rep(i,N+1)rep(j,N+1){
			int n=N-v[0].fi*i-v[1].fi*j;
			if(n<0)continue;
			int k=n/v[2].fi;
			n-=v[2].fi*k;
			n+=v[0].se*i+v[1].se*j+v[2].se*k;
			chmax(ans,n);
		}
		return ans;
	}

	int x=v[0].fi*v[1].fi;
	int y=max(v[1].fi*v[0].se,v[0].fi*v[1].se);
	int ans=0;
	for(int i=0;i<v[1].fi;i++){
		for(int j=0;j<v[0].fi;j++){
			int n=N-v[0].fi*i-v[1].fi*j;
			if(n<0)continue;
			int k=n/x;
			n-=x*k;
			n+=v[0].se*i+v[1].se*j+y*k;
			chmax(ans,n);
		}
	}
	return ans;
}

signed main(){
	int N;
	cin>>N;

	vint A(3),B(3);
	rep(i,3)cin>>A[i];
	rep(i,3)cin>>B[i];


	vpint X,Y;
	rep(i,3){
		if(A[i]<B[i]){
			X.eb(A[i],B[i]);
		}
		else if(A[i]>B[i]){
			Y.eb(B[i],A[i]);
		}
	}

	N=calc(N,X);
	N=calc(N,Y);
	cout<<N<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int s = pow(3, n);
  int t = 1;
  rep(i,n) {
    if (a[i] % 2 == 0) t *= 2;
  }
  cout << s - t << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 4108
//Optimise
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define fast()                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;

#define f first
#define s second
#define pb push_back
#define mp make_pair

const long long mod = 100000000;
const long long High = 1e16;

int main()
{
    fast();
    ll k,n;
    cin >> n >> k;
    vector<ll> Entries(n);
    vector<ll> Bits(41);
  	for(ll i=0;i<n;++i)
    {
	    cin >> Entries[i];
    	ll x = Entries[i];
	    for(ll j=0;j<=40;++j)
        	if(x&((ll)pow(2,j))) Bits[j]++;
    }
  	ll ans = 0;
  	ull sum = 0;
  	for(int i=40;i>=0;--i)
    {
      //cout << ((ll)pow(2,i)) << ' ' <<Bits[i] << ' ' << n - Bits[i] << '\n';
      if(Bits[i] < n - Bits[i])
      	
        	if((ans|((ll)pow(2,i))) <= k)
              ans |= ((ll)pow(2,i));
    	//cout << ans << '\n';
    }
  	for(ll i=0;i<n;++i)
		sum += (Entries[i]^ans);
  cout << sum;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

    sort(ALL(s));
    if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
	return 0; 
}

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

int main(){
    int n;
    cin >> n;
    if (n % 2 == 1){
        cout << 0 << endl;
        exit(0);
    }
    vector<int> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];
    sort(s.begin(), s.end());
    cout << s[n/2] - s[n/2 - 1] << endl;
}

Measured memory_bytes: 640
#include <cassert>
#include <cmath>
#include <iostream>
#include <iomanip>

int main()
{
    double x = 0;
    double y = 0;
    double a = M_PI_2;
    while(true){
        int d, t;
        char c;
        std::cin >> d >> c >> t;
        if(d == 0 && t == 0) break;
        x += d * std::cos(a);
        y += d * std::sin(a);
        a += (-t * M_PI / 180);
    }
    double IntX, IntY;
    std::modf(x, &IntX);
    std::modf(y, &IntY);
    std::cout << std::fixed << std::setprecision(0);
    std::cout << IntX << std::endl;
    std::cout << IntY << std::endl;
    return 0;
}

Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forna(i,a,n) for(int i =a; i < n; i++)
#define fornd(i,a) for (int i = (a)-1; i >= 0; i--)
#define endl '\n'
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);
#define all(x) x.begin(), x.end()
typedef long long int unsigned lliu;
typedef long long int lli;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<vi> vvi;
typedef vector<pi> vpi;


int main(){
	fastIO
	lli a, b, c, k;
	cin>>a>>b>>c>>k;
	lli suma=0;
	suma+=min(a, k);
	k-=a;
	k-=b;
	suma-=k>0?k:0;
	cout<<suma<<endl;
	return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define sz(a) (long long)((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#define mp make_pair
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
        }
        base = base * base;
        y = y >> 1;
    }
    return ans;
}

int main()
{
    fastinput;
    LL n, i, j, k, t, temp, tc;
    cin>>n;
    LL d=n%10;
    if(d==2 || d==4 || d==5 || d==7 || d==9)
    {
        cout<<"hon\n";
    }
    else if(d==3)
    {
        cout<<"bon\n";
    }
    else
    {
        cout<<"pon\n";
    }
    

    return 0;
}


Measured memory_bytes: 3648
#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 ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll Nagaemon1;
void swap(ll i,ll j){
  Nagaemon1=i;
  i=j;
  j=Nagaemon1;
}
ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main(void){
  ll n,q;
  cin >> n;
  vector<ll> a(n);
  vector<ll> w(100001);
  rep(i,100001)w[i]=0;
  ll ans=0;
  rep(i,n){
    cin >> a[i];
    ans+=a[i];
    w[a[i]]++;
  }
  cin >> q;
  vector<ll> b(q),c(q);
  rep(i,q){
    cin >> b[i] >> c[i];
    ans=ans+(c[i]-b[i])*w[b[i]];
    w[c[i]]+=w[b[i]];
    w[b[i]]=0;
    cout << ans << endl;
  }
}

Measured memory_bytes: 6348
#include<bits/stdc++.h>
using namespace std;
int n,m[5],dp[100010][5];
int a,b,c,ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i){
		scanf("%d%d%d",&a,&b,&c);
		m[1]=a;
		m[2]=b;
		m[3]=c;
		for(int k=1;k<=3;++k){
			for(int j=1;j<=3;++j){
				if(j!=k)dp[i][k]=max(dp[i-1][j]+m[k],dp[i][k]);
			}
		}
	}
	for(int i=1;i<=3;++i){
		ans=max(ans,dp[n][i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define MAX 0X3f3f3f3f
#define maxn 200000+10
int vis[200006];
map<int,int>mmp;
int main()
{
    int n,m;
    cin>>n>>m;
    //1-n是否路径只有2
    string s2="IMPOSSIBLE";
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;
        if(a==1)
        {
            if(vis[b])
            {
                s2="POSSIBLE";
            }
            vis[b]=1;
        }
        if(b==n)
        {
            if(vis[a])
            {
                s2="POSSIBLE";
            }
            vis[a]=1;
        }
    }
    cout<<s2<<endl;
    for(int i=1;i<=n;i++)
    {

    }
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;

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

int dp[50][3001];
const int MOD = 100000;

int main() {
  while (true) {
    int n, m, s;
    cin >> n >> m >> s;
    if (n == 0) break;
    n = n * n;
    rep (i, 50) rep (j, 3001) dp[i][j] = 0;
    dp[0][0] = 1;
    rep (i, m + 1) if (i > 0) for (int j = n; j > 0; --j) for (int k = i; k <= s; ++k) {
	  dp[j][k] += dp[j - 1][k - i];
	  dp[j][k] %= MOD;
    }
    cout << dp[n][s] << endl;
  }
}

Measured memory_bytes: 1744
input = gets

list = input.split("\s").map{|x| x.to_i}

total = list[0]
feet = list[1]

found = false
(0..100).each do |t_total|
  k_total = total - t_total
  next if k_total < 0
  feet_cnt = t_total * 2 + k_total * 4
  found = true if feet_cnt == feet
  break if found
end

puts found == true ? 'Yes' : 'No'


Measured memory_bytes: 14352
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
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; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}

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

  ll maxi = 1;
  for(ll i = 2; i * i <= n; i++){
    if(n % i == 0) {
      maxi = i;
    }
  }

  ll ans = (maxi - 1) + (n / maxi - 1);
  cout << ans << endl;
}


Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1 {
	class Program {
		static void Main(string[] args) {
			Console.ReadLine();
			var ngo = new List<int>(Console.ReadLine().Split().Select(select => int.Parse(select)).ToArray());
			ngo.Sort((aa,bb)=>bb-aa);
			int a = 0, b = 0;
			for (int i = 0; i < ngo.Count; i += 2) a += ngo[i];
			for (int i = 1; i < ngo.Count; i += 2) b += ngo[i];
			Console.WriteLine(a - b);
		}
	}
}


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

char shift(char c, int n) {
  return (c - 'A' + n) % 26 + 'A';
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  for (int i = 0; i < s.size(); i++)
    cout << shift(s[i], n);
  cout << endl;
  
  return 0;
}


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

using namespace std;

typedef long long ll;
ll arr[111];
ll lcm(ll a, ll b) {
  return (a * b) / __gcd(a, b);
}

int main() {
  int n;
  cin >> n;
  double ans = 0;
  for (int i = 1; i <= n; ++i) {
    double x;
    cin >> x;
    ans += (1./x);
  }
  ans = (1./ans);
  cout << setprecision(10) << fixed << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

const int N = 100001;

//START OF CODE ->->->->->->->

void solve()
{
    int n,m;
    cin>>n>>m;

    vector<int> a(n);
    map<int,int> f;
    // vector<int> f(N,0);
    int sum = 0;
    rep(i,0,a.size())
    {
        cin>>a[i];
        sum += a[i];
        f[a[i]]++;
        // f[a[i]]++;
    }

    while(m--)
    {
        auto it = f.end();
        it--;

        sum -= (it->ft - (it->ft/2));
        f[it->ft]--;
        f[it->ft/2]++;

        if ( f[it->ft] == 0 )
        {
            f.erase(it);
        }
    }
    // while(m--)
    // {
    //     auto x = max_element(all(a));
    //     sum -= (*x - (*x/2));
    //     *x = *x/2;
    // }

    // repr(i,N-1,1)
    // {
    //     if ( f[i] >= 1 && (m--) )
    //     {
    //         f[i]--;
    //         f[i/2]++;
    //         sum -= (i - (i/2));
    //     }

    //     if ( m == 0 )
    //     {
    //         break;
    //     }
    // }

    cout<<sum<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 7296
// nikkei_procon2019_C
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <map>
#include <tuple>  // std::tuple std::get
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    ll N, taka, aoki;
    cin >> N;
    vector<tuple<ll, ll, ll>> vec(N);
    REP(i, N) {
        cin >> taka >> aoki;
        vec[i] = make_tuple(taka, aoki, taka+aoki);
    }
    
    sort(vec.begin(), vec.end(),
        [](tuple<ll , ll , ll> &tup1, tuple<ll , ll , ll> &tup2) {
            return get<2>(tup1) > get<2>(tup2);
        }
    );
    // calculation
    taka = aoki = 0;
    REP(i, N) {
        if (i%2 == 0) {
            taka += get<0>(vec[i]);
        } else {
            aoki += get<1>(vec[i]);
        }
    }
    cout << taka - aoki << "\n";
    
    return 0;
}


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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 4000000000; //4*10^9;
constexpr auto MOD = 1000000007; //10^9+7;

int main()
{

    string s,t;
    cin >> s >> t;

    cout << t<<s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f first
#define s second
#define ll long long
#define db double
#define pb push_back
#define p_q priority_queue
 
using namespace std;
 
const int N = 3e3, Mod = 998244353, INF = 1e9;

ll n, W, dp[200][300000], w[300000], v[200000], maxx;
 
int main() {
 
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
 	
 	cin >> n >> W;
 	for (int i = 1; i <= n; i ++) {
 	    cin >> w[i] >> v[i];
 	}
 	
 	for (int i = 1; i <= n; i ++) {
 	    for (int j = 1; j <= W; j ++) {
 	        dp[i][j] = dp[i-1][j];
 	        if (j >= w[i]) {
 	            dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]] + v[i]); 
 	        }
 	    }
 	}
 	
    for (int i = 1; i <= W; i ++) {
        maxx = max (maxx, dp[n][i]);
    }
    cout << maxx;
	
	
}

Measured memory_bytes: 82168
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef long double ld;

#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define file_name(a) (freopen(((string)(a) + ".in").c_str(),"r",stdin), freopen(((string)(a) + ".out").c_str(),"w",stdout))


int nxt() {
	int x;
	cin >> x;
	return x;
}

int main() {
	ll n = 100, x, ans = 0;
	cin >> x;
	while (n < x) {
		n += n / 100;
		ans++;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
#include<stack>
#include<stdlib.h>
#define LEN 100005
using namespace std;
//queue実装
typedef struct pp{
   // char name[100];
    string name;
    int t;
} P;

P Q[LEN];
int head,tail,n;
void enqueu(P x){
    Q[tail]=x;
    tail=(tail+1)%LEN;
}
P dequeue(){
    P x=Q[head];
    head=(head+1)%LEN;
    return x;
}
int main(){
    int elaps = 0,c;
    int i,q;
    P u;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++){
        //sscanf("%s",Q[i].name);
        cin>>Q[i].name;
        scanf("%d",&Q[i].t);
        
    }
    head=1;
    tail=n+1;
    while(head!=tail){
        u=dequeue();
        c=min(q,u.t);
        u.t-=c;
        elaps+=c;
        if(u.t>0){
            enqueu(u);
        }else{
            cout<<u.name<<" "<<elaps<<endl;
        }
        
        
    }

return 0;
}



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

int main(){
    string s,t; cin >> s >> t;
    int ans=10000000;
    int ss=s.size();
    int tt=t.size();
    for (int i=0;i<ss-tt+1;i++){
        int a=0;
        int b=0;
        for (int j=i;j<tt+i;j++){
            if (s[j]!=t[b]) a++;
            b++;
        }
        ans=min(a,ans);
    }
    cout <<  ans << "\n";
}






Measured memory_bytes: 3620
unittest
{
	assert( [ "4 3", "0 1 W", "1 2 W", "5 3 B", "5 4 B" ].parse.expand.solve == 4 );
	assert( [ "2 1000", "0 0 B", "0 1 W" ].parse.expand.solve == 2 );
	assert( [ "6 2", "1 2 B", "2 1 W", "2 2 B", "1 0 B", "0 6 W", "4 5 W" ].parse.expand.solve == 4 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( int[] );
	auto xycs = new Tuple!( int, int, char )[ nk[ 0 ] ];
	foreach( ref xyc; xycs )
	{
		input.popFront;
		auto ts = input.front.split.to!( char[][] );
		xyc = tuple( ts[ 0 ].to!( int ), ts[ 1 ].to!( int ), ts[ 2 ][ 0 ] );
	}
	return tuple( nk[ 1 ], xycs );
}

auto solve( int k, Tuple!( int, int, char )[] xycs )
{
	auto kk = 2 * k;
	
	// 各希望を市松模様4セットの中にプロット
	auto bss = new int[][]( 1 + kk * 2, 1 + kk * 2 );
	auto wss = new int[][]( 1 + kk * 2, 1 + kk * 2 );
	foreach( xyc; xycs )
	{
		auto x = xyc[ 0 ] % kk;
		auto y = xyc[ 1 ] % kk;
		if( xyc[ 2 ] == 'B' )
		{
			bss[ 1 + x      ][ 1 + y      ]++;
			bss[ 1 + x + kk ][ 1 + y      ]++;
			bss[ 1 + x      ][ 1 + y + kk ]++;
			bss[ 1 + x + kk ][ 1 + y + kk ]++;
		}
		else
		{
			wss[ 1 + x      ][ 1 + y      ]++;
			wss[ 1 + x + kk ][ 1 + y      ]++;
			wss[ 1 + x      ][ 1 + y + kk ]++;
			wss[ 1 + x + kk ][ 1 + y + kk ]++;
		}
	}
	
	// 二次元累積和表に変換
	for( auto x = 1; x < bss.length; x++ )
	{
		for( auto y = 1; y < bss[ x ].length; y++ )
		{
			bss[ x ][ y ] += bss[ x - 1 ][ y ] + bss[ x ][ y - 1 ] - bss[ x - 1 ][ y - 1 ];
			wss[ x ][ y ] += wss[ x - 1 ][ y ] + wss[ x ][ y - 1 ] - wss[ x - 1 ][ y - 1 ];
		}
	}
	
	// 市松模様をずらして希望を叶えられる最大数を検索
	auto ans = 0;
	for( auto x = kk; x < bss.length; x++ )
	{
		for( auto y = kk; y < bss[ x ].length; y++ )
		{
			auto bc = bss[ x      ][ y      ] - bss[ x - k  ][ y      ] - bss[ x      ][ y - k  ] + bss[ x - k  ][ y - k  ]
			        + bss[ x - k  ][ y - k  ] - bss[ x - kk ][ y - k  ] - bss[ x - k  ][ y - kk ] + bss[ x - kk ][ y - kk ];
			auto wc = wss[ x - k  ][ y      ] - wss[ x - kk ][ y      ] - wss[ x - k  ][ y - k  ] + wss[ x - kk ][ y - k  ]
			        + wss[ x      ][ y - k  ] - wss[ x      ][ y - kk ] - wss[ x - k  ][ y - k  ] + wss[ x - k  ][ y - kk ];
			ans = max( ans, bc + wc );
		}
	}
	return ans;
}


Measured memory_bytes: 132092
#include<stdio.h>
#include<math.h>
int main (){
char s[9]={0};
int shu=0,wa=0,ji[8]={0},i,j;
  scanf ("%s",s);
  for (i=0;i<strlen(s);i++){
   ji[i]= s[i]-'0';
  }
for (i=0;i<strlen(s);i++){
wa=wa+ji[i];
shu=shu+(ji[i]*pow(10,strlen(s)-i-1));
}


  if (shu%wa == 0){
  printf ("Yes");
  }
    else{
    printf ("No");
    }
   return 0; 
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i, n) for (ll i=0;i<n;i++)
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  llc(n);
  llc(m);
  ll l;
  if (n==1&&m==2) l=3;
  if (n==1&&m==3) l=2;
  if (n==2&&m==1) l=3;
  if (n==2&&m==3) l=1;
  if (n==3&&m==2) l=1;
  if (n==3&&m==1) l=2;
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int p = Partition(A, 0, n - 1);
            for (int i = 0; i < n-1; i++){
                if (i == p) Console.Write("[{0}] ", A[i]);
                else Console.Write("{0} ", A[i]);
            }
            Console.WriteLine(A[n-1]);
        }
        public static int Partition(int[] A, int p, int r)
        {
            int temp, x = A[r], i = p - 1;
            for(int j = p; j < r; j++)
            {
                if(A[j] <= x)
                {
                    temp = A[++i];
                    A[i] = A[j];
                    A[j] = temp;
                }
            }
            temp = A[++i];
            A[i] = A[r];
            A[r] = temp;
            return i;
        }
    }
}



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

int main() {
    int a, b;
    cin >> a >> b;
    string ans;
    if (a == b) ans = "Draw";
    else {
        if (a == 1) ans = "Alice";
        else if (b == 1) ans = "Bob";
        else if (a < b) ans = "Bob";
        else if (a > b) ans = "Alice";
    }
    cout << ans << endl;
    return 0;
}

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<int> X(N);
	iota(ALL(X),1);
	vector<ll> P=vecin(N),Q=vecin(N);
	
	int A=0,B=0,K=0;
	do{
		int CA=0,CB=0;
		REP(i,N){
			if(P[i]==X[i]) CA++;
			if(Q[i]==X[i]) CB++;
		}
		if(CA==N) A=K;
		if(CB==N) B=K;
		K++;
	}while(next_permutation(ALL(X)));

	out(abs(A-B));
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a,b;

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

  if(a > b)
    {
      printf("a > b\n");
    }
  else if(a < b)
    {
      printf("a < b\n");
    }
  else if(a == b)
    {
      printf("a == b\n");
    }
  return 0;

}



Measured memory_bytes: 2144
n = int(input())
A = list(map(int,input().split()))
if n ==1: print(0);exit()
cnt = 0
for i in range(1,n):
    if A[i]<A[i-1]:
        cnt += A[i-1]-A[i]
        A[i] = A[i-1]
        
print(cnt)


Measured memory_bytes: 105076
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
  int N;
  int t=1;
  int b=0;
  cin >> N;
 long long int h[N];
  for(int i=0;i<N;i++){
    cin >> h[i];
  }
   sort(h, h + N, greater<int>());
  for(int j=0;j<=N-1;j++){
   
 
      if(h[j]==h[j+1]){
       t++;
        continue;
      } else if(t!=1){
        b+=t%2;
         t=1;
        continue;
      }
      b++;
    
  }
  cout << b << endl ;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        int count = 0;
        boolean next = true;
        while (next) {
            for (int i = 0; i < A.length; i++) {
                if (A[i] % 2 == 0) {
                    A[i] = A[i] / 2;
                } else {
                    next = false;
                }
            }
            if (next) {
                count++;
            }
        }

        System.out.printf("%d\n", count);
    }
}

Measured memory_bytes: 21844