akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <queue>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#define ll long long
using namespace std;
const int maxn=1e5+111;
int a[2000];
int main(){
    ll n,k;
	scanf("%lld%lld",&n,&k);
	n=n%k;
	printf("%lld\n",min(n,k-n));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

template<typename D> class BinarySearch {
    D left;
    D right;
    function<bool(D)> func;

    public:
        BinarySearch(D l, D r, function<bool(D)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc() {
            while (abs(right - left) > 1) {
                D m = (left + right) / 2;
                if (func(m)) {
                    right = m;
                } else {
                    left = m;
                }
            }
            return right;
        }
};

void solve() {
    int n, k;
    cin >> n >> k;
    vi w(n);
    REP(i, n) cin >> w[i];

    function<bool(int)> f = [&](int m) {
        int num = 0;
        int tmp = 0;
        REP(i, n) {
            if (tmp + w[i] > m) {
                if (tmp == 0) return false;
                if (w[i] > m) return false;
                tmp = w[i];
                num++;
            } else {
                tmp += w[i];
            }
        }
        num++;
        return num <= k; 
    };

    BinarySearch<int> bs(-1, INF, f);
    cout << bs.calc() << endl;

}



Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool opred[200000];
vector <int> mas[200000];
vector <int> rebr[200000];
int j=0;
vector <int> BFS(int g){
	int j1=0,j2=1;
	int h[800000];
	h[0]=g;
	while(j1!=j2){
		if(opred[h[j1]]==0){
			opred[h[j1]]=1;
			mas[j].push_back(h[j1]);
			vector <int> x = rebr[h[j1]];
			for(int i=0;i<x.size();i++){
				h[j2]=x[i];
				j2++;	
			}
		}
		j1++;	
	}
	/*for(int i=0;i<j2;i++){
		cout<<h[i]<<" ";
	}
	cout<<endl;
	vector <int> x = mas[j];
	for(int k=0;k<x.size();k++){
		cout<<x[k]<<"lol";
	}
	cout<<endl;w*/
	j++;
	return mas[j-1];
}
int main() {
	ios_base::sync_with_stdio(false);
	vector <int> masive[200000];
	int n;
	int m;
	cin>>n>>m;
	ll a[200000];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<m;i++){
		int x, y;
		cin>>x>>y;
		rebr[x].push_back (y);
		rebr[y].push_back (x);
	}
	/*for(int i=0;i<n;i++){
		vector <int> x=rebr[i];
		for(int k=0;k<x.size();k++){
		      cout<<x[j]<<" ";
		}
		cout<<endl;
	}*/
	int tim=0;
	for(int i=0;i<n;i++){
		if(opred[i]==0){
			masive[tim]=BFS(i);
			tim++;
		}
	}
	if(j==1){
		cout<<"0";
		return 0;
	}
	if(2*j-2>n){
		cout<<"Impossible";
		return 0;
	}
	vector <int> x;
	vector <ll> answer[200000];
	for(int i=0;i<j;i++){
		x=masive[i];
		for(int k=0;k<x.size();k++){
			answer[i].push_back(a[x[k]]);	
		}
	}
	ll ans=0;
	for(int i=0;i<j;i++){
		sort(answer[i].begin(),answer[i].end());
	}
	ll af[200000];
	int h=0;
	for(int i=0;i<j;i++){
		vector <ll> y=answer[i];
		ans+=y[0];
		for(int k=1;k<y.size();k++){
			af[h]=y[k];
			h++;
		}
	}
	sort(af,af+h);
	for(int i=0;i<j-2;i++){
		ans+=af[i];
	}
	cout<<ans;
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  int a = 0, b = 0, c = 0;
  for(auto now : s){
    if(now == 'a') a++;
    else if(now == 'b') b++;
    else c++;
  }
  
  bool ok = 1;
  if(abs(a - b) > 1) ok = 0;
  if(abs(b - c) > 1) ok = 0;
  if(abs(c - a) > 1) ok = 0;
  
  if(ok ) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin>>s;
    cout<<(s=="ABC"?"ARC":"ABC")<<endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long a = in.nextLong(), b = in.nextLong();
        long[] h = new long[n];
        for(int i = 0; i < n;i ++) {
            h[i] = in.nextLong();
        }
        long left = 0L, right = (long)1e9;
        while (left < right) {
            // System.out.println(left + " " + right);
            long c = (left + right) / 2;
            if(isBeatUp(h, a, b, c)){
                right = c;
            } else {
                left = c + 1;
            }
        }
        System.out.println(right);
    }

    public static boolean isBeatUp(long[] health, long a, long b, long c) {
        long cnt = 0;
        for(long h : health) {
            long t = (long)Math.ceil((h - b*c) / (double)(a - b));
            cnt += Math.max(t, 0);
        }
        return cnt <= c;
    }
}

Measured memory_bytes: 50924
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int main(int argc, char const *argv[])
{
    int N, L;
    std::cin >> N >> L;

    std::vector<std::string> v(N);
    for (int i = 0; i < N; i++) {
        std::cin >> v[i];
    }
    std::sort(v.begin(), v.end());
    for (int i = 0; i < N; i++) {
        std::cout << v[i];
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int foo[3005];
 
int main() {
  string s;
  cin>>s;
  foo[0]=1;
  long long tmp=0;
  long long ten=1;
  long long ans=0;
  for(int i=s.size()-1;i>=0;i--) {
    tmp=(tmp+(s[i]-'0')*ten)%2019;
    ans+=foo[tmp]++;
    ten=(ten*10)%2019;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3700
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        _n: usize,
        s: String,
        k: usize,
    );
    let cc : char = s.chars().nth(k-1).unwrap();
    for c in  s.chars(){
        if c == cc {
            print!("{}", c);
        } else {
            print!("*");
        }
    }
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  } else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll 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;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int k, x;
	cin >> k >> x;
	if (k * 500 >= x)cout << "Yes" << endl;
	else cout << "No" << endl;
}
int main() {
	solve();
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  if (A == B) {
    cout << C << endl;
  } else if (A == C) {
    cout << B << endl;
  } else {
    cout << A << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <numeric>

using namespace std;

int main() {

    string S, T;
    int counter = 0;

    cin >> S;
    cin >> T;

    for (int i = 0; i < S.length(); ++i) {
        if (S[i] == T[i]) {
            counter += 1;
        }
    }

    cout << counter << endl;

    return 0;
}

Measured memory_bytes: 256
//  main.cpp
//  CppTest

#include <stdio.h>
#include <string>
#include <string.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    long long int N,A;
    long long int max=0,sum=0;
    cin >> N;
    for(int j = 0;j<N;j++){
        cin >> A;
        if(max < A){
            max = A;
        }
        else{
            sum = sum + (max - A);
        }
    }
    cout << sum << endl;
    /////////////////////


    return 0;
}


Measured memory_bytes: 3616
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLower solver = new CLower();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLower {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int n = sc.nextInt();
            int[] tab = new int[n];
            for (int i = 0; i < n; i++) {
                tab[i] = sc.nextInt();
            }
            int ans = 0;
            for (int i = 0; i < n - 1; i++) {
                int start = i;
                int end = i + 1;
                while (end < n && tab[end] <= tab[end - 1]) end++;
                end--;
                ans = Math.max(ans, end - start);
                i = end;
            }
            out.println(ans);
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 39532
N=int(input())
import itertools

l=[i for i in range(1,N+1)]
li=[]
for v in itertools.permutations(l,N):
    li.append(list(v))
a=li.index(list(map(int,input().split())))
b=li.index(list(map(int,input().split())))

print(abs(b-a))


Measured memory_bytes: 14468
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double a[11];
  while(cin >>a[1]){
    double ans = 0;
    for(int i=2; i<11; i++){
      if(i%2 == 0) a[i] = a[i-1]*2;
      else a[i] = a[i-1]/3;
    }
    for(int i=1; i<11; i++) ans+=a[i];
    printf("%.8lf\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
int main(void){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(W-x>=r && x>=r && H-y>=r && y>=r){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);

int n, d;
ll a;
pair<int, ll> p[200002];
ll pref[200002];

int main () {

	cin >> n >> d >> a;
	for (int i = 0; i < n; i++) {
		cin >> p[i].X >> p[i].Y;
	}
	
	sort(p, p + n);
	ll tren = 0;
	ll sol = 0;
	for (int i = 0; i < n; i++) {
		tren += pref[i];
		ll dmg = p[i].Y-tren;
		
		//cout << tren << ", " <<dmg << endl;
	
		if (dmg > 0) {
			ll k = dmg;
			k /= a;
			if (dmg % a != 0) k++;
			sol += k;
			
			//cout << p[i].X << ": " << k << endl;
			
			tren += k*a;
			int lo = i+1, hi = n-1;
			ll gdje = 2*d;
			gdje += p[i].X;
			while (lo < hi) {
				int mid = (lo+hi)/2;
				if ((ll)p[mid].X <= gdje) lo = mid+1;
				else hi = mid;
			}
			
			if (p[lo].X <= p[i].X+2*d) lo ++;
			pref[lo] -= k*a;
			//cout << p[lo].X << " " << p[i].X+2*d << endl;
			//cout << lo << "-=" << k*a << endl;
		}
	}
	
	cout << sol;

	return 0;
}

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

#define ll long long
using namespace std;

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	vector<ll> arr1(n),  arr2(m);
	for (int i=0; i<n; i++) cin >> arr1[i];
	for (int i=0; i<m; i++) cin >> arr2[i];
	vector<ll> pre1(n+1), pre2(m+1);
	for (int i=0; i<n; i++) pre1[i+1] = pre1[i]+arr1[i];
	for (int i=0; i<m; i++) pre2[i+1] = pre2[i]+arr2[i];
	int mx = 0;
	for (int i=0; i<= n; i++) {
		if (pre1[i] > k) break;
		int t = k - pre1[i];
		if (t >= pre2[m]) mx = max(mx, i+m);
		else {
			int l=0, r=m;
			while (l<r) {
				int m = (l+r)/2;
				if (pre2[m] <= t) {
					l = m+1;
				}
				else {
					r = m;
				}
			}
			mx = max(mx, i+l-1);
		}
	}
	cout << mx;
}


Measured memory_bytes: 9600
import sys
import socket
import random

if socket.gethostname() in ['N551J', 'F551C']:
    sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
letter = ['L', 'R', 'D', 'U']


def check():
    M = 10 ** 2
    n = 1
    x = [random.randint(-M, M) for i in range(n)]
    y = [random.randint(-M, M) for i in range(n)]
    m, d, w = solve(n, x, y)

    return True


def solve(n, x, y):

    if len(set([(x[i] + y[i]) % 2 for i in range(n)])) == 2:
        return -1
    d = [2 ** k for k in range(35, -1, -1)]
    parity = (x[0] + y[0]) % 2
    if parity == 0:
        d.append(1)
    m = len(d)
    w = []
    for i in range(n):
        u, v = 0, 0
        s = []
        for j in range(m):
            choices = []
            for k in range(4):
                distance = abs(u + d[j] * dx[k] - x[i]) + abs(v + d[j] * dy[k] - y[i])
                choice = (distance, k)
                choices.append(choice)
            choices.sort()
            smallest_distance, best_k = choices[0]
            u += d[j] * dx[best_k]
            v += d[j] * dy[best_k]
            s.append(letter[best_k])
        w.append(''.join(s))
    return m, d, w


def main():

    random.seed = 1
    n = read_int()
    x = [0] * n
    y = [0] * n
    for i in range(n):
        x[i], y[i] = read_int_list()
    res = solve(n, x, y)
    if res == -1:
        print(res)
        return
    m, d, w = res
    print(m)
    print(*d)
    print('\n'.join(w))


if __name__ == '__main__':
    # check()
    main()


Measured memory_bytes: 5476
#!python3

# input
N, C = list(map(int, input().split()))
X, V = [0] * (N + 1), [None] * N
for i in range(N):
    X[i + 1], V[i] = list(map(int, input().split()))


def main():
    Vsum = [0] * (N + 1)
    for i in range(N):
        Vsum[i + 1] = Vsum[i] + V[i]
    
    A, B = [0] * (N + 1), [0] * (N + 1)
    for i in range(1, N + 1):
        A[i] = max(A[i - 1], Vsum[i] - X[i])
        B[i] = max(B[i - 1], Vsum[-1] - Vsum[-1 - i] - (C - X[-i]))
    
    ans = 0
    for i in range(1, N):
        ans = max(ans, A[i] + B[N - i] - X[i])
    for i in range(1, N):
        ans = max(ans, B[i] + A[N - i] - (C - X[-i]))
    ans = max(ans, A[N])
    ans = max(ans, B[N])

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 23568
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
    const int p = 10;
   const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
    const int p = 179;
   const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")`

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int r;
    cin >> r;
    cout << fixed << setprecision(10) << PI * (ld)r * 2.0;
}
/*

*/


Measured memory_bytes: 3800
#include <stdio.h>
#include <string.h>
int compa(const void *a,const void *b)
{
 return *(int*)a-*(int*)b;
}

int compb(const void *a,const void *b)
{
 return strcmp(a,b);
}

int main(void)
{
 char  tango[200001][11];
 int a[200001];
 int N,i;
 int max=0;
 scanf("%d",&N);
 int start=0;
 int end =0;

 for(i=0;i<N;i++)
  {
    scanf("%s ",tango[i]);
    a[i] = 0;
  }

 qsort(tango,N,11,compb);
/*
 for(i=0;i<N;i++)
   {
   printf("%s\n",tango[i]);
   }
*/
//printf("debug11 %d\n",N);
// printf("debug22 %d %d\n",start,end);
while(end<=N)
   {
    end= start+1;
//   printf("debug33 %d %d\n",start,end);
    L_Break:
    if(strcmp(tango[start],tango[end]) == 0) 
      {
      end ++;
      goto L_Break;
      }
    else
      {
      a[end-1] = end-start;
  //    printf("NG  %s %s %d\n",tango[start],tango[end],end-start);

    }
      start = end;  


   }

 for(i=0;i<N;i++)
  {
//   printf("%d ",a[i]);
   if(max <= a[i]) max = a[i];
//   if (a[i] == max) printf("%s\n",tango[i]);
  }

   for(i=0;i<N;i++)
  {
   if (a[i] == max) printf("%s\n",tango[i]);
  }


 return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 29;

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep (i, n) cin >> s[i];
    sort(all(s));
    string ans = "";
    rep (i, n) ans += s[i];
    cout << ans << endl;
}


Measured memory_bytes: 256
use std::fmt::{Debug, Display};
use std::io::{self, Read};
use std::str::{self, FromStr};


fn solve(n: u32, m: u32) -> u32 {
    (n - 1) * (m - 1)
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next(), sc.next()));
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(256),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: Debug,
    {
        self.buf.clear();
        for c in self.bytes
            .by_ref()
            .map(|c| c.unwrap())
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
        {
            self.buf.push(c);
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
        <C as FromStr>::Err: Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


#[allow(dead_code)]
fn print_foreach<T: Display>(answer: &[T]) {
    for x in answer {
        println!("{}", x);
    }
}


#[allow(dead_code)]
fn print_yn(answer: bool, yes: &str, no: &str) {
    println!("{}", if answer { yes } else { no });
}


#[allow(dead_code)]
fn print_or<T: Display>(answer: &Option<T>, or: &T) {
    match *answer {
        Some(ref x) => println!("{}", x),
        None => println!("{}", or),
    }
}


Measured memory_bytes: 4352
<?php
$bunsetus = trim(fgets(STDIN));
$bunsetu = explode(" ", $bunsetus);
if($bunsetu[0]==$bunsetu[1]+$bunsetu[2]){
  echo "Yes";
}elseif($bunsetu[1]==$bunsetu[0]+$bunsetu[2]){
  echo "Yes";
}elseif($bunsetu[2]==$bunsetu[0]+$bunsetu[1]){
  echo "Yes";
}else{
  echo "No";
}
?>

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
ll quick(ll a,ll b)
{
	ll ret=1;
	while(b)
	{
		if(b&1)
			ret=ret*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ret;
}
ll inv(ll a){return quick(a,mod-2);}
const int maxn=407;
ll pre[maxn][maxn];
int a[maxn],b[maxn];
ll dp[maxn][maxn];
int main()
{
	for(int j=1;j<=400;j++)
	{
		ll cur=1;
		for(int i=0;i<=400;i++)
		{
			pre[i][j]=(pre[i][j-1]+cur)%mod;
			cur=cur*j%mod;
		}
	}
	int n,c;
	scanf("%d%d",&n,&c);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) scanf("%d",&b[i]);
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=c;j++)
			for(int k=0;k<=j;k++)
				dp[i][j]=(dp[i][j]+dp[i-1][k]*(pre[j-k][b[i]]-pre[j-k][a[i]-1]+mod)%mod)%mod;
	printf("%lld\n",dp[n][c]);
}


Measured memory_bytes: 2816
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string S;
	std::cin >> S;

	if (S <= std::string("2019/04/30")) {
		std::cout << "Heisei\n";
	} else {
		std::cout << "TBD\n";
	}
}


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

using namespace std;

int main(void) {
	int n, k;
	int x[51], y[51];
	long long int result = 5e18;
	long long int xf, xs, yf, ys;
	int count = 0;

	cin >> n >> k;
	
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
	}

	for (int x1 = 1; x1 <= n; x1++) {
		for (int x2 = x1 + 1; x2 <= n; x2++) {
			for (int y1 = 1; y1 <= n; y1++) {
				for (int y2 = y1 + 1; y2 <= n; y2++) {
					xf = x[x1];
					xs = x[x2];
					yf = y[y1];
					ys = y[y2];
					count = 0;

					for (int i = 1; i <= n; i++) {
						if (min(xf, xs) <= x[i] && max(xf, xs) >= x[i] && min(yf, ys) <= y[i] && max(yf, ys) >= y[i]) {
							count++;
						}
					}

					if (count >= k) {
						if (abs(xf - xs)*abs(yf - ys) < result) {
							result = abs(xf - xs)*abs(yf - ys);
						}
					}
				}
			}
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            // 入力
            var s = cin.ReadLine.ToCharArray();
            var cDic = new Dictionary<char,int>();
            int count = 0;
            foreach (var c in s)
            {
                if (cDic.ContainsKey(c))
                {
                    count = cDic[c] + 1;
                    cDic[c] = count;
                }
                else
                {
                    count = 1;
                    cDic.Add(c, count);
                }
            }

            string result = "Yes";
            if (cDic.Count == 2)
            {
                foreach (var i in cDic)
                {
                    if (i.Value != 2)
                    {
                        result = "No";
                    }
                }
            }
            else
            {
                result = "No";
            }

            WriteLine(result);
        }  
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

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

int main() {
    
    // 1. input.
    int N;
    cin >> N;
    
    // 2. output answer.
    for(int i = 0; i < N; i++){
        int a, b, c;
        cin >> a >> b >> c;
        bool isRight = false;
        if(a * a + b * b == c * c) isRight = true;
        if(b * b + c * c == a * a) isRight = true;
        if(c * c + a * a == b * b) isRight = true;
        if(isRight) cout << "YES" << endl;
        else        cout << "NO"  << endl;
    }
    
    return 0;
    
}


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

void call_v2(long long n){
    for(int i=1;i<=n;i++){
        if(i%3==0)cout << " "<< i;
        else{
            int n=i;
            while(n != 0){
                if(n%10==3){cout << " "<<i;break;}
                n/=10;
            }
        }
        
    }
    cout << endl;
}

int main(){
    long long n;
    cin >> n;
    call_v2(n);

return 0;
}


Measured memory_bytes: 3084
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){

    int N;
    cin >> N;
    ll ans = (ll)N*(N-1) / 2;
    cout << ans << endl;
    return 0;
}

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

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define REV(i, a) for (int i = (a); i >= 0; --i)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int A, B, C, K;

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

    cin >> A >> B >> C >> K;
    int ans = K % 2 == 1 ? B - A : A - B;
    if (abs(ans) > 1000000000000000000) {
        cout << "Unfair" << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <map>
#include <iostream>

using namespace std;

int main() {
    unsigned long long N;
    cin >> N;

    map<unsigned long long, pair<unsigned long long, bool>> btn;
    for (int i = 1; i <= N; i++) {
        unsigned long long ai;
        cin >> ai;
        btn.emplace(i, make_pair(ai, false));
    }

    int switch_count = 0;
    unsigned long long idx = 1;
    while (idx != 2) {
        auto next_idx_visited_pair_itr = btn.find(idx);
        if (next_idx_visited_pair_itr == btn.end() ||
            idx == next_idx_visited_pair_itr->second.first || next_idx_visited_pair_itr->second.second) {
            cout << -1 << endl;
            return 0;
        }
        idx = next_idx_visited_pair_itr->second.first;
        next_idx_visited_pair_itr->second.second = true;
        switch_count++;
    }
    cout << switch_count << endl;
    return 0;
}


Measured memory_bytes: 6528
#include<stdio.h>
#include<string.h>
int main(){
    char s[11];
    int i,len,tmp=0,ans=0;
    scanf("%s",s);
    len=strlen(s);
    for(i=0;i<=len;i++){
        if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')tmp++;
        if(ans<tmp)ans=tmp;
        if(s[i+1]!='A'&&s[i+1]!='T'&&s[i+1]!='C'&&s[i+1]!='G')tmp=0;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

//*
//遅延セグ木ここから
//↓ここを変える
typedef struct sayouso{ll k;}sayouso;
typedef struct atai{ll a;}atai;
//↑ここを変える

typedef struct node{sayouso T;atai x;}node;
node *lsegN,*lseg;
ll lsegNUM;

//↓ここから変える
sayouso sid={INF};
atai aid={INF};
atai xx(atai x,atai y){
	atai ret;
	ret.a=min(x.a,y.a);
	return ret;
}
atai Tx(sayouso T,atai x){
	atai ret;
	ret.a=min(T.k,x.a);
	return ret;
}
sayouso TT(sayouso S,sayouso T){
	sayouso ret;
	ret.k=min(S.k,T.k);
	return ret;
}
//↑ここまで変える

//要素数(2ベキ)でこれを呼ぶ
void lseguse(ll n){
	lsegN=(node*)calloc(2*n,sizeof(node));
	lsegNUM=n;
	lseg=lsegN+lsegNUM;
	rep(i,0,lsegNUM){
		lseg[i].x=aid;
		lseg[i].T=sid;
	}
	for(int i=lsegNUM-1;i>0;i--){
		lsegN[i].x=xx(lsegN[2*i].x,lsegN[2*i+1].x);
		lsegN[i].T=sid;
	}
}
//lseg[i].xに値を与えてから初期化
void lseginit(){
	for(int i=lsegNUM-1;i>0;i--)lsegN[i].x=xx(lsegN[2*i].x,lsegN[2*i+1].x);
}
void lsegupdatesub(ll l,ll r,sayouso T,ll i,ll cl,ll cr){
	if(l>=r)return;
	//disjointなとき
	if(cr<=l||r<=cl)return;
	//完全に含むとき
	if(l<=cl&&cr<=r){
		lsegN[i].T=TT(T,lsegN[i].T);
		return;
	}
	//どちらでもないとき
	//遅延伝播
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	//再帰的に更新
	ll cm=(cl+cr)/2;
	lsegupdatesub(l,r,T,2*i  ,cl,cm);
	lsegupdatesub(l,r,T,2*i+1,cm,cr);
	//自身のnodeを更新
	lsegN[i].x=xx(Tx(lsegN[2*i].T,lsegN[2*i].x),Tx(lsegN[2*i+1].T,lsegN[2*i+1].x));
	lsegN[i].T=sid;
}
void lsegupdate(ll l,ll r,sayouso T){lsegupdatesub(l,r,T,1,0,lsegNUM);}
atai lsegcalcsub(ll l,ll r,ll i,ll cl,ll cr){
	if(l>=r)return aid;
	//完全に含むとき
	if(l<=cl&&cr<=r)return Tx(lsegN[i].T,lsegN[i].x);

	ll cm=(cl+cr)/2;
	//遅延伝播(変更はないので配るだけで良い)
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	lsegN[i].x=Tx(lsegN[i].T,lsegN[i].x);
	lsegN[i].T=sid;

	//左側だけ
	if(r<=cm)return lsegcalcsub(l,r,2*i  ,cl,cm);
	//右側だけ
	if(cm<=l)return lsegcalcsub(l,r,2*i+1,cm,cr);
	//両方
	return xx(lsegcalcsub(l,r,2*i,cl,cm),lsegcalcsub(l,r,2*i+1,cm,cr));
}
atai lsegcalc(ll l,ll r){return lsegcalcsub(l,r,1,0,lsegNUM);}
//遅延セグ木ここまで
//*/

E e[100010];
ll d[100010];
int main(){
	int n,m,s,t;
	scanf("%d%d%d%d",&n,&m,&s,&t);
	rep(i,1,n+1)scanf("%d",d+i);
	rep(i,0,m){
		int x,y;
		scanf("%d%d",&x,&y);
		e[i].s=x;
		e[i].g=y;
	}
	qsort(e,m,sizeof(E),esort);
	
	lseguse(1<<17);
	sayouso T={0};
	lsegupdate(1,s+1,T);
	rep(i,0,m){
		ll x=lsegcalc(e[i].s,e[i].s+1).a;
		sayouso T={x+d[e[i].g]};
		lsegupdate(e[i].s,e[i].g+1,T);
	}
	printf("%lld\n",lsegcalc(t,t+1).a);
}


Measured memory_bytes: 8240
n, m = map(int, input().split())
a = []
for _ in range(m):
    u, v = map(int, input().split())
    a.append((u, v))
a.sort()
i, c = 0, 0
for u, v in a:
    if u >= i:
        c += 1
        i = v
    else:
        i = min(i, v)
print(c)


Measured memory_bytes: 17000
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
const char nl = '\n';
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))
ll power(ll x, unsigned int y) {ll res = 1;	while (y > 0) { if (y & 1) res = res*x%mod; y = y>>1; x = x*x;} return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
void solve(){
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    
    // c>b>a
    while(k && (b<=a)){
    	b=b*2;
    	k--;
    	
    }
    while(k && (c<=b)){
    	c=c*2;
    	k--;
    }
    if((c>b) && (b>a)){
    	cout<<"Yes";
    }else{
    	cout<<"No";
    }
    
}
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


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

int n,m;
int a,ans1=0,ans2=0;
string b;
int num[100005];
bool ok[100005];

int main(){
	cin>>n>>m;
	memset(num,false,sizeof(num));
	memset(ok,false,sizeof(ok));
	for(int i=1;i<=m;i++){
	cin>>a>>b;
		if(b=="AC"){
			if(ok[a]==false){
				ans1++;
				ans2+=num[a];
				ok[a]=true;
			}
		}
		else if(b=="WA"){
			if(ok[a]==false){
			num[a]++;
			}
		}		
	}
	cout<<ans1<<" "<<ans2<<endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<iomanip>

using namespace std;

#define rep(i, a, n) for (int i = (a); i < (n); ++i)

void Main(){
  int K,s;
  cin>>K>>s;
  int cnt=0;
  rep(i,0,K+1){
    rep(j,0,K+1){
      int k=s-i-j;
      if(0<=k && k<=K && i+j+k==s){
        cnt++;
      }
    }
  }
  cout<<cnt<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  Main();
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long LL;
const int MAXN = 2e5 + 8;

LL sum[MAXN], a[MAXN];

int main()
{
    #ifdef LOCAL
    freopen("a.txt", "r", stdin);
    //freopen("a.out", "w", stdout);
    int T = 4;
    while(T--){
    #endif // LOCAL
    ios::sync_with_stdio(false); cin.tie(0);

    LL n, i, ans = 9e18;
    cin >> n;
    for(i = 1; i <= n; i++){
        cin >> a[i];
    }
    sum[0] = 0;
    for(i = 1; i <= n; i++){
        sum[i] = sum[i-1] + a[i];
        //cout << sum[i] << endl;
    }
    for(i = 1; i < n; i++){
        ans = min(ans, (LL)abs(sum[n] - sum[i] - sum[i]));
    }
    cout << ans << endl;



    #ifdef LOCAL
    cout << endl;
    }
    #endif // LOCAL
    return 0;
}



Measured memory_bytes: 3328
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int r; cin >> r;
    double ans = r*2*3.14159;
    ct(ans);
}



Measured memory_bytes: 3772
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
    
n=I()
a=LI()
a.sort()

ans=0
for i in range(n):
    ans+=min(a[2*i],a[2*i+1])

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			if(i*j==n)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
int main(){
    char input[1050];
    int p = 0;
    while(~(input[p]=getchar()))p++;
    input[p] = 0;
    for(int i = 0;i < p - 5;i++){
	if(strncmp(input + i, "peach", 5) == 0){
	    input[i] = 'a';
	    input[i + 1] = 'p';
	    input[i + 2] = 'p';
	    input[i + 3] = 'l';
	    input[i + 4] = 'e';
	}
	else if(strncmp(input + i, "apple", 5) == 0){
	    input[i] = 'p';
	    input[i + 1] = 'e';
	    input[i + 2] = 'a';
	    input[i + 3] = 'c';
	    input[i + 4] = 'h';
	}
    }
    printf("%s", input);
    return 0;
}

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

int n, m, a, b, inin[100005], dp[100005];
vector<int> G[100005];
queue<int> q;

int main() {
	cin >> n >> m;
	for (int i=0; i<m; i++) {
		cin >> a >> b;
		G[a].push_back(b);
		inin[b]++;
	}
	for (int i=1; i<=n; i++) {
		if (inin[i] == 0) q.push(i);
	}
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for (int v : G[u]) {
			inin[v]--;
			if (inin[v] == 0) q.push(v);
			dp[v] = max(dp[v], dp[u] + 1);
		}
	}
	cout << *max_element(dp, dp + n + 1) << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX





void solve()
{
  int k, n;
  cin >> k >> n;
  int arr[n];
  inp(arr, n);
  sort(arr, arr+n);
  int ans = INT_MAX;
  rep(i,0,n-2)
  {
    ans = min({ans, k-(arr[(i+1)%n]-arr[i])});
  }
  ans = min(ans, arr[n-1]-arr[0]);
  cout << ans << endl;
}

signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}


Measured memory_bytes: 1792