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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	long long N;
	vector<long long> S, T;
	long long max = 0;

	cin >> N;
	for(int i=0; i<N; i++){
		long long tmp;
		cin >> tmp;
		S.push_back(tmp);
		max += tmp;
	}

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

	long long ans = 0;
	if((max % 10) != 0){
		ans = max;
	}
	else{
		for(int i=0; i<N; i++){
			if((S[i] % 10) != 0){
				ans = max - S[i];
				break;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[3001][3001]={0};
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[0][i];
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<n;j++){
            if( (i+j) >= n){continue;}
            a[i][j]=max(a[0][i+j]-a[i-1][j],a[0][j]-a[i-1][j+1]);
        }
    }
    cout<<a[n-1][0];
    return 0;

}

Measured memory_bytes: 70016
#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lont;
int main() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	int Z = S.size();
	vector<char>veca(Z + 1);
	for (int i = 0; i < Z; i++) {
		veca.at(i)=S.at(i);
	}
	int cnta = 0;
	int suma = 0;
	for (int ia = 0; ia < Z; ia++) {
		if (veca.at(ia) == veca.at(ia + 1)) {
			cnta++;
		}
		else {
			suma += cnta;
			cnta = 0;
		}
	}
	cout << min(suma + K * 2, Z - 1) << endl;
}



	



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

int main() {
  INIT;
  
  int n;
  cin>> n;
  if(n >=1000){
  cout << "ABD"<< endl;
}else{
  cout << "ABC"<< endl;
}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
const ll INF = 1001001001;
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; }

int main(){
  ll l,r;
  cin >> l >> r;
  r = min(r,l+4038);
  int ans = 2018;
  for(ll i=l;i<r;i++){
    for(ll j=i+1;j<=r;j++){
      int t = (i*j) % 2019;
      ans = min(ans,t);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
void vdeb(string s, vector<int> x) {cout<<s<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<endl;}
//=======================================================================================================

int main()
{
    string s;
    cin >> s;
    int flag = 0;

    if(s[0] == s[1] && s[2] == s[3]) flag = 1;
    if(s[0] == s[2] && s[1] == s[3]) flag = 1;
    if(s[0] == s[3] && s[1] == s[2]) flag = 1;
    if(s[0] == s[1] && s[1] == s[2] && s[2] == s[3]) flag = 0;

    if(flag == 1) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N, M;
    cin >> N >> M;
    vector<ll> H(N);
    for(size_t i=0;i<N; i++)
    {
        cin >> H[i];
    }
    map<long, vector<long>> H_path;
    long A, B;
    for(size_t i=0;i<M; i++)
    {
        cin >> A >> B;
        H_path[A].push_back(B);
        H_path[B].push_back(A);
    }
    ll count = 0;
    for(const auto& h:H_path)
    {
        bool isOK = true;
        //cerr << h.first << ":" << H[h.first-1] << ":<pair>:";
        for(size_t i=0;i<h.second.size(); i++)
        {
            if(H[h.first-1] <= H[h.second[i]-1])
            {
                isOK=false;
                break;
            }
            //cerr << h.second[i] << " ";
        }
        if(isOK) count++;
        //cerr << endl;
    }
    cout << count + (N - H_path.size()) << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 14268
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

ll gcd(ll a, ll b) {
    if(b == 0LL) return a;
    return gcd(b, a%b);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll g = 0LL;
    for(int i=0;i<n;++i) {
        cin >> a[i];
        if(i) g = gcd(g, a[i]);
        else g = a[0];
    }

    vector<int> spf(1000001, 0);
    for(ll i=2LL;i*i<=1000000;++i) {
        if(spf[i]) continue;
        spf[i] = i;
        ll j = i+i;
        while(j <= 1000000) {
            if(spf[j] == 0) spf[j] = i;
            j += i;
        }
    }
    for(int i=0;i<=1000000;++i) if(spf[i] == 0) spf[i] = i;

    set<ll> used;
    for(int i=0;i<n;++i) {
        while(a[i] != 1) {
            if(used.find(spf[a[i]]) != used.end()) {
                if(g == 1LL) {
                    cout << "setwise coprime\n";
                } else {
                    cout << "not coprime\n";
                }
                return 0;
            }
            used.insert(spf[a[i]]);
            // cerr << spf[a[i]] << endl;
            int s = spf[a[i]];
            while(a[i] % s == 0LL) a[i] /= s;
        }
    }

    cout << "pairwise coprime\n";
    return 0;
}


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

int main(){
  int A,B;
  cin  >> A >> B;
  int ans = (B-1)/(A-1);
  
  if((B-1)%(A-1)!=0){
    ans++;
  }
  
  
  
  
  cout << ans << endl;
}

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

using namespace std;

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

    vector<int> m(n);
    for (int i = 0; i < n; ++i) {
        cin >> m[i];
        x -= m[i];
    }

    int ans = n;
    ans += x / (*min_element(m.begin(), m.end()));

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

Measured memory_bytes: 256
S = input()

al_list = [chr(i) for i in range(97, 97+26)]
s_list = []
Flag = True

for al in S:
    s_list.append(al)

if set(s_list) == set(al_list):
    print('None')
else:
    print(min(list(set(al_list) - set(s_list))))

Measured memory_bytes: 3956
use std::io;
use std::cmp;

// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}


fn main() {

    let n = read_t_in_line::<i32>()[0];
    let a = read_t_in_line::<i32>()[0];
    println!("{}", n * n - a);
    
    

}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

				Scanner sc = new Scanner(System.in);

				int T_hp = sc.nextInt();
				int T_attack = sc.nextInt();

				int A_hp = sc.nextInt();
				int A_attack = sc.nextInt();


				int A_turn = 0;
				int T_turn =1;
				//どちらかのヒットポイントが0以下になるまで繰り返す。
					while(T_hp > 0 && A_hp > 0) {
					//カウントが1のほうが攻撃を仕掛ける。
						if(T_turn ==1) {
							A_hp = A_hp - T_attack;
							A_turn = 1;
							T_turn = 0;
						}else if(A_turn == 1) {
							T_hp = T_hp - A_attack;
							T_turn = 1;
							A_turn = 0;
						}
					}
				//}
				if(T_hp > 0) {
					System.out.println("Yes");
				}else if(T_hp <= 0) {
					System.out.println("No");
				}


			}
		}


Measured memory_bytes: 35732
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    int n;
    string s;
    cin >> n;
    cin.ignore();
    REP(i,n) {
        getline(cin, s);
        if (s.size() < 6) {
            cout << s << endl;
        }else {
            REP(i,6) {
                cout << s[i];
            }
            for(int i = 6; i < s.size(); i++) {
                if (s[i] != 'o') cout << s[i];
                else {
                    if (s[i-6] == 'H' && s[i-5] == 'o' && s[i-4] == 's' && s[i-3] == 'h' && s[i-2] == 'i' && s[i-1] == 'n') {
                        cout << 'a';
                    }else {
                        cout << s[i];
                    }
                }
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
int main(){
	int a[101][101],b,i,j,n,k;
	char c[101][101];
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%s",c[i]);
	}
	for(i=0;i<n;i++){
		b=0;
		for(j=0;j<k;j++){
			if(c[i][j]=='c'){
				a[i][j]=0;
				b=1;
			}
			else if(b!=0){
				a[i][j]=b;
				++b;
			}
			else{
				a[i][j]=-1;
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<k;j++){
			printf("%d",a[i][j]);
			if(j<k-1){
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef long long int LL;
const LL INF = 3e18;

int w, h, n;
LL x[100010], y[100010];

VI homex, homey;
LL candidate[2][2];
LL ans = INF;
LL ans_loc[2];

int main()
{
  scanf("%d%d%d", &w, &h, &n);
  for(int i = 0; i < n; i++){
    scanf("%lld%lld", &x[i], &y[i]);
    
    homex.PB(x[i]);
    homey.PB(y[i]);
  }
  
  sort(homex.begin(), homex.end());
  sort(homey.begin(), homey.end());

  candidate[0][0] = homex[(homex.size() - 1) / 2];
  candidate[0][1] = homex[homex.size() / 2];
  candidate[1][0] = homey[(homex.size() - 1) / 2];
  candidate[1][1] = homey[homex.size() / 2];

  for(int i = 0; i < 4; i++){
    LL sum = 0, mx = 0;
    
    for(int j = 0; j < n; j++){
      LL dist = abs(candidate[0][(i & 2) / 2] - x[j]) + abs(candidate[1][i & 1] - y[j]);

      sum += dist * 2;
      mx = max(mx, dist);
    }
    sum -= mx;

    if(ans > sum){
      ans = sum;
      ans_loc[0] = candidate[0][(i & 2) / 2];
      ans_loc[1] = candidate[1][i & 1];
    }
  }

  printf("%lld\n%lld %lld\n", ans, ans_loc[0], ans_loc[1]);
  return 0;
}

Measured memory_bytes: 3708
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int n;
        scanf("%d",&n);
        vector<int>ar(n);
        for(auto&e:ar){
                scanf("%d",&e);
        }
        for(int i=n-1;i>0;i--){
                printf("%d ",ar[i]);
        }
        printf("%d\n",ar[0]);
        return 0;
}

Measured memory_bytes: 1172
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

while True:
    a1, m1, a2, m2, a3, m3 = map(int, input().split())
    if a1 == 0:
        break
    a = [a1, a2, a3]
    m = [m1, m2, m3]
    cyc = [0, 0, 0]
    for i in range(3):
        xyz = 1
        j = 0
        while True:
            j += 1
            xyz = a[i]*xyz%m[i]
            if xyz == 1:
                cyc[i] = j
                break
    print(lcm(*cyc))



Measured memory_bytes: 6340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  int minr = 1000000000;
  int tmp = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A;
    while (A%2 == 0){
    tmp++;
    A/=2;
    }
    if (minr > tmp){
      minr = tmp;
    }
    tmp = 0;
  }
 cout << minr << endl;
}

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

using namespace std;

#define ll long long
const int mxN=1e5;

int main() {
//#ifndef ONLINE_JUGDE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif

	ios::sync_with_stdio(0);
    cin.tie(0);
    
	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	if(x>0&&(x/d)>=k){
		x=x-(k)*d;
		cout<<x;
		return 0;
	}
	ll y=x/d;
	x-=y*d;
	k-=y;
	if(k%2==0)
		cout<<abs(x);
	else
		cout<<min(abs(x-d),abs(x+d));
    return 0;
}

Measured memory_bytes: 3656
n = int(input())
s = input()
sdate = [0] * (n+1)
sdatw = [0] * (n+1)
#print(sdate)
import sys
for i in range(1, n+1):
    #print(i)
    if s[i-1] == "W":
        sdatw[i] += 1
    if s[i-1] == "E":
        sdate[i] += 1
    sdate[i] += sdate[i-1]
    sdatw[i] += sdatw[i-1]

#print(sdate)
#print(sdatw)
res = 9999999999
for i in range(1, n + 1):
    res = min(res, sdatw[i-1] +  sdate[n] - sdate[i])
print(res)

Measured memory_bytes: 26956
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int W = cin.nextInt();
        int H = cin.nextInt();
        long[] cost = new long[H + W];
        for (int i = 0; i < W; i++)
        {
            cost[i] = (long)cin.nextInt() * 2;
        }
        for (int i = 0; i < H; i++)
        {
            cost[i + W] = (long)cin.nextInt() * 2 + 1;
        }
        long Hnokori = H + 1;
        long Wnokori = W + 1;
        long ans = 0;
        Array.Sort(cost);
        for (int i = 0; i < cost.Length; i++)
        {
            long c = cost[i] / 2;
            int id = (int)(cost[i] % 2);
            if (id == 0)
            {
                //w
                ans += Hnokori * c;
                Wnokori--;
            }
            else
            {
                ans += Wnokori * c;
                Hnokori--;
            }
        }
        Console.WriteLine(ans);
    }

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 17436
A, B, N = map(int, input().split())
import math

# for x in range(1, 1+N):
#   l = math.floor(A*x/B)
#   r = A * math.floor(x/B)
#   print((x, l-r, l, r))

x = min(B-1, N)
l = math.floor(A*x/B)
r = A * math.floor(x/B)
print(l-r)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
int gcd(int,int);
vector<int> waru(vector<int>);

int main() {
  int K;
  int sum=0;
  cin >> K;
  for(int a=1;a<=K;a++){
    for(int b=1;b<=K;b++){
      for(int c=1;c<=K;c++){
        sum+=gcd(gcd(a,b),c);
      }
    }
  }
  cout << sum << endl;
}

int gcd(int a,int b){
  vector<int> vec={a,b};
  if(a<b)swap(vec.at(0),vec.at(1));
  while(vec.at(1)!=0){
    vec=waru(vec);
  }
  return vec.at(0);
}

vector<int> waru(vector<int> i){
  vector<int> vec(2);
  int syou;
  vec.at(0) =i.at(1);
  syou=i.at(0)/i.at(1);
  vec.at(1) =i.at(0)-syou*i.at(1);
  return vec;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N;
  cin >> N;
  map<int, int> paper;
  rep(i, N)
  {
    int A;
    cin >> A;
    paper[A]++;
  }
  int ans = 0;
  for (pair<int, int> p : paper)
  {
    if (p.second % 2 == 1)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;

  rep(i, n) {
    if (s.substr(i, n - i) == t.substr(0, n - i)) {
      cout << n + i << endl;
      return 0;
    }
  }
  cout << 2 * n << endl;
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n;
    cin >> n;

    double sum = 0;
    rep(i, n){
        double money;
        string type;
        cin >> money >> type;

        if(type == "JPY") sum += money;
        else sum += money * 380000;
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
import sys
import math
readline = sys.stdin.buffer.readline

a,b = map(int,readline().split())

for i in range(1,10**6):
    if math.floor(i*0.08) == a:
        if math.floor(i*0.10) == b:
            print(i)
            exit()
            """
    elif math.ceil(i*0.08) == a:
        if math.floor(i*0.10) == b:
            print(i)
            exit()
        elif math.ceil(i*0.10) == b:
            print(i)
            exit()"""
print(-1)

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

int digit(int N){
  int d1 = N%10;
  int d10 = N/10;
  int pro = 1;
  if(d1>=2 && d10>=2) {
    pro = d1*d10;
  } else {
    pro = 0;
  }
  return pro;
}

int main(){
  int m,d;
  cin >>m >>d;
  int cnt = 0;
  for(int i = 1; i<=d; i++){
    int pro = digit(i);
    for(int j = 2; j<=m; j++){
      if(j==pro) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	set<int> s;
	for (int i = 0; i < n; i++) {
		int d;
		cin >> d;
		s.insert(d);
	}
	cout << s.size() << endl;
	return 0;
}


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

using namespace std;

int a, b, c, d, e, f, new_a, new_b;
int ans_w = 10, ans_s = -1;
double chk;


int main() {
    cin >> a >> b >> c >> d >> e >> f;
    new_a = a * 100;
    new_b = b * 100;

    chk = (double)(e * 100) / (100 + e);

    for (int i = 0; i <= f; i += new_a) {
        for (int j = 0; j <= f; j += new_b) {
            for (int k = 0; k <= f; k += c) {
                for (int l = 0; l <= f; l += d) {
                    if (i + j + k + l == 0) continue;
                    if (i + j + k + l > f) break;
                    if ((double)(k + l) * 100 / (i + j + k + l) > chk) break;
                    if ((double)(k + l) * 100 / (i + j + k + l) > (double)(ans_s * 100) / (ans_w + ans_s)) {
                        ans_w = i + j;
                        ans_s = k + l;
                    }
                }
            }
        }
    }
    cout << ans_w + ans_s << " " << ans_s << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll val[3], tmp, res;
	cin >> val[0] >> val[1] >> val[2];
	sort(val, val+3);

	res = val[2] - val[1];
	val[1] = val[2];
	val[0] += res;
	res += (val[2] - val[0] + 1) / 2;
	res += val[2] % 2 == val[0] % 2 ? 0 : 1;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    
    if(a > b) {
        cout << "a > b" << endl;
    }else if (a < b) {
        cout << "a < b" << endl;
    }else {
        cout << "a == b" << endl;
    }
}


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

int main() {
    int D;
    cin >> D;
    if (D == 25) {
        cout << "Christmas" << endl;
    }
    else if (D == 24) {
        cout << "Christmas Eve" << endl;
    }
    else if (D == 23) {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (D == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}


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

int main() {
    int n;
cin>>n;
string s;
cin>>s;
if(n==1||n%2!=0){
cout<<"No"<<endl;
}
else{
    int flag=0;
    for(int i=0;i<n/2;i++){
            if(s[i]!=s[n/2+i]){
            flag=1;
            break;}
        }
    if(flag==1)
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;
}
	// your code goes here
	return 0;
}


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

int main() {
  long long X, K, D;
  cin >> X >> K >> D;
  X = abs(X);
  long long count = X / D;
  if (count > K) {
    cout << X - K*D << endl;
  } else {
    X -= count*D;
    K -= count;
    if (K % 2 == 1) {
      X = abs(X - D);
    }
    cout << X << endl;
  }
}

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

typedef long long ll;
typedef unsigned long long ull;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5) + 5;
#define REP(i, n) for (int i = 0; i < n; i++)

ull n, x, cum[MAX_N]{};

int main() {
    cin >> n >> x;
    REP(i,n){
        ull a;
        cin >> a;
        cum[i+1] += cum[i]+a;
    }
    ull ans = LLINF;
    for(ull i=1;i<=n;i++){
        ull tmp = 5ull*cum[n], k = n - i;
        while(1){
            if(k<=i)break;
            k -= i;
            tmp += 2*cum[k];
        }
        tmp += (n+i)*x;
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#define debug(x) cout << #x << "==" << x << endl;

const int INF = 1000000007;

using namespace std;

//入力
#define MAX_N 100000
int N;
int A[MAX_N];
int B[MAX_N+1];

// n ^ k mod m
long long powmod(int n, int k,int m) {

  if ( k == 0 ) {
    return 1;
  } else if( k % 2 != 0 ) {
    return ( n * powmod( n, k-1, m ) ) % m;
  } else {
    long long x =  powmod( n, k/2, m );
    return x * x % m;
  }

}

int main() {
  ios::sync_with_stdio(false);

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

  sort(A, A + N);



  bool correct = true;
  int i, num;
  if( N % 2 != 0 ) {
    correct &= (A[0] == 0);
    i = 1;
    num = 2;
  } else {
    i = 0;
    num = 1;
  }
  while( i < N ) {
    correct &= (A[i] == num);
    correct &= (A[i+1] == num);
    num += 2;
    i += 2;
  }


  if( !correct ) {
    cout << 0 << endl;
  } else {
  cout << powmod(2, N / 2, INF) << endl;
  }

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue> 
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
const int maxn=1e5+5;
const int inf=1>>31;
int n;
int tot;
struct node {
	int x,y;
	int d;
	node(){}
	node(int x,int y,int d):x(x),y(y),d(d){}
}nd[maxn],nd2[maxn];
 
bool cmpx(node a,node b) 
{
	return a.x<b.x;
}
bool cmpy(node a,node b) 
{
	return a.y<b.y;
}
 
bool cmpd(node a,node b) 
{
	return a.d<b.d;
}

int no[maxn];

int find(int x) {
	if (x==no[x])return x;
	return no[x]=find(no[x]);
}
 
void merge(int u,int v) {
	int p=find(u);
	int q=find(v);
	if (p != q) {
		no[p]=q;
	}
}
 
bool check(int x,int y) {
	if (find(x)==find(y)) return true;
	else return false;
}
 
int ans()
{
	int sum=0;
	for (int i=0; i<=n; i++)no[i]=i;
	for (int i=0; i < tot; i++) {
		node tmp=nd2[i];
		if (tmp.d==0) merge(tmp.x,tmp.y);
		if (!check(tmp.x,tmp.y)) 
		{
			merge(tmp.x,tmp.y);
			sum+=tmp.d;
		}
	}
	return sum;
}
 
int main() {
	cin>>n;
	for (int i=1; i<=n; i++) 
	{
		cin>>nd[i].x>>nd[i].y;
		nd[i].d=i;
	}
	tot=0;
	sort(nd+1,nd+1+n,cmpx);
	for (int i=2; i<=n; i++) 
	{
		nd2[tot++]=node(nd[i].d,nd[i-1].d,nd[i].x-nd[i-1].x);
	}
	sort(nd+1,nd+n+1,cmpy);
	for (int i=2; i<=n; i++) 
	{
		nd2[tot++]=node(nd[i].d,nd[i-1].d,nd[i].y-nd[i-1].y);
	}
	sort(nd2,nd2 + tot,cmpd);
	cout<<ans()<<endl;
	return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>          // printf(), getc()
#include <ctype.h>          // isdigit()

#define MAX_N 500000
#define swap(a, b) { int t; t = a; a = b; b = t; }

void
max_heapify(int a[], int h, int i)
{
	int largest;

	int l = 2 * i;
	int r = 2 * i + 1;

	/* ????????????????????????????????§???????????§???node????????¶ */
	if (l <= h && a[l] > a[i])
		largest = l;
	else
		largest = i;

	if (r <= h && a[r] > a[largest])
		largest = r;

	if (largest != i) /* ????????????????????§????????´?????? */
	{
		swap(a[i], a[largest]);
		max_heapify(a, h, largest);
	}
}

int
main(int argc, char** argv)
{
	int a[MAX_N + 1];
	int h;
	int n, s;
	int i;
	int c;

	h = 0;
	c = getc(stdin);
	while (isdigit(c))
	{
		h = 10 * h + c - '0';
		c = getc(stdin);
	}

	if (c == '\n')
		c = getc(stdin);

	for (i = 1; i <= h; ++i)
	{
		while (c == ' ')
			c = getc(stdin);

		if (c == '-')
		{
			s = -1;
			c = getc(stdin);
		}
		else
			s = 1;

		n = 0;
		while (isdigit(c))
		{
			n = 10 * n + c - '0';
			c = getc(stdin);
		}

		a[i] = s * n;
	}

	for (i = h / 2; i >= 1; --i)
		max_heapify(a, h, i);

	for (i = 1; i <= h; ++i)
		printf(" %d", a[i]);

	printf("\n");
	return 0;
}

Measured memory_bytes: 2464
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;GG(e<0);
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    const int NUM=1e5+10;
    bool nop[NUM];int prn,prm[NUM],mip[N];
    void pre()
    {
        fo(i,2,NUM-1)
        {
            if(!nop[i]) prm[++prn]=i,mip[i]=i;
            for(int j=1;j<=prn and (ll)prm[j]*i<NUM;j++)
            {
                int t=prm[j]*i;nop[t]=1;mip[t]=prm[j];
                if(i%prm[j]==0) break;
            }
        }
    }
    unordered_map<ll,int> a,b;
    ll f[N],lg[N];
    void main()
    {
        pre();
        int n=qread();
        fo(i,1,n)
        {
            ll num=qread();
            for(int i=1;prm[i]<=2200;i++) {ll tmp=1ll*prm[i]*prm[i]*prm[i];while(num%tmp==0)num/=tmp;}
            a[num]++;
        }
        fo(i,2,N-1) lg[i]=lg[i>>1]+1;
        int ans=(a[1]>0);
        fo(i,2,1e5)
        {
            vc<int> tmp;
            int num=i;bool err=0;
            while(num>1) {
                int now=mip[num];tmp.PB(now);
                int ct=0;while(num%now==0)num/=now,ct++;
                if(ct>1) err=1;
            }if(err) continue;

            int m=sz(tmp);
            f[0]=1;fo(t,0,m-1) f[0]*=tmp[t];
            fo(s,1,bin(m)-1)
            {
                int t=s&-s;f[s]=f[s^t]*tmp[lg[t]];
                if(s>((bin(m)-1)^s)) ans+=max(a[f[s]],a[f[(bin(m)-1)^s]]),a[f[s]]=a[f[(bin(m)-1)^s]]=0;
            }
        }
        for(unordered_map<ll,int>::iterator t=a.begin();t!=a.end();t++) if(t->FR!=1) ans+=t->SE;write(ans);
    }
};//(ans+MOD)%MOD
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 30836
#include <stdio.h>
#define TRUE 1
#define FALSE 0

int N;

typedef struct{
    char mark;
    int value;
} trump;

void swap(trump *a, trump *b){
    trump tmp;

    tmp = *a;
    *a = *b;
    *b = tmp;
}

void BubblleSort(trump C[]){
    int i,j;

    for(i=0; i<N-1; i++){
        for(j=N-1; j>=i+1; j--){
            if(C[j].value < C[j-1].value) 
                swap(&C[j],&C[j-1]);
        }
    }
}

void SelectionSort(trump C[]){
    int i,j;
    int minj;

    for(i=0; i<N; i++){
        minj = i;
        for(j=i; j<N; j++){
            if(C[j].value < C[minj].value)
                minj = j;
        }

        swap(&C[i],&C[minj]);
    }
}

void Allprint(trump C[]){
    int i;

    for(i=0; i<N; i++){
        if(i != 0) printf(" ");
        printf("%c%d",C[i].mark,C[i].value);
    }
    printf("\n");
}

int check_stable(trump in[],trump out[]){
    int i,j,k,l;
    for(i=0; i<N; i++){
        for(j=i+1; j<N; j++){
            for(k=0; k<N; k++){
                for(l=k+1; l<N; l++){
                    if(in[i].value == in[j].value
                        && in[i].value == out[l].value 
                            && in[i].mark == out[l].mark 
                                &&in[j].value == out[k].value
                                     &&in[j].mark == out[k].mark)
                                        return FALSE;
                }
            }
        }
    }

    return TRUE;
}


int main(){
    int i;
    trump in[36];
    trump bubble[36];
    trump selection[36];

    scanf("%d",&N);
    for(i=0; i<N; i++){ 
        scanf(" %c%d",&in[i].mark,&in[i].value);
    }
    for(i=0; i<N; i++){
        bubble[i] = in[i];
        selection[i] = in[i];
    }

    BubblleSort(bubble);
    Allprint(bubble);
    if( check_stable(in,bubble) ) printf("Stable\n");
    else printf("Not stable\n");

    SelectionSort(selection);
    Allprint(selection);
    if(check_stable(in,selection)) printf("Stable\n");
    else printf("Not stable\n");

    return 0;

}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 1000001   
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,s,t,
u,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

int main()
{
    scanf("%lld",&n);
    flg=0;
    for(L i=0;i<n;i++){
        scanf("%lld",&d);
        if(d%2==0&&flg==0){
            if(d%3==0||d%5==0){}
            else{
                flg=1;
            }
        }
    }
    if(flg==0)printf("APPROVED\n");
    else printf("DENIED\n");
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

vector<int> pos[210000];
unordered_map<long long int, int> m;

long long int ret(long long int X, long long int Y){
	return X * 1e9 + Y;
}

int main(){
	
	int H, W, N;
	cin >> H >> W >> N;
	
	for(int i = 0; i < N; i++){
		int X, Y;
		cin >> X >> Y;
		pos[Y].push_back(X);
		m[ret(X, Y)] = 1;
	}
	
	for(int i = 0; i < 210000; i++){
		sort(pos[i].begin(), pos[i].end());
		pos[i].push_back(H + 1);
		m[ret(H + 1, i)] = 1;
	}
	
	int posx = 1, posy = 1;
	int ans = 1000000;
	bool flag = true;
	
	while(true){
		if(flag){
			for(int i = 0; i < pos[posy].size(); i++){
				if(pos[posy][i] > posx){
					ans = min(ans, pos[posy][i] - 1);
					break;
				}
			}
		}
		if(m.find(ret(posx + 1, posy)) == m.end()){
			posx += 1;
		}else{
			break;
		}
		if(m.find(ret(posx, posy + 1)) == m.end()){
			posy += 1;
			flag = true;
		}else{
			flag = false;
		}
		if(posy > W){
			break;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 29044
#include <cstdio>
#include <cmath>
using namespace std;


int main (void)
{
	int d;
	long long sum=0;
	int n, min=1000001, max=-1000001, i;

	scanf("%d", &n);


	for (i=0; i<n; i++){
		scanf("%d", &d);
		sum += d;
		if (min > d)
			min = d;
		if (max < d)
			max = d;
	}

	printf("%d %d %ld\n", min, max, sum);

	return 0;
}

Measured memory_bytes: 1032
k,a,b = map(int,input().split())
if a+2>=b:
  print(1+k)
else:
  #bisできるセット
  q = (k-a+1)//2
  if q ==0:
    print(1+k)
  else:
    print(1+(k-2*q)+q*(b-a))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;


int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> a(0);
    ll o=1;
    while (true){
        if (o*o>m) break;
        if (m%o==0){
            a.push_back(o);
            a.push_back(m/o);
        }
        o++;
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    rep(i,a.size()){
        if (a.at(i)*n<=m){
            cout << a.at(i) << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
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(nullptr);
    
    int n, m;
    cin >> n >> m;
    vll a(m);
    rep(i, m) cin >> a[i];
    sort(all(a));
    vll d(m-1);
    rep(i, m-1) d[i] = a[i+1] - a[i];
    sort(all(d));
    vll sm(m);
    rep(i, m-1) sm[i+1] = sm[i] + d[i];
    ll ans = sm[max(m-n, 0)];
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>

#define INFTY 1000000001

using namespace std;

int n, s[500010], cnt = 0;

void merge(int *A, int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int i, j;

  //generate L[0...n1], R[0...n2]
  int L[n1 + 10], R[n2 + 10];
  for(i = 0;i < n1;i++) L[i] = A[left + i];
  for(i = 0;i < n2;i++) R[i] = A[mid + i];

  L[n1] = INFTY;
  R[n2] = INFTY;

  i = 0;
  j = 0;

  for(int k = left;k < right;k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }else{
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(int *A, int left, int right){
  if(left + 1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){

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

  mergeSort(s, 0, n);

  for(int i = 0;i < n;i++){
    cout << (i?" ":"");
    cout << s[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 6984
#include<stdio.h>
int main()
{
    int power,i,j,k,temp,sum=0;
    scanf("%d%d",&power,&temp);
    for(i=0;i<temp;i++)
    {
        scanf("%d",&j);
        sum+=j;
    }
    if(sum>=power)
    {
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 1640
#include <stdio.h>
int main(){
	double a,b,x,y;
	scanf ("%lf%lf%lf%lf",&a,&b,&x,&y);
	printf ("%lf ",a*b/2);
	if (x==a/2 && y==b/2){
		printf ("1");
		}
	else{
		printf ("0");
		}
	return 0;
	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

void dfs(vector<vector<int>> &G, vector<int> &C, vector<bool> &S, int n) {
    S[n] = true;
    for (auto g : G[n]) {
        if (S[g]) continue;
        C[g] += C[n];
        dfs(G, C, S, g);
    }
}

int main() {
    int N, Q; cin >> N >> Q;
    vector<vector<int>> G(N);
    REP(i, 0, N - 1) {
        int a, b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> counter(N, 0);
    REP(i, 0, Q) {
        int p, x; cin >> p >> x;
        counter[--p] += x;
    }

    vector<bool> seen(N, false);
    dfs(G, counter, seen, 0);

    REP(i, 0, N) {
        cout << counter[i];
        if (i < N - 1) cout << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 29824
using System;
using System.Text;

public class A
{
	public static void Main()
	{
		StringBuilder sb = new StringBuilder(Console.ReadLine());
		sb.Replace("eraser", "");
		sb.Replace("erase", "");
		sb.Replace("dreamer", "");
		sb.Replace("dream", "");
		if(sb.ToString() == "")
		{
			Console.WriteLine("YES");
		}
		else
		{
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 13664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct LazySegmentTreeAddMax {
    const ll INF = 1000000000;
    ll n;
    std::vector<long long> node, lazy;
    LazySegmentTreeAddMax(std::vector<long long> v) {
        ll sz = (ll)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        lazy.resize(2*n-1, 0);
        for(ll i=0;i<sz;++i) {
            node[i+n-1] = v[i];
        }
        for(ll i=n-2;i>=0;--i) {
            node[i] = std::max(node[2*i+1], node[2*i+2]);
        }
    }
    void eval(ll k, ll l, ll r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }
    void add(ll a, ll b, long long x, ll k=0, ll l=0, ll r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
            return;
        }
        add(a, b, x, 2*k+1, l, (l+r)/2);
        add(a, b, x, 2*k+2, (l+r)/2, r);
        node[k] = std::max(node[2*k+1], node[2*k+2]);
    }
    long long query(ll a, ll b, ll k=0, ll l=0, ll r=-1) {
        if(r < 0) r = n;
        if(b <= l || r <= a) return 0;
        eval(k, l, r);
        if(a <= l && r <= b) return node[k];
        long long vl = query(a, b, 2*k+1, l, (l+r)/2);
        long long vr = query(a, b, 2*k+2, (l+r)/2, r);
        return std::max(vl, vr);
    }
};
using ld = long double;
using P = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vector<ll>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const ll INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(ll i=0;i<(ll)(s.size());++i) {
    cout << s[i];
    if(i == (ll)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n, d, a; cin >> n >> d >> a;
  vll x(n), h(n);
  vector<pair<ll, ll>> v(n);
  for(ll i=0;i<n;++i) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin(), v.end());
  for(ll i=0;i<n;++i) {
    x[i] = v[i].first;
    h[i] = v[i].second;
  }
  LazySegmentTreeAddMax st(h);
  ll r = 1;
  ll cnt = 0;
  for(ll i=0;i<n;++i) {
    while(r != n && x[r] <= x[i] + 2*d) {
      r++;
    }
    ll tmp = st.query(i, i+1);
    if(tmp > 0) {
      cnt += (tmp - 1) / a + 1;
      st.add(i, r, -a * ((tmp - 1) / a + 1));
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 16256
#include <iostream>
#include <vector>
#include <map>

using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::map;

struct Pair {
	public:
		int a, b;
		void set(int, int);
};
inline void Pair::set(int _a, int _b) {
	a = _a;
	b = _b;
}
inline bool operator< (const Pair& left, const Pair& right) {
	if (left.a != right.a) {
		return (left.a < right.a);
	} else {
		return (right.b < left.b);
	}
}
inline bool operator== (const Pair& left, const Pair& right) {
	if (left.a == right.a and left.b == right.b) {
		return true;
	}
}

int main(void) {
	while (1) {
		int M, T, P, R;
		cin >> M >> T >> P >> R;
		if (M == 0 and T == 0 and P == 0 and R == 0) {
			break;
		}

		vector<int> correct_num(T, 0);
		vector<int> time(T, 0);
		vector<int> penalty(T, 0);
		vector<vector<int>> wrong(T, vector<int>(P, 0));
		map<Pair, vector<int>> rank;
		for (int i = 0; i < R; i++) {
			int m, t, p, j;
			cin >> m >> t >> p >> j;
			t--;
			p--;

			if (j == 0) {
				//time[t] = m;
				time[t] += m;
				correct_num[t]++;
				if (wrong[t][p] != 0) {
					penalty[t] += wrong[t][p];
				}
			} else {
				wrong[t][p]++;
			}
		}
		for (int i = 0; i < T; i++) {
			time[i] += 20 * penalty[i];
			Pair pair;
			pair.set(correct_num[i], time[i]);
			rank[pair].push_back(i+1);
		}

		for (auto itr_map = rank.rbegin(); itr_map != rank.rend(); ++itr_map) {
			//cout << itr_map->first.a << ":" << itr_map->first.b << endl;
			if (itr_map != rank.rbegin()) {
				cout << ",";
			}
			for (auto itr_vec = itr_map->second.rbegin(); itr_vec != itr_map->second.rend(); ++itr_vec) {
				if (itr_vec != itr_map->second.rbegin()) {
					cout << "=";
				}
				cout << *itr_vec;
				//cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
}



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

int main()
{
   double r;
   cin>>r;
   double pi=3.14159265359;
   cout<<fixed;
   cout<<setprecision(6)<<pi*r*r<<" "<<2*pi*r;
   cout<<"\n";
    return 0;
}



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

#define max(a,b) (((a) < (b)) ? (b) : (a))
int main(void) {
    int64_t A,B,C;
    cin >> A >> B >>C;
    cout << max(0,C-(A-B)) << endl;
    return 0;
}


Measured memory_bytes: 256
def num_checker(string1, string2):
    if (int(string1)==0 and int(string2) != 0) or 9 < int(string1 + string2) < 13:
        return True
    else:
        return  False

S = input()
if num_checker(list(S)[0], list(S)[1]):
    if num_checker(list(S)[2], list(S)[3]):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num_checker(list(S)[2], list(S)[3]):
        print("YYMM")
    else:
        print("NA")

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

int main(){
  double n;
  cin >> n;
  for (auto x = (int)(n/1.08); x <= (int)((n+1)/1.08); ++x) {
    if (x * 108 / 100 == n) {
      cout << x;
      return 0;
    }
  }
  
  cout << ":(";
  return 0;
}

Measured memory_bytes: 888