akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

const int MAX = 2000005;
const int MOD = 1000000007;

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

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

/* 初期化 */
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

/* combination */
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll n1, a1, b1;
ll com[200005];
void calc(ll n) {
    com[0] = 1;
    REPN(i, 1, 200005) {
        com[i] = com[i-1] * (n-i+1);
        com[i] %= MOD;
        com[i] *= inv[i];
        com[i] %= MOD;
        //cout << i << " " << com[i] << endl;
    }
}


int main(){
    cin >> n1 >> a1 >> b1;
    ll x = modpow(2, n1, MOD);
    ll y = 1, z = 1;
    COMinit();
    calc(n1);
    ll ans = (x - 1 - com[a1] -com[b1] + MOD + MOD) % MOD;
    //cout << x << " " << com[a1] << " " << com[b1] << endl;

    cout << ans << endl;


    return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  V<int> a(n);
  REP(i, n) cin >> a[i], a[i] -= (i+1);

  sort(ALL(a));
  int mid = a[n/2];

  int ret = 0;
  REP(i, n) {
    ret += abs(a[i] - mid);
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(void) {
	int N, A, B;

	scanf("%d%d%d", &N, &A, &B);

	int sam = N * A;

	if (sam >= B) {
		printf("%d\n", B);
	}
	else {
		printf("%d\n", sam);
	}

	return 0;
}

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

while (n > 10):
    n = n % 10



hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]


if n in hon:
    print('hon')

elif n in pon:
    print('pon')

else:
    print('bon')

Measured memory_bytes: 9120
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	int n,m; cin >> n >> m;
	vector<int> v[m];
	vector<int> x(n);
	for(int i=0;i<n;i++){
		cin >> x[i];
	}
	sort(x.begin(),x.end());
	for(int i=0;i<n;i++){
		v[x[i]%m].push_back(x[i]);
	}
	ll ans=0;
	ans+=v[0].size()/2;
	if(m%2==0){
		ans+=v[m/2].size()/2;
	}
	for(int i=1;i<=(m-1)/2;i++){
		if(v[i].size()>v[m-i].size()){
			swap(v[i],v[m-i]);
		}
		int cnt=0;
		for(int j=0;j<v[m-i].size();j++){
			int cp=v[m-i][j];
			int res=0;
			while(cp==v[m-i][j]){
				res++;
				j++;
			}
			j--;
			cnt+=res/2;
		}
		ans+=min(cnt,(int)(v[m-i].size()-v[i].size())/2);
		ans+=v[i].size();
	}
	cout << ans << endl;
}


Measured memory_bytes: 6144
#include <iostream>
using namespace std;
int main(void){
    int N,i;
    int A[100001];
    int w = 0, f = 0;
    cin >> N;
    for(i=0;i < N; i++) {
        cin >> A[i];
    }
    for(i--;i >0; i--) {
        cout << A[i] << " ";
    }
    cout << A[i] << endl;
    return 0;
}


Measured memory_bytes: 3076
/*
Stay innocent, be naive. 
But still dream big. 
Dream big to the point that it is beyond your ability and endeavour to achieve it. 
So dream big and don’t lose your innocence.
*/
import java.util.*;
import java.io.*;

   public class Main
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int Q = Integer.parseInt(st.nextToken());
         LinkedList<Integer>[] edges = new LinkedList[N+1];
         for(int i=1; i <= N; i++)
            edges[i] = new LinkedList<Integer>();
         for(int i=0; i < N-1; i++)
         {
            st = new StringTokenizer(infile.readLine()); 
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            edges[a].add(b);
            edges[b].add(a);
         }
         //query
         int[] addon = new int[N+1];
         for(int i=0; i < Q; i++)
         {
            st = new StringTokenizer(infile.readLine()); 
            int p = Integer.parseInt(st.nextToken());
            int x = Integer.parseInt(st.nextToken());
            addon[p] += x;
         }
         //dfs
         int[] res = new int[N+1];
         dfs(edges, 1, addon, res, new boolean[N+1]);
         StringBuilder sb = new StringBuilder();
         for(int i=1; i <= N; i++)
            sb.append(res[i]+" ");
         System.out.println(sb.toString());
      }
      public static void dfs(LinkedList<Integer>[] edges, int curr, int[] addon, int[] res, boolean[] seen)
      {
         res[curr] += addon[curr];
         seen[curr] = true;
         for(int next: edges[curr])
         {
            if(seen[next])
               continue;
            res[next] += res[curr];
            dfs(edges, next, addon, res, seen);
         }
      }
   }

Measured memory_bytes: 164632
n = input()
data = [int(i) for i in input().split(' ')]

def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list

print(' '.join([str(i) for i in data]))
insertion_sort(data)
#print(' '.join([str(i) for i in insertion_sort(data)]))

Measured memory_bytes: 7704
/*************************************************************************

**  **  **  ****   ****    ******   **    **  **     **   **   **   **              
** **   **  ** ** ** **   **     *  **    **  **   *    *    *    *    *
****    **  **   *   **   **        ********  **   *         *         *
****    **  **       **   **        ********  **     *     *   *     *
** **   **  **       **   **     *  **    **  **        *         *
**  **  **  **       **    ******   **    **  **  ***********************      

*************************************************************************/

#include<bits/stdc++.h>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a, b, c ,d;
    cin >> a >> b >> c >> d;
    string s = a + b + c + d;
    sort(s.begin(),s.end());
    do{
        if (s == "1974") 
            {cout << "YES"; return 0;}
    }while (next_permutation(s.begin(),s.end()));
    cout << "NO";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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 dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    int ans = 0;
    map<int, int> mem;
    rep(i, 0, n) {
        int p; cin >> p;
        mem[p]++;
    }
    for (auto itr = mem.begin(); itr != mem.end(); ++itr) {
        int fr = itr->first, sec = itr->second;
        if (fr > sec) ans += sec;
        else ans += sec - fr;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#include<bitset>
using namespace std;
#define ios ios_base::sync_with_stdio(false);cin.tie(0);
#define setnow clock_t tStart;
#define setTime tStart = clock();
#define time0 (double)(clock() - tStart)/CLOCKS_PER_SEC
#define setin(x) ifstream cin(x);
#define setout(x) ofstream cout(x);
#define NMAX 30
typedef long long ll;
typedef long long int lli;
typedef pair < int, int> dbl;
const int maxInt = 1e9*2;
const lli maxLong = 1e18*2;

int main(){
    int d, n;
    cin >> d >> n;
    if(d == 0){
        if(n == 100)cout << "101";
        else
            cout << n << endl;
    }
    else if(d == 1){
        if(n == 100)cout << (n+1) * 100 << endl;
        else
            cout << n * 100 << endl;
    } else if(d == 2) {
        if(n == 100)cout << (n+1) * 10000 << endl;
        else
        cout << n * 10000 << endl;
    }
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n, k;
	cin >> n >> k;
	double p[n];

	zip(i, 0, n)
	{
		cin >> p[i];
		p[i] = (p[i] + 1) / 2;
	}
	cout << fixed << setprecision(7);
	double x = 0;
	zip(i, 0, k)
	{
		x += p[i];
	}
	double ans = x;
	for (int i = k; i < n; i++)
	{
		x = x - p[i - k];
		x += p[i];
		ans = max(ans, x);
	}
	cout << ans << en;

	return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<stack>
#include<queue>
#include<numeric>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> v(n),p(n),q(n);
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    iota(v.begin(),v.end(),1);
    int i = 0,a = 0,b = 0;
    do{
        if(v == p) a = i;
        if(v == q) b = i;
        i++;
    }while(next_permutation(v.begin(),v.end()));
    cout<<abs(a-b)<<endl;
    return 0;
}

Measured memory_bytes: 256
// contest name
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    ll N, W;
    cin >> N >> W;
    ll dp[N+1][W+1];
    ll w[N+1], v[N+1];
    REP(i,N){
        cin >> w[i] >> v[i];}
    REP(i,N+1){REP(j,W+1){dp[i][j] = 0;}}
  
    REP(i,N){
        REP(j,W+1){
            if(j < w[i]){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 79104
/**
* Problem Link: 
*/              
#include <bits/stdc++.h>

using namespace std;

void test_case(int case_no) {
    int n;
    cin >> n;
    vector<int> a(n), cnt(n);
    for(int i = 1; i < n; ++i) {
        cin >> a[i];
    }
    for(int i = 1; i < n; ++i) {
        cnt[a[i]-1]++;
    }
    for(int i = 0; i < n; ++i) {
        cout << cnt[i] << "\n";
    }
}

int main() {
    // freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    for(int i = 1; i <= t; ++i) {
        test_case(i);
    }
    return 0;
}

Measured memory_bytes: 4780
#include<iostream>

using namespace std;

int main(){
  int n;
  cin >>n;
  int a = 100000;
  for (int i= 0; i<n; i++){
    a = a*1.05;
    if(a%1000 >0) a= a-a%1000+ 1000;
  }
  cout << a <<endl;
}
  

Measured memory_bytes: 1160
import collections
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

sc = collections.Counter(s)
tc = collections.Counter(t)
ans = 0
for x in sc.keys():
  ans = max(ans,sc[x]-tc[x])
print(ans)

Measured memory_bytes: 67160
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>

using ll = long long;
using namespace std;
ll M = 1000000000000000;


int main()
{
	int n;
	cin >> n;
	vector<int> hei(n);
	bool ok = true;
	for (int i = 0;i < n;i++) {
		cin >> hei[i];
		if (i > 0) {
			if (hei[i] - 1 >= hei[i - 1])
				hei[i]--;
		}
	}
	for (int i = 0;i < n-1;i++) {
		if (hei[i] > hei[i + 1])
			ok = false;
	}
	if (ok)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 3752
//冒泡排序
#include <iostream>

using namespace std;

void trace(int a[], int N, int count){

    for(int i=0; i<N;++i)
    {
        if(i>0)
            cout<<" ";
        cout<<a[i];
    }

    cout<<"\n"<<count<<endl;
}
int main(){
    int n;
    int a[100];

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

    int count =0;
    bool flag=1;

    for(int i=0;i<n-1;++i)
    {
        if(flag)
            flag=0;
        else
        {
            trace(a,n,count);
            return 0;
        }
        for(int j=0;j<n-i-1;++j)
        {
            if(a[j]>a[j+1])
            {
                int temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
                count++;
                flag=1;
            }
        }
    }

    trace(a,n,count);
    return 0;
}



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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i + 1 < s.size(); i++) {
        if (s.substr(i, 2) == "AC") {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int m = a * b;
        int r = 2 * ( a + b );
        System.out.println( m + " " + r );
    }
}


Measured memory_bytes: 26244
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, sum, k, q;
ll di_sum;

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

  cin >> n;
  rep(i, n) cin >> a[i] >> b[i];
  rep(i, n) {
    di_sum += a[i] * b[i];
    sum += b[i];
  }
  ans = di_sum / 9;
  if (di_sum % 9 == 0) ans--;
  Cout(ans + sum - 1);
  return 0;
}

Measured memory_bytes: 5888
#include<stdio.h>
#include<string.h>
#define N 100000000 
    
int a();
int b(char);
void insert();
int find();
 
char c[14];
int x[N];
int n;
    
int main()
{
  char str[7];
  int i;
    
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%s%s", str, c);
      
      if(str[0] == 'i') insert();
      else if(str[0] == 'f'){
	if(find()) printf("yes\n");
	else printf("no\n");
      }
    } 
  return 0;
}
   
int a()
{
  int x=0, i, p=1;
  
  for(i = 0; i < strlen(c); i++)
    {
      x += p*(b(c[i]));
      p *= 5;
    }
  return x;
}
    
int b(char c)
{    
  if(c == 'A') return 1;
  else if(c == 'C') return 2;
  else if(c == 'G') return 3;
  else return 4;
}
   
void insert()
{
  x[a()]=1;
}

int find()
{
  int key =a();
        
  if(x[key]) return 1;
  else return 0;
} 

Measured memory_bytes: 38620
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  Scanner sc;

  Main() {
    sc = new Scanner(System.in);
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  class Point {
    int x, y;
  }

  int[][] ofs = {
      {-1, 0},
      {0, 1},
      {1, 0},
      {0, -1}
  };
  int INF = 1 << 28;

  void run() {
    for (; ; ) {
      int N = ni();
      if (N == 0) {
        break;
      }

      ArrayList<Point> list = new ArrayList<>();
      Point zero = new Point();
      zero.x = 0;
      zero.y = 0;
      list.add(zero);
      for (int i = 0; i < N - 1; ++i) {
        int n = ni();
        int d = ni();
        Point atom = list.get(n);
        Point next = new Point();
        next.x = atom.x + ofs[d][0];
        next.y = atom.y + ofs[d][1];
        list.add(next);
      }

      int minx = INF;
      int maxx = -INF;
      int miny = INF;
      int maxy = -INF;
//      debug();
      for (Point p : list) {
//        debug(p.x, p.y);
        minx = Math.min(minx, p.x);
        maxx = Math.max(maxx, p.x);
        miny = Math.min(miny, p.y);
        maxy = Math.max(maxy, p.y);
      }
      System.out.println((maxx - minx + 1) + " " + (maxy - miny + 1));
    }
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	map<string,int> mp;
	while(n--){
		string s;
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;
	return 0;
 } 

Measured memory_bytes: 3632
H = int(input())
W = int(input())
N = int(input())

A_div, A_mod = divmod(N, H)
if A_mod != 0:
    A_div += 1

B_div, B_mod = divmod(N, W)
if B_mod != 0:
    B_div += 1

print(min(A_div, B_div))

Measured memory_bytes: 3060
N,M=[int(x) for x in input().split()]
b=[1]*(N+1)
lst={1}
for i in range(M):
    x,y=[int(j) for j in input().split()]
    b[x]-=1
    b[y]+=1
    if x in lst:
        lst.add(y)
        if b[x]==0 :
            lst.remove(x)
#ans=0
#for i in range(1,N+1):
    #if(b[i]!=0 and i in lst):
        #ans+=1

print(len(lst))


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

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

    int cnt[2] = {0, 0};
    
    string s; cin >> s;
    for (int i = 0; i < s.size(); ++i)
        ++cnt[(i & 1) xor (s[i] - '0')];
    cout << min(cnt[0], cnt[1]) << '\n';
}

Measured memory_bytes: 512
using System;
    class Program
    {
        static void Main(string[] args)
        {
            long xInput = long.Parse(Console.ReadLine());
            int xMax = (int)System.Math.Sqrt(xInput);
            int xMinN = int.MaxValue;

            for (int i = 1; i <= xMax; ++i)
            {
                if (xInput % i == 0)
                {
                    int xNewMinN = System.Math.Max(1 + (int)System.Math.Log10(i) , 1 + (int)System.Math.Log10(xInput / i));
                    if (xNewMinN < xMinN)
                    {
                        xMinN = xNewMinN;
                    }
                }
            }

            Console.WriteLine(xMinN);
        }
    }


Measured memory_bytes: 13140
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int x[n];
    
    for(int i = 0; i < n; ++i)
        scanf("%d", &x[i]);
    
    int mini = x[0], maxi = x[0];
    
    for(int i = 1; i < n; ++i) {
        if (x[i] > maxi) 
            maxi = x[i];
            
        if (x[i] < mini) 
            mini = x[i];
    }
    
    int melhorTotal;
    
    for(int p = mini; p <= maxi; ++p) {
        int total = 0;
        for(int i = 0; i < n; ++i)
            total += (x[i] - p)*(x[i] - p);
        if (p == mini || total < melhorTotal)
            melhorTotal = total;
    }
    
    printf("%d\n", melhorTotal);
    
    

    return 0;
}








Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,m,i,j,l[3005],r[3005],sum,top,f[3005][3005],g[3005][3005];
char s[3005],c1[3005],c2[3005];
int main(){
	//freopen("camp.in","r",stdin);
	//freopen("camp.out","w",stdout);
	n=read();m=read();
	scanf("%s",s+1);
	for(i=1;i<=m;i++){
		l[i]=read();r[i]=read();
		if(r[i]<=r[i-1]){
			l[i]=0;
			r[i]=0;
			m--;
			i--;
		}
	}
	for(i=1;i<=n;i++){
		c1[i]=s[i];
		c2[i]=s[i];
	}
	for(i=1;i<=m;i++){
		sum=0;
		for(j=l[i];j<=r[i];j++)
			if(c1[j]=='1')
				sum++;
		for(j=l[i];j<=l[i]+sum-1;j++)
			c1[j]='1';
		for(j=l[i]+sum;j<=r[i];j++)
			c1[j]='0';
	}
	for(i=1;i<=m;i++){
		sum=0;
		for(j=l[i];j<=r[i];j++)
			if(c2[j]=='0')
				sum++;
		for(j=l[i];j<=l[i]+sum-1;j++)
			c2[j]='0';
		for(j=l[i]+sum;j<=r[i];j++)
			c2[j]='1';
	}
	for(i=1;i<=n;i++)
		if(c1[i]=='1'){
			top++;
			l[top]=i;
		}
	top=0;
	for(i=1;i<=n;i++)
		if(c2[i]=='1'){
			top++;
			r[top]=i;
		}
	for(i=0;i<=r[top];i++)
		g[0][i]=1;
	for(i=1;i<=top;i++){
		for(j=l[i];j<=r[i];j++)
			f[i][j]=g[i-1][j-1];
		for(j=l[i];j<=r[top];j++)
			g[i][j]=(g[i][j-1]+f[i][j])%mo;
	}
	pus(g[top][r[top]],2);
	return 0;
}

Measured memory_bytes: 39168
#include <bits/stdc++.h>
using namespace std;
typedef long long int llt;
int main()
{
    llt n, k ,q;
    cin>>n>>k>>q;
    llt arr[n] = {0};
    memset(arr, 0, sizeof(arr));
    for(int i=0;i<q;i++)
    {
        llt a;
        cin>>a;
        a--;
        arr[a]++;
    }
    for(int i=0;i<n;i++)
    {
        if(q - arr[i] < k) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
	
	int n, q;
	vector<int> S, T;
	
	cin >> n;

	while (n--)
	{
		int a;
		cin >> a;
		S.push_back(a);
	}

	cin >> q;

	while (q--)
	{
		int a;
		cin >> a;
		T.push_back(a);
	}

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

	int c = 0;

	for (int i = 0; i < T.size(); i++) {

		int left, middle, right;
		left = 0;
		right = S.size() - 1;

		while (left <= right)
		{
			middle = (left + right) / 2;

			if (T[i] == S[middle]) {
				c++;
				break;
			}
			else if (T[i] > S[middle]) {
				left = middle + 1;
			}
			else if (T[i] < S[middle]) {
				right = middle - 1;
			}
		}
	}

	cout << c << endl;

	return 0;
}


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

int main() {
  string str;
  cin >> str;
  
  int x = 0;
  
  for ( int i = 0; i < 3; i++) {
    if ( str.at(i) == '1' ) {
       x++;
    }  
  }
    
  cout << x << endl;
    
}


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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for( int i = 0; i < N; ++i ) cin >> A[i];


    map<int,int> mp;
    for( int i = 0; i < N; ++i ) ++mp[A[i]];
    
    sort( A.begin(), A.end(), greater<int>() );

    int ans = 0;
    for( int i = 0; i < N; ++i ){
        if( mp[A[i]] == 0 ) continue;
        // A[i] < tmp = 2^k なる tmp を求める
        long long tmp = 1;
        while( tmp <= A[i] ) tmp *= 2;
        if( A[i]*2 == tmp ){  // A[i] = tmp/2 = 2^{k-1} のとき
            if( mp[A[i]] >= 2 ){
                ++ans;
                mp[A[i]] -= 2;
            }
        }else{
            if( mp[tmp-A[i]] > 0 ){
                ++ans;
                --mp[A[i]];
                --mp[tmp-A[i]];
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ll x,k,d;
    cin>>x>>k>>d;
    x = abs(x);
    ll n = x/d;
    if(x%d!=0) n++;
    if(k<=n)
    {
       cout<<min(abs(x-k*d), abs(x-(k-1)*d))<<"\n";
    }
    else
    {
        ll rem = k-n;
        ll val1,val2;
        if(rem%2) val1 = abs(x-(n-1)*d);
        else val1 = abs(x-n*d);
        rem++;
        if(rem%2) val2 = abs(x-n*d);
        else val2 = abs(x-(n-1)*d);
        cout<<min(val1,val2)<<"\n";
    }
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#define MAXL 5

int main(void){
    char s[MAXL];
    scanf("%s", s);
    
    if(strlen(s) == 2){
        printf("%s\n", s);
    }else{
        for(int i = strlen(s) - 1; i > -1; i--){
            printf("%c", s[i]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int recursion(int);
int recursion(int i){
  int sum;
  if(i==0) {
    return 0;
  } else
  sum = i + recursion(i-1);
  return sum;
}

int main(void) {
  int a;
  cin>>a;
  cout<<recursion(a);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int INF = 10000 ;
int main(void){
     int N , Ma , Mb ;
     int a[45] , b[45] , c[45] ;
     cin >> N >> Ma >> Mb ;
     for(int i=1;i<=N;i++){
          cin >> a[i] >> b[i] >> c[i] ;
     }
     
     int dp[N+2][500][500] ;
     for(int i=1;i<=N;i++){
          for(int j=0;j<500;j++){
               for(int k=0;k<500;k++){
                    dp[i][j][k] = INF ;
               }
          }
     }
    
    for(int i=1;i<=N;i++){
         dp[i][0][0] = 0 ;
    }
    dp[1][a[1]][b[1]] = c[1] ;
    
    for(int i=1;i<N;i++){
         for(int j=0;j<=400;j++){
              for(int k=0;k<=400;k++){
                   
                   if(a[i+1]>j || b[i+1]>k){
                        dp[i+1][j][k] = dp[i][j][k] ; 
                   }else{
                        dp[i+1][j][k] = min(dp[i][j][k] , dp[i][j-a[i+1]][k-b[i+1]] + c[i+1]) ;
                   }
                   
              }
         }
    }
    
    int ans = INF ;
    
    for(int i=1;i<=40;i++){
         ans = min(ans , dp[N][i*Ma][i*Mb]) ;
    }
    if(ans >= INF){
         cout << -1 << endl ;
    }else{
         cout << ans << endl ;
    }
    
}








Measured memory_bytes: 39424
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 string p,s,t,r;
 cin >> s;
 p=s;
 reverse(p.begin(),p.end());
 r=s.substr(0,s.length()/2);
 t=r;
 reverse(t.begin(),t.end());
 if(t==r && p==s)
 {
  reverse(s.begin(),s.end());
  r=s.substr(0,s.length()/2);
  t=r;
  reverse(t.begin(),t.end());
  if(t==r)
  cout << "Yes";
  else
  cout << "No";
 }
 else
 cout << "No";
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll mod = 1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  if (a[n-1] != b[0]) {
    cout << 0 << endl;
    return 0;
  }
  ll res = 1;
  vector<int> d(n);
  d[0] = d[n-1] = 1;
  for (int i = 1; i < n-1; i++) {
    if (a[i-1] < a[i]) {
      if (a[i] > b[i]) {
        cout << 0 << endl;
        return 0;
      }
      d[i] = 1;
    } else d[i] = min(a[i], b[i]);
  }
  for (int i = n - 2; i > 0; i--) {
    if (b[i + 1] < b[i]) d[i] = 1;
  }
  
  for (int i = 0; i < n; i++) {
    (res *= d[i]) %= mod;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 1408
import java.util.Scanner;

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

		// 標準入力より値Hを取得
		int maxLine = sc.nextInt() - 1;

		// 標準入力より値Wを取得
		int maxRow = sc.nextInt() - 1;

		// 標準入力より値hを取得
		int line = sc.nextInt() - 1;

		// 標準入力より値wを取得
		int row = sc.nextInt() - 1;

		// int型2次元配列 [行：H 列：W] [値0：白 値1：黒]
		int[][] arrayInt = new int[maxLine][maxRow];

		// 行の処理
		// 1行目からh行目までの要素の値を1(黒)にする
		// forループ 0から、h-1まで
		for (int i = 0; i < line; i++) {
			// forループ 0から、W-1まで
			for (int j = 0; j < maxRow; j++) {
				// 要素の値に1を代入
				arrayInt[i][j] = 1;
			}
		}

		// 列の処理
		// 1列目からw行までの要素の値を1(黒)にする
		// forループ 0から、H-1まで
		for (int i = 0; i < maxLine; i++) {
			// forループ 0から、w-1まで
			for (int j = 0; j < row; j++) {
				// 要素の値に1を代入
				arrayInt[i][j] = 1;
			}
		}

		// 要素0(白)の数を判定
		// カウンタ変数を0に設定
		int counter = 0;
		// forループ 0から、H-1まで
		for (int i = 0; i < maxLine; i++) {
			// forループ 0から、W-1まで
			for (int j = 0; j < maxRow; j++) {
				// if文 値が0の時、カウンタ変数をインクリメント
				if (arrayInt[i][j] == 0) {
					counter++;
				}
			}
		}

		// カウンタ変数を出力
		System.out.println(counter);
		sc.close();
	}
}


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

int main()
{
    int h[10];
	for(int i=0 ; i<10 ; i++){
		cin >> h[i];
	}
	sort(h,h+10);
	cout << h[9] <<endl<<h[8]<<endl<<h[7]<<endl;
	return 0;
}

Measured memory_bytes: 1176
import java.util.Scanner;
public class Main{
	Scanner sc=new Scanner(System.in);
	int n,m;
	
	void a(){
		for(int i=0; i<7; i++){
			n=sc.nextInt();
			m=sc.nextInt();
			System.out.println(n-m);
		}
	}
		
	public static void main(String[]agrs){
		new Main().a();
	}
}
		

Measured memory_bytes: 17312
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,tot;
int hd[100009],eg[200009],nxt[200009];
int vis[100009];
void ins(int a,int b)
{
	eg[++tot]=b;
	nxt[tot]=hd[a];
	hd[a]=tot;
}
void dfs(int x)
{
	if(vis[x])
		return;
	vis[x]=1;
	for(int i=hd[x];i;i=nxt[i])
		dfs(eg[i]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,a,b,c;i<=m;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		ins(a,b);
		ins(b,a);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			dfs(i);
			ans++;
		}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 4096
#include<stdio.h>

int main(void)
{
	int i=0,n, x[10000],max,min;
	long long int sum = 0;
	scanf("%d", &n);
	
	scanf("%d",&x[i]);
	max = x[i];
	min = x[i];
	sum = sum + x[i];
	i++;
	while (i < n)
	{
		scanf("%d",&x[i]);
		sum = sum + x[i];
		if (x[i]>max)
		{
			max = x[i];
		}
		if (x[i] < min)
		{
			min = x[i];
		}
		i++;
		

	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18



int main(){
    int a,b;
    cin >> a >> b;
    int c = b-a;
    int sum = 0;
    rep(i,c){
        sum += i+1;
    }
    int ans = sum - b;
    cout << ans << endl;
}

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

int main(){
  char x[1000];
  while(1){
    cin >> x;

    int sum=0;
    for(int i=0;x[i]!='\0';i++){
      sum += (int)(x[i]-'0');
    }

    if(sum==0) break;
    else cout << sum << endl;
  }

  return 0;
}
    

Measured memory_bytes: 1140
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }

    ull operator"" _64u(unsigned long long x){ return ull(x); }

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;

E_Set E;
vector<ll> X;
vector<ll> counter;

void dfs(int v, int s = 0){
    s += X[v];
    counter[v] = s;
    for (auto &&u : E[v]) {
        if(counter[u] != -1) continue;
        dfs(u, s);
    } // end u
}


void sub_main(istream &is) {
    ll N, Q;
    is >> N >> Q;
    if(!is) return;
    E.clear();
    X.clear();
    X.resize(N, 0);
    for (int i = 0; i < N-1; ++i) {
        int a, b;
        is >> a >> b;
        a--;b--;
        E[a].insert(b);
        E[b].insert(a);
    } // end i
    for (int j = 0; j < Q; ++j) {
        int p, x;
        is >> p >> x;
        p--;
        X[p] += x;
    } // end j
    counter.clear();
    counter.resize(N, -1);
    dfs(0);
    for (int i = 0; i < N; ++i) {
        cout << counter[i] << ' ';
    } // end i
    cout << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_D.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 54472
#include <bits/stdc++.h>
using namespace std;
const int MOD =(int)(1e9)+7;
int main()
{
    int N,M;
    cin >> N >> M;
    map<int,int>A,B;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        A[a]++;
        if(A[a]>1){
            cout << 0 << endl;
            return 0;
        }
    }
    for(int i=0;i<M;i++){
        int b;
        cin >> b;
        B[b]++;
        if(B[b]>1){
            cout << 0 << endl;
            return 0;
        }
    }

    long long ans=1;
    long long both=0;
    long long onlya=0;
    long long onlyb=0;
    for(int num=N*M;num>=1;num--){
        bool fa=A[num]>0;
        bool fb=B[num]>0;
        if(fa&&fb){
            both+=onlya+onlyb;
            onlya++;
            onlyb++;
        }
        else if(fa){
            ans*=onlyb;
            ans%=MOD;
            onlya++;
            both+=onlyb-1;
        }
        else if(fb){
            ans*=onlya;
            ans%=MOD;
            onlyb++;
            both+=onlya-1;
        }
        else{
            ans*=both;
            ans%=MOD;
            both--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 93952
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A%3 == 0 || B%3 == 0 || (A+B)%3 == 0)
			System.out.println("Possible");
		else
			System.out.println("Impossible");
	}

}


Measured memory_bytes: 24020
S = list(input())
n = len(S)
ans = [0] * n
 
for i in range(2):
  cnt = 0 
  for k in range(n):
    if S[k] == "R":
      cnt += 1
    else:
      ans[k] += cnt // 2
      ans[k-1] += (cnt + 1) // 2
      cnt = 0
  
  
  ans = list(reversed(ans))
  S = list(reversed(S))
 
  for j in range(n):
    if S[j] == "R":
      S[j] = "L"
    else:
      S[j] = "R"
for item in ans:
  print(item, end=" ")

Measured memory_bytes: 5544
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
  long long a,b;
  cin >> a >> b;
  int keta = 0;
  long long k = 0;
  k = 1;
  while(k <= a){
    keta++;
    k *= b;
  }
  cout << keta << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int a,b;
int main()
{
	read(a);
	read(b);
	if(a>b)	swap(a,b);
	if(a==1)
	{
		int ans=b-2;
		if(b==1)	ans=1;
		printf("%d\n",ans);
		return 0;
	}
	printf("%lld\n",1ll*(a-2)*(b-2));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,possible_times=100;
  cin>>N;
  for(int i=0;i<N;i++){
    int x,c=0;
    cin>>x;
    while(x%2==0){
      x/=2;
      c++;
    }
    if(c<possible_times)
      possible_times=c;
  }
  cout<<possible_times<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int build[4][3][10];
    int i,j,k;
	for(int i = 0;i<4;i++)
	{
		for(int j = 0;j<3;j++)
		{
			for(int k = 0;k<10;k++)
			{
				build[i][j][k] = 0;
			}
		}
	}
	int n = 0;
	scanf("%d",&n);
	while(n--)
	{
		int b,f,r,v;
		scanf("%d %d %d %d",&b,&f,&r,&v);
		build[b-1][f-1][r-1]+=v;
	}
	for(i = 0;i<4;i++)
	{
		for(j = 0;j<3;j++)
		{
			for(k = 0;k<10;k++)
			{
				printf(" %d",build[i][j][k]);
			}
			printf("\n");
		}
		if(i !=3)
		{
			printf("####################\n");
		}
	}
	return 0;
 } 


Measured memory_bytes: 2712
#include<bits/stdc++.h>
const int N = 2e5 + 5;
const long long inf = 1e18;
using namespace std;

int n;
long long a[N], ans = inf;

void cal(int x, int y, int z){
    if (0 >= x || x >= y || y >= z || z >= n) return;
    long long B = a[x], C = a[y] - a[x], D = a[z] - a[y], E = a[n] - a[z];
    ans = min(ans, max(max(B, C), max(D, E)) - min(min(B, C), min(D, E)));
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], a[i] += a[i-1];
    for (int i = 2; i <= n-2; i++){
        int l = 1, r = i, A, B;
        while (l != r){
            int mid = (l + r) >> 1;
            if (a[mid] >= a[i] - a[mid]) r = mid;
            else l = mid+1;
        }
        A = l;
        l = i+1, r = n;
        while (l != r){
            int mid = (l + r) >> 1;
            if (a[mid] - a[i] >= a[n] - a[mid]) r = mid;
            else l = mid+1;
        }
        B = r;
        cal(A, i, B); cal(A-1, i, B); cal(A, i, B-1); cal(A-1, i, B-1);
    }
    cout << ans;
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    a,b=SI().split()
    a=int(a)
    b1,b0=map(int,b.split("."))
    print(a*(b1*100+b0)//100)

main()


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int l,r,d; cin >> l >> r >> d;
   cout << ((r/d)-((l-1)/d)) <<endl;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A == B)
    cout << "Draw\n";
  else if (A < B) {
    if (A == 1)
      cout << "Alice\n";
    else
      cout << "Bob\n";
  } else {
    if (B == 1)
      cout << "Bob\n";
    else
      cout << "Alice\n";
  }
  return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "FTFFTFFF", "4 2" ].parse.expand.solve == "Yes" );
	assert( [ "FTFFTFFF", "-2 -2" ].parse.expand.solve == "Yes" );
	assert( [ "FF", "1 0" ].parse.expand.solve == "No" );
	assert( [ "TF", "1 0" ].parse.expand.solve == "No" );
	assert( [ "FFTTFF", "0 0" ].parse.expand.solve == "Yes" );
	assert( [ "TTTT", "1 0" ].parse.expand.solve == "No" );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	input.popFront;
	auto xy = input.front.split.to!( long[] );
	return tuple( s, xy[ 0 ], xy[ 1 ] );
}

auto solve( dchar[] s, long x, long y )
{
	auto gs = s.group;
	
	// 最初は必ず右に移動するので先に処理しておく
	if( gs.front[ 0 ] == 'F' )
	{
		x -= gs.front[ 1 ];
		gs.popFront;
	}
	
	// 横移動と縦移動を分別
	long[] as;
	long[] bs;
	long at;
	long bt;
	auto h = true;
	foreach( g; gs )
	{
		if( g[ 0 ] == 'F' )
		{
			if( h )
			{
				as ~= g[ 1 ];
				at += g[ 1 ];
			}
			else
			{
				bs ~= g[ 1 ];
				bt += g[ 1 ];
			}
		}
		else
		{
			if( g[ 1 ] % 2 ) h = !h;
		}
	}
	if( at < x.abs || bt < y.abs ) return "No";		// 全力で近づいても届かないのでダメ
	
	// 横移動を右と左に振り分けてちょうどxに止まれるか判定
	if( !solve2( as, at, x ) ) return "No";
	
	// 縦移動を上と下に振り分けてちょうどyに止まれるか判定
	if( !solve2( bs, bt, y ) ) return "No";
	
	return "Yes";
}

auto solve2( long[] ds, long dt, long g )
{
	auto dp = new bool[][]( 1 + ds.length, dt * 2 + 1 );
	dp[ 0 ][ dt ] = true;
	foreach( i, d; ds )
	{
		for( auto p = 0L; p < dp[ i ].length; p++ )
		{
			if( !dp[ i ][ p ] ) continue;
			dp[ i + 1 ][ p - d ] = true;
			dp[ i + 1 ][ p + d ] = true;
		}
	}
	return dp[ $ - 1 ][ dt + g ];
}


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

using namespace std;

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

  int w,d;
  while(cin>>w>>d){
    if(w==0) break;
    int h[30]={0};
    int res=0;
    std::vector<int> x(w+1),y(d+1);
    for(int i=0;i<w;i++){
      cin>>x[i];
      h[x[i]]++;
      res+=x[i];
    }
    for(int i=0;i<d;i++){
      cin>>y[i];
      if(h[y[i]]>0){
        h[y[i]]--;
      }
      else res+=y[i];
    }
    cout<<res<<endl;
  }
  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define INL inline
#define REG register
#define DB double
#define LDB long double
#define ULL unsigned long long
#define LL long long

#define RPT(i,x,y) for (REG int i=(x);i<(y);i++)
#define DRPT(i,x,y) for (REG int i=(x);i>(y);i--)
#define MST(a,b) memset((a),(b),sizeof(a))
#define MRK() cout<<"Mark"<<endl;
#define WRT(x) cout<<#x<<" = "<<(x)<<endl;

#define MAXN 10000
#define MAXM 10000
#define MOD 998244353
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5

#define _ 0
using namespace std;

int n;
int a[210000];
int main()
{
	cin>>n;
	RPT(i,0,n)
		scanf("%d",&a[i]);
	int mx=0;
	int mm=-1;
	RPT(i,1,n)
		if (a[mx]<a[i])
			mx=i;
	RPT(i,0,n)
		if ((mm==-1 || mm!=-1 && a[mm]<a[i]) && i!=mx)
			mm=i;
	RPT(i,0,n)
		if (i==mx)
			printf("%d\n",a[mm]);
		else
			printf("%d\n",a[mx]);
	return ~~(0^_^0);
}



Measured memory_bytes: 2432
array = []
output = "Yay!"
for i in range(5):
  n = int(input())
  array.append(n)

k = int(input())

for i in range(5):
  for j in range(i+1,5):
    if abs(array[i]-array[j]) > k:
      output = ":("
          
print(output)

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

int main() {
  vector<int> A(3) ;
  for( int i=0 ; i<3; i++ ){
    cin>> A[i] ;
  }
  if ( A[0]+A[1]+A[2] >=22) 
    cout << "bust" <<endl;
  
  else
   
  
  cout << "win" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n),b(n);
  priority_queue<pair<ll,int>> q;
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n){
    cin >> b[i];
    q.push({b[i],i});
  }
  ll ans = 0;
  while(!q.empty()){
    auto p = q.top(); q.pop();
    int pl = p.S-1;
    if(pl<0) pl+=n;
    int pr = p.S+1;
    if(n<=pr) pr-=n;
    ll cnt = (b[p.S]-a[p.S])/(b[pl]+b[pr]);
    b[p.S] -= (b[pl]+b[pr])*cnt;
    ans += cnt;
    if(b[p.S]!=a[p.S] && cnt > 0){
      q.push({b[p.S],p.S});
    }    
  }

  if(a==b){
    cout << ans << ln;
  } else {
    cout << -1 << ln; return 0;
  }
  return 0;
}

Measured memory_bytes: 10564