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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll n, a;
    cin >> n;
    cin >> a;
    ll b = n / 500;
    if (n - 500 * b <= a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


void solve(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n){ cin >> a.at(i); }
    string s;
    cin >> s;
    if(s.back() == '1'){
        cout << 1 << endl;
        return;
    }

    vector<ll> z;
    RREP(i, s.size()){
        if(s.at(i) == '0'){
            z.push_back(a.at(i));
        }else{
            if(s.at(i + 1) == '0'){
                sort(ALL(z));
                RREP(j, z.size()){
                    if(z.at(j) == 0){ continue; }
                    ll k;
                    for(k = 60; k >= 0; --k){
                        if((z.at(j) >> k) & 1){
                            break;
                        }
                    }
                    REP(l, z.size()){
                        if(l == j){ continue; }
                        if((z.at(l) >> k) & 1){
                            z.at(l) ^= z.at(j);
                        }
                    }
                }
                sort(ALL(z));
            }

            ll y = a.at(i);
            RREP(j, z.size()){
                if(z.at(j) == 0){ continue; }
                ll k;
                for(k = 60; k >= 0; --k){
                    if((z.at(j) >> k) & 1){
                        break;
                    }
                }
                if((y >> k) & 1){
                    y ^= z.at(j);
                }
            }
            if(y != 0){
                cout << 1 << endl;
                return;
            }
        }
    }
    cout << 0 << endl;
}

int main(){
    ll t;
    cin >> t;
    REP(i, t){
        solve();
    }
    return 0;
}


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

void print(std::vector<int> readVec){
    int sz = readVec.size();
    for(int i = 0; i < sz; ++i){
        std::cout << readVec.at(i);
        if(sz - 1 != i){
            std::cout << " ";
        }
    }

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

int main(){
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    for(int i = 0; i < n; ++i){
        std::cin >> a.at(i);
    }

    std::vector<int> ans;    
    int i = n - 1, j = n % 2;
    while(1 - j <= i){
        ans.push_back(a.at(i));
        i -= 2;
    }
    i = j;
    while(i < n - 1){
        ans.push_back(a.at(i));
        i += 2;
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 4724
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    bool checker{};
    for (int i = 1; i < 10; i++)
    {
        if (N / i * i == N && N / i < 10)
        {
            checker = 1;
        }
    }
    cout << (checker ? "Yes" : "No") << endl;
    return 0;
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

struct mint {
  ll v;
  mint() : v(0) {}
  mint(ll v) : v((v % MOD + MOD) % MOD) {}
  operator ll() const { return v; }
  mint pow(ll t) const;
  mint inv() const;
};
mint& operator+=(mint& a, mint b) { return a = a.v + b.v; }
mint& operator-=(mint& a, mint b) { return a = a.v - b.v; }
mint& operator*=(mint& a, mint b) { return a = a.v * b.v; }
mint operator+(mint a, mint b) { return a += b; }
mint operator-(mint a, mint b) { return a -= b; }
mint operator*(mint a, mint b) { return a *= b; }
mint operator-(mint a) { return (mint)0 - a; }
mint& operator/=(mint& a, mint b) { return a *= b.inv(); }
mint operator/(mint a, mint b) { return a /= b; }
mint mint::pow(ll t) const {
  if (!t) return 1;
  mint a = pow(t >> 1);
  a *= a;
  if (t & 1) a *= *this;
  return a;
}
mint mint::inv() const { return pow(MOD - 2); }
bool operator==(mint a, mint b) { return a.v == b.v; }
bool operator!=(mint a, mint b) { return a.v != b.v; }
istream& operator>>(istream& os, mint& a) { return (os >> a.v); }
ostream& operator<<(ostream& os, const mint& a) { return (os << a.v); }

mint mfact(int n) { // n! (mod MOD)
  static vector<mint> fact(1, 1);
  int pn = fact.size();
  if (pn < n + 1) {
    fact.resize(n + 1);
    for (int i = pn; i <= n; i++) fact[i] = fact[i - 1] * (mint)i;
  }
  return fact[n];
}
mint mifact(int n) { // n! (mod MOD)
  static vector<mint> ifact(1, 1);
  int pn = ifact.size();
  if (pn < n + 1) {
    ifact.resize(n + 1);
    ifact[n] = mfact(n).inv();
    for (int i = n; i >= pn; --i) ifact[i - 1] = ifact[i] * (mint)i;
  }
  return ifact[n];
}
mint nPk(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  if (k == 0) return 1;
  return mfact(n) * mfact(n - k).inv();
}
mint nCk(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  if (k == 0) return 1;
  // return mfact(n) * mfact(k).inv() * mfact(n - k).inv();
  return mfact(n) * mifact(k) * mifact(n - k);
}

void solve() {
  int n, k;
  cin >> n >> k;
  k = min(k, n - 1);
  mint ans = 0;
  mifact(n);
  for (int i = 0; i <= k; i++) {
    ans += nCk(n, i) * nCk(n - i - 1 + i, i);
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

int main() {

    /* 解説AC */
    int n, k;
    cin >> n >> k;

    double ret = 0;

    for (int i = 1; i <= n; i++) {
        
        double tmp = 1.0/n;
        int now = i;

        while (now < k) {
            now *= 2;
            tmp /= 2;
        }

        ret += tmp;
    }

    printf("%.12f\n" ,ret);
    
/*以下、コンテスト中回答
    long double n;
    cin >> n;

    int k;
    cin >> k;

    long double sum = 1; 

    long double kakuritsu;
    kakuritsu = 1 / n;

    long double a = 1;
    int count = 0;
    long double torima = 0;
    long double res = 0;

    for (int i = 1; i < n+1; i++) {

        count = 0;
        a = i;
        sum = 1;

        while (a <= k) {
            a *= 2;
            count ++;
        }

        for (int j = 0; j < count; j++) {
            sum *= 0.5;
        }

        torima = kakuritsu * sum;
    
        res += torima;
        
    }

    printf("%.10f" , res);

    return 0;
    */
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

mod = 1000000007

s = ns().rstrip()

nums = [0]*4
nums[0] = 1
for c in s:
    if c == 'A':
        nums[1] += nums[0]
        nums[1] %= mod
    elif c == "B":
        nums[2] += nums[1]
        nums[2] %= mod
    elif c == "C":
        nums[3] += nums[2]
        nums[3] %= mod
    else:
        nums[3] = nums[3]*3+nums[2]
        nums[2] = nums[2]*3+nums[1]
        nums[1] = nums[1]*3+nums[0]
        nums[0] = nums[0]*3
        for k in range(4):
            nums[k] %= mod
print(nums[3])



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

int main() {
	string ans = "NO";
	int v[3];
	cin >> v[0]>>v[1]>>v[2];
	if(v[0]*v[1]*v[2]==175){
		ans = "YES";
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define ll long long
int cmp(int a,int b){
	return a>b;
}
int main(){
 	ll n,k;
 	cin >> n >> k;
 	if(n%k==0) {
 		cout << "0";	
	}else {
		cout << min(n,abs(n%k-k));
	} 
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static List<int> list = new List<int>();
    static void Main(string[] args) {
        int x;
        Input(out x);
        list.Add(2);
        if(x < 3) {
            Console.WriteLine(2);
            return;
        }
        int i = 3;
        while(true) {
            if(IsPrime(i)) {
                if(i >= x) {
                    Console.WriteLine(i);
                    return;
                } else {
                    list.Add(i);
                }
            }
            i++;
        }
    }
    static bool IsPrime(int n) {
        foreach(var p in list) {
            if(n % p == 0) {
                return false;
            }
        }
        return true;
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    IOS

    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> v(1e6+10,0);

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

    sort(all(a));
    int ans=0;
    for(int i=0;i<n;i++)
    {
    	
		if(i&&a[i]==a[i-1])
			v[a[i]]++;

    	if(v[a[i]])
    		continue;

    	for(int j=2*a[i];j<=1e6;j+=a[i])
    		v[j]++;
    }

    for(int i=0;i<n;i++)
    {
    	if(!v[a[i]])
    		ans++;
    }

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


Measured memory_bytes: 7916
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int a, b, d, r;
	double f;
	cin >>a>>b;
	d = a / b;
	r = a%b;
	f = double(a) / b;
	cout << d << " " << r << " ";
	printf("%.8lf\n", f);
	
	
		return 0;
}

Measured memory_bytes: 3232
#include <iostream>

using namespace std;
using ll = long long;

#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define in(v) if (scanf("%d", &v)<1);

int main() {
  int N; in(N);

  ll push_count = 0;
  int A[N], B[N];
  rep(i, N) {
    in(A[i]); in(B[i]);
  }
  rrep(i, N-1)
    if ((A[i] + push_count) % B[i] != 0)
      push_count += B[i]-((A[i]+push_count) % B[i]);

  printf("%lld\n", push_count);

  return 0;
}


Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var ar = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()
    var k=ar[0]
    var n=ar[1]

    var a = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()
    var min = Int.MAX_VALUE
    var temp = 0

    for(i in 0..a.size-1)
    {
        if(i+1<=a.size-1)
           temp= a[i]+k-a[i+1]
        if(temp<min)
            min=temp
    }

    temp = a[a.size-1]-a[0]
    if(temp<min)
        min=temp

    println(min)
}


Measured memory_bytes: 82412
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  vector<long long>H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  sort(H.begin(),H.end());
  long long small=H.at(N-1);
  for(int i=0;i<N-K+1;i++){
    small=min(small,H.at(i+K-1)-H.at(i));
  }
  cout<<small<<endl;
}
    

Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = ""; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

using namespace std;

const ll INF = 1e9 + 10;
const ll INF2 = 1e18 + 10;
const int MOD = 1e9 + 7;
const ld EPS = 1e-4;

const int LOGN = 19;
const int MAXN = 2e5;

struct Line {
	mutable ll k, m, p;
	bool operator<(const Line& o) const { return k < o.k; }
	bool operator<(ll x) const { return p < x; }
};

struct LineContainer : multiset<Line, less<>> {
	// (for doubles, use inf = 1/.0, div(a,b) = a/b)
	const ll inf = LLONG_MAX;

	ll div(ll a, ll b) { // floored division
		return a / b - ((a ^ b) < 0 && a % b); }

	bool isect(iterator x, iterator y) {
		if (y == end()) { x->p = inf; return false; }
		if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
		else x->p = div(y->m - x->m, x->k - y->k);
		return x->p >= y->p;
	}

	// kx + m
	void add(ll k, ll m) {
		auto z = insert({k, m, 0}), y = z++, x = y;
		while (isect(y, z)) z = erase(z);
		if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
		while ((y = x) != begin() && (--x)->p >= y->p)
			isect(x, erase(y));
	}

	ll query(ll x) {
		assert(!empty());
		auto l = *lower_bound(x);
		return l.k * x + l.m;
	}
};


int main() {
	FAST;

	int n;
	ll c;
	cin >> n >> c;

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

	LineContainer s;
	vector<ll> dp(n);

	for (int i = 1; i < n; i++) {
		s.add(2 * a[i - 1], -a[i - 1] * a[i - 1] - dp[i - 1]);
		dp[i] = -s.query(a[i]) + c + a[i] * a[i];
	}

	cout << dp[n - 1];
}



Measured memory_bytes: 18744
#include<stdio.h>

int main(){
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  if ( a == b && c == d ||
       a == c && b == d ||
       a == d && b == c ) printf("yes\n");
  else printf("no\n");

  return 0;
}




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

int main(){
    string s;
    cin >> s;
    int len = s.size();
    int flag1=-1;
    int flag2=0;
    for(int i=0;i<len;i++){
        if(flag1!=-1){
            if(s[i]=='Z'){
                flag2=i;
            }
        }else if(flag1==-1 && s[i]=='A'){
            flag1=i;
        }
    }
    cout << flag2 - flag1 + 1 << endl;

    return 0;
}

Measured memory_bytes: 640
/*
 Shahadat Hossain
 I.C.T Department
 Comilla University
 Session: 2013-2014
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define UNIQUE(x)       x.erase(unique(all(x)), x.end())

#define fs              first
#define sc              second
#define pb              push_back

#define sz(x)           (int)x.size()
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define ms(a,b)         memset(a, b, sizeof(a))
#define valid(x,y,n, m)      x>=0 && y>=0 && x<n && y<m

#define input           freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output          freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)

#define endl            '\n'
#define eps             1e-5
#define yes             printf("YES\n")
#define no              printf("NO\n")

#define int             long long

inline void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}

int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
inline int Set(int n,int pos) { return n = n | (1LL << pos); }
inline int Reset(int n,int pos) { return n = n & ~(1LL << pos); }
inline bool Check(int n,int pos) { return (bool)(n & (1LL << pos)); }
inline int Count(ll n) { return __builtin_popcountll(n); }

typedef pair<int,int> pint;
int const N = 2e5 + 10;
int const MOD = 1e9 + 7;

int tree[N];
int n, m;

int query(int idx){
    int res = 0;
    while(idx > 0){
        res += tree[idx];
        idx -= idx & (-idx);
    }
    return res;
}
void update(int idx, int val){
    while(idx <= m){
        tree[idx] += val;
        idx += idx & (-idx);
    }
}

int fun(int day){
    int left = 1, right = day;
    int last = query(right);
    if(last == 0) return -1;
    int res = -1;
    while(left <= right){
        int mid = (left + right) >> 1;
        if(query(mid) >= last){
            res = mid;
            right = mid - 1;
        }
        else{
            left = mid + 1;
        }
    }
    return res;
}

bool compare(pint a, pint b){
    if(a.fs == b.fs)
        return a.sc < b.sc;
    return a.fs < b.fs;
}


int32_t main(){
    fast();
    cin >> n >> m;
    
    vector<pair<int,int> > ar(n);
    for(int i = 0; i < n; i++)
        cin >> ar[i].sc >> ar[i].fs;
    
    for(int i = 1; i <= m; i++)
        update(i, 1);
    
    
    sort(ar.begin(), ar.end(), compare);
    int res = 0;
    
    while(ar.size()){
        int day = ar.back().sc;
        int reward = ar.back().fs;
        ar.pop_back();

        int temp = fun(m - day + 1);
        if(temp != - 1){
            update(temp, -1);
            res += reward;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 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;
}
signed main() {
    string S;
    cin >> S;
    if(S == "ARC")
        cout << "ABC" << endl;
    else
        cout << "ARC" << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <n; (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}

using namespace std;
int main(){
    int n,m;std::cin >> n>>m;
    std::vector<int> a(n+1);
    std::vector<int> b(m+1);
    std::cin >> a[0]>>b[0];
    rep(i,n)std::cin >> a[i+1];
    rep(i,m)std::cin >> b[i+1];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    if(a[n]<b[0])std::cout <<"No War"<< std::endl;
    else std::cout << "War" << std::endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
int main(){
	int n;	
	cin>>n;
	cout<<n*(n+1)/2;
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 1e5+23;
pair<int, int> a[N];

void solve() {
  int n; scanf("%d", &n);
  for (int x, i = 0; i < n; ++i) {
    scanf("%d", &x);
    a[i] = {x, i};
  }
  sort(a, a+n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i].second%2 != i%2) ++ans;
  }
  printf("%d", ans/2);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 4584
# ABC165b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと
    import math

    def dump(*args):
        sys.stderr.write(str(args))

    x = int(input())
    now = 100

    for i in range(4000):
        if now >= x:
            print(i)
            exit(0)
        now = math.floor(now*1.01)


if __name__ == '__main__':
    main()


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

using namespace std;

struct Edge {
    int src, dst, rev;
    bool in;
    Edge(int s, int d, bool in, int rev = 0) :
        src(s), dst(d), rev(rev), in(in) {}
};

class GiftExchangeParty {
public:
    GiftExchangeParty(int n, int m) : n(n), m(m), g(n), deg(n) {}

    // src から dst へ向き付けを行う
    void add_edge(const int src, const int dst, const bool in) {
        g[src].emplace_back(Edge(src, dst, in, g[dst].size()));
        g[dst].emplace_back(Edge(dst, src, !in, g[src].size() - 1));
        ++deg[dst];
    }

    pair<int, int> MinimumDiff() {
        vector<bool> visited(n, false);

        while (true) {
            int min_idx = distance(deg.begin(), min_element(deg.begin(), deg.end()));
            int max_idx = distance(deg.begin(), max_element(deg.begin(), deg.end()));

            fill(visited.begin(), visited.end(), false);
            if (Dfs(min_idx, deg[min_idx] + 2, -1, true, visited)) continue;

            min_idx = distance(deg.begin(), min_element(deg.begin(), deg.end()));
            max_idx = distance(deg.begin(), max_element(deg.begin(), deg.end()));

            fill(visited.begin(), visited.end(), false);
            if (!Dfs(max_idx, -1, deg[max_idx] - 2, false, visited)) break;
        }

        return {*min_element(deg.begin(), deg.end()), *max_element(deg.begin(), deg.end())};
    }

private:
    int n, m;
    vector<vector<Edge>> g;
    vector<int> deg; // 入次数

    bool Dfs(const int cur, const int lb, const int ub, bool dir, vector<bool> &visited) {
        if (visited[cur]) return false;
        if ((!dir && deg[cur] <= ub) || (dir && lb <= deg[cur])) return true;

        visited[cur] = true;
        for (auto &e : g[cur]) {
            if (e.in == dir && Dfs(e.dst, lb, ub, dir, visited)) {
                if (dir) { // min
                    ++deg[e.src]; --deg[e.dst];
                    e.in = false; g[e.dst][e.rev].in = true;
                }
                else { // max
                    --deg[e.src]; ++deg[e.dst];
                    e.in = true; g[e.dst][e.rev].in = false;
                }
                return true;
            }
        }

        return false;
    }
};


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

    int n, m, u, v;

    while (cin >> n >> m, n) {
        GiftExchangeParty prob(n, m);

        for (int i = 0; i < m; ++i) {
            cin >> u >> v;
            prob.add_edge(u - 1, v - 1, true);
        }

        auto ans = prob.MinimumDiff();
        cout << ans.first << ' ' << ans.second << '\n';
    }

    return 0;
}



Measured memory_bytes: 3252
#include<bits/stdc++.h>
main(){for(char s[50],i,j,p,q;p=atoi(gets(s)),p;printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}

Measured memory_bytes: 1128
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, k, q = LI()
L = IR(q)
point = [k] * n
limit = q
for i in L:
    point[i-1] += 1


for j in point:
    if j <= limit:
        print('No')
    else:
        print('Yes')

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	int X;
	cin >> X;
	if (X==3 || X==5 | X==7){
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 764
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	cin >> N;
	s = char('a' - 1) + s + char('a' - 1);
	vector<int>v;
	for (int i = 1; i < s.size(); i++) {
		v.push_back((s[i] - s[i - 1] + 26) % 26);
	}
	UnionFind uf(v.size());

	for (int i = 0; i < v.size(); i++) {
		uf.Unite(i, v.size() - 1 - i);
	}
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		uf.Unite(L - 1, R);
	}
	vector<int>box(v.size());
	for (int i = 0; i < v.size(); i++) {
		box[uf.Find(i)] += v[i];
	}
	for (auto i : box) {
		if (i % 26) {
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	return 0;
}

Measured memory_bytes: 2024
from collections import defaultdict
A,B = map(int,input().split())

def count(n,k):
    n = bin(n)[2:]
    n = '0'+n
    res = 0
    if n[-k-1]=='1':
        if k==0:
            res += 1
        else:
            res += (int(n[-1])+1)%2
    if k == 0:
        res = (res+int(n[-2]))%2
    return res

def f(n):
    if n < 0:
        n = 0
    d = defaultdict(lambda:0)
    for k in range(len(bin(n)[2:])):
        d[k] = count(n,k)
    return d

d_a = f(A-1)
d_b = f(B)
ans = ''
for i in range(40):
    ans = str((d_a[i]+d_b[i])%2) + ans
ans = int(ans,2)
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000000000007;
const int MOD=1000000007;
int n,m,x;
int c[30];
int a[40][100005];
int solve(vector<bool> const& status){
  int res=0;
  vector<int> sum(m,0);
  rep(i,n){
    if(status[i]){
      res+=c[i];
      rep(j,m){
        sum[j]+=a[i][j];
      }
    }
  }
  rep(i,m){
    if(sum[i]<x)res=inf;
  }
  return res;
}
int rec(vector<bool> status,int cur){
  if(cur==n){
    return solve(status);
  }
  int res=rec(status,cur+1);
  status[cur]=false;
  res=min(rec(status,cur+1),res);
  return res;
}
signed main(){
  cin>>n>>m>>x;
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  }
  vector<bool> status(n,true);
  int res=rec(status,0);
  if(res==inf){
    res=-1;
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3684
#include <algorithm>
#include <math.h>
#include <map>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void A_Serval_vs_Monster(void) {

	int H, A;
	cin >> H >> A;

	cout << ((H % A == 0) ? H / A : int(H / A) + 1);
	return;
}

void B_Common_Raccoon_vs_Monster(void) {

	int H, N;
	cin >> H >> N;

	int sum = 0;
	int A;
	for (int loop = 0; loop < N; loop++) {
		cin >> A;
		sum += A;
	}

	cout << ((sum >= H) ? "Yes" : "No") << flush;
	return;
}

int main(void) {

	//A_Serval_vs_Monster();
	B_Common_Raccoon_vs_Monster();
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
void solve(int m);       //データの処理
void clear(void);            //segment[0]の初期化

int n,m;                 //数字の個数,数字
int segment[11][7]=      //各セグメントに対応するbitの状態
  /*{g,f,e,d,c,b,a}*/
  {
    {0,0,0,0,0,0,0},     //変化させる配列
    {0,1,1,1,1,1,1},     //0
    {0,0,0,0,1,1,0},     //1
    {1,0,1,1,0,1,1},     //2
    {1,0,0,1,1,1,1},     //3
    {1,1,0,0,1,1,0},     //4
    {1,1,0,1,1,0,1},     //5
    {1,1,1,1,1,0,1},     //6
    {0,1,0,0,1,1,1},     //7
    {1,1,1,1,1,1,1},     //8
    {1,1,0,1,1,1,1}      //9
  };		    

int main(){

  int i,j;

  while(1){

  /*数字の個数nの入力*/
  scanf("%d",&n);

  if(n==-1)break;

  /*n個の数字を入力*/
  for(i=0;i<n;i++){
    scanf("%d",&m);

    /*データの処理*/
    solve(m);

  }

  /*segment[0]を0で初期化*/
  clear();
  
  }

  return 0;
}
/*データ処理*/
void solve(int m){

  int i,j;

  /*segment[m+1]からsegment[0]を引いたときそのbitが0以外なら1にする*/
  for(i=0;i<7;i++){
    segment[0][i]=segment[m+1][i]-segment[0][i];
    if(segment[0][i]==-1){
      segment[0][i]=1;
    }
  }

  /*結果の出力*/
  for(i=0;i<7;i++){
    printf("%d",segment[0][i]);
  }

  printf("\n");

  /*segment[0]をsegment[m+1]に初期化する*/
  for(i=0;i<7;i++){
    segment[0][i]=segment[m+1][i];
  }

}
/*segment[0]を0で初期化*/
void clear(){

  int i;

  for(i=0;i<7;i++){
    segment[0][i]=0;
  }

}

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

int main() {
	int N;
	cin >> N;
	vector<vector<int>> edge(N);
	for(int i=0;i<N-1;i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	// 0からN-1までの最短距離を求める
	// 0とN-1の真ん中
	vector<int> before(N, 0);
	queue<pair<int,int>> q;
	q.push({-1, 0});
	while(!q.empty()) {
		auto tmp = q.front(); q.pop();
		int bef = tmp.first;
		int now = tmp.second;
		if(bef != -1) {
			before[now] = bef;
		}
		for(int i=0;i<edge[now].size();i++) {
			int next = edge[now][i];
			if(next == bef) continue;
			q.push({now, next});
		}
	}
	vector<int> route;
	int now = N - 1;
	route.push_back(now);
	while(now != 0) {
		int bef = before[now];
		route.push_back(bef);
		now = bef;
	}
	reverse(route.begin(), route.end());
	int fcnt = 0;
	int forbidden = route[(route.size()+1)/2];

	queue<pair<int,int>> qq;
	qq.push({-1,0});
	while(!qq.empty()) {
		auto tmp = qq.front(); qq.pop();
		int bef = tmp.first;
		int now = tmp.second;
		fcnt++;
		for(int i=0;i<edge[now].size();i++) {
			int next = edge[now][i];
			if(bef == next or next == forbidden) continue;
			qq.push({now,next});
		}
	}
	int scnt = N - fcnt;
	// cout << fcnt << endl;
	cout << ((fcnt>scnt) ? "Fennec" : "Snuke") << endl;
}

Measured memory_bytes: 6780
import java.util.Scanner;

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

        if (a.length() == b.length()) {
            for (int i = 0; i < a.length(); i++) {
                if (a.charAt(i) != b.charAt(i)) {
                    System.out.println(a.charAt(i) > b.charAt(i) ? "GREATER" : "LESS");
                    return;
                }
            }
            System.out.println("EQUAL");
        } else {
            System.out.println(a.length() > b.length() ? "GREATER" : "LESS");
        }
    }
}


Measured memory_bytes: 23252
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

ll n, k;

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

    ll res = 0;
    REP2(i, k+1, n+1) {
        res += n/i*(i-k) + max(n%i-k+1, 0LL);
        if (k == 0) res--;
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using  namespace std; 
int  main() { 
  int a,b,c,d,x,y;
  cin>>a>>b>>c>>d;
x=(a+d-1)/d;
y=(b+c-1)/b;

 if(x<y) cout<<"No"<<endl;
  else cout<<"Yes"<<endl; 
  return 0;
  
  }


Measured memory_bytes: 3632
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        double x1 = scan.nextDouble();
        double y1 = scan.nextDouble();
        double x2 = scan.nextDouble();
        double y2 = scan.nextDouble();
        
        double x_len = Math.abs(x1 - x2);
        double y_len = Math.abs(y1 - y2);
        double out = Math.sqrt((x_len * x_len) + (y_len * y_len));
        System.out.println(out);
    }
}



Measured memory_bytes: 27984
#include <bits/stdc++.h>
#define M ((ll)1e9+7)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi acos(-1)
typedef long long ll;
using namespace std;


void solve()
{
   ll v=1;int n;cin>>n;
   ll h[100001]={0};
   ll ar[n];
   for(int i=0;i<n;i++)
   cin>>ar[i];
   for(int i=0;i<n;i++)
   {
       if(ar[i]==0){v=(v*(3-h[0]))%M;
       h[0]++;}
       else
       {
           v=(v*(h[ar[i]-1]-h[ar[i]]))%M;
           h[ar[i]]++;
       }
   }
   cout<<v<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

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

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

string keyence = "keyence";

int main() {
    string s;
    cin >> s;

    bool ok = false;
    for(int i=0;i<s.length();++i) {
        string t = s.substr(0, i+1) + (i<7?s.substr(i+s.length()-6):"");
        if(t == keyence) {
            ok = true;
            break;
        }
    }
    cout << (ok?"YES":"NO") << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[233],cnt;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)
	    for(int j=i+1;j<=n;j++)
	        for(int k=j+1;k<=n;k++){
	        	int x=a[i],y=a[j],z=a[k];
	        	if(x!=y&&y!=z&&x!=z&&x+y>z&&x+z>y&&y+z>x)
	        	    cnt++;
	        }
	cout<<cnt<<endl;
}

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

int main()
{
  int K,N,i,max=0,sa;

  cin >> K >> N;

  vector<int> a(N);
  for(i=0;i<N;i++){
   cin >> a[i];
  }
  for(i=0;i<N-1;i++){
    sa = a[i+1] - a[i];
    if(sa > max) max = sa;
  }
  sa = a[0] + K - a[N-1];
  if(sa > max) max = sa;
  cout << K-max << endl;

  return 0;

}


Measured memory_bytes: 1024
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

const int MAX = 210000;

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

	int N;
	cin >> N;
	map<int, int> A, B;
	int a;
	rep(i, 0, N)
	{
		cin >> a;
		if (i % 2 == 0)
		{
			A[a]++;
		}
		else
		{
			B[a]++;
		}
	}
	A[-1] = 0;
	B[-1] = 0;

	pair<int, int> maxc[2][2];
	rep(i, 0, 2)rep(j, 0, 2)
	{
		maxc[i][j].first = -1;
		maxc[i][j].second = INF;
	}
	for (auto& p : A)
	{
		p.second = N / 2 - p.second;
		if (p.second < maxc[0][1].second)
		{
			maxc[0][1] = p;
			if (maxc[0][1].second < maxc[0][0].second)
			{
				swap(maxc[0][1], maxc[0][0]);
			}
		}
	}

	for (auto& p : B)
	{
		p.second = N / 2 - p.second;
		if (p.second < maxc[1][1].second)
		{
			maxc[1][1] = p;
			if (maxc[1][1].second < maxc[1][0].second)
			{
				swap(maxc[1][1], maxc[1][0]);
			}
		}
	}

	int ans = INF;
	if (maxc[0][0].first != maxc[1][0].first)
	{
		chmin(ans, maxc[0][0].second + maxc[1][0].second);
	}
	else
	{
		if (maxc[0][1].first != maxc[1][0].first)
		{
			chmin(ans, maxc[0][1].second + maxc[1][0].second);
		}
		if (maxc[0][0].first != maxc[1][1].first)
		{
			chmin(ans, maxc[0][0].second + maxc[1][1].second);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6528
/*lost it in the lonely highway*/
#include <bits/stdc++.h>
#define PI acos(-1)
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cerr<<#x<<" = "<<x<<endl;
#define pb push_back
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define bump cout<<"bleh\n"
#define all(v) (v).begin(),(v).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define file freopen("input.txt", "r", stdin)
#define reset(x,n) memset(x,n,sizeof(x))

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
*/

/*
find_by_order(k): It returns to an iterator to the kth element (counting from zero)
order_of_key(k) : It returns to the number of items that are strictly smaller than our item k
*/

using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e8+7;
const int nmax=1e5+10;
const int eps=1e-8;
const ll infll=1e15;


int main()
{
    fastio;
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    
    cout<<x<<" "<<y<<" "<<z<<"\n";



    return 0;
}

/*

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

    string S;
    cin >> S;

    int love = 753;
    int ans = INF;
    REP(i, S.size() - 2) {
        int tmp = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
        ans = min(ans, abs(love - tmp));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,t;
	cin >> n >> t;
	vector<ll> a(n);
	FOR(i,0,n)cin >> a[i];
	ll maxa[n],mina[n];
	maxa[n-1]=a[n-1];
	mina[0]=a[0];
	FORR(i,0,n-1)maxa[i] = max(a[i],maxa[i+1]);
	FOR(i,1,n)mina[i]=min(a[i],mina[i-1]);
	ll maxsa=-INF;
	FOR(i,0,n){
		maxsa = max(maxa[i]-mina[i],maxsa);
	}
	ll ans = 0;
	set<P> se;
	FOR(i,0,n){
		if(maxsa==(maxa[i]-mina[i])){
			if(!se.count({maxa[i],mina[i]})){
				ans++;
				se.insert({maxa[i],mina[i]});
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <vector>
using namespace std;

int main() {
        long long x, y;
        scanf("%lld%lld", &x, &y);
        int cnt = 0;
        while (x <= y) {
                x *= 2;
                cnt ++;
        }
        printf("%d\n", cnt);
        return 0;
}



Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>

using namespace std;
typedef long long ll;

int main()
{
	int X, Y, Z;
	scanf("%d %d %d", &X, &Y, &Z);
	printf("%d %d %d\n", Z, X, Y);
	return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        N: u32,
        d: [u32; N],
    }
    let mut d = d;
    d.sort();
    d.dedup();

    println!("{}", d.len());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<i64> a(n), b(n);
    for (int i = 0; i < n; i++) std::cin >> a[i] >> b[i];
    i64 ret = 0;
    for (int i = n - 1; i >= 0; i--) {
        ret += (b[i] - (a[i] + ret) % b[i]) % b[i];
    }
    std::cout << ret << std::endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include"bits/stdc++.h"
using namespace std;

int hash1(vector<string>& lib, int key)
{
	return (key % lib.size());
}

int hash2(vector<string>& lib, int key)
{
	return (1 + (key % (lib.size() - 1)));
}

int getKey(string str)
{
	int key = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (str.at(i) == 'A') key += i*i*i*1;
		else if (str.at(i) == 'C') key += i*i*i*13;
		else if (str.at(i) == 'G') key += i*i*i*157;
		else key += i*i*i*1885;
	}
	return key;
}

int insert(vector<string>& lib, string str)
{
	int key = getKey(str);
	int i = 0;
	while(1){
		int H = ((hash1(lib, key) + (i * hash2(lib , key))) % lib.size());
		if (lib.at(H) == "\0")
		{
			lib.at(H) = str;
			return 1;
		}
		i++;
	}
}

int find(vector<string>& lib, string str)
{
	int key = getKey(str);
	int i = 0;
	while (1) {
		int H = ((hash1(lib, key) + (i * hash2(lib , key))) % lib.size());
		if (lib.at(H) == str)
		{
			return 1;
		}
		else if (lib.at(H) == "\0") {
			return 0;
		}
		i++;
	}
}


int main(void) {

	int N;
	cin >> N;

	vector<string> lib(2000000, "\0");
	char str[14], pro[6];
	for(int i = 0; i < N; i++)
	{
		scanf("%s %s", pro, str);
		if (pro[0] == 'i')
		{
			insert(lib, str);
		}
		else {
			if (find(lib, str)) printf("yes\n");
			else printf("no\n");
		}
	}


	return 0;
}


Measured memory_bytes: 45508