akhauriyash/Code-Regression huggingface dataset:
_ = input()
num_list = list(map(lambda x: int(x), input().split(" ")))

num_list.sort()
num_list.reverse()

Alice = 0
Bob = 0
turn = True

while(True):
  if len(num_list) == 0:
    break
  
  if turn:
    Alice += num_list.pop(0)
  else:
    Bob += num_list.pop(0)
  turn = not turn
print(Alice - Bob)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws IOException {
		try (PrintWriter writer = new PrintWriter(System.out);
			InputReader reader = new InputReader(System.in)) {
			int[] firstCondition = reader.readIntsSplitByDelimiter(" ");
			int distance = firstCondition[2] - firstCondition[1];
			if (distance % 2 == 0) {
				writer.println("Alice");
			} else {
				writer.println("Borys");
			}

			writer.flush();
		}
	}
}


class InputReader implements Closeable, AutoCloseable {
	private final BufferedReader br;

	InputReader(InputStream inputStream) {
		this.br = new BufferedReader(new InputStreamReader(inputStream));
	}

	String readLine() throws IOException {
		return this.br.readLine();
	}

	String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
		return this.readLine().split(delimiter);
	}

	int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
		String[] strings = this.readStringsSplitByDelimiter(delimiter);

		int[] ints = new int[strings.length];
		int stringsLength = strings.length;
		for (int i = 0; i < stringsLength; i++) {
			ints[i] = Integer.parseInt(strings[i]);
		}

		return ints;
	}

	@Override
	public void close() throws IOException {
		br.close();
	}
}

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

int main(){
  int n;
  cin >> n;
  if(n%10 == 9){
	  cout << "Yes" << endl;
	  return 0;
  }
  n/=10;
  if(n%10 == 9){
	  cout << "Yes" << endl;
	  return 0;
  }
  cout << "No" << endl;
  return 0;

}



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

int main(void){
  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 cout << "Christmas Eve Eve Eve" << endl;

  return 0;
}


Measured memory_bytes: 256
//SILENT KILLER
              //HARD WORK BEATS TALENT WHEN TALENT DOESNOT WORK HARD
#include<bits/stdc++.h>
//typedef long long ll;
using namespace std;
int main()
{
     string str;
     cin>>str;
     int l=str.size();
     if(str[l-1]=='s')
        cout<<str<<"es"<<endl;
     else
        cout<<str<<"s"<<endl;


}


















Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n,t;cin>>n>>t;
    int s[n];rep(i,n)cin>>s[i];
    ll ans = 0;
    rep(i,n-1){
        ans+=min(t,s[i+1]-s[i]);
    }
    ans += t;
    co(ans);
}

Measured memory_bytes: 1024
import System.IO
import Data.List

type CookieCount = Integer
type YuckCount = CookieCount
type YummyCount = CookieCount
type PoisonedCount = CookieCount

countUpTargetCookies :: (YuckCount, YummyCount, PoisonedCount) -> CookieCount
countUpTargetCookies (yuck, yummy, poisoned) = yummy + poisoned

eatableCount :: YuckCount -> YummyCount -> PoisonedCount -> (YuckCount, YummyCount, PoisonedCount)
eatableCount yuck yummy poisoned
  | poisoned <= (unpoisoned) = (yuck, yummy, poisoned)
  | poisoned >  (unpoisoned) = (yuck, yummy, unpoisoned + 1)
  where unpoisoned = yuck + yummy

main = do
  args <- getLine
  let stringArray = words args
  let [yuck, yummy, poisoned] = [read numberStr | numberStr <- stringArray]
  putStr . show $ countUpTargetCookies (eatableCount yuck yummy poisoned)


Measured memory_bytes: 508
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();
		int c = sc.nextInt() * 2;
		int x = sc.nextInt();
		int y = sc.nextInt();

		int max = x > y ? x : y;

		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= max; i++) {
			// cの分
			int sum = i * c;

			// aの分を足りない分を買い足す
			if(x > i)
				sum += (x - i) * a;

			// bの分を足りない分を買い足す
			if(y > i)
				sum += (y - i) * b;

			min = min < sum ? min : sum;
		}
		System.out.print(min);
	}
}


Measured memory_bytes: 23892
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count = 0;
		for(int i=1; i<=n; i++){
			if(i % 2 == 1){
				int ct = 0;
				for(int j=1; j<=n; j++){
					if(i % j == 0){ct++;}
				}
				if(ct == 8){count++;}
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 35696
import itertools
n = int(input())
c = 0
if n <= 2:
    print(0)
    exit()
li = list(map(int,input().split()))

lis = list(itertools.combinations(li,3))
for i in range(len(lis)):
    if max(lis[i]) >= (sum(lis[i])-max(lis[i])):
        c += 0
    else:
        if len(lis[i]) == len(set(lis[i])):
            c += 1
        else:
            c += 0
print(c)


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

using namespace std;

void insertSort(int array[], int n);
void display(int array[],int n);

int main(){
  //subsitituting
  int n;
  cin >> n;
  int A[n];

  for(int i=0; i<n; i++){
    cin >> A[i];
  }
  display(A,n);
  insertSort(A,n);
}

void insertSort(int array[], int n){
  int i,j,k;
  for(i=1;i<n;i++){
    int a = array[i];
    for(j=0;j<i;j++){
      if(a<array[j]){
        for(k=i;k>j;k--){
            array[k] = array[k-1];
        }
        array[j] = a;
        break;
      }
    }
    display(array,n);
  }

}

void display(int array[],int n){
  for(int i=0; i<n ;i++){
    if(i>0) cout << " ";
    cout << array[i];
  }
  cout << endl;
}

Measured memory_bytes: 1160
MOD = 1000000007
N = int(input())
S1 = input()
S2 = input()
if S1[0] == S2[0]:
    ans = 3
    p = 1
    i = 1
else:
    ans = 6
    p = 0
    i = 2

while i < N:
    if S1[i] == S2[i]:
        if p:
            ans *= 2
        p = 1
        i += 1
    else:
        if p:
            ans *= 2
        else:
            ans *= 3
        p = 0
        i += 2
    ans %= MOD
print(ans)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define mod 1000000007
#define inf (1ll<<60)
#define eps 1e-9
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
using namespace std;

int main() {
    
    
    fast();
    int t;
    cin>>t;
    cout<<44*((float)(t))*1.0/7<<endl;
	return 0;
}


Measured memory_bytes: 3776
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,k,a[105],aa;
int main(){
	cin>>n>>k;
	while(k--){
		int s,x;
		cin>>s;
		while(s--)cin>>x,a[x]=1;
	}
	for(int i=1;i<=n;i++)if(!a[i])aa++;
	cout<<aa;
}


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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, r;
    cin >> n >> r;
    if (n >= 10) cout << r << '\n';
    else cout << r + 100 * (10 - n) << '\n';
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000000 + 7
#define PI 3.14159265359

const long long INF = 100000;
typedef pair<int,int> P;
typedef long long ll;

using Graph = vector<vector<int>>;

vector<int> num(2000 +5);//  num[k]は2頂点間の距離がkである2頂点の組の数
vector<int> d(2000 + 5, -1);// d[x]はある始点sから頂点xまでの距離

// 始点sから他の頂点までの距離を求めるbfs

void bfs(vector<vector<int>> &G, int s) {
	d[s] = 0;
	queue<int> que;
	que.push(s);
	
	while (que.size()) {
		int iTop = que.front();
		que.pop();

		for (auto next_iTop : G[iTop]) {//queの先頭に隣接する頂点の距離を更新
			if (d[next_iTop] == -1) {// まだ見ていない頂点なら距離は-1
				d[next_iTop] = d[iTop] + 1;
				que.push(next_iTop);

			}
		}
	}
	for (int i = 0; i < d.size(); i++) {
		if (d[i] >= 1 && d[i] < 2000) num[d[i]]++;
	}
}

int main() {
	int N, X, Y;
	cin >> N >> X >> Y;
	
	Graph G(N + 1);
	G[1].push_back(2);
	G[N].push_back(N - 1);
	G[X].push_back(Y);
	G[Y].push_back(X);

	for (int i = 2; i <= N - 1; i++) {
		G[i].push_back(i - 1);
		G[i].push_back(i + 1);
	}

	for (int s = 1; s <= N; s++) {
		bfs(G, s);
		for (int i = 0; i <= N; i++) {
			d[i] = -1;
		}

	}
	for (int k = 1; k <= N - 1; k++) {
		cout << num[k] / 2 << endl;
	}

}


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

///--->>> CONTAINERS <<<---///
using i64 = int64_t;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vector< ll > >;
using vpi = vector<pair<ll,ll> >;
using pi = pair<ll,ll>;
using st = set<ll>;
using stk = stack<ll>;
using kiwi = queue<ll>;
using pkiwi = priority_queue<ll>;
using mp = map<ll,ll>;
using ump = unordered_map<ll,ll>;

///--->>> MACROS<<<---///
const ll mx = 3e5+123;
#define MOD 1000000007
#define REP(i,n) for (ll i=1;i<=n;++i)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

///--->>>OPTIMIZE<<<---///
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

///--->>> DEBUGGER<<<---///
#define dbg(args...) do {cerr<<#args<<" : "; diraf(args); } while(0)
void diraf ()  {        cerr << endl;}
template < typename T, typename ... hello>void diraf( T arg, const hello &... rest) {cerr<<arg<< ' ';diraf(rest...);}

int main(int argc, char* argv[]){
    fastio;
    ///freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    ///cout<<fixed<<setprecision(20);
    ll n; cin>>n;
    while(n--)
        cout<<"ACL";

return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <typename T, typename U>
vector<U> make_vector(T&& n, U&& val) {
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
decltype(auto) make_vector(T&& n, Args&&... args) {
  return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...));
}

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

void solve() {
  int n;
  cin >> n;
  vi32 s(n);
  cin >> s;
  sort(s.begin(), s.end());
  int q;
  cin >> q;
  i64 ans = 0;
  rep(qi, q) {
    int t;
    cin >> t;
    int l = lower_bound(all(s), t) - s.begin();
    int r = upper_bound(all(s), t) - s.begin();
    ans += r - l > 0;
  }
  cout << ans << endl;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s;
  cin>>s;
  ll n=s.size();
  vll dp1(n),dp2(n);
  REP(i,n){
    if(i==0){
      if(s[i]=='1'){
        dp1[i]=2;
        dp2[i]=1;
      }
      else{
        dp1[i]=1;
        dp2[i]=0;
      }
    }
    else{
      if(s[i]=='1'){
        dp1[i]=dp1[i-1]*2;
        dp2[i]=dp1[i-1]+dp2[i-1]*3;
      }
      else{
        dp1[i]=dp1[i-1];
        dp2[i]=dp2[i-1]*3;
      }

    }

    dp1[i] %=MOD;
    dp2[i] %=MOD;
  }

  ll ans=dp1[n-1]+dp2[n-1];
  ans%=MOD;
  cout<<ans<<endl;
}



Measured memory_bytes: 2000
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int str[1005];
int main()
{
    int n;
    while(scanf("%d",&n)==1)
    {
        for(int i=0;i<n;i++)
            scanf("%d",&str[i]);

            sort(str,str+n);

            printf("%d\n",str[n-1]-str[0]);

    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 99999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong n,k,h,ans=0;
    cin >> n >> k;
    rep(i,n){
        cin >> h;
        if(h >= k) ans++;
    }
    cout << ans << endl;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

int main(){

    ll a, b, n; cin >> a >> b >> n;

    cout << (ll)(a*min(b-1,n)/b) << endl;

    return 0;
}

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

int main(){
    int H, W;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3096
use proconio::input;
// use itertools::*;

fn main() {
  input!{
    a:f64,b:f64,c:f64,d:f64
  };
  let kill_a = (a / d).ceil();
  let kill_b = (c / b).ceil();
  dbg!(kill_a, kill_b);
  println!("{}", if kill_b <= kill_a {"Yes"} else {"No"});
}


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

int main(void){
  double n,k; cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n; i++){
    double p = 1, count = i;
    while(count < k){
      p = p/2;
      count *= 2;
    }
    ans += p;
  }
  printf("%.12f\n",ans/n);
  return 0;
}


Measured memory_bytes: 256
N=int(input())
*A,=map(int,input().split())
*B,=map(int,input().split())

Minus=0
Plus=[]
ans=0
for a,b in zip(A,B):
    if a<b:
        ans+=1
        Minus+=b-a
    elif a>b:
        Plus.append(a-b)

Plus.sort()
i=0
M=len(Plus)
Plus=Plus[::-1]
while Minus>0 and i<M:
    ans+=1
    Minus-=Plus[i]
    i+=1

if Minus>0:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 24260
#include<iostream>
#include<bits/stdc++.h>
#include<array>
using namespace std;
#define int long long
#define fast_cin ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define endl "\n"
#define with_tests int t; cin >> t; while(t--){ solve(); cout << endl; }
#define without_tests solve(); cout << endl;
#define CEIL(x, y) (ll)ceil((long double)(x)/(long double)(y))
#define epsilon 1e-9 
typedef long long ll;
const int mod = 1e9+7;
const int N = 1e5+1;

void solve(){
    
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    for(int i=0; i<n; i++){
        for(int j=1; j<=k && (i+j) < n; j++){
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]));
        // cout << i << " " << dp[i] << endl;
        }
    }
    cout << dp[n-1]; 

}

int32_t main(){

    fast_cin;
    // with_tests;
    without_tests;

    return 0;
}


Measured memory_bytes: 4780
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;

public class Main {

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

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			//			solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int x = nextInt();
		int a = nextInt();

		out.println(x < a ? 0 : 10);
	}

	private void solveB() {
		int n = nextInt();
		int x = nextInt();
		int[] wk = IntStream.range(0, n).map(i -> nextInt()).toArray();

		int d = 0;
		int cnt = 0;
		if (d <= x) {
			cnt++;
		}

		for (int i = 0; i < wk.length; i++) {
			d = d + wk[i];
			if (d <= x) {
				cnt++;
			}
		}

		out.println(cnt);
	}

	private void solveC() {
		int w = nextInt();
		int h = nextInt();
		int x = nextInt();
		int y = nextInt();

		out.println("");
	}

	private void solveD() {
		int n = nextInt();

		out.println("");
	}

	private void solveE() {
		int n = nextInt();

		out.println("");
	}

	private void solveF() {
		int n = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 27604
#include<cstdio>
#include<algorithm>
using namespace std;
int order[8001]={0},n=0;
int orderx[8001]={0},ordery[8001]={0},nx=0,ny=0;
int x,y;
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    char c; int tmpx=0,tmpy=0;
    while((c=getchar())=='T'||c=='F')
    {
        if(c=='T')
            n++;
        else
            order[n]++;
    }
    for(int i=1;i<=n;i++)
        if(i%2==0)
            orderx[nx++]=order[i];
        else
            ordery[ny++]=order[i];
    scanf("%d %d",&x,&y);
    sort(orderx, orderx+nx,cmp);   sort(ordery, ordery+ny,cmp);
    tmpx=order[0];
    for(int i=0;i<nx;i++)
    {
        if(tmpx>=x)
            tmpx-=orderx[i];
        else
            tmpx+=orderx[i];
    }
    for(int i=0;i<ny;i++)
    {
        if(tmpy>=y)
            tmpy-=ordery[i];
        else
            tmpy+=ordery[i];
    }
    if(x==tmpx&&y==tmpy)
        printf("Yes");
    else
        printf("No");
    return 0;
}

Measured memory_bytes: 256
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str1,str2;
    cin>>str1>>str2;
    str1+=str2;
    a=stoll(str1);
    b=sqrt(a);
    if(pow(b,2)==a) cout<<"Yes";
    else cout<<"No";


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

int main(){
    string s;
    cin >> s;
    
    string t = "AKIHABARA";
    int id[4] = {0, 4, 6, 8};
    rep(i, 1<<4){
        string u = t;
        rep(j, 4)if((i>>j) & 1) u[id[j]] = '#';
        string v = "";
        rep(j, u.size())if(u[j] != '#') v += u[j];
        if(s == v){
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 100005
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define scan(a) scanf("%d", &a)
#define print(a) printf("%d\n", a);
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

/* ----------------------------------------------------------------------------------- */

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

/* ----------------------------------------------------------------------------------- */

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
    typedef string::iterator si;
    static void call(si it, si ed) {}
    template<typename T, typename ... aT>
    static void call(si it, si ed, T a, aT... rest) {
        string b;
        for(; *it!=','; ++it)
            if(*it!=' ')
                b+=*it;
        cout << b << "=" << a << " ";
        call(++it, ed, rest...);
    }
};

/* ----------------------------------------------------------------------------------- */

vi g[MAX];
vi h(MAX);
vi connect(MAX);

void solve() {
	int n, m;
	cin >> n >> m;
	int ans = 0;
	REP(i, 1, n) {
        g[i].clear();
    }
    REP(i, 1, n) {
        scan(h[i]);
    }
	REP(i, 1, m) {
		int u, v;
        scan(u);
        scan(v);
        g[u].pb(v);
        g[v].pb(u);
	}

	REP(i, 1, n) {
        bool on = 1;
        for(auto it : g[i]) {
            if(h[i] <= h[it]) {
                on = 0;
                break;
            }
        }
        if(on) {
            ans++;
        }
    }

	print(ans);

}

int main() {
    solve();

    // __test {
    //     solve();
    // }
}

Measured memory_bytes: 9124
#include<bits/stdc++.h>
#define ll long long int
#define fl(i,x,y) for( int i=x;i<y;i++)
#define w(t) while(t--)
#define vi vector<ll>
#define vvi vector< vi >
#define si set<ll>
#define msi multiset<ll>
#define si_d set<ll, greater<ll> >
#define mii map<ll,ll>
#define pb push_back
#define msi_it  multiset<ll> :: iterator
#define si_it set<ll> :: iterator
#define sort1(v) sort(v.begin(),v.end());
#define F first
#define S second
using namespace std;
#define N 1000000007
#define mod 15000000000031
int main()
{
	ll n,total=0;cin>>n;
	ll k=n/500;
	total+=(k*1000);
	n-=(k*500);
	ll v=n/5;
	total+=(v*5);
	cout<<total;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define pb push_back 
#define F first 
#define S second 
#define f(i,n) for(int i=0;i<n;i++) 

using namespace std;

string pS(ll n) 
{ 
    char str[1000]; // To store result (Excel column name) 
    ll i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        ll rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    return str;
} 

void test(){
	ll n;
	cin>>n;
	cout<<pS(n)<<"\n";
}

int main(){
	int tests = 1;
//	cin>>tests;
	while(tests--){
		test();
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll min(ll a, ll b){
    if(a < b)
        return a;
    return b;
}
int main(){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll cnt = 0;
    ll y = min(a, k);
    cnt += y;
    k -= y;
    k -= min(b, k);
    ll u = min(c, k);
    k -= u;
    cnt -=u;
    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 3632
n, m, k = [int(_) for _ in input().split(' ')]

tmp = [int(_) for _ in input().split(' ')]
a = [0]
for i in range(n):
    a.append(a[i] + tmp[i])
tmp = [int(_) for _ in input().split(' ')]
b = [0]
for i in range(m):
    b.append(b[i] + tmp[i])

answer = 0
i2 = m
for i1 in range(n + 1):
    while a[i1] + b[i2] > k and i2 > 0:
        i2 -= 1
    if i1 + i2 >= answer and a[i1] + b[i2] <= k:
        answer = i1 + i2

print(answer)

Measured memory_bytes: 53264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//ll lcm(ll x, ll y){ return x*y/__gcd(x, y);}
int main(){
    char C; cin >> C;
    int c = C;
    c++;
    //for(ll i=0; i<n; i++){}
    cout << (char)c;

}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf = 1 << 30;
const int MAX_N = 1 <<16;

int n;
int dp[MAX_N];
int times[16][16+1];

int main(void){
	while (cin >> n,n){
		rep(i,n)
			rep(j,n+1) 
				cin >> times[i][j];

		rep(i,1<<n) dp[i]=inf;
		dp[(1<<n)-1]=0;
		for(int i=(1<<n)-1;i>=0;i--){
			rep(j,n){  // 攻略するゲーム
				if((i>>j)&1){
					int next=i&~(1<<j);
					dp[next]=min(dp[next],dp[i]+times[j][0]);
					rep(k,n){ // 装備する武器
						if((i>>k)&1)
							continue;
						dp[next]=min(dp[next],dp[i]+times[j][k+1]);
					}
				}
			}
		}
		cout << dp[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 1416
#include<stdio.h>

int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b&&b==c){
		printf("Yes\n");
	}
	else if(c>a&&c<b){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}


	return 0;
}

Measured memory_bytes: 128
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alphabet_list = [ch for ch in alphabet]

def get_alphabet_num(chr):
    global alphabet
    global alphabet_list
    num = 0
    for i in range(len(alphabet)):
        if chr == alphabet_list[i]:
            num = i
            break
    return num

N = int(input())
input_str = input()

list = [''] * len(input_str)

for i in range(len(input_str)):
    input_num = get_alphabet_num(input_str[i]) + N
    if input_num > 25:
        input_num -= 26
    list[i] = alphabet_list[input_num]
    input_num = 0

list = ''.join(list)
print(list)

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> vf(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 10; ++j) {
      int f;
      cin >> f;
      if (f == 1) {
        vf[i] |= (1 << j);
      }
    }
  }

  vector<vector<int>> vp(n, vector<int>(11));
  for (int i = 0; i < vp.size(); ++i) {
    for (int j = 0; j < vp[i].size(); ++j) {
      cin >> vp[i][j];
    }
  }

  int ans;
  for (int i = 1; i < (1 << 10); ++i) {
    int pt = 0;
    for (int j = 0; j < vf.size(); ++j) {
      int cnt = bitset<16>(i & vf[j]).count();
      pt += vp[j][cnt];
    }

    if (i == 1 || ans < pt) {
      ans = pt;
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
a = inpl()
now = 0
ans = 0
for i in range(n):
    if now > a[i]:
        ans += now - a[i]
    else:
        now = a[i]
print(ans)


Measured memory_bytes: 94264
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p)*(b))%m;
		b=((b)*(b))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
vector<ll>h[1000002];
ll w[1000002];
multiset<ll>m;
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll H,W,M,h1,w1;
	cin>>H>>W>>M;
	for (int i = 0; i < M; i++)
	{
		cin>>h1>>w1;
		h[h1].pb(w1);
		w[w1]++;
	}
	for(int w1=1;w1<=W;w1++)
	{
		m.insert(-w[w1]);
	}
	ll ans = 0;
	for(int h1=1;h1<=H;h1++){
		for(auto w1:h[h1]){
			ans = max(ans, (ll)h[h1].size()+w[w1]-1);
				// cout<<w1<<" "<<ans<<endl;		
			m.erase(m.lower_bound(-w[w1]));
		}
		ans = max(ans, (ll)h[h1].size()-*(m.begin()));
		for(auto w1:h[h1]){
			m.insert(-w[w1]);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 52864
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] d = new int[n];
        for(int i=0; i<n; i++) {
            d[i] = in.nextInt();
        }
        Arrays.sort(d);
        System.out.println(d[n/2]-d[n/2-1]);
    }
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int Mod =(1e9)+7;
using P = pair<ll,ll>;

 ll mod=998244353;

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

ll modpow(ll N, ll P){
if(P==0) return 1;
if(P%2==0){
ll t =modpow(N, P/2);
return t*t % mod;
}
return N * modpow(N, P-1)%mod;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main(){
    ll n,m,k;cin >>n>>m>>k;
    COMinit();
    ll ans=0;
    for (int i = 0; i <= k; ++i) {
            ll x=m*modpow(m-1,n-i-1)%mod;
           ans+=COM(n-1,i)*x;
           ans%=mod;
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 15552
#ID
from collections import deque
n,m=map(int,input().split())
s=[]
for i in range(m):
    p,y=map(int,input().split())
    s.append([y,p,i+1])
s=sorted(s)
s=deque(s)
s.appendleft(0)
t=[1]*(n+1)
ID=[0]*(m+1)
for i in range(1,m+1):
    ID[s[i][2]]=str(s[i][1]*(10**6)+t[s[i][1]]).zfill(12)
    t[s[i][1]]+=1
for i in range(1,m+1):
    print(ID[i])

Measured memory_bytes: 32420
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll x,n; cin >> x >> n; ll ans = -100;
  set<ll> forbid;
  
  rep(i,n){
    ll x; cin >> x;
    forbid.insert(x);
  }
  
  ll i = 0;
  while(ans == -100){
    if(!forbid.count(x-i)) ans = x-i;
    else if(!forbid.count(x+i)) ans = x+i;
    i++;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>

std::vector<int> v;

int main()
{
	int n;
	while( std::cin >> n, n )
	{
		v.clear();

		for( int i = 0; i != n; ++i )
		{
			int a;
			std::cin >> a;
			v.push_back( a );
		}

		int b;
		std::cin >> b;

		int ans = 0;
		int l = 0, r = v.size() - 1;
		while( l <= r )
		{
			int mid = ( l + r ) / 2;

			++ans;

			if( r <= l )
				break;

			if( v[mid] < b )
				l = mid + 1;
			else if( v[mid] > b )
				r = mid - 1;
			else
				break;
		}

		std::cout << ans << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/








int N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    set<char> s;
    rep(i, 0, N) {
        char c; cin >> c;
        s.insert(c);
    }

    if (s.size() == 3) printf("Three\n");
    else printf("Four\n");
}

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

int main() {
    int a, b;
	cin >> a >> b;
    cout << "a ";
    if(a<b) cout << "<";
    if(a>b) cout << ">";
    if(a==b)cout << "==";
    cout << " b" << "\n";

	return 0;
}


Measured memory_bytes: 3052
# -*- coding: utf-8 -*-
# import numpy as np
N = map(int, raw_input().split())
N.sort()

a,b,c = tuple(N)


cnt = 0
# if a=b=c:
#     print 0:
# else:

d1 = c - a
d2 = c - b

i = d1 / 2
d1 = d1 - i * 2

cnt += i

j = d2 / 2
d2 = d2 - j * 2

cnt += j

if d1 == d2 == 0:
    print cnt

elif d1 == d2 == 1:
    print cnt + 1
else:
    print cnt + 2




Measured memory_bytes: 2568
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define range(i, n) for(i = 0; i < n; ++i)
#define RANGE(i, m, n) for(i = m; i < n; ++i)
#define arange(arr) iota(arr.begin(), arr.end(), 0)
#define ARANGE(arr, n) iota(arr.begin(), arr.end(), n)

using namespace std;
int i, j;

// https://ikatakos.com/pot/programming_algorithm/data_structure/union_find_tree
// 経路圧縮している場合はランクではなくサイズ
struct UnionFind{
  // 負：根あり，絶対値はサイズの大きさ
  // 非負：根ではなく，値は親を指す（普通の parent の動き）
  vector<int> par;
  UnionFind(int n):par(n, -1){}
  
  int root(int x){
    // 負なので親，x はサイズの大きさではなく親の index
    if(par[x] < 0) return x;
    // 経路の圧縮（親を root に統一）
    else return par[x] = root(par[x]);
  }
  
  bool find(int x, int y){
    return root(x) == root(y);
  }
  
  //union が予約語
  void merge(int x, int y){
    x = root(x); y = root(y);
    if(x == y) return;
    
    // 絶対値でサイズの大きさを比較
    // rx が ry よりサイズが大きくなるよう swap
    if(-par[x] < -par[y]) swap(x, y);
    
    // rx に ry をくっつける
    // サイズの更新（ry のサイズを加算）
    par[x] += par[y];
    // 親の更新
    par[y] = x;
  }
};

int main(void){
  int N;
  cin >> N;
  
  using Pint = pair<int, int>;
  using Edge = pair<int, Pint>;
  vector<int> x(N), y(N);
  vector<Edge> edges;
  
  range(i, N){
    cin >> x[i] >> y[i];
  }
  
  vector<int> ids(N);
  arange(ids);
  sort(ids.begin(), ids.end(),
       [&](int i, int j) -> int {return x[i] < x[j];});
  range(i, N-1){
    int u = ids[i], v = ids[i+1];
    edges.push_back(Edge(x[v]-x[u], Pint(u, v)));
  }
  
  arange(ids);
  sort(ids.begin(), ids.end(),
       [&](int i, int j) -> int {return y[i] < y[j];});
  range(i, N-1){
    int u = ids[i], v = ids[i+1];
    edges.push_back(Edge(y[v]-y[u], Pint(u, v)));
  }
  
  sort(edges.begin(), edges.end(),
       [](Edge i, Edge j) -> int {return i.first < j.first;});
  
  UnionFind uf(N);
  int result = 0;
  for(Edge e: edges){
    int u = e.second.first, v = e.second.second;
    if(uf.find(u, v)) continue;
    result += e.first;
    uf.merge(u, v);
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 6132
/*

Author : 5hifaT

github:https://github.com/jspw

linkedin : https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/

Stackoverflow : https://stackoverflow.com/story/jspw 


*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h> //works like magic, but at cost.
using namespace std;
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%llid",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%llid\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout<<x<<endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define fk(i, k, n) for(int i=k; i<n; i++)
#define fn(i, n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define llii long long int
#define F first
#define S second
#define OJ \
          freopen("input.txt", "r", stdin); \
          freopen("output.txt", "w", stdout);
#define alli(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortalli(x) sort(alli(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<llii, llii>	pl;
typedef vector<int>		vi;
typedef vector<llii>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     int n;
     vi array;
     cin>>n;
     fo(i, n){
         int s;
         cin>>s;
         array.pb(s);
     }int ac=0,bc=0;
     sort(array.begin(),array.end());
     fo(i, n){
         
        if(i%2==0){
            ac += array[0];
            array.erase(array.begin());

        }  if(i%2!=0){
            bc += array[0];
            array.erase(array.begin());

        }
     }cout<<abs(ac-bc)<<"\n";












return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
const int MAX = 510000;
const int MOD = 1000000007;
const int inf = 1<<31-1;
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; }
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
int main(void) {
    int n; cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }ll ans = mod_pow(10, n,MOD);
    ans += mod_pow(8, n,MOD);
    ans = (ans - 2 * mod_pow(9, n, MOD) + 2 * MOD) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
  int h,w;
  cin>>h>>w;
  r(i,h)r(j,w){
    string s;
    cin>>s;
    if(s=="snuke"){
      cout<<(char(j+'A'))<<i+1<<endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
int w[300000];
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = next<int>();
	rep(i, 0, n-1) w[next<int>()]++;
	hrp(i, 1, n) cout<<w[i]<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}


Measured memory_bytes: 5200
#include<iostream>

using namespace std;
int main()
{
    int x,y;
    cin >> x >> y;
  if(y%2 == 1){
    cout << "No";
    return 0;
  }
  	int a =y/2-x,b = 2*x-y/2;
	if (y/2-x == int(y/2-x) && 2*x-y/2 == int(2*x-y/2)){
      if(a>=0&&b>=0){
        cout << "Yes";
        return 0;
      }
    }
	cout << "No";
}


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

using namespace std;

typedef unsigned long long int ull;
typedef long long int lli;
typedef pair<int, int> pii;

const int mod = 1'000'000'007;
const int sz = 112345;

int main() {
  lli x, y;
  cin >> x >> y;
  if (x % y == 0) {
    puts("-1");
  } else {
    cout << x << endl;
  }
}


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;

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;

  string ans = "";
  rep(i, N) {
    ans += S[i];
    ans += T[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256