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

#define M 17438616 // (5^12-1)/14
#define L 14

char H[M][L] = {}; /* Hash Table */

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

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

int h1(long long key){ return key/14; }
int h2(long long key){ return key%14; }

int find(char str[]){
  long long key = getKey(str);
  if ( H[h1(key)][h2(key)] ) return 1;
  return 0;
}

int insert(char str[]){
  long long key = getKey(str);
  H[h1(key)][h2(key)] = 1;
  return 0;
}

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

    return 0;
}



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

using namespace std;

struct doll {
    int x, h;
    bool operator<(const doll& o) const {
        return x < o.x && h < o.h;
    }
};

bool compare_by_x(const doll& a, const doll& b) {
    return a.x < b.x;
}

int n, m;
vector<doll> ds;
vector<int> dp;

int solve(int c) {
    if (0 <= dp[c]) return dp[c];
    for (int i = 0; i < c; i++) {
        if (ds[i] < ds[c]) {
            dp[c] = max(dp[c], solve(i)+1);
        }
    }
    return dp[c];
}

int main() {
    while (cin >> n, n != 0) {
        ds.clear();
        for (int i = 0; i < n; i++) {
            doll d;
            cin >> d.x >> d.h;
            ds.push_back(d);
        }
        cin >> m;
        for (int i = 0; i < m; i++) {
            doll d;
            cin >> d.x >> d.h;
            ds.push_back(d);
        }
        sort(ds.begin(), ds.end(), compare_by_x);
        dp.clear();
        dp.resize(n+m, -1);

        dp[0] = 1;
        int max_mat = 0;
        for (int i = 0; i < n+m; i++) 
            max_mat = max(max_mat, solve(i));
        cout << max_mat << endl;
    }
    return 0;
}
    

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

const int MAX_G = 401;
int N, MA, MB;
int A[40];
int B[40];
int C[40];
int G[MAX_G][MAX_G];
 
int main() {
 
    cin >> N >> MA >> MB;
    rep(i, N){
        cin >> A[i] >> B[i] >> C[i];
    }
 
    rep(i, MAX_G)
        rep(j, MAX_G)
    {
        G[i][j] = 999999;
    }
    G[0][0] = 0;
 
    rep(i, N){
        for (int a = MAX_G - 1; a >= 0; a--)
            for (int b = MAX_G - 1; b >= 0; b--)
        {
            if (G[a][b] != 999999){
                int aa = a + A[i];
                int bb = b + B[i];
                G[aa][bb] = min(G[aa][bb], G[a][b] + C[i]);
            }
        }
    }
 
    int ret = 999999;
    int ma = MA;
    int mb = MB;
    while (true){
        ret = min(G[ma][mb], ret);
 
        ma += MA;
        mb += MB;
        if (ma >= MAX_G || mb >= MAX_G) break;
    }
 
    if (ret == 999999) ret = -1;
    cout << ret << endl;
 
    return 0;
}


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

using namespace std;

const int N = 100 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, m;
long long a[N];
pair<long long, int> b[N];

bool read() {
    if (!(cin >> n >> m))
        return false;

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

    for (int i = 0; i < m; ++i)
        cin >> b[i].second >> b[i].first;

    return true;
}

void solve() {
    sort(b, b + m, [](pair<long long, int> a, pair<long long, int> b) {
        return a.first > b.first;
    });

    sort(a, a + n, [](long long a, long long b) { return a < b; });

    for (int i = 0, j = 0; j < m; ++j)
        for (int k = 0; k < b[j].second && i < n && a[i] <= b[j].first; ++k, ++i)
            a[i] = b[j].first;

    cout << accumulate(a, a + n, 0ll) << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl v(n);
    rep(i, n) {
        cin >> v[i];
    }

    ll ans = 0;
    exrep(l, 0, k) {  // 左からl個取り出す
        exrep(r, 0, k) {  // 右からr個取り出す
            if(l+r > k || l+r > n) {
                continue;
            }
            vl vec;  // 持っている宝石の価値
            rep(i, l) {
                vec.pb(v[i]);
            }
            for(ll i = n-1; i >= n-r; i--) {
                vec.pb(v[i]);
            }
            sort(all(vec));
            ll y = k - (l+r);  // 捨てられる回数
            ll cnt = 0;  // いま何回捨てたか
            ll now = 0;  // いまのスコア
            rep(i, vec.size()) {
                if(cnt < y && vec[i] < 0) {
                    cnt++;
                }
                else {
                    now += vec[i];
                }
            }
            chmax(ans, now);
        }
    }

    out(ans);
    re0;
}

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

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

Measured memory_bytes: 5760
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#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 IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

signed main(void)
{
	int n;
	string s;
	cin >> n >> s;
	
	int x = 0, ans = 0;
	REP(i, s.size()) {
		if(s[i] == 'I') x++;
		else x--;
		ans = max(ans, x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from scipy.sparse import*;N=int(input());Z=[[i]+list(map(int,input().split()))for i in range(N)];P=set()
for j in[1,2]:
 Z.sort(key=lambda a:a[j])
 for i in range(1,N):
  a,b,c=Z[i-1]
  d,e,f=Z[i]
  P.add((min(abs(e-b),abs(f-c)),a,d))
d,i,j=zip(*P);print(int(csgraph.minimum_spanning_tree(csr_matrix((d,(i,j)),(N,N))).sum()))

Measured memory_bytes: 81556
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = sz(s);
    vvi idx(26);
    rep(i, n) {
        idx[s[i] - 'a'].pb(i);
    }
    rep(i, 26) {
        if (sz(idx[i]) == 1) continue;
        rep(j, sz(idx[i]) - 1) {
            if (idx[i][j+1] - idx[i][j] <= 2) {
                cout << idx[i][j]+1 << " " << idx[i][j+1]+1 << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1" << endl;
}

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

using namespace std;

#define ll long long
#define ar array


int n;

void solve(){

    cin >> n;

    n = n%10;
    if(n == 3){
        cout << "bon" << endl;
    }
    else if(n == 0 || n == 1 || n==6 || n==8){
        cout << "pon" << endl;
    }
    else{
        cout <<"hon" <<endl;
    }
}   





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 3660
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

vector<int> zalgo(string S) {
	vector<int>A(S.size());
	A[0] = S.size();
	int i = 1, j = 0;
	while (i < S.size()) {
		while (i + j < S.size() && S[j] == S[i + j])j++;
		A[i] = j;
		if (j == 0) { i++; continue; }
		int k = 1;
		while (i + k < S.size() && k + A[k] < j) { A[i + k] = A[k]; k++; }
		i += k;
		j -= k;
	}
	return A;
}

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

	int N;
	cin >> N;
	string S;
	cin >> S;

	int ans = 0;
	for (int l1 = 0; l1 < N; l1++) {
		string temp;
		for (int i = l1; i < N; i++)temp.pb(S[i]);
		vector<int>A = zalgo(temp);
		for (int j = l1; j < N; j++)ans = max(min(A[j-l1],j-l1),ans);
	}
	puts(ans);

	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
      if(a < b){
                System.out.println("a < b");
      }else if(a > b){
                System.out.println("a > b");
      }else{
                System.out.println("a == b");
      }
    }
}



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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int d[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>d[i];
	}
	sort(d,d+n);
	cout<<d[n/2]-d[n/2-1]<<endl;
	return 0;
}


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn func(x: usize) -> usize {
    match x % 4 {
        0 => x,
        1 => 1,
        2 => x+1,
        _ => 0,
    }
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", if a <= 1 {0} else { func(a-1) } ^ func(b));
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

Measured memory_bytes: 4352
<?php
	for($dataset_cnt = 0; 5 >= $dataset_cnt; $dataset_cnt++)
	{
		$input_cnt = trim(fgets(STDIN));
		if(0 == $input_cnt)
		{
			break;
		}
		
		$pointa = 0;
		$pointb = 0;
		
		for($loop_cnt = 0; $input_cnt > $loop_cnt; $loop_cnt++)
		{
			$input_data = split(" ", trim(fgets(STDIN)));
			if($input_data[0] > $input_data[1])
			{
				$pointa += $input_data[0] + $input_data[1];
			}
			else if($input_data[0] < $input_data[1])
			{
				$pointb += $input_data[0] + $input_data[1];
			}
			else
			{
				$pointa += $input_data[0];
				$pointb += $input_data[1];
			}
		}
		echo $pointa . " " . $pointb . "\n";
	}
?>


Measured memory_bytes: 9268
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _001_B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nx = ReadLongs();
            long n = nx[0];
            long x = nx[1];
            Console.WriteLine(Length(n, x));
        }

        static long Length(long n, long x)
        {
            long min = Math.Min(n - x, x);
            long max = n - min;
            long cnt = max / min;

            if (max % min == 0)
            {
                return min * 3 * cnt;
            }
            else
            {
                long margin = max % min;
                return min * 3 * cnt + Length(margin + min, min);
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  char a;
  cin>>a;
  cout<<(a=='a' || a=='i' || a=='u' || a=='e' || a=='o' ? 
         "vowel" : "consonant")<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};

int main(void){
    int N,M;
    cin >> N >> M;
    int ans[N]={};
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--,v--;
        ans[u]++,ans[v]++;
    }
    rep(i,N) cout << ans[i] << endl;
}

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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i, n) for (ll i = 0; i < (n); i++)
#define forn for (ll i = 0; i < (n); i++)
#define fori(i, k, n) for (ll i = k; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}
template <typename T>
void print(vector<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(deque<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(vector<vector<T>> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

void solve()
{
	ll x, c = 100;
	int ans = 0;
	cin >> x;
	while (c < x)
	{
		c += c / 100;
		ans++;
	}
	cout << ans << en;
}

int main()
{
	fast;
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3632
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {n:usize,
    a:[i64;n],}

    let mut ds = vec![0; n + 1];
    let mut dp = vec![vec![-INF; n + 1]; n + 1];
    for i in 0..n {
        ds[i + 1] = ds[i] + a[i];
    }
    let mut g = G {
        n: n,
        a: a,
        ds: ds,
        dp: dp,
    };
    println!("{}", g.f(1, n));
}
struct G {
    n: usize,
    a: Vec<i64>,
    ds: Vec<i64>,
    dp: Vec<Vec<i64>>,
}

impl G {
    fn f(&mut self, l: usize, r: usize) -> i64 {
        if self.dp[l][r] != -INF {
            return self.dp[l][r];
        }
        if l == r {
            self.dp[l][r] = 0;
            return 0;
        }
        // dbg!(l, r);
        let mut ret = INF;
        for m in l..r {
            ret = min(ret, self.f(l, m) + self.f(m + 1, r));
        }
        self.dp[l][r] = ret + self.ds[r] - self.ds[l - 1];
        return self.dp[l][r];
    }
}

const INF: i64 = 1 << 60;


Measured memory_bytes: 3348
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
a, b = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
# 公約数の中から、素数を選べばいいのかな。


def is_prime(num):
    if num == 2:
        return True
    if num < 2 or num % 2 == 0:
        return False
    sqrt_num = num ** 0.5
    i = 2
    while i <= sqrt_num:
        if num % i == 0:
            return False
        i += 1
    return True

def lc(n):
    l = set()
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            l.add(i)
            l.add(n // i)
        i += 1
    return l
A = lc(a)
B = lc(b)
LC = list(A & B)

primes = []
for n in LC:
    if n == 1:
        primes.append(n)
    elif is_prime(n):
        primes.append(n)
ans = len(primes)
print(ans)

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;

int d[5];

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

	ll x,y;cin>>x>>y;

	ll a = y/x;

	ll cnt=0;

	while(a){
		cnt++;
		a/=2;
	}
	writeln(cnt);


}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int INF=1<<30;
int N,X,MIN,Ans;
int main(){
	scanf("%d",&N);
	MIN=INF;
	for(int i=1;i<=N;i++){
		scanf("%d",&X);
		if(X<MIN){
			Ans++;
			MIN=X;
		}
	}
	printf("%d\n",Ans);
	return 0;
}

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

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	long long a=0,b=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0'){
			a++;
		}
		else{
			b++;
		}
	}
	cout<<min(a,b)*2<<endl;
}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    vector<int> a(m);
    REP(i,m) cin >> a[i];
    sort(all(a));
    vec x={0,2,5,5,4,5,6,3,7,6};
    vec b;
    rep(i,m) b.pb(x[a[i]]);

    vec dp(n+10,-1);
    dp[0]=0LL;
    for(int i=1;i<=n;i++){
        rep(k,m){
            if(i-b[k]<0||dp[i-b[k]]==-1) continue;
            chmax(dp[i],dp[i-b[k]]+1);
        }
    }
    // rep(i,n+1) cout<<dp[i]<<" ";cout<<endl;

    pvec xx(m);
    rep(i,m) xx[i]=P(a[i],b[i]);
    sort(rall(xx));
    string ans="";
    for(int i=n;i>=0;i--){
        rep(j,m){
            if(i-xx[j].sc>=0&&dp[i]==dp[i-xx[j].sc]+1){
                ans+=to_string(xx[j].fs);
                i-=xx[j].sc;
                i++;
                // debug(dp[i]);
                // debug(dp[i-xx[j].sc]);
                break;
            }
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 4992
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout



#include <vector>

constexpr int N_Harf = 100'000;
constexpr int N_MAX = N_Harf *2;
class union_find
{
private:
	std::array<int, N_MAX>parent;
	std::array<int, N_MAX>rank;
public:
	union_find()
	{
		//parent.resize(siz);
		//rank.resize(siz);
		for (int i = 0; i < N_MAX; ++i)
		{
			parent[i] = i;
			rank[i] = 0;
		}
	}
	void unite(int x, int y)
	{
		int xr = find(x);
		int yr = find(y);
		if (rank[xr] > rank[yr])
		{
			parent[yr] = xr;
		}
		else if (rank[xr] > rank[yr])
		{
			parent[xr] = yr;
		}
		else if (xr != yr)
		{
			parent[yr] = xr;
			++rank[xr];
		}
	}
	int find(int x)
	{
		if (parent[x] == x)
		{
			return x;
		}
		else
		{
			return parent[x] = find(parent[x]);
		}
	}
	bool check(int x, int y)
	{
		return find(x) == find(y);
	}
}uf;


int32_t N;
char s[1000000];
char res[1000000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N>>s;
	const char type[2] = { 'S','W' };
	for (int32_t s1 = 0; s1 <= 1; ++s1)for (int32_t s2 = 0; s2 <= 1; ++s2)
	{
		res[0] = s1;
		res[1] = s2;
		for (int32_t i = 2; i < N; ++i)
		{
			if ((s[i - 1] == 'o') == (res[i - 1] == 0)) {
				res[i] = res[i - 2];
			}
			else {
				res[i] = res[i - 2] ^ 1;
			}
		}

		bool ok = true;
		if ((s[N - 1] == 'o') == (res[N - 1] == 0)) {
			if (res[0] != res[N - 2]) { ok = false; }
		}
		else {
			if (res[0] == res[N - 2]) { ok = false; }
		}
		if ((s[0] == 'o') == (res[0] == 0)) {
			if (res[1] != res[N - 1]) { ok = false; }
		}
		else {
			if (res[1] == res[N - 1]) { ok = false; }
		}

		if (ok) {
			for (int32_t i = 0; i < N; ++i)
			{
				std::cout << type[res[i]];
			}
			std::cout << std::endl; return 0;
		}
	}
	std::cout << -1 << std::endl;

	return 0;
}
#endif


Measured memory_bytes: 2424
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string A;
    auto f = [&](string &s){
        int a = 0, b = 0;
        for (int i = 1; i < s.size(); ++i) {
            if(s[i] == 'A') a++;
            else b++;
        }
        if(a < b) b++;
        else a++;
        cout << a << " " << b << "\n";
    };
    while(cin >> A, A != "0"){
        string B, C;
        cin >> B >> C;
        f(A); f(B); f(C);
    }
    return 0;
}


Measured memory_bytes: 3044
n=int(input())
vote=list(map(int,input().split()))
for i in range(n-1):
    a,b=map(int,input().split())
    if vote[0]%a==0:
        A=vote[0]//a
    else:A=vote[0]//a+1
    if vote[1]%b==0:
        B=vote[1]//b
    else:B=vote[1]//b+1
    if A>B:
        if B*a>=vote[0]:
            vote[0]=B*a;vote[1]=B*b
        else:
            vote[0]=A*a;vote[1]=A*b
    elif A<B:
        if A*b>=vote[1]:
            vote[0]=A*a;vote[1]=A*b
        else:
            vote[0]=B*a;vote[1]=B*b
    else:
        vote[0]=A*a;vote[1]=A*b
print(sum(vote))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll a,b,c; cin >> a >> b >> c;
  ll ans = 0;
  while(1){
    if(a%2==1 || b%2==1|| c%2==1) break;
    if(a==b && b==c){
      cout << -1 << endl;
      return 0;
    }
    ll aa = a; ll bb = b; ll cc = c;
    a = (bb+cc)/2;
    b = (aa+cc)/2;
    c = (aa+bb)/2;
    ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,c,t,temp,x,y;
string str;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	map<int,bool> mp;
	cin>>n;
	mp[n]=1;
	for(int i=2;i<1000000+1;i++)
	{
	    if(n%2==1)
	    {
	        temp=3*n+1;
	        if(mp[temp])
	        {
	            cout<<i;return 0;
	        }
	        mp[temp]=1;
	        n=temp;
	    }
	    else
	    {
	        temp=n/2;
	        if(mp[temp])
	        {
	            cout<<i;
	            return 0;
	        }
	        mp[temp]=1;
	        n=temp;
	    }
	}
	
	
	
	
	
}

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

int main() {
    long long N; cin >> N;
    long long ans = N - 1;
    for (int i = 1; i < sqrt(N) + 1; i++) {
        if (N % i == 0) {
            ans = i + N / i  - 2;
        }
    }
    cout << ans << endl;    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 200005
#define MOD 1000000007

char s[MAX][11];
int cmp_str(const void *a, const void *b) {
  return strcmp(s[*(int *)a], s[*(int *)b]);
} /* aaa,aab.. */

int main(void) {
  int n;
  scanf("%d", &n);
  rep(i, 0, n) scanf("%s", s[i]);

  int idx[MAX];
  rep(i, 0, n+1) idx[i] = i;
  idx[n] = n;
  qsort(idx, n, sizeof(int), cmp_str);
  int max = 0;
  int cnt = 1;
  rep(i, 0, n) {
    if (strcmp(s[idx[i]], s[idx[i+1]]) == 0) {
      cnt++;
      continue;
    }
    max = max(max, cnt);
    cnt = 1;
  }
  cnt = 1;
  rep(i, 0, n) {
    if (strcmp(s[idx[i]], s[idx[i+1]]) == 0) {
      cnt++;
      continue;
    }
    if (cnt == max) printf("%s\n", s[idx[i]]);
    cnt = 1;
  }
  return 0;
}


Measured memory_bytes: 4852
N = int(input())
S = list(input())
sumi, result = [], 0
while len(sumi)<10 and N>0:
  x = S.pop(0)
  N -= 1
  if x in sumi:
    continue
  sumi.append(x)
  sumi_2, i = [], 0
  for i in range(N-1):
      s = S[i]
      if s in sumi_2:
        continue
      sumi_2.append(s)
      result += len(set(S[i+1:]))
print(result)

Measured memory_bytes: 9392
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int dp[110][110];
char a[110][110];
int main() {
    int h,w;
    cin>>h>>w;
    for(int i=0;i<=h;i++)
        for(int j=0;j<=w;j++)
            dp[i][j]=2e9;

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>a[i][j];
        }
    }

    if(a[1][1]=='#')
        dp[1][1]=1;
    else
        dp[1][1]=0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(a[i][j]=='#'){
                if(a[i-1][j]=='.')
                    dp[i][j]=min(dp[i-1][j]+1,dp[i][j]);
                else
                    dp[i][j]=min(dp[i-1][j],dp[i][j]);
                if(a[i][j-1]=='.')
                    dp[i][j]=min(dp[i][j-1]+1,dp[i][j]);
                else
                    dp[i][j]=min(dp[i][j-1],dp[i][j]);
            }else{
                // .
                if(i==1&&j==1){;}
                else dp[i][j]=min(dp[i][j-1],dp[i-1][j]);

            }
        }
    }
    /*
    for(int i=0;i<=h;i++){
        for(int j=0;j<=w;j++){
            cout<<dp[i][j]<<' ' ;
        }
        cout<<'\n';
    }*/
    cout<<dp[h][w];
}


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


double dp[3100][3100];

int main(){
  int n;
  cin >> n;
  vector<double> p(n);
  for(int i=0;i<n;++i){
    cin >> p[i];
  }
  dp[0][0]=1.0;
  for(int i=0;i<n;++i){
    for(int j=0;j<=i;++j){
      dp[i+1][j+1]+=dp[i][j]*p[i];
      dp[i+1][j]+=dp[i][j]*(1-p[i]);
    }
  }

  double ans=0.0;
  for(int j=(n+1)/2;j<=n;++j){
    ans+=dp[n][j];
  }

  printf("%.10lf\n",ans);
  return 0;

}


Measured memory_bytes: 72320
#include <iostream>

char a[200];
int b, kekka = 0;

int main()
{
	std::cin >> b;
	for(int i = 0; i < b; i++)
	{
		std::cin >> a[i];
		if(a[i] == 'Y')
		{
			kekka++;
		}
		
	}

	if(kekka == 0)
	{
		std::cout << "Three" << std::endl;
	}else
	{
		std::cout << "Four" << std::endl;
	}

}

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

int main(void){
    int n,a,b;
    cin >> n >> a >> b;
    for(int i = 0;;i++){
        if(i % 2 == 0){
            //Alice
            if(a+1 != b)a++;
            else if(1 < a)a--;
            else {
                cout << "Borys" << endl;
                break;
            }
        } else {
            //Borys
            if(b-1 != a)b--;
            else if(n > b)b++;
            else {
                cout << "Alice" << endl;
                break;
            }
        }
    }
}

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

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	
	long long a;
	long double b;
	cin >> a >> b;
	long long ans=a*b;
	cout << ans << endl;
		
	return 0;
}



Measured memory_bytes: 3696
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func getInput() (int, int) {
	sc.Split(bufio.ScanWords)

	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	Y, _ := strconv.Atoi(sc.Text())

	return N, Y
}

func main() {

	x, y, z := do()

	fmt.Printf("%d %d %d\n", x, y, z)
}

func do() (int, int, int) {
	N, Y := getInput()

	x := Y / 10000
	if x > N {
		return -1, -1, -1
	}

	for ; 0 <= x; x-- {
		y := (Y - 10000*x) / 5000
		if x+y > N {
			return -1, -1, -1
		}

		for ; 0 <= y; y-- {
			if 10000*x+5000*y+1000*(N-x-y) == Y {
				return x, y, N - x - y
			}
		}
	}
	return -1, -1, -1
}


Measured memory_bytes: 640
i = input()
s = 0
for n in range(len(i)):
    if (n+1)%2 == 0:
        if i[n] == 'R' :
            s = 1
            break
    else:
        if i[n] == 'L':
            s = 1
            break
if s == 1:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

struct lazy_segtree {
  int n;
  vector<ll> data;
  vector<ll> lazy;

  lazy_segtree(const int s) {
    init(s);
  }

  lazy_segtree(const vector<ll> &v) {
    int s = v.size();
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = v[i];
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = data[i*2+1] + data[i*2+2];
    }
  }

  void init(const int s) {
    n = 1;
    while (n < s) n <<= 1;
    data = vector<ll>(2*n-1);
    lazy = vector<ll>(2*n-1);
  }

  void evaluate(int p) {
    if (lazy[p] != 0) {
      data[p] += lazy[p];
      if (p <= n-2) {
        lazy[p*2+1] += lazy[p] / 2;
        lazy[p*2+2] += lazy[p] / 2;
      }
      lazy[p] = 0;
    }
  }

  void update(int l, int r, ll v, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init

    // evaluate lazy value
    evaluate(p);

    if (r <= a || b <= l) return; // out of range
    if (l <= a && b <= r) { // fully covered
      lazy[p] += v * (b - a);
      evaluate(p);
    }
    else {
      update(l, r, v, p*2+1, a, (a + b) / 2); // left
      update(l, r, v, p*2+2, (a + b) / 2, b); // right
      data[p] = data[p*2+1] + data[p*2+2]; // update
    }
    return;
  }

  ll query(int l, int r, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init
    if (r <= a || b <= l) return 0LL; // out of range

    // evaluate lazy value
    evaluate(p);

    if (l <= a && b <= r) return data[p];// fully covered

    ll vl = query(l, r, p*2+1, a, (a + b) / 2); // left
    ll vr = query(l, r, p*2+2, (a + b) / 2, b); // right
    return vl + vr;
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<vector<int> > query(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    cin >> query[i][0] >> query[i][1] >> query[i][2];
    if (query[i][0] == 0) cin >> query[i][3];
  }

  lazy_segtree lst(n);
  vector<ll> ans;
  for (int i = 0; i < q; i++) {
    if (query[i][0] == 0) { // add
      lst.update(query[i][1]-1, query[i][2], query[i][3]);
    }
    else { // getSum
      ans.push_back(lst.query(query[i][1]-1, query[i][2]));
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}



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

int main() {
  int h, w, k;
  scanf("%d %d %d", &h, &w, &k);
  int cnt = 0;
  vector<vector<char>> c(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) cin >> c[i][j];
  }
  for (int tmph = 0; tmph < (1 << h); tmph++) {//6?
    bitset<6> s(tmph);
    for (int tmpw = 0; tmpw < (1 << w); tmpw++) {
      bitset<6> t(tmpw);
      int blk = 0;
      for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) if(s.test(i) && t.test(j) && c.at(i).at(j) == '#') blk++;
      }
      if(blk == k) cnt++;
    }
  }
  cout << cnt;
}

Measured memory_bytes: 3684
#include <stdio.h>

unsigned long gcd(unsigned long a, unsigned long b){
	if(a % b == 0)return b;
	return gcd(b, a % b);
}

int main(void){
	int n;
	unsigned long a, b;
	scanf("%d", &n);
	scanf("%ld", &a);
	for(int i = 0; i < n - 1; i++){
		scanf("%ld", &b);
		a = gcd(a, b);
	}
	printf("%ld\n", a);
	return 0;
}


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

int main() {
	int N;
	cin >> N;
	int np=N, f=0;
	while(np!=0){
	    f += np%10;
	    np /= 10;
	}
	if(N%f) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
def gcd(x,y): #x<y
    if x==0:
        return y
    else:
        return gcd(y%x,x)



C,D,A,B =map(int,input().split())
la =[D//A,(C-1)//A]
lb =[D//B,(C-1)//B]
lcm = A*B //gcd(A,B)
lab =[D//lcm,(C-1)//lcm]

ans = la[0] +lb[0] -la[1] -lb[1] -(lab[0]-lab[1])
print(D-C+1-ans)

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

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

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

}

Node treeSuccessor(Node x){
  Node y;
  if( x->right != NIL ){
    return treeMinimum(x->right);
  }

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

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

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

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

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

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

  free(y);
}

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

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

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

  z->parent = y;

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

}

void inorder(Node u){
  if( u == NIL ){
    return;
  }

  inorder(u->left);
  printf(" %d" ,u->key);
  inorder(u->right);  
}

void preorder(Node u){
  if( u == NIL ){
    return;
  }

  printf(" %d" ,u->key);
  preorder(u->left);
  preorder(u->right);  


}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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

int main() {
	int n, k, x, y;
	int out = 0;
	cin >> n;
	cin >> k;
	cin >> x;
	cin >> y;
	for (int i = 0; i < n; ++i) {
		int price;
		if ( i < k ) { price = x;} else {price = y;}
		out += price;
	}
	
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
INF=1000000005
def merge(a,right,mid,left):
    r=a[right:mid]
    l=a[mid:left]
    i=0
    j=0
    q=mid-right
    r.append(INF)
    l.append(INF)
    cnt=0
    while i+j!=left-right:
        if r[i]>l[j]:
            a[right+i+j]=l[j]
            j+=1
            cnt+=q-i
        else:
            a[right+i+j]=r[i]
            i+=1
    return cnt
def mergesort(a,right,left):
    if right+1<left:
        mid=(right+left)//2
        v1=mergesort(a,right,mid)
        v2=mergesort(a,mid,left)
        v3=merge(a,right,mid,left)
        return v1+v2+v3
    else:
        return 0
n=int(input())
a=list(map(int,input().split()))
ans=mergesort(a,0,n)
print(ans)


Measured memory_bytes: 27472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;

int main() {
    int a; cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#define MAX 1000000000
int memo[50010];
int c[20];
int f(int x){
    int i;
    int min=MAX,a;
    if(x==0)return 0;
    if(memo[x]!=0)return memo[x];
    for(i=0;i<20;i++){
        if(x-c[i]>=0&&c[i]>0){
            a=f(x-c[i]);
            if(min>a)min=a;
        }
    }
    return memo[x]=min+1;
}

int main(void){
    int i,n,m;
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d",&c[i]);
    }
    printf("%d\n",f(n));
}

Measured memory_bytes: 3560
import math
p=10**9+7
def kaijo(n):
    kotae=1
    for i in range(1,n+1):
        kotae*=i
        #kotae%=p
    kotae%=p
    return(kotae)

x,y=map(int,input().split())

fanc=[1]*(10**6)
finv=[1]*(10**6)
inv=[1]*(10**6)

for i in range(2,666670):
    fanc[i]=fanc[i-1]*i%p
    inv[i]=p-inv[p%i]*(p//i)%p
    finv[i]=finv[i-1]*inv[i]%p

kanou=True

a=2*y-x
b=2*x-y

if(a<0 or b<0):
    kanou=False
if(a%3!=0 or b%3!=0):
    kanou=False

if(not kanou):
    print(0)
else:
    a//=3
    b//=3
    x-=a+b
    y-=a+b
    so=x+y
    #print(x,y,so)
    #t1=kaijo(so)
    #t2=kaijo(x)
    #t3=kaijo(y)
    #print(t1,t2,t3)
    #ans=t1//(t2*t3)
    #ans=ans%p
    ans=fanc[so]*finv[x]*finv[y]%p
    print(ans)

Measured memory_bytes: 92020
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;
int main()
{
    map <int, int> mp;
    int a, b, c;

    cin >> a >> b >> c;

    mp[a % b] ++;
    int counter = 2;
    int flag = 0;
    bool condition = false;
    if(a % b == c)
    {
    	flag = 1;
    	condition = true;
    }    
    while(condition == false)
    {
    	int val = (a * counter) % b;
    	mp[val] ++;
    	if(mp[val] == 2)
    		condition = true;
    	if(val == c)
    	{
    		flag = 1;
    		condition = true;
    	}
    	counter ++;
    }

    if(flag == 1)
    	cout << "YES" << endl;
    else
    	cout << "NO" << endl;
}

Measured memory_bytes: 256
num_ary = []
bmi_ary = []
while line = gets
n,w,l = line.split(",").map(&:to_f)
num_ary << n
bmi = w.to_i / (l.to_f ** 2)
bmi_ary << bmi
end

for i in 0..bmi_ary.size
if bmi_ary[i].to_i >= 25.0
  puts num_ary[i].to_i
end
end


Measured memory_bytes: 8916
import sys

for line in sys.stdin:
  a, op, b = line.split()
  a = int(a)
  b = int(b)

  if op == '?':
    break

  if op == '+':
    print(a+b)
  elif op == '-':
    print(a-b)
  elif op == '*':
    print(a*b)
  elif op == '/':
    print(a//b)

Measured memory_bytes: 7680
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
char s[101];
int n;
bool c,f;
int main()
{
	cin>>s;
	n=strlen(s);
	for(int i=0;i<n;i++)
	{
		if(s[i]=='C')
		c=true;
		if(s[i]=='F'&&c)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
#include<ctime>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>

using namespace std;
typedef long long ll;
#define MP make_pair

int main(void) {
    int r;
    cin>>r;
    cout<<r*2*3.141592<<"\n";

    
    
    return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int MAX_N=1<<20;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    cout<<(x^1);
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long int 
#define endl '\n'
#define INF 1000000000
#define MOD 1000000007
#define MAX 100000000 
#define mp make_pair
#define pb push_back
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y,z;
    cin>>x>>y>>z;
    if((x+y+z)>=22)
    cout<<"bust"<<endl;
    else
    cout<<"win";
}

Measured memory_bytes: 3632