akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = (int) 1e5 + 10;
vector<vector<int> > es;

int n;

int read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  es = vector<vector<int> >(n);
  for (int i = 0; i < n - 1; ++i) {
    int s, t;
    scanf("%d%d", &s, &t);
    --s, --t;
    es[s].pb(t), es[t].pb(s);
  }
  return 1;
}


int dfs(int v, int p = -1) {
  int res = 0;
  int mn = 0;
  for (int u : es[v]) {
    if (u == p) {
      continue;
    }
    int got = dfs(u, v);
    {
      int x = (res & got);
      if (x) {
        mn = max(mn, 31 - __builtin_clz(x) + 1);
      }
    }

    res |= got;
    res |= (1 << mn) - 1;
    ++res;
    mn = __builtin_ctz(res);
    res ^= (1 << mn);
  }
  return res ^ (1 << mn);
}

void solve() {
  int mask = dfs(0);
  printf("%d\n", 31 - __builtin_clz(mask));
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 11392
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n) for(int i=1;i<=n;i++)
#define DEBUG 0

lli dp[2010][2010];
lli s[4002][4002];

lli get(lli x,lli y,lli k){
	return s[x+k-1][y+k-1]+s[x-1][y-1]-s[x-1][y+k-1]-s[x+k-1][y-1];
}

int main(){

	lli n,k;
	cin>>n>>k;

	REP(i,2010)REP(j,2010)dp[i][j]=0;

	REP(i,n){
		lli x,y;
		char c;
		cin>>x>>y>>c;
		if(c=='W')y+=k;
		dp[x%(2*k)+1][y%(2*k)+1]++;
	}

	for(lli j=1;j<4*k+1;j++){
		for(lli i=1;i<4*k+1;i++){
			s[i][j] = s[i][j-1]+dp[(i-1)%(2*k)+1][(j-1)%(2*k)+1];
		}
	}

	for(lli j=1;j<4*k+1;j++){
		for(lli i=1;i<4*k+1;i++){
			s[i][j] += s[i-1][j];
		}
	}
	lli ans=0;

	for(lli i=1;i<2*k+1;i++){
		for(lli j=1;j<2*k+1;j++){
			ans = max(ans,get(i,j,k)+get(i+k,j+k,k));
		}
	}


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

Measured memory_bytes: 156928
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			String s = sc.next();
			
			if(s.charAt(s.length()-1) == 's') {
				System.out.println(s + "es");
			}else {
				System.out.println(s + "s");
			}
			

		}catch(Exception e) {
			e.printStackTrace();
		}

	}


}

Measured memory_bytes: 38528
#include<iostream>
#include<algorithm>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(C) (C).begin(),(C).end()
#define fi first
#define se second

typedef pair<int,string> pis;

const int    val[]={  64,  32,  16,  8,     4,    2,    1};
const string str[]={"R1","R2","R4","R8","R16","R32","R64"};

class st{
public:
  int sc;
  string s;
  bool operator<(const st & a)const{
    if (s.size() != a.s.size())return s.size() < a.s.size();
    return s < a.s;
  }
};

vector<st> all;
void make(){
  rep(i,7){
    int now =val[i];
    string snow=str[i];
    all.pb((st){now,snow});
    REP(j,i+1,7){
      now+=val[j];
      snow+=".";
      all.pb((st){now,snow});
    }
  }
  sort(ALL(all));
  //rep(i,all.size())printf("%4d %s\n",all[i].sc,all[i].s.c_str());
}

const int N = 6400010;
int dp[N];
int path[N];

int encode(string &in){
  int sum=0;
  int p=0;
  while(p < in.size()){
    p++;//in[p]='R';
    int now=0;
    while(p < in.size() && isdigit(in[p]))now=now*10+(in[p++]-'0');
    now = 64/now;
    sum+=now;
    while(p < in.size() && in[p] == '.')p++,sum+=now/2,now/=2;
  }
  return sum;
}

bool cmpstr(string &a,string &b){
  int len=min(a.size(),b.size());
  rep(i,len){
    if (a[i] != b[i])return a[i] < b[i];
  }
  return a.size() > b.size();
}

void solve(int tar){
  rep(i,tar+1)dp[i]=N*10,path[i]=-1;
  dp[0]=0;
  rep(i,tar+1){
    rep(j,all.size()){
      if (i-all[j].sc >= 0 && 
	  (all[j].s.size()+dp[i-all[j].sc] < dp[i] ||
	   (all[j].s.size()+dp[i-all[j].sc]==dp[i]&& 
	    cmpstr(all[j].s,all[path[i]].s)))){
	dp[i]=all[j].s.size()+dp[i-all[j].sc];
	path[i]=j;
      }
    }
  }
  while(path[tar] != -1){
    cout << all[path[tar]].s;
    tar=tar-all[path[tar]].sc;
  }
  cout << endl;
}

main(){
  make();
  int te;
  cin>>te;
  while(te--){
    string in;
    cin>>in;
    solve(encode(in));
  }
  return false;
}

Measured memory_bytes: 25000
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
LL ans;
LL n,k;

LL C(LL D,LL U){
	if(U > D/2) U = D-U;
	//cout << D <<' ' <<U <<endl;
	LL fz = 1,fm = 1,Z=1,R = 1;
	while(U!=0){
		R = R * D/Z;
		Z++;
		D--;
		U--;
	}
	return R;
}

LL Chick(LL x ,LL y){
	//cout << x <<' '<<y <<endl;
	LL k = 0;
	for(LL i = y;i <= x;i++){
		k += C(i,y);
	}
	return k;
}
int main(){
	cin >> n >> k;
	if(k > n)ans = (n+1)/2;
	else if(k == n)ans = (n+1)/2 + 1;
	else{
		ans = 0;
		LL M = (n-k)/(k+1);
		M++;
		//cout << M <<endl;
		//int x = (k+1)/2-1;
		//cout<<x<<endl;
		for(LL i = 1;i <= M;i++){
			LL all = ((n - i * (k+1))+1)/2 + i;
			//cout << all <<"   " <<i <<"   "<<endl;
			ans += Chick(all,i);
			//cout << Chick(all,i) <<endl;
		}
		ans += (n+1)/2;
	}
	cout << ans <<endl;
}


Measured memory_bytes: 3096
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<>();
		for(int i = 0 ; i < n ; i++) {
			int a = sc.nextInt();
			if(map.containsKey(a)) {
				map.put(a, map.get(a) + 1);
			} else {
				map.put(a, 1);
			}
		}
		int ans = 0;
		for(int key : map.keySet()) {
			if(key <= map.get(key)) {
				ans += map.get(key) - key;
			} else {
				ans += map.get(key);
			}
		}
		System.out.println(ans);
	}
}


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

int main(){
  double N, count = 0.0, p = 0.0;
  
  cin >> N;
  
  if(fmod(N,2) == 0){
    count = N / 2.0;
  }
  else{
    count = (N-1.0) / 2.0 + 1.0;
  }
  
  p = count / N;
  
  cout << p << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
llfor;ll ans=0;////////////////////////////////////////////////////////////
int main(){
 ll n,m=0,k,r;
 cin>>n>>k;
 ll a[n+10]={0};
 rep(j,0,n){
  cin>>a[j];
  if(j==0)r=a[j];
  else r=gcd(r,a[j]);
  m=max(m,a[j]);
 }
 if(m<k){
  puts("IMPOSSIBLE");
  return 0;
 }
 if(k%r==0){
  puts("POSSIBLE");
  return 0;
 }
 puts("IMPOSSIBLE");
 return 0;}

Measured memory_bytes: 4328
#include <iostream>
#include <vector>
#include <numeric>
#include <limits>

using namespace std;
typedef long long ll;

void setmin(ll& a, ll b){
    if(a > b){ a = b; }
}

void setmax(ll& a, ll b){
    if(a < b){ a = b; }
}

int main(){
    ll n, w;
    cin >> n >> w;
    vector<ll> weight(n), value(n);
    for(int i = 0; i < n; ++i){
        cin >> weight.at(i);
        cin >> value.at(i);
    }

    ll vsum = accumulate(value.begin(), value.end(), 0);

    vector<vector<ll>> dp(n + 1, vector<ll>(vsum + 1, numeric_limits<ll>::max()));
    dp.at(0).at(0) = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j <= vsum; ++j){
            if(dp.at(i).at(j) == numeric_limits<ll>::max()){ continue; }
            if(j + value.at(i) <= vsum){
                setmin(
                    dp.at(i + 1).at(j + value.at(i)),
                    dp.at(i).at(j) + weight.at(i)
                );
            }
            setmin(
                dp.at(i + 1).at(j),
                dp.at(i).at(j)
            );
        }
    }

    ll ans = 0;
    for(int j = 0; j <= vsum; ++j){
        if(dp.at(n).at(j) <= w){
            setmax(ans, j);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 80256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: usize = 1 << 60;

fn main() {
    input!{
        D: usize,
        G: usize,
        pc: [(usize, usize); D],
    }
    let mut ans = INF;
    for bit in 0..(1<<D) {
        let mut selected = HashSet::new();
        let mut score = 0;
        let mut solved = 0;
        for i in 0..D {
            let (p, c) = pc[i];
            let per_one = 100*(i+1);
            if bit & 1<<i == 0 {
                selected.insert(i);
                score += per_one * p + c;
                solved += p;
            }
        }
        if score >= G {
            chmin!(ans, solved);
            continue;
        }
        for i in (0..D).rev() {
            if selected.contains(&i) {
                continue;
            }
            let (mut p, _) = pc[i];
            let per_one = 100*(i+1);
            while p != 0 && score < G {
                score += per_one;
                solved += 1;
                p -= 1;
            }
            if score >= G {
                chmin!(ans, solved);
                break;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc167/tasks/abc167_b>
 問題文============================================================
 B - Easy Linear Programming
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B,C,K; cin >> A >> B >> C >> K;
    
    res += 1*min(A,K);
    K -= min(A,K);
    res += 0*min(B,K);
    K -= min(B,K);
    res += -1*min(C,K);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,m;
	cin >>n >>m;
	if(abs(n-m) >1){ puts("0");return 0;}
	
	ll sn =1, sm=1;
	rep(i,n) (sn *= (i+1)) %=mod;
	rep(i,m) (sm *= (i+1)) %=mod;

	//cout <<sn <<"  "<<sm <<"\n";
	
	ll ans = (sn * sm) %mod;
	if(n == m) (ans *=2)%=mod;
	cout << ans <<"\n";
	return 0;
}


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

template <typename T>
struct flow_graph {
	
	struct edge {
		int from, to;
		T cap, f;
	};
	
	vector<edge> edges;
	vector<vector<int>> g;
	vector<int> level, iter;
	int n, st, fin;
	T flow;
	
	flow_graph(int n, int st, int fin) : n(n), st(st), fin(fin) {
		assert(0 <= st && st < n && 0 <= fin && fin < n && st != fin);
		g.resize(n);
		level.resize(n);
		iter.resize(n);
		flow = 0;
	}
	
	void clear_flow() {
		for (const edge &e : edges) {
			e.f = 0;
		}
		flow = 0;
	}
	
	void add(int from, int to, T cap = 1, T rev_cap = 0) {
		assert(0 <= from && from < n && 0 <= to && to < n);
		g[from].emplace_back(edges.size());
		edges.push_back({from, to, cap, 0});
		g[to].emplace_back(edges.size());
		edges.push_back({to, from, rev_cap, 0});
	}
	
	bool bfs() {
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[st] = 0;
		q.emplace(st);
		while (!q.empty()) {
			int i = q.front();
			q.pop();
			for (int id : g[i]) {
				const edge &e = edges[id];
				if (0 < e.cap - e.f && level[e.to] < 0) {
					level[e.to] = level[i] + 1;
					q.emplace(e.to);
				}
			}
		}
		return 0 < level[fin];
	}
	
	T dfs(int now, T f = numeric_limits<T>::max()) {
		if (now == fin) {
			return f;
		}
		for (int &i = iter[now]; i < g[now].size(); i++) {
			int id = g[now][i];
			edge &e = edges[id];
			if (0 < e.cap - e.f && level[now] < level[e.to]) {
				T d = dfs(e.to, min(f, e.cap - e.f));
				if (0 < d) {
					e.f += d;
					edges[id ^ 1].f -= d;
					return d;
				}
			}
		}
		return 0;
	}
	
	T max_flow() {
		while (bfs()) {
			fill(iter.begin(), iter.end(), 0);
			for (T f = dfs(st); 0 < f; f = dfs(st)) {
				flow += f;
			}
		}
		return flow;
	}
	
	vector<bool> min_cut() {
		max_flow();
		vector<bool> r(n);
		for (int i = 0; i < n; i++) {
			r[i] = level[i] != -1;
		}
		return r;
	}
};

int main() {
	int n;
	cin >> n;
	pair<int, int> a[n], b[n];
	for (auto &p : a) {
		cin >> p.first >> p.second;
	}
	for (auto &p : b) {
		cin >> p.first >> p.second;
	}
	flow_graph<int> g(2 * n + 2, 2 * n, 2 * n + 1);
	for (int i = 0; i < n; i++) {
		g.add(2 * n, i);
		g.add(n + i, 2 * n + 1);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i].first < b[j].first && a[i].second < b[j].second) {
				g.add(i, n + j);
			}
		}
	}
	cout << g.max_flow() << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<int64_t> vec(87);
  vec.at(0) = 2;
  vec.at(1) = 1;
  for (int i = 2; i <= N; i++) {
    vec.at(i) = vec.at(i - 1) + vec.at(i - 2);
  }
  
  cout << vec.at(N) << endl;
}


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

int main(){
    int N, M, X;
    cin>>N>>M>>X;
    vector<int> V(M);
    for(int i=0;i<M;i++) cin>>V[i]; 
    
    int ans = lower_bound(V.begin(), V.end(), X) - V.begin();
    int ans2 = M - ans;
    cout<<min(ans, ans2)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(int argc, char const *argv[])
{
	int n,l;
	cin>>n>>l;
	string a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}

	sort(a,a+n);

	for (int i = 0; i < n; ++i)
	{
		cout<<a[i];
	}
	cout<<'\n';

	return 0;
}

Measured memory_bytes: 256
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

import numpy as np
import bisect

ra=[0]+list(np.cumsum(a))
rb=[0]+list(np.cumsum(b))

ans=0
for i in range(n+1):    
    capa = k - ra[i]
    if ra[i]>k:
        break
    j=bisect.bisect_right(rb,capa)


    ans=max(ans,i-1+j)
            
print(ans)    


Measured memory_bytes: 60200
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

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()
{
    int N;
    cin >> N;
    ll A[N];
    rep(i, N) cin >> A[i];

    ll res = A[0];
    rep(i, N) {
        res = euclidean_gcd(res, A[i]);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
 
#define rp(i, k, n) for (int i = k; i < n; i++)
using ll = long long;
using ld = double;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

int mypow(int X, int n) {  // 繰り返し２乗法　計算量log(n)
    if(n == 0) return 1;
    int Y = mypow(X, n/2);
    if(n % 2 == 1) return X * Y % 13 * Y % 13;
    else return Y * Y % 13;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    reverse(s.begin(), s.end());
    vector<vector<ll>> dp(100010, vector<ll>(13));
    dp[0][0] = 1;
    rp(i, 0, n) {
        char c = s.at(i);
        int p = mypow(10, i);
        if(c == '?') {
            rp(m, 0, 10) {
                rp(j, 0, 13) {
                    dp[i+1][(j+p*m)%13] = (dp[i+1][(j+p*m)%13]+dp[i][j])%MOD;
                }
            }
        }
        else {
            int m = c - '0';
            rp(j, 0, 13) {
                dp[i+1][(j+p*m)%13] = (dp[i+1][(j+p*m)%13]+dp[i][j])%MOD;
            }
        }
    }
    // rp(i, 0, n+1) {
    //     rp(j, 0, 13) {
    //         printf("%lld / ", dp[i][j]);
    //     }
    //     printf("\n");
    // }
    cout << dp[n][5] << endl;
    return 0;
}


Measured memory_bytes: 16704
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll N;
  cin >> N;
  ll a = 0;
  ll amin = 1001;
  ll amax = -1;

  REP(i, N) {
    cin >> a;
    amin = min(a, amin);
    amax = max(a, amax);
  }
  ll ans = amax - amin;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

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

  if(n==0){
    if(a[0]==1){
      cout<<1<<endl;
    }else{
      cout<<-1<<endl;
    }
    return 0;
  }

  if(a[0]==1){
    if(n==0){
      cout<<1<<endl;
      return 0;
    }else{
      cout<<-1<<endl;
      return 0;
    }
  }

  lint result=1;
  lint prev=1;
  for(int i=1;i<=n;i++){
    lint upper_lim=cum[n]-cum[i-1];
    lint lower_lim=a[i];

    if(prev>upper_lim||prev*2<lower_lim){
      cout<<-1<<endl;
      return 0;
    }else{
      result+=min(prev*2, upper_lim);
      prev=min(prev*2, upper_lim)-a[i];
    }

  }
  cout<<result<<endl;


  return 0;
}




Measured memory_bytes: 4780
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <cmath>

#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
  int n,m;
  int keta =0;
  cin >> n;
  m=n;
  while(m!=0){
    m/=10;
    keta++;
  }
  int ans=0;
  if(keta%2 == 0){
    keta -=1;
    for(double i=keta;i>0;i-=2){
      ans += 9*pow(10,i-1);
    } 
    cout << ans;
  } else {
    for(double i=keta-2;i>0;i-=2){
      ans += 9*pow(10,i-1);
    }
    double j=keta-1;
    cout << ans+(n-pow(10,j))+1;
  }
    
      
  
 
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)
int main(){
    int x;
    cin>>x;


    for(int i=10;i<1000;i*=10){
        int mod=x%i;
        if(mod==2 ||mod==4||mod==5||mod==7||mod==9){
            cout<<"hon"<<endl;
            return 0;
        }
        else if(mod==0 ||mod==1||mod==6||mod==8){
            cout<<"pon"<<endl;
            return 0;
        }
        else if(mod==3){
            cout<<"bon"<<endl;
            return 0;
        }else 
            continue;
    }
  
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int n;
  cin>>n;
  vector<int> as(n),ae(n),hs(n),he(n),bs(n),be(n);
  auto get=[](){
    int h,m;
    cin>>h>>m;
    return h*60+m;
  };
  for(int i=0;i<n;i++){
    as[i]=get();
    ae[i]=get();
    hs[i]=get();
    he[i]=get();
    bs[i]=get();
    be[i]=get();
  }
  vector<int> v(n*6);
  copy(as.begin(),as.end(),v.begin()+n*0);
  copy(hs.begin(),hs.end(),v.begin()+n*1);
  copy(bs.begin(),bs.end(),v.begin()+n*2);
  copy(ae.begin(),ae.end(),v.begin()+n*3);
  copy(he.begin(),he.end(),v.begin()+n*4);
  copy(be.begin(),be.end(),v.begin()+n*5);
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  int ans=0;
  auto calc=[&](int x,int y,int z){
    int res=0;
    for(int i=0;i<n;i++)
      if(as[i]<=x&&x<=ae[i]
	 &&hs[i]<=y&&y<=he[i]
	 &&bs[i]<=z&&z<=be[i])
	res++;
    //cout<<x<<" "<<y<<" "<<z<<":"<<res<<endl;
    return res;
  };
  for(int x:v)
    for(int y:v)
      for(int z:v)
	ans=max(ans,calc(x,y,z));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3140
from collections import defaultdict
def f(n):
  dd=defaultdict(int)
  c=[2,3,5,7,11,13,17,19,23,29,31]
  i=0
  while i<11 and n//c[i]:
    while i<11 and n%c[i]==0:
      dd[c[i]]+=1
      n=n//c[i]
    i+=1
  r=1
  for i in dd.values():
    r*=(i+1)
  return r

n=int(input())

l=[i for i in range(1,n+1,2)]
print(sum([1 for i in l if f(i)==8]))


Measured memory_bytes: 3444
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll MOD = 998244353;
const double PI = 2 * asin(1);

ll GCD(ll A, ll B){
  ll M = max(A, B), m = min(A, B);
  while (M % m != 0){
    ll K = M % m;
    M = m; m = K;
  }
  return m;
}

ll LCM(ll A, ll B){
  ll G = GCD(A, B);
  return (A / G) * B;
}

int main(){
  int N; ll M; cin >> N >> M;
  vector <ll> A(N);
  bool odd = false, even = false;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if ((A[i]/ 2) % 2 == 0) even = true;
    else odd = true;
  }

  if (even == true && odd == true){
    cout << 0 << endl;
    return 0;
  }

  if (odd == true){
    ll l = A[0] / 2, L = A[0];
    bool flag = true;
    for (int i = 1; i < N; i++){
      l = LCM(l, A[i] / 2);
      if (flag == true) L = LCM(L, A[i]);

      if (l > M){
        cout << 0 << endl;
        return 0;
      }
      if (l + L > M) flag = false;
    }

    if (flag == false){
      cout << 1 << endl;
      return 0;
    }

    ll ans = 1; M -= l;
    ans += M / L;
    cout << ans << endl;
    return 0;
  }

  bool flag = true;
  ll l = A[0] / 2, L = A[0];
  for (int i = 1; i < N; i++){
    l = LCM(l, A[i] / 2);
    if (flag == true) L = LCM(L, A[i]);

    if (l > M){
      cout << 0 << endl;
      return 0;
    }
    if (l + L > M) flag = false;
  }

  for (int i = 0; i < N; i++){
    if ((l - A[i] / 2) % A[i] != 0 && (l - A[i] / 2) >= 0){
      cout << 0 << endl;
      return 0;
    }
  }
  
  ll ans = 1; M -= l;
  if (flag == true) ans += M / L;
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int N,Y;
int main(){
    cin >> N >> Y;

    int ans10000 = -1;
    int ans5000 = -1;
    int ans1000 = -1;
    for(int i=0;i<=N;++i){
        for(int j=0;j<=N-i;++j){
            if((Y - 10000*i - 5000*j)==1000*(N-i-j)){
                ans10000 = i;ans5000 = j;ans1000 = N-i-j;
                break;
            }
        }
    }


    cout << ans10000 << " " << ans5000 << " " << ans1000 <<  endl;
    return 0;
}


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

int cooktime(int t)
{
	return (t+9)/10*10;
}
int waitime(int t)
{
	return (t+9)/10*10 - t;
}
int main()
{
	vector<int> order(5);
	for(int i = 0; i < 5; i++){
		cin >> order[i];
	}
	int sum = 0;
	for(int i = 0; i < 5; i++)
		sum += cooktime(order[i]);
	int wt = 0;
	for(int i = 0; i < 5; i++){
		wt = max(waitime(order[i]), wt); 
	}
	sum -= wt;
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
n = 0
w = 0
s = 0
e = 0

for i in range(len(S)):
    if S[i] == "N":
        n += 1
    elif S[i] == "W":
        w += 1
    elif S[i] == "S":
        s += 1
    else:
        e += 1
if n > 0 and w > 0 and s > 0 and e > 0:
    print("Yes")
elif n > 0 and s > 0 and w == 0 and e == 0:
    print("Yes")
elif w > 0 and e > 0 and s == 0 and n == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <utility>
using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

pair<string, vector<string>> split(const string &S) {
  int index;
  string T = S;
  index = T.find(':');
  string group = T.substr(0, index);
  T = T.substr(index + 1);
  vector<string> members;
  while(true) {
    index = T.find(',');
    if(index == string::npos) {
      members.push_back(T.substr(0, T.find('.')));
      break;
    }
    members.push_back(T.substr(0, index));
    T = T.substr(index + 1);
  }
  return make_pair(group, members);
}

int main() {
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    vector<string> data(N);
    for(int i = 0; i < N; ++i) {
      cin >> data[i];
    }
    vector<pair<string, vector<string>>> data2(N);
    for(int i = 0; i < N; ++i) {
      data2[i] = split(data[i]);
    }
    map<string, int> groups;
    for(int i = 1; i < (int)data2.size(); ++i) {
      groups[data2[i].first] = i;
    }
    set<string> memb;
    for(int i = 0; i < (int)data2[0].second.size(); ++i) {
      memb.insert(data2[0].second[i]);
    }
    while(true) {
      bool update = false;
      for(auto p : groups) {
        if(memb.count(p.first)) {
          update = true;
          memb.erase(p.first);
          for(string & name : data2[p.second].second) {
            memb.insert(name);
          }
        }
      }
      if(!update) break;
    }
    cout << memb.size() << endl;
  }
}

Measured memory_bytes: 1352
#include<stdio.h>
#include<stdlib.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  if(tail == LEN) tail = 1;
  else tail++;
}

P dequeue(){
  P x = Q[head];
  if(head == LEN) head = 1;
  else head++;
  return x;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = n+1;
  
  while(head != tail){
    u = dequeue();
    if(q < u.t) c = q;
    else c = u.t;

    u.t = u.t - c;
    elaps = elaps + c;

    if(u.t > 0){
      enqueue(u);
    }
    else printf("%s %d\n",u.name,elaps);
  }
    return 0;
}


Measured memory_bytes: 11892
#include <cstdio>
#include <cctype>
#include <utility>
#include <cmath>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;
	while (isspace(c)) {c = gcu();}
	if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (double q, x; q = in(), q != -1;) {
		for (x = q / 2; abs(x * x * x - q) >= 0.00001 * q; x = x - (x * x * x - q) / (3 * x * x))
			;
		printf("%f\n", x);
	}
}


Measured memory_bytes: 2520
import java.util.Scanner;


	public class Main {
		
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[] p =new int[m];
			String[] s = new String[m];
			int[] ac = new int[n+1];
			int[] wa = new int[n+1];
			
			for(int i=0;i<m;i++) {
				p[i] = sc.nextInt();
				s[i] = sc.next();
			}
			
			for(int i=0;i<m;i++) {
				if(s[i].equals("AC")&&!(ac[p[i]]>=1)) {
					ac[p[i]] = 1;
				}
				if(s[i].equals("WA")&&!(ac[p[i]]>=1)) {
					wa[p[i]]++;
				}
			}
			
			int acnum = 0;
			int penanum = 0;
			
			for(int i=1;i<=n;i++) {
				acnum += ac[i];
				if(ac[i]>0) {
					penanum += wa[i];
				}
			}
			
			System.out.println(acnum+" "+penanum);
		}
		
	}


Measured memory_bytes: 71088
from sys import stdin
from collections import defaultdict
from heapq import *

class UnionFind:

    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n)]
        self.height = [0] * n
        self.size = [1] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def getsize(self, x):
        return self.size[self.find(x)]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.height[x] < self.height[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = self.par[x]
            self.size[x] += self.size[y]
            if self.height[x] == self.height[x]:
                self.height[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

N, M = map(int, input().split())
uf = UnionFind(N+1)
for i in range(M):
    a, b = map(int, input().split())
    uf.unite(a, b)
ans = 0
for i in range(N):
    ans = max(ans, uf.getsize(i+1))
print(ans)

Measured memory_bytes: 89980
#include<bits/stdc++.h>
using namespace std;
#define int long long  
#define mod 1000000007
#define am 998244353
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
int abs(int a,int b){ 
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
}
int lcm(int a,int b){//最小公倍数
    return (a*b)/gcd(a,b);
}	    
signed main(){
// __builtin_ctz(N);      Nを２で何回割り切れるかを返す
//(n+1)*n/2;              １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    int all=0;
    int ur=0,ub=0;
    int wr=0,wb=0;
    int qr=0,qb=0;
    cin>>a>>b>>c;
    all=a*b*c;
    ur=((a+1)/2)*b*c;
    ub=all-ur;
    wr=a*((b+1)/2)*c;
    wb=all-wr;
    qr=a*b*((c+1)/2);
    qb=all-qr;
    cout<<min(abs(ur,ub),min(abs(wr,wb),abs(qr,qb)))<<"\n";
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

typedef long long ll;

ll ans[2333333];
int tot;

void put(ll x){ans[++tot]=x;}

int dig(ll x)
{
	int ret=0;
	while(x)ret+=x%10,x/=10;
	return ret;
}

bool check(ll m,ll i)
{
	if(m-i<i)return 0;

	return (m/i)%10!=0;
}

void dfs(ll m)
{
//	printf("m = %lld\n",m);
	put(m);

	ll sm=dig(m);

	for(ll i=1;i<m;i*=10)
	{
//		if(m==9)printf("m = %lld , i = %lld\n",m,i);
//		if(!check(m,i))continue;
//		printf("m = %lld ,i*sm = %lld\n",m,i*sm);

		ll n=m-i;

		if(n*sm<=m*dig(n))
		{
			dfs(m-i);
			return;
		}
	}
}

void initialize()
{
	ll pi=10;
	for(int i=1;i<=14;i++)
		pi*=10;

	dfs(pi-1);

	std::sort(ans+1,ans+tot+1);
}

int main()
{
//	freopen("ans","w",stdout);
	initialize();
	int K;

	scanf("%d",&K);
	for(int i=1;i<=K;i++)
		printf("%lld\n",ans[i]);

	return 0;
}


Measured memory_bytes: 256
/*
      author : nishi5451
      created: 12.08.2020 11:35:21
*/

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


int main(){
    int x;
    cin >> x;
    int ans = 8-(x-400)/200;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    
		String x = "";
		try {
			x = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		for (int i = 0; i < x.length(); i++) {
			char c = x.charAt(i);
			if ((c < 'A') || c > 'z') {
				System.out.print(c);
				continue;
			}
			
			if ((c - 'a') < 0) {
				c = (char)(c + ('a' - 'A'));
			} else {
				c = (char)(c - ('a' - 'A'));
			}
			System.out.print(c);
		}
		
		System.out.println();
	}
}

Measured memory_bytes: 24868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedMap;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N;
    	SortedMap<String, SortedMap<Integer, Integer>> ranking = new TreeMap<>();
    	
        void solve(InputReader in, PrintWriter out) {
            // write your code here
        	N = in.nextInt();
        	for (int i = 1; i <= N; ++i) {
        		String s = in.next();
        		int p = in.nextInt();
        		if (!ranking.containsKey(s)) {
        			ranking.put(s, new TreeMap<>(Comparator.reverseOrder()));
        		}
        		ranking.get(s).put(p, i);
        	}
        	
        	for (Map.Entry<String, SortedMap<Integer, Integer>> e : ranking.entrySet()) {
        		for (Map.Entry<Integer, Integer> e1 : e.getValue().entrySet()) {
        			out.println(e1.getValue());
        		}
        	}
        }
        
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

const int N_MAX = 2e5;

vi G[N_MAX];
int ans[N_MAX];

void dfs(int v, int p=-1)
{
    for(auto u:G[v]){
        if (u==p) continue;
        ans[u]+=ans[v];
        dfs(u,v);
    }
}

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q; cin>>N>>Q;
    rep(i,N-1){
        int a,b; cin>>a>>b; a--; b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    while(Q--){
        int p,x; cin>>p>>x; p--;
        ans[p]+=x;
    }
    dfs(0);
    rep(i,N){
        if (i>0) cout<<" ";
        cout<<ans[i];
    }
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 27844
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>

int main() {
	char str[1000];
	scanf("%s", str);
	for (int i = 0, len = strlen(str); i < len; i++)
		str[i] += str[i] > 'C' ? -3 : 23;
	printf("%s\n", str);

	return 0;
}

Measured memory_bytes: 948
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

LL N, A[112345];
int which = 0;
LL ans;

int main()
{
	in >> N;
	rep(i, N) { in >> A[i]; }

	rep(i, N - 1)
	{
		if (which == 0)
		{
			if (A[i] > A[i + 1])
			{
				which = 2;
			}
			if (A[i] < A[i + 1])
			{
				which = 1;
			}
		}
		if (which == 1 && A[i] > A[i + 1])
		{
			++ans;
			which = 0;
		}
		if (which == 2 && A[i] < A[i + 1])
		{
			++ans;
			which = 0;
		}
	}

	out << ans + 1 << std::endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

        final int n = sc.nextInt();

        for (int i = 0; i <= n; i += 4) {
            for (int j = 0; j <= n; j += 7) {
                if (i + j == n) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }
}


Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    vector<int> A, S;
    for (auto x : mp) A.push_back(x.se);
    sort(all(A));
    S.push_back(0);
    for (int a : A) {
        int nxt = S.back() + a;
        S.push_back(nxt);
    }
    REP(i, 1, n) {
        int ok = 0, ng = n/i + 1;
        while(ng - ok > 1) {
            int mid = (ng + ok) / 2;
            int idx = lower_bound(all(A), mid) - A.begin();
            int m = S[idx] + (A.size() - idx) * mid;
            if (m >= mid * i) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        cout << ok << endl;
    }
}

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


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

int main(){
    
    int n;
    cin >> n;
    vector<double> x(n);
    vector<string> u(n); 
    int jmoney = 0;
    double bmoney = 0;
    for(int i=0; i<n; i++){
        cin >> x.at(i);
        cin >> u.at(i);
        if(u.at(i) == "BTC"){
            bmoney += x.at(i)*380000;
        }
        else{
            jmoney += x.at(i);
        }
    }
    cout << bmoney+jmoney << endl;
}

Measured memory_bytes: 3796