akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

ll count(const vi& v, int k) {
    ll ans = 0;
    for (auto x: v) {
        ans += (x-1) / k;
    }
    return ans;
}


void solve() {
    int N, K;
    cin >> N >> K;
    vi v;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    ll left = 1, right = 1e9;
    while (left < right) {
        ll mid = (left + right) / 2;
        ll k = count(v, mid);
        if (k > K) {
            left = mid+1;
        } else {
            right = mid;
        }
    }
    cout << left;
};

//#define LOCAL 1

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

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();

    return 0;
}

Measured memory_bytes: 4228
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
// top front right left back bottom
//front
void S(vector<int>&in){
  int tmp=in[1];
  in[1]=in[0];
  in[0]=in[4];
  in[4]=in[5];
  in[5]=tmp;
}
//right
void E(vector<int>&in){
  int tmp=in[2];
  in[2]=in[0];
  in[0]=in[3];
  in[3]=in[5];
  in[5]=tmp;
}
//turn
void T(vector<int>&in){
  int tmp=in[1];
  in[1]=in[2];
  in[2]=in[4];
  in[4]=in[3];
  in[3]=tmp;
}
int main(){
	int n;
	while(cin>>n,n){
		vector<vip>in(n);
		rep(i,n){
			int x,y;cin>>x>>y;
			vi t(6);
// top front right left back bottom
			cin>>t[3]>>t[2]>>t[1]>>t[4]>>t[5]>>t[0];
			string s;cin>>s;
			in[i].pb({t[5],{x,y}});
			rep(j,s.size()){
				if(s[j]=='R')E(t),x++;
				if(s[j]=='L')E(t),E(t),E(t),x--;
				if(s[j]=='F')S(t),y--;
				if(s[j]=='B')S(t),S(t),S(t),y++;
				rep(k,in[i].size())if(in[i][k].second==pii(x,y)){in[i][k].first=t[5];goto end;}
				in[i].pb({t[5],{x,y}});
				end:;
			}
		}
		int N=1<<n;
		vi dp(N,-inf);
		dp[0]=0;
		rep(i,N){
			map<pii,int>ma;
			rep(j,n)if(i&1<<j)rep(k,in[j].size())ma[in[j][k].second]=1;
			rep(j,n)if((i&1<<j)==0){
				int sum=0;
				rep(k,in[j].size())if(ma.count(in[j][k].second)==0)
					sum+=in[j][k].first;
				cmax(dp[i|1<<j],dp[i]+sum);
			}
		}
		cout<<dp[N-1]<<endl;
	}
}











Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sf(n) scanf("%lld",&n)
#define sff(n,m) scanf("%lld %lld",&n,&m)
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PLL pair<ll,ll>
#define mod 1000007
#define mx 100005
#define FILE freopen("input.txt","r",stdin)

ll P[mx];
ll ar[mx];

ll F(ll x)
{
  if(x==P[x]) return x;
  return P[x] = F(P[x]);
}

vector<PLL>v;

int main()
{
ll n,m;
sff(n,m);

for(ll i = 1;i<=n;i++){
  P[i] = i;
  ar[i] = 1;
}

while(m--)
{
  ll a,b;
  sff(a,b);

  v.push_back({a,b});
}

ll tot = (n*(n-1))/2;
ll ans = 0;
stack<ll>st;

for(ll i = v.size()-1;i>=0;i--){

    st.push(tot-ans);

    if(F(v[i].first)!=F(v[i].second)){
        ll px = F(v[i].first);
        ll py = F(v[i].second);
        ans+=(ar[px]*ar[py]);
        ar[px]+=ar[py];
        P[py] = px;
    }


}

while(!st.empty()){
    cout<<st.top()<<endl;
    st.pop();
}

return 0;
}


Measured memory_bytes: 5232
#include<stdio.h>
int main(void){

	int n,nai[5][4][11]={0};
	int b,f,r,v,i;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		nai[b][f][r]+=v;
	}
	for(b=1;b<5;b++){
		for(f=1;f<4;f++){
			for(r=1;r<11;r++){
				printf(" %d",nai[b][f][r]);
			}
			printf("\n");
		}
		if(b!=4){
			printf("####################\n");
		}
	}
	return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

void bfs(int v,vector<vector<int>>& vertex, int d[]);

//int depth = 0;

int main(){
    int n;
    cin >> n;
    int num;
    int tmp2;
    int d[n];
    for(int i=0;i<n;i++){
        d[i] = -1;
    }
    vector<vector<int>> vertex;
    vector<int> tmp;
    for(int i=0;i<n;i++){
        cin >> num;
        cin >> num;
        for(int j=0;j<num;j++){
            cin >> tmp2;
            tmp.push_back(tmp2-1);
        }
        vertex.push_back(tmp);
        tmp.clear();
    }
    bfs(0, vertex, d);
    
    for(int i=0;i<n;i++){
        cout << i+1 << " " <<  d[i] << endl;
    }
    return 0;
}

void bfs(int v, vector<vector<int>>& vertex, int d[]){
    queue<int> Q;
    Q.push(v);
    d[v] = 0;
    while(!Q.empty()){
        v = Q.front();
        Q.pop();
        bool flag = false;
        for(int i : vertex[v]){
            if(d[i]==-1){
                d[i] = d[v] + 1;
                Q.push(i);
                flag = true;
            }
        }
    }
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

int main()
{
	int n, m, x;
	std::cin >> n >> m >> x;
	std::vector<int> c(n);
	std::vector<std::vector<int>> a(n, std::vector<int>(m));
	for (int i = 0; i < n; i++) {
		std::cin >> c[i];
		for (auto &e : a[i]) {
			std::cin >> e;
		}
	}
	
	int cSum = 0;
	for (auto e : c) {
		cSum += e;
	}
	std::vector<int> aSum(m);
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			aSum[i] += a[j][i];
		}
		if (aSum[i] < x) {
			std::cout << "-1" << std::endl;
			return 0;
		}
	}
	
	std::function<int(int, int)> func;
	func = [&](int first, int last) {
		int min = 5677970;
		int rt, j;
		for (int i = first; i < last; i++) {
			for (j = 0; j < m; j++) {
				aSum[j] -= a[i][j];
				if (aSum[j] < x) {
					for (int k = 0; k <= j; k++) {
						aSum[k] += a[i][k];
					}
					break;
				}
			}
			if (j < m) {
				continue;
			}
			cSum -= c[i];
			if (last < n) {
				min = std::min(min, func(i + 1, last + 1));
			}
			else {
				min = std::min(min, cSum);
			}
			cSum += c[i];
			for (j = 0; j < m; j++) {
				aSum[j] += a[i][j];
			}
		}
		return min;
	};
	int cMin = cSum;
	int rt;
	for (int i = 0; i < n; i++) {
		rt = func(0, n - i);
		if (rt == 5677970) {
			break;
		}
		cMin = std::min(cMin, rt);
	}
	
	std::cout << cMin << std::endl;
	
	return 0;
}


Measured memory_bytes: 3164
N,M = map(int,input().split())
kss = []
for _ in range(M):
    kss.append(list(map(int,input().split())))
p = list(map(int,input().split()))
answer = 0
for i in range(1 << N):
    members = {}
    for j in range(N):
    
        if (i>>j)&1 == 1:
            # 部分集合にメンバーを追加していく
            members[j+1] = 1
        else:
            members[j+1] = 0
    for k in range(M):
        howManySwitchesOn = 0
        for l in range(len(kss[k])):
            if l == 0:
                continue
            if members[kss[k][l]] == 1:
                howManySwitchesOn += 1
        if howManySwitchesOn%2 != p[k]:
            break
    else:
        answer += 1
    
print(answer)

Measured memory_bytes: 3064
n = gets.to_i
d = Array.new n
f = Array.new n
v = Array.new n
g = Array.new n
n.times do
  u, _, *cs = gets.split.map(&:to_i)
  g[u-1] = cs.map {|c| c - 1 }
end
t = 1
dfs = lambda do |u|
  break if v[u]
  v[u] = true
  d[u] = t
  t += 1
  g[u].each do |c|
    dfs[c]
  end
  f[u] = t
  t += 1
end
n.times do |u|
  dfs[u]
end
n.times do |u|
  puts "#{u+1} #{d[u]} #{f[u]}"
end

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

using namespace std;
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; }

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1 << 30;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
bool cmp(P a, P b) { return a.second < b.second;} //End sort (Interval scheduling problem)

string S;
string T;
bool can;
int idx = 0;

void solve() {
	for(int i=S.size() - T.size(); i >= 0;i--) {
		int cnt = 0;
		for(int j=0;j<T.size();j++) {
			if(S[i + j] == T[j] || S[i + j] == '?') cnt++;
		}
		if(cnt == T.size()) {
			can = true;
			idx = i;
			break;
		}
	}

	return ;
}

int main(void){
	cin>>S>>T;

	solve();

	if(can) {
		S.replace(idx, T.size(), T);

		while(S.find("?") != -1) S[S.find("?")] = 'a';
		cout<< S <<endl;
	}
	else cout<< "UNRESTORABLE" <<endl;
		
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vec vector

typedef long long ll;

const ll inf = 1LL << 60;
const int mod = 1e9 + 7;

using namespace std;

/* Input variables. */
int n, k;

/* Solve! */
void solve() {
  double sum = 0;
  irep(i, 1, n + 1) {
    double p = 1.0 / n;
    int v = i;
    while (v < k) v *= 2, p /= 2;
    sum += p;
  }
  printf("%.20f", sum);
  cout << endl;
}

int main() {
  /* Input handling. */
  cin >> n >> k;

  solve();
  return 0;
}

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

int main()
{
    int n, k, i, sum = 0;
    scanf("%d %d", &n, &k);
    int arr[n];
    for(i = 0; i < n; i++){
        scanf("%d", &arr[i]);
    }
    sort(arr, arr + n);
    for(i = 0; i < k; i++){
        sum = sum + arr[i];
    }
    printf("%d ", sum);

    return 0;
}


Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
int num[4];

int main(){
    string s;
    cin >> s;
    for(int i=0;i<4;i++)num[i] = s[i] - '0';
    if(num[0]+num[1]+num[2]+num[3]==7)cout << num[0] << "+" << num[1] << "+" << num[2] << "+" <<num[3] <<"=7"<<endl;
    else if(num[0]-num[1]+num[2]+num[3]==7)cout << num[0] << "-" << num[1] << "+" << num[2] << "+" <<num[3] <<"=7"<<endl;
    else if(num[0]+num[1]-num[2]+num[3]==7)cout << num[0] << "+" << num[1] << "-" << num[2] << "+" <<num[3] <<"=7"<<endl;
    else if(num[0]-num[1]-num[2]+num[3]==7)cout << num[0] << "-" << num[1] << "-" << num[2] << "+" <<num[3] <<"=7"<<endl;
    else if(num[0]+num[1]+num[2]-num[3]==7)cout << num[0] << "+" << num[1] << "+" << num[2] << "-" <<num[3] <<"=7"<<endl;
    else if(num[0]-num[1]+num[2]-num[3]==7)cout << num[0] << "-" << num[1] << "+" << num[2] << "-" <<num[3] <<"=7"<<endl;
    else if(num[0]+num[1]-num[2]-num[3]==7)cout << num[0] << "+" << num[1] << "-" << num[2] << "-" <<num[3] <<"=7"<<endl;
    else cout << num[0] << "-" << num[1] << "-" << num[2] << "-" <<num[3] <<"=7"<<endl;
    
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b)
{
	int c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}
signed main() {
	int N;
	cin >> N;
	
	vector<int> t(N);

	for (int i = 0; i < N; i++) {
		cin >> t[i];
	}
	int res = 1;
	for (int i = 0; i < N; i++) {
		res = (res / gcd(res, t[i]))*t[i];
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Data.Set as Set
import Data.List as List

chunksOf :: Int -> [a] -> [[a]]
chunksOf n [] = []
chunksOf n xs = (take n xs):(chunksOf n $ drop n xs)

f :: Int -> String -> [String]
f n s
  | n <= (length s) = (take n s):(f n $ tail s)
  | otherwise = []

g :: Int -> String -> (Set String)
g n s
  | n <= (length s) = Set.insert (take n s) (g n $ tail s)
  | otherwise = fromList []

main = do
  s <- getLine
  k <- read <$> getLine :: IO Int
  --let s = "atcoderandatcodeer"
  --let k = 5
  --let s = "aba"
  --let k = 4
  putStrLn $ (!! (k - 1)) $ Set.toAscList $ Set.unions $ List.map (\i -> g i s) [1..k]
  --putStrLn $ (!! (k - 1)) $ List.sort $ List.nub $ List.concat $ List.map (\i -> f i s) [1..k]


Measured memory_bytes: 5116
/**
 * author:  virenkathiriya96
 * created: 2020.08.31 14:34:20 
**/

#include<bits/stdc++.h>

using namespace std;

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int c;
  cin >> c;
  int ans = (c % 1000 == 0) ? 0 : 1000 - (c % 1000);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
    #define sz(a) (int)(a).size()
     
    using namespace std;
     
    template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
    template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
    const int INF = 2e5+2;
    const long long hell = 998244353ll;
    
    double dis(vector<int>a,vector<int> b){
    	double ans=0;
    	for(int i=0; i<sz(a); i++){
    		ans += (a[i]-b[i])*(a[i]-b[i]);
    	}
    	return sqrt(ans);
    }

    void solve(){
          int n,d;
          cin>>n>>d;
          vector<vector<int> > arr(n,vector<int> (d));
          for(int i=0; i<n; i++){
          	for(int j=0; j<d; j++){
          		cin>>arr[i][j];
          	}
          }
          int cnt=0;
          double ans=0;
          for(int i=0; i<n; i++){
          	for(int j=0; j<n; j++){
          		ans = dis(arr[i],arr[j]);
          		if(i!=j && ceil(ans)==floor(ans)){
          			cnt++;
          		}
          	}
          }

          cout<<cnt/2<<endl;

    }

    int main(){
    	
    	ios_base::sync_with_stdio(0);cin.tie(0);
    	
    	int q=1;
    #ifdef LOCAL
      	cin>>q;
#endif
	while(q--){
	 solve();
	}

    #ifdef LOCAL
        cout << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    #endif	
    	return 0;
    }

Measured memory_bytes: 256
/* ex4-3
  kt125*/

#include<stdio.h>

int meter(int heightA, int heightB); //雪が何メートル積もっているかを返す関数

int main(void){
    int heightA, heightB, ans;  //西側A,東側B,answer
    scanf("%d %d", &heightA, &heightB);
    ans = meter(heightA, heightB); 
    printf("%d", ans);
    return 0;
}

int meter(int heightA, int heightB){
    int diff = heightB - heightA,  //隣り合う二つの塔の高さの差
        real_heightB;  //雪に埋もれた部分も合わせた本当の長さ
    for(int i = 0 ; i < diff; i++){
        real_heightB += i + 1;
    }
    return real_heightB-heightB;  //雪に埋もれている長さを返す
}

Measured memory_bytes: 128
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct Combination{
private:
    ll N;
    vector<ll> fac, facinv;

public:
    Combination(ll n){
        N = n;
        fac.push_back(1); fac.push_back(1);
        rep(i,2,N+1) fac.push_back(fac[i-1] * i % MOD);
        rep(i,0,N+1) facinv.push_back(power(fac[i], MOD-2));
    }
    ll power(ll x, ll n){
        if(n == 0) return 1LL;
        ll res = power(x * x % MOD, n/2);
        if(n % 2 == 1) res = res * x % MOD;
        return res;
    }
    ll nck(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[k] % MOD * facinv[n-k] % MOD;
    }
    ll npk(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[n-k] % MOD;
    }
    ll get(ll x){return fac[x];};
    ll getinv(ll x){return facinv[x];};
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll ans = 0;
    Combination cb(200010);

    rep(i,0,min(N, K+1)){
        ans += cb.nck(N-1, (N-i)-1) * cb.nck(N, i) % MOD;
        ans %= MOD;

    }
    print(ans);

    

}

Measured memory_bytes: 6000
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

     int k = sc.nextInt();
     int x = sc.nextInt();
     if (500*k>=x) {
       System.out.println("Yes");
     }else{
       System.out.println("No");
     }
      }
    }


Measured memory_bytes: 21588
integer a, b, c, ans
ans = 3
read*, a, b, c
if(a==b) then
	ans = ans - 1
end if
if(b==c) then
	ans = ans - 1
end if
if(a==c) then
	ans = ans -1
end if
if(ans==0) then
	ans = 1
end if
print*, ans
end

Measured memory_bytes: 256
//ALDS1_2_B Sort I - Section Sort
#include <iostream>
using namespace std;

void swap(int& n1, int& n2)
{
    int temp;
    temp = n1;
    n1 = n2;
    n2 = temp;
}

void printArray(int* a, int n)
{
    for(int i=0; i<n; i++ ) {
        cout << *(a+i);
        if(i<n-1) cout << " ";
    }
    cout << endl;
}

int main()
{
    int l;
    int a[100];
    cin >> l;
    for(int i=0; i<l; i++) {
        cin >> a[i];
    }

    int count = 0;
    int mini;    
    for(int i = 0; i < l; i++) {
        mini = i;
        for(int j = i; j < l; j++) {
            if (a[j] < a[mini]) {
                mini = j;
                
            }
        }
        if (a[i] != a[mini]) {
            swap(a[i],a[mini]);
            count++;
        }
    
    }
    printArray(a,l);
    cout << count << endl;
}


Measured memory_bytes: 3084
n, m = [int(v) for v in input().split()]
d = {}
for i in range(m):
    ai, bi = [int(v) for v in input().split()]
    d[ai] = d.get(ai, [])
    d[bi] = d.get(bi, [])
    d[ai].append(bi)
    d[bi].append(ai)

from collections import deque

r = {1: None}
q = deque([1])
while q:
    no = q.popleft()
    for c in d[no]:
        if c not in r:
            r[c] = no
            q.append(c)

print('Yes')
for i in range(2, n +1):
    print(r[i])

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

// 入力関連
long long N;
long long A[1 << 18];
long long B[1 << 18];
long long S[1 << 18];

// その他
long long min_value = 0, sa = 0;
multiset<long long> SetL, SetR;

void measure(int pos) {
	auto itr = SetL.end(); itr--;
	min_value += abs(S[pos] - (*itr));
}

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N; i++) cin >> B[i];
	for (int i = 1; i <= N; i++) S[i] = S[i - 1] + B[i];

	// 直線を追加していく
	SetL.insert(0);
	SetR.insert(0);
	for (int i = 1; i <= N; i++) {
		sa += A[i];
		if (!SetL.empty() && SetR.size() == 0) {
			auto itr = SetL.end(); itr--;
			SetR.insert((*itr) - sa + A[i]);
		}
		if (sa < S[i]) {
			auto itr = SetR.begin();
			SetL.insert((*itr) + sa);
			SetR.erase(itr);
			measure(i);
			continue;
		}

		if (SetL.empty() && SetR.empty()) {
			SetL.insert(S[i]);
			SetR.insert(S[i] - sa);
		}
		else {
			// Case #1: 両方左側のパターン
			auto itr = SetL.end(); itr--;
			if (S[i] < (*itr)) {
				SetL.insert(S[i]);
				SetL.insert(S[i]);
				auto itr1a = SetL.end(); itr1a--;
				long long val1a = (*itr1a);
				SetR.insert((*itr1a) - sa);
				SetL.erase(itr1a);

				auto itr1b = SetL.end(); itr1b--;
				long long val1b = (*itr1b);
				min_value += (val1a - val1b);
			}
			else {
				long long val1 = (1LL << 60);
				if (!SetR.empty()) {
					auto itr2 = SetR.begin();
					val1 = (*itr2);
				}

				// Case #2: 両方右側のパターン
				if (val1 < S[i]) {
					SetR.insert(S[i] - sa);
					SetR.insert(S[i] - sa);
					auto itr3a = SetR.begin();
					SetL.insert((*itr3a) + sa);
					SetR.erase(itr3a);
				}
				else {
					// Case #3: 片方右側のパターン
					SetL.insert(S[i]);
					SetR.insert(S[i] - sa);
				}
			}
		}
		measure(i);
	}

	// 最後の調整
	vector<long long> vec1, vec2;
	while (!SetL.empty()) {
		auto itr = SetL.begin();
		vec1.push_back((*itr));
		SetL.erase(itr);
	}
	while (!SetR.empty()) {
		auto itr = SetR.begin();
		vec2.push_back((*itr) + sa);
		SetR.erase(itr);
	}

	if (vec1.size() >= 1 && vec1[vec1.size() - 1] > S[N]) {
		for (int i = 0; i < vec1.size(); i++) {
			if (vec1[i] > S[N]) min_value += (vec1[i] - S[N]);
		}
	}
	if (vec2.size() >= 1 && S[N] > vec2[0]) {
		for (int i = 0; i < vec2.size(); i++) {
			if (S[N] > vec2[i]) min_value += (S[N] - vec2[i]);
		}
	}

	cout << min_value << endl;
	return 0;
}

Measured memory_bytes: 15612
#include<iostream>
using namespace std;
int num(int n,int i){
  if(n-i>=0) return n-i;
  else return 0;
}
int main(){
  int ap,bp,abp,abd,x,y,i,min=2000000000,la,su,tx,ty;
  cin >> ap >> bp >> abp >> x >> y;
  abd=2*abp;
  la = (x>y) ? x : y;
  for(i=0;i<=la;i++){
    su = abd*i + num(x,i)*ap + num(y,i)*bp;
    if(min > su){
      min = su;
    }
  }
  cout << min;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#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);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define rsort(x) sort(all(x));reverse(all(x))
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  cin>>s;
  if(s.find('9')!=-1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main(){
  ll m;
  cin >> m;
  ll sum = 0, digit = 0;
  for(ll i = 0; i < m; i++){
    ll d, c;
    cin >> d >> c;
    sum += d * c;
    digit += c;
  }
  cout << digit - 1 + (sum - 1) / 9 << endl;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while((u != NIL) && (k != u->key)){
    if(k < u->key){
      u = u->left;
    }
    else {
      u = u->right;
    }
  }
  
  return u;
}

Node treeSuccessor(Node x){
  Node y;

  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  y = x->parent;
  
  while((y != NIL) && (x = y->right)){
    x = y;
    y = y->parent;
  }

  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if((z->left == NIL) || (z->right == NIL)){
    y = z;
  }
  else {
    y = treeSuccessor(z);
  }

  if(y->left != NIL){
    x = y->left;
  }
  else {
    x = y->right;
  }

  if(x != NIL){
    x->parent = y->parent;
  }
  if(y->parent == NIL){
    root = x;
  }
  else if(y == y->parent->left){
    y->parent->left = x;
  }
  else {
    y->parent->right = x;
  }

  if(y != z){
    z->key = y->key;
  }
}

void Insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else {
      x = x->right;
    }
  }
  z->parent = y;
  
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else {
    y->right = z;
  }
  
}

void Inorder(Node u){
  if(u->left != NIL){
    Inorder(u->left);
  }
  printf(" %d",u->key);
  
  if(u->right != NIL){
    Inorder(u->right);
  }
}

void Preorder(Node u){
  printf(" %d",u->key);
  if(u->left != NIL){
    Preorder(u->left);
  }
  if(u->right != NIL){
    Preorder(u->right);
  }
}

int main(){
  int n, i, x;
  char com[20];;
  Node t;

  scanf("%d", &n);

  root = malloc(sizeof(struct node));
  root = NIL;
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      t = treeSearch(root, x);
      if (t != NIL) printf("yes\n");
      else printf("no\n");
    } else if (com[0] == 'i'){
      scanf("%d", &x);
      Insert(x);
    } else if (com[0] == 'p'){
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    } else if (com[0] == 'd'){
      scanf("%d", &x);
      treeDelete(treeSearch(root,x));
    }
  }

  return 0;
}

Measured memory_bytes: 9844
#include<iostream>
#include<cmath>
using namespace std;
int main(){

  int n;
  
  while(1){
    cin >>n;
    if(n == 0)break;
    int cnt=0;

    for(int i=0 ; i*i <= n ; i++){
      for(int j=0 ; j*j+i*i <= n && i >= j; j++){
	for(int k=0 ; k*k+j*j+i*i <= n && j >= k; k++){
	  int l=sqrt(n-i*i-j*j-k*k);
	  if((i*i+j*j+k*k+l*l == n) && k >= l){
	    cnt++;
	  }
	}
      }
    }
    
    cout <<cnt<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
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; }

int main(){
  string s; cin >> s;
  ll k; cin >> k;
  int num = min(k,(ll)s.size());
  rep(i,num) if('2' <= s[i]){
    cout << s[i];
    return 0;
  }
  cout << 1;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  ll X;
  cin >> X;
  ll now = 100;
  for (int i = 1;; i++) {
    now = (ll)((double)now * 1.01);
    if (now >= X) {
      cout << i << endl;
      return;
    }
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3652
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
tree=[[] for i in range(n+1)]
parent=[0]*(n+1)
count=[0]*m
for i in range(1,m+1):
    a,b=ab[-i]
    A=parent[a]
    B=parent[b]
    if A==0 and B==0:
        parent[a]=a
        parent[b]=a
        tree[a].append(b)
        count[-i]=1
    elif A==0:
        count[-i]=len(tree[B])+1
        parent[a]=B
        tree[B].append(a)
    elif B==0:
        count[-i]=len(tree[A])+1
        parent[b]=A
        tree[A].append(b)
    elif parent[a]==parent[b]:
        count[-i]=0
    else:
        A=parent[a]
        B=parent[b]
        u=len(tree[A])
        v=len(tree[B])
        count[-i]=(u+1)*(v+1)   
        if u<v:
            A,B=B,A
            a,b=b,a
        for u in tree[B]:
            parent[u]=A
        parent[B]=A
        tree[A].append(B)
        tree[A]+=tree[B]
        tree[B]=[]
sum=0
for i in range(0,m):
    sum+=count[i]
    print(sum)

Measured memory_bytes: 86616
import sys
input = sys.stdin.readline
import random
import time
import copy
time0=time.time()

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]

T=[0]
for i in range(1,D+1):
    MAX=-1
    for j in range(1,27):
        if S[i][j]>MAX:
            k=j
            MAX=S[i][j]
    T.append(j)

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

while time.time()-time0<1.77:
    BT=copy.deepcopy(T)
    BLAST=copy.deepcopy(LAST)
    BANS=ANS
    
    d=random.randint(1,D)
    after_t=random.randint(1,26)

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS<BANS:
        T=BT
        LAST=BLAST
        ANS=BANS

print(*T[1:])

Measured memory_bytes: 180072
from fractions import gcd


def main():
    #####segfunc######
    def segfunc(x, y):
        return gcd(x, y)

    def init(init_val):
        # set_val
        for i in range(n):
            seg[i + num - 1] = init_val[i]
            # built
        for i in range(num - 2, -1, -1):
            seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])

    def update(k, x):
        k += num - 1
        seg[k] = x
        while k:
            k = (k - 1) // 2
            seg[k] = segfunc(seg[k * 2 + 1], seg[k * 2 + 2])

    def query(p, q):
        if q <= p:
            return ide_ele
        p += num - 1
        q += num - 2
        res = ide_ele
        while q - p > 1:
            if p & 1 == 0:
                res = segfunc(res, seg[p])
            if q & 1 == 1:
                res = segfunc(res, seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = segfunc(res, seg[p])
        else:
            res = segfunc(segfunc(res, seg[p]), seg[q])
        return res

    n = int(input())
    a = tuple(map(int, input().split()))

    #####単位元######
    ide_ele = 0

    # num:n以上の最小の2のべき乗
    num = 2 ** (n - 1).bit_length()
    seg = [ide_ele] * 2 * num
    init(a)

    ans = -1
    for i in range(n):
        ans = max(ans, gcd(query(0, i), query(i + 1, n)))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 93792
n = int(input())
s = [int(i) for i in input().split()]
q = int(input())
t = [int(i) for i in input().split()]
ans = 0
s.append(10000000000)
for i in range(q):
    l = 0
    r = n + 1
    while r - l > 1:
        m = (l + r) // 2
        if s[m] > t[i]:
            r = m
        else:
            l = m
    if r > 0 and s[r - 1] == t[i]:
        ans += 1
print(ans)


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

int main() {
    int k; cin >> k;
    int ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = i + 1; j <= k; j++) {
            if (i%2==0 && j%2==1) ans++;
            else if (i%2==1 && j%2==0) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    ull x,y,i=1,c=1;
    cin>>x>>y;
    for(i=x;i<=y;i*=2)
    {
        if(i*2 <=y)
        {
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD=1000000007;

int main() {
    ll N,M; cin>>N>>M;
    ll ans=0;
    if(N==1 &&M==1){
        ans=1;
    }
    else if(N==1 || M==1){
        ans=max(N,M)-2;
    }
    else if(N==2||M==2){
        ans=0;
    }
    else{
        ans=(N-2)*(M-2);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
M = [input() for i in range(H)]
dp = [[0 for i in range(W+1)] for j in range(H+1)]
dp[1][1] = 1

for i in range(1, H+1):
  for j in range(1, W+1):
    if i == 1 and j == 1:
      continue
    if M[i-1][j-1] == "#":
      continue
    dp[i][j] = dp[i-1][j] + dp[i][j-1]
print(dp[H][W] % (10**9+7))

Measured memory_bytes: 158440
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>

using namespace std;

typedef long long ll;

int main(void){
    ll n , a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector <int> x[n];
  vector <int> y[n];
  for (int i = 0; i < n; i++) {
	  int a;
	  cin >> a;
	  for (int j = 0; j < a; j++) {
		  int xj, yj;
		  cin >> xj >> yj;
		  xj--;
		  x[i].push_back(xj);
		  y[i].push_back(yj);
		}
	}
  int ans = 0;
  for (int s = 0; s < (1 << n); s++) {
	  bool flag = true;
	  for (int i = 0; i < n; i++) {
		  if (s & (1 << i)) {
			  for (int j = 0; j < x[i].size(); j++) {
				  if ((s & (1 << x[i][j])) ^ (y[i][j] << x[i][j])) {
					  flag = false;
					  break;
					}
				}
			  if (!flag) {
				  break;
				}
			}
		}
	  if (flag) {
		  int num = 0;
		  for (int i = 0; i < n; i++) {
			  if (s & (1 << i)) {
				  num++;
				}
			}
		  ans = max(ans, num);
		}
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int floor(float x){
  int64_t a = x;
  return a;
}

int main(){
  int64_t A, B, N;
  cin >> A >> B >> N;
  
  int64_t x;
  
  if(B <= N){
    x = B - 1;
  }
  else{
    x = N;
  }
  
  int64_t inner = A * floor( x / B);
  int64_t outer = floor( A * x / B);
  
  cout << outer - inner << endl;
  
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	unordered_map<string,int> mp;
	mp["AC"]=0;
	mp["WA"]=0;
	mp["TLE"]=0;
	mp["RE"]=0;
	string temp;
	for(int i=0;i<n;i++){
		cin>>temp;
		mp[temp]++;
	}
	cout<<"AC"<<" x "<<mp["AC"]<<"\n";
	cout<<"WA"<<" x "<<mp["WA"]<<"\n";
	cout<<"TLE"<<" x "<<mp["TLE"]<<"\n";
	cout<<"RE"<<" x "<<mp["RE"];
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
signed main(){
	bool ans=true;
	int c[3][3];
	vector<int>minx(3,999);
	int y[3];
	rep(i,3){
		rep(j,3)cin>>c[i][j];
	}
	rep(i,3){
		rep(j,3){
			minx[i]=min(c[i][j],minx[i]);
		}
	}
	rep(i,3){
		rep(j,3){
			c[i][j]-=minx[i];
			y[j]=c[i][j];
		}
	}
	rep(i,3){
		rep(j,3){
			if(y[j]!=c[i][j])ans=false;
		}
	}
	if(ans)puts("Yes");
	else puts("No");
}
	
	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,a=0;
  cin>>n>>k;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  for(int i=0;i<n;i++){
    a+=min(abs(k-x[i]),x[i]);
  }
  cout<<a*2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #include <bits/stdtr1c++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
 
 
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
 
/// Typedef
typedef long long           ll;
typedef unsigned long       ul;
typedef unsigned long long  ull;
typedef vector<int>         vi;
typedef vector<vi>          vvi;
typedef vector<ll>          vll;
typedef pair<int,int>       pii;
typedef pair<ll,ll>         pll;
 
#define mt                  make_tuple
#define fbo                 find_by_order
#define ook                 order_of_key
#define UB                  upper_bound
#define LB                  lower_bound
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define SQR(x)              ((x)*(x))
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

/// Constants
#define MAX                 200005 
#define MOD                 1000000007
#define base                1000000007
#define eps                 1e-9
#define INF                 1<<20    // 2,305,843,009,213,693,952
#define inf                 2000000000       // 536,870,912
#define PI                  acos(-1.0)  // 3.1415926535897932
// #define INF              0x3f3f3f3f3f3f3f3f
// #define inf              0x3f3f3f3f
///string reverse example

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("C:\\Users\\raiha.DESKTOP-5M3GJRN\\Videos\\Raihan\\input.txt", "r", stdin);
        freopen("C:\\Users\\raiha.DESKTOP-5M3GJRN\\Videos\\Raihan\\output.txt", "w", stdout);
    #endif
    int n,x,s=0;
    cin>>n;
    FOR(i,0,n){
        si(x);
        if(x%2==0){
            if(x%3!=0 && x%5!=0)s=1;
        }
    }
    if(!s)puts("APPROVED");
    else puts("DENIED");
    #ifdef VAMP
       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] a = new long[210];
        int count = 0;
        
        boolean flg = false;
        
        
        for(int i = 0 ; sc.hasNext() ; i++){
            a[i] = sc.nextLong();
        }
        
        
        while(true){
            for(int i = 0; i <= (N - 1) ; i++){
                if(a[i] % 2 != 0){
                    flg = true;
                }else{
                    a[i] = a[i] / 2;
                }
            }
            if(flg){
                break;
            }else{
                count++;
            }
        }
        System.out.println(count);
    }
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    ll n,c;cin>>n>>c;
    vl x(n),v(n);
    vl a1(1,0),a2(1,0),b1(1,0),b2(1,0),c1(1,0),c2(1,0),d1(1,0),d2(1,0);
    rep(i,n)cin>>x[i]>>v[i];
    ll suma=0;
    rep(i,n){
        suma+=v[i];
        if(suma-x[i]>a1[a1.size()-1]){
            a1.PB(suma-x[i]);
            a2.PB(x[i]);
        }
        if(suma-2*x[i]>b1[b1.size()-1]&&x[i]<c/2){
            b1.PB(suma-2*x[i]);
            b2.PB(x[i]);
        }
    }
    ll sumc=0;
    for(int i=n-1;i>=0;--i){
        sumc+=v[i];
        if(sumc-(c-x[i])>c1[c1.size()-1]){
            c1.PB(sumc-(c-x[i]));
            c2.PB(c-x[i]);
        }
        if(sumc-2*(c-x[i])>d1[d1.size()-1]&&(c-x[i])<c/2){
            d1.PB(sumc-2*(c-x[i]));
            d2.PB(c-x[i]);
        }
    }
    ll ans1=a1[a1.size()-1];
    for(int i=1;i<b1.size();++i){
        ll sum=0;
        sum+=b1[i];
        int k=lower_bound(all(c2),c-b2[i])-c2.begin();
        sum+=c1[k-1];
        if(ans1<sum)ans1=sum;
    }
    ll ans2=c1[c1.size()-1];
    for(int i=1;i<d1.size();++i){
        ll sum=0;
        sum+=d1[i];
        int k=lower_bound(all(a2),c-d2[i])-a2.begin();
        sum+=a1[k-1];
        if(ans2<sum)ans2=sum;
    }
    cout<<max(ans1,ans2)<<endl;
}

Measured memory_bytes: 6748
#include <string>
#include <iostream>

using namespace std;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n; cin >> n;

	double arr[n + 1];

	arr[0] = 0;

	for(int i = 1; i <= n; i++) {
		cin >> arr[i];

		arr[i] = 1/arr[i] + arr[i-1];
	}

	cout << 1 / arr[n] << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DIM 107
#define INF 1000000000000000007
//#define endl "\n"
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<long long, long long>  pairll;

ll n,m,h,w,c;
ll i,j,res,sum;
ll a[DIM][DIM];
ll b[DIM];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> c;
    for(i=1; i<=m; i++) cin >> b[i];
    for(i=1; i<=n; i++){
        for(j=1; j<=m; j++){
            cin >> a[i][j];
        }
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=m; j++){
            if(j==1) res=a[i][j]*b[j];
            else res+=a[i][j]*b[j];
        }
        if(res+c>0) sum++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#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(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  string s;

  map<string,int> dict;
  cin >> n;
    REP(i,n){
        cin >> s;
        if (dict.count(s)==0)dict.emplace(s,0);
        dict[s]++;
    }
    cin >> m;
    REP(i,m){
        cin >> s;
        if (dict.count(s)==0)dict.emplace(s,0);
        dict[s]--;
    }
    int mx = 0;
    for(auto x : dict) {
        mx = max(mx,  x.second);
    }
    cout << mx << endl;
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
a=([0]*m)*n
b=list(map(int,input().split()))
for i in range(n):
    a[i]=list(map(int,input().split()))
ans=0
for i in range(n):
    tot=0
    for j in range(m):
        tot+=a[i][j]*b[j]
    if tot+c>0:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

int main() {

	int n;
	int a[2][110]{};

	cin >> n;

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

	int sum[2][110]{};
	for(int i = 1; i < n + 1; i++)
	{
		sum[0][i] += a[0][i] + sum[0][i-1];
		sum[1][i] += a[1][i] + sum[1][i-1];
	}
	
	int max = 0;
	for(int i = 1; i < n+1; i++)
	{
		int sum2array = sum[0][i] + (sum[1][n] - sum[1][i - 1]);
		if(max < sum2array) max = sum2array;
	}

	cout << max << endl;
}



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

namespace AtCoder0815
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] L = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            long ans = 0;

            for (var i = 1; i <= N; i++)
            {
                for (var j = 1; j <= N; j++)
                {
                    if (i >= j) continue;
                    for (var k = 1; k <= N; k++)
                    {
                        if (j >= k) continue;
                        if (L[k - 1] == L[j - 1]) continue;
                        if (L[i - 1] == L[j - 1]) continue;
                        if (L[i - 1] == L[k - 1]) continue;
                        if (L[k - 1] < L[j - 1] + L[i - 1] && L[j - 1] < L[k - 1] + L[i - 1] && L[i - 1] < L[k - 1] + L[j - 1])
                            ans++;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28232
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  set<int> s;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int t,x;
    cin>>t>>x;
    if(t==0) s.emplace(x);
    if(t==0) cout<<s.size()<<endl;
    if(t==1) cout<<s.count(x)<<endl;
    if(t==2) s.erase(x);
  }
  return 0;
}



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

using namespace std;

int n,k;

void solve(){
    int i,j;
    string str;
    cin >> n >> k;
    vector<long long> h(n);
    for(i = 0;i < n;i++) cin >> h[i];
    sort(h.begin(),h.end());
    long long ans = 0;
    for(i = 0;i < n-k;i++) ans += h[i];
    cout << ans << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 1792