akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()

int main() {
   int n,d,x;
   cin >> n >> d >> x;
   rep(i,n){
      int a,j=0; cin >> a;
      while(a*j+1<=d){
         j++; x++;
      }
   }
   cout << x << endl;
}

Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
if b<=c or d<=a:
    print(0)
elif a<=c<=d<=b:
    print(d-c)
elif a<=c<=b<=d:
    print(b-c)
elif c<=a<=b<=d:
    print(b-a)
elif c<=a<=d<=b:
    print(d-a)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
  for(int i=0;i<=W;i++){
    for(int j=0;j<=H;j++){
    }
  }
      int A,B,C,D;
      A=x-r;
      B=x+r;
      C=y+r;
      D=y-r;
      if(A>=0&&B<=W&&C<=H&&D>=0){
	cout<<"Yes"<<endl;
      }
      else{
	cout<<"No"<<endl;
      }
  return 0;
}

Measured memory_bytes: 1160
import math
A,B =list(map(int,input().split()))
fr = 0
for i in range(10**6):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        print(i)
        fr += 1
        break
if fr == 0:
    print(-1)

Measured memory_bytes: 40684
#include <bits//stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long int ll;
int main() {
	int n,cnt = 0; cin >> n; vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	ll sum = 0;
	rep(i, n - 1) {
		sum += a[i];
		if (sum * 2 < a[i + 1]) cnt = i+1;
	}cout << n - cnt << endl;
}


Measured memory_bytes: 3668
import Control.Applicative
import Control.Monad
import Data.Vector.Unboxed (Vector, (!), (//))
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    print $ solve n
    main

solve :: Int -> Int
solve n = let lv = n `div` 2 + 2
              v = V.unfoldr (\i -> if 2 * i <= n + 2
                                   then Just (i * (i + 1) `div` 2, i + 1)
                                   else Nothing) 0
          in length $ do
            i <- [0 .. lv - 2]
            guard $ bsearch v (v ! i + n) (i + 2) lv
            return ()
            

bsearch :: Vector Int -> Int -> Int -> Int -> Bool
bsearch v x l r
  | l >= r = False
  | x > y = bsearch v x (m + 1) r
  | x < y = bsearch v x l m
  | otherwise = True
  where
    m = (l + r) `div` 2
    y = v ! m



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

using namespace std;
using ll = long long;

int main() {
	ll N;
	cin >> N;

	ll min_value = 10000000000000000;
	for (int i = 0; i < 5; i++) {
		ll value;
		cin >> value;
		if (min_value > value) {
			min_value = value;
		}
	}

	cout << 5 + (N - 1)  / min_value << endl;


	return 0;
}

Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  string s;
  int ans = 0;
  cin >> s;
  for(auto t:s){
    ans+=(t=='1');
  }
  cout << ans << endl;


return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
  ll MOD = 1e9+7;

ll modpow(ll a, ll n){
  if(n==1) return a%MOD;
  if(n%2==1) return (a*modpow(a,n-1))%MOD;
  else{
    ll t=modpow(a,n/2)%MOD;
    return (t*t)%MOD;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  ll N; cin>>N;
  vector<ll> A(N,0);
  rep(i,N) cin>>A[i];
  ll sum=0;
  rep(i,N) (sum+=A[i])%=MOD;
  ll g = modpow(2,MOD-2);
  ll ans = 0;
  rep(i,N){
    ans += ((sum-A[i]) * A[i])%MOD;
    ans = (ans+MOD)%MOD;
  }
  ans *= g;
  ans %= MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 4776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define LL long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
using namespace std;
int n,m,k;
char c[810][810];
int s1,s2;
int res=0;
priority_queue< pair<PII, PII> > pq;
int d1[4]={0,0,1,-1};
int d2[4]={1,-1,0,0};
PII d[810][810];
inline bool ok(int x,int y)
{
	return x>=0 && y>=0 && x<n && y<m;
}
int main()
{
	cin >>n>>m>>k;
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<m;j++)
		{
			cin >>c[i][j];
			if (c[i][j]=='S')
			{
				s1=i;
				s2=j;
				c[i][j]='.';
			}
			d[i][j]=MP(1e9,0);
		}
	}
	d[s1][s2]=MP(0,-k);
	pq.push(MP(MP(0,-k),MP(s1,s2)));
	while (!pq.empty())
	{
		int t=-pq.top().F.F;
		int tt=pq.top().F.S;
		int x=pq.top().S.F;
		int y=pq.top().S.S;
		pq.pop();
		if (d[x][y]!=MP(t,tt)) continue;
		if (x==0 || x==n-1 || y==0 || y==m-1)
		{
			cout <<(t+k-1)/k;
			return 0;
		}
		if (t%k==0) tt+=k;
		//cout <<x<<" "<<y<<" "<<t<<" "<<tt<<" ###\n";
		bool fl=0;
		for (int i=0;i<4;i++)
		{
			int xi=x+d1[i];
			int yi=y+d2[i];
			if (!ok(xi,yi) || (c[xi][yi]=='#' && !tt)) continue;
			if (c[xi][yi]=='#')
			{
			    if (d[xi][yi].F<t+1 || (d[xi][yi].F==t+1 && d[xi][yi].S>=tt-1))
				    continue;
			    fl=1;
				d[xi][yi]=MP(t+1,tt-1);
			    pq.push(MP(MP(-(t+1),tt-1),MP(xi,yi)));
			}
			else
			{
				if (d[xi][yi].F<t+1 || (d[xi][yi].F==t+1 && d[xi][yi].S>=tt))
				    continue;
			    fl=1;
				d[xi][yi]=MP(t+1,tt);
			    pq.push(MP(MP(-(t+1),tt),MP(xi,yi)));
			}
		}
		if (!fl)
		{
			pq.push(MP(MP(-(t+k-(t%k)),tt),MP(x,y)));
			d[x][y]=MP(t+k-(t%k),tt);
		}
	}
	return 0;
}

Measured memory_bytes: 8180
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;

int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


int x[100010],y[100010];
int main() {
	int A,B;cin>>A>>B;
	if(A%2==1&&B%2==1){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
}


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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {

            var n = int.Parse(Console.ReadLine());
            var points = new(int x, int y) [n];
            for (var i = 0; i < n; i++)
            {
                var pos = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
                points[i] = (pos[0], pos[1]);
            }
            var sum = 0D;
            var fact = kaijo(n - 1);
            for (var i = 0; i < n; i++)
            {
                var a = points[i];
                for (var j = i + 1; j < n; j++)
                {
                    var b = points[j];
                    sum += 2 * fact * Math.Sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
                }
            }

            Console.WriteLine(sum / (fact * n));

            int kaijo(int num)
            {
                var r = 1;
                for (var i = 1; i <= num; i++)
                {
                    r *= i;
                }
                return r;
            }
        }
    }
}

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

typedef long long ll;

ll D;
const ll MAX_K = 18;
vector<ll> Pow10;
ll R;

void calc(ll hi, ll lo, ll d, ll acc) {
  if (hi <= lo) {
    if (d == 0) R += acc * (hi == lo ? 10 : 1);
    return;
  }
  ll base = Pow10[hi] - Pow10[lo];
  ll x = d / base;
  if (d < 0) ++x;
  for (ll s : {x - 2, x - 1, x, x + 1}) {
    if (s < -9 || 9 < s) continue;
    calc(hi - 1, lo + 1, d - s * base, acc * (10 - abs(s) - (lo == 0 ? 1 : 0)));
  }
}
int main() {
  cin >> D;
  Pow10.resize(MAX_K);
  Pow10[0] = 1;
  for (ll i = 1; i < MAX_K; ++i) Pow10[i] = 10 * Pow10[i - 1];
  for (ll k = 2; k <= MAX_K; ++k) {
    calc(k - 1, 0, D, 1);
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int r, g, b, n;
    int ans = 0;
    cin >> r >> g >> b >> n;
    for (int R = 0; R <= n; R += r)
    {
        for (int G = 0; G < n + 1 - R; G += g)
        {
            if ((n - R - G) % b == 0)
                ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int N, Q;
int a[271828], b[271828];
int p[271828], x[271828];

int ec[271828];
int* e[271828];

void ae(int f, int t) {
	e[f] = realloc(e[f], sizeof(*e[f]) * (ec[f] + 1));
	if (e[f] == NULL) exit(2);
	e[f][ec[f]++] = t;
}

uint64_t mimorisuzuko[271828];

uint64_t kotae[271828];

void dexiiefuesu(int node, uint64_t sum, int from) {
	int i;
	sum += mimorisuzuko[node];
	kotae[node] = sum;
	for (i = 0; i < ec[node]; i++) {
		if (e[node][i] != from) {
			dexiiefuesu(e[node][i], sum, node);
		}
	}
}

int main(void) {
	int i;
	if (scanf("%d%d", &N, &Q) != 2) return 1;
	for (i = 0; i < N - 1; i++) {
		if (scanf("%d%d", &a[i], &b[i]) != 2) return 1;
	}
	for (i = 0; i < Q; i++) {
		if (scanf("%d%d", &p[i], &x[i]) != 2) return 1;
	}

	for (i = 0; i < N - 1; i++) {
		ae(a[i], b[i]);
		ae(b[i], a[i]);
	}
	for (i = 0; i < Q; i++) {
		mimorisuzuko[p[i]] += x[i];
	}
	dexiiefuesu(1, 0, 0);

	for (i = 1; i <= N; i++) {
		printf("%" PRIu64 "%c", kotae[i], i < N ? ' ' : '\n');
	}

	return 0;
}


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

// Problem https://atcoder.jp/contests/abc074/tasks/arc083_a

pair<int,int> solver(int A,int B,int C,int D,int E,int F){
    int oneCupA=A*100;
    int oneCupB=B*100;
    int oneSpoonSugerC = C;
    int oneSpoonSugerD = D;
    int meltPer100 = E;
    int resultSW = F;
    double maxMeltRate=(double)meltPer100/((double)meltPer100+100.0);
    vector<int> canWater;
    for(int j=0;j<=resultSW;j=j+oneCupA){
        for(int k=0;k<=resultSW-j;k=k+oneCupB){
            if( j==0 and k==0)continue;
            canWater.push_back(j+k);
        }
    }
/**     for(int j=0;j<canWater.size();j++){
        cout << canWater.at(j) << " ";
    } **/
    double maxMeltMax=0.0;
    int maxMeltWater,maxMeltSugar;
    for(int j=0;j<canWater.size();j++){
        for(int k=0;k<=resultSW-canWater.at(j);k=k+oneSpoonSugerC){
            for(int m=0;m<=resultSW-canWater.at(j)-k;m=m+oneSpoonSugerD){
            //    cout << "Water:" << canWater.at(j) << " ";
            //    cout << "C: " << k << " ";
            //    cout << "D: " << m  << " ";
                // cout << endl ;
                int suger=k+m;
            //    cout << "SugarSum: " << suger << " ";
                double nowMeltRate;
                nowMeltRate = (double)suger / ((double)canWater.at(j)+(double)suger);
            //    cout << "NowMelt: " << nowMeltRate << " ";
                if(maxMeltMax <= nowMeltRate and nowMeltRate <= maxMeltRate){
                    maxMeltMax = nowMeltRate;
                    maxMeltWater = canWater.at(j)+suger;
                    maxMeltSugar = suger;
            //        cout << "TOKERU" << " ";
                }
              //  else{
            //        cout << "TOKENAI" << " ";
            //    }
            //    cout << endl;
            }
        }
    }
    cout << endl;
    return {maxMeltWater,maxMeltSugar};
}

int main(void){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    pair<int,int> answer = solver(A,B,C,D,E,F);
    cout << answer.first << " " << answer.second << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <memory.h>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <complex>
#include <cstring>

using namespace std;

#define FILE_PREFIX "../../../../../../../../CompetitiveProgramming/CF/CF/"
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR((i), 0, (n))
#define ll unsigned int
#define pb push_back

const int N = 3e5*32;
const int MOD = 1e9 + 7;

int n, A, B;

void NO() {
    cout << -1 << endl;
    exit(0);
}

int main() {
//        freopen(FILE_PREFIX"input.txt", "r", stdin);
    ios :: sync_with_stdio(false);

    cin >> n >> A >> B;
    if (1LL * A * B < n) {
        NO();
    }
    
    if (A + B - 1 > n) {
        NO();
    }
    
    vector<int> res;
    
    int L = n - A;
    
    int start = 1;
    for (int v = 1; v <= A; ++v) {
        int take = min(L, B-1);
        L -= take;
        
        for (int j = start+take; j >= start; --j) res.push_back(j);
        start += take + 1;
    }
    
//
//    while (start <= n) {
//        int left = n - start + 1;
//        if (left == A) {
//            res.push_back(start);
//            start++;
//            A--;
//            continue;
//        }
//
//        int diff = left - A-1;
//        if (diff >= B-1) diff = B-1;
//        diff++;
//        for (int j = start + diff-1; j >= start; --j) {
//            res.push_back(j);
//        }
//
//        start += diff;
//        A--;
//    }
    
    for (int i = 0; i < res.size(); ++i) cout << res[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3440
l = ['q','w','e','r','t','a','s','d','f','g','z','x','c','v','b']

def which(c):
    return 0 if c in l else 1

while True:
    st = input()
    if st == "#": break
    lis = list(st)
    count = 0
    hand = which(lis[0])
    for c in lis:
        tmp = which(c)
        if tmp != hand:
            count += 1
        hand = tmp
    print(count)

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

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

using ll = long long int;

ll N,Q;
vector<ll> A;
inline void input(){
    fast_io();
    cin >> N >> Q;
    A = fetch_vec<ll>(N);
}

inline int solve(){
    atcoder::fenwick_tree<ll> ft(N);
    for (int i = 0; i < N; i++)
    {
        ft.add(i,A[i]);
    }
    
    for (int i = 0; i < Q; i++)
    {
        ll t,a,b;
        cin >> t >> a >> b;
        if(t==0){
            ft.add(a,b);
        }
        else{
            cout << ft.sum(a,b) << "\n";
        }
    }
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 12168
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

pair<int,int> a[101];
int b[101];
bool comp(pair<int,int> x, pair<int,int> y){
	return x.fi > y.fi;
}

int main(){
	int n, m, t[4], p, s = INF;
	scanf("%d", &n);
	m = (n*(n-1))/2;
	rrep(i,n)a[i].se = i;
	rep(i,m){
		rep(j,4)scanf("%d", &t[j]);
		if(t[2] > t[3])a[t[0]].fi += 3;
		if(t[2] < t[3])a[t[1]].fi += 3;
		if(t[2] == t[3])a[t[0]].fi++, a[t[1]].fi++;
	}
	sort(a+1, a+n+1, comp);
	for(int i = 1;i <= n;i++){
		if(s > a[i].fi){
			s = a[i].fi;
			p = i;
		}
		a[i].fi = p;
		b[a[i].se] = i;
	}
	rrep(i,n)printf("%d\n", a[b[i]].fi);
	return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

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


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

int main()
{
    string S; cin >> S;
    int ans = 0;
// SUN,MON,TUE,WED,THU,FRI,SAT
    if (S == "SUN") {
        ans = 7;
    }
    else if (S == "MON") {
        ans = 6;
    }
    else if (S == "TUE") {
        ans = 5;
    }
    else if (S == "WED") {
        ans = 4;
    }
    else if (S == "THU") {
        ans = 3;
    }
    else if (S == "FRI") {
        ans = 2;
    }
    else if (S == "SAT") {
        ans = 1;
    }

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


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int q,state=0;
string s,a[2];

void nhap()
{
    cin>>s>>q;
    while (q--)
    {
        int t;
        cin>>t;
        if (t==1) state^=t;
        else
        {
            int f;
            char c;
            cin>>f>>c;
            f--;
            for (int i=0;i<2;++i)
            {
                if ((i^state)==f)
                    a[i]+=c;
            }
        }
    }
    if (state) reverse(s.begin(),s.end());
    for (int i=0;i<2;++i)
    {
        if ((i^state)==1) s+=a[i];
        else
        {
            reverse(a[i].begin(),a[i].end());
            s=a[i]+s;
        }
    }
    cout<<s;
}

int main()
{
    nhap();
    return 0;
}


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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
	int a,b;
  cin >> a >> b;
  if(a==b) cout << "Draw" << endl;
  else{
   if(a==1){
    	cout << "Alice"  << endl;
   }
    else if(b==1){
     cout << "Bob"  << endl;
    }
    else if(a<b){
     	cout << "Bob"  << endl;
    }
    else{
     cout <<"Alice"  << endl;
    }
  }
  
  
  return 0;
    

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<iostream>
using namespace std;

#define int long long int
#define all(x) (x).begin(), (x).end()
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'

void solve(){
	int n;
	cin>>n;
	vector<vector<int>>d(n,vector<int>(2));
	int cnt=0;
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>d[i][0]>>d[i][1];
		if(d[i][0]==d[i][1]){
			cnt++;
		}else{
			cnt=0;
		}
		ans=max(ans,cnt);
	}
	if(ans>=3){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

int32_t main(){

	//remove for interactive problems
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	solve();
	cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

	return 0;
}

Measured memory_bytes: 3840
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>

namespace n91 {

void main_() {
  const usize n = scan<usize>();
  std::vector<double> v(n);
  for (const auto i : rep(0_z, n)) {
    v[i] = scan<double>();
  }
  std::sort(v.begin(), v.end());
  double ans = v[0_z];
  for (const auto i : rep(1_z, n)) {
    ans = (ans + v[i]) / static_cast<double>(2);
  }
  std::cout << ans << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
const int q=1000000007;
int x[10],y[10],a[2000010],b[2000010],p;
inline int C(int n,int m)
{
	if(m<0 || m>n)
	  return 0;
	else
	  return (L)a[n]*b[m]%q*b[n-m]%q;
}
inline int orz(int x1,int y1,int x2,int y2)
{
	return C(x2-x1+y2-y1,x2-x1);
}
inline void calc(int i,int j,int ii,int jj,int k)
{
	int l=0,r=0;
	l=(l+orz(x[1]-1,y[1]-1,i,j))%q;
	l=(l-orz(x[1]-1,y[2],i,j))%q;
	l=(l-orz(x[2],y[1]-1,i,j))%q;
	l=(l+orz(x[2],y[2],i,j))%q;
	r=(r+orz(ii,jj,x[6]+1,y[6]+1))%q;
	r=(r-orz(ii,jj,x[5],y[6]+1))%q;
	r=(r-orz(ii,jj,x[6]+1,y[5]))%q;
	r=(r+orz(ii,jj,x[5],y[5]))%q;
	p=(p+(L)l*r%q*k)%q;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k;
	for(i=1;i<=6;i++)
	  scanf("%d",&x[i]);
	for(i=1;i<=6;i++)
	  scanf("%d",&y[i]);
	a[0]=1;
	for(i=1;i<=2e6;i++)
	  a[i]=(L)a[i-1]*i%q;
	b[0]=b[1]=1;
	for(i=2;i<=2e6;i++)
	  b[i]=q-(L)q/i*b[q%i]%q;
	for(i=1;i<=2e6;i++)
	  b[i]=(L)b[i-1]*b[i]%q;
	for(i=y[3];i<=y[4];i++)
	  {
	   calc(x[3]-1,i,x[3],i,-x[3]-i);
	   calc(x[4],i,x[4]+1,i,x[4]+i+1);
	  }
	for(i=x[3];i<=x[4];i++)
	  {
	   calc(i,y[3]-1,i,y[3],-y[3]-i);
	   calc(i,y[4],i,y[4]+1,y[4]+i+1);
	  }
	p=(p+q)%q;
	printf("%d\n",p);
	return 0;
}


Measured memory_bytes: 16000
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str1=sc.next();
		String str2=sc.next();
		int ans=0;
		for(int i=0;i<str1.length();i++){
		    if(str1.charAt(i)!=str2.charAt(i))
		    ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 41212
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

bool calc(long[] as, long[] bs) {
    auto asum = as.sum;
    auto bsum = bs.sum;

    if (asum > bsum) return false;

    long r = 0;
    for (int i = 0; i < as.length; i++) {
        r += max(0, as[i] - bs[i]);
    }

    if (asum + 2 * r > bsum + r) return false;

    for (int i = 0; i < as.length; i++) {
        long x = bs[i] - as[i];
        if (x > 0) {
            r -= x / 2;
        }
    }

    return r <= 0;
}

void main() {
    readint;
    auto as = readln.split.to!(long[]);
    auto bs = readln.split.to!(long[]);
    writeln(calc(as, bs) ? "Yes" : "No");
}

Measured memory_bytes: 3068
#同じ文字の間隔を2文字以上空ける　abcabcabc,,,,,
s=input()
if len(s)==1:
    print("YES")
    exit()
    
c=[0,0,0]
for i in range(len(s)):
    if s[i]=="a":
        c[0]+=1
    elif s[i]=="b":
        c[1]+=1
    elif s[i]=="c":
        c[2]+=1
if max(c)-min(c)>=2:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 9116
#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ln length()
#define mod 1000000007
#define MAX 1000000
#define umap unordered_map
#define uset unordered_set
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define V(x) vector<x>
#define deci(n) cout<<fixed<<setprecision(n)
#define pq priority_queue
#define dbg(x)      cout << #x << " = " << x << '\n'
#define FOR(i,s,e)    for(ll i=(ll)s;i<(ll)e;i++)

typedef long long int ll;
typedef long double ldb;

ll gcd(ll a, ll b){
    ll mi=min(a, b), mx=max(a, b), temp;
    while(mi){
        temp=mi;
        mi=mx%mi;
        mx=temp;
    }
    return mx;
}

ll pw(ll x, ll n){
    ll ans=1;
    while(n){
        if(n&1ll){
            ans*=x;
            // ans%=mod;
        }
        x*=x;
        // x%=mod;
        n>>=1ll;
    }
    return ans;
}


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll dp[n],arr[n];
    FOR(i,0,n)
    {
        cin>>arr[i];
    }
    dp[0]=0;
    FOR(i,1,n)
    {
        dp[i]=LLONG_MAX;
        FOR(j,1,k+1)
        {
            if(i-j>=0)
            {
                dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
            }
        }
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}


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

int main() {
    int n, x = 0, m = 0;
    string s;
    cin >> n >> s;
    rep(i, n) {
        if(s[i] == 'I') {
            x++;
            if(m < x) {
                m = x;
            }
        } else {
            x--;
        }
    }
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int abs(int x)
{
    if(x>=0)return x;
    return -x;
}
int main()
{
    int n,i,a[105],ans=0,b,mi=1000;
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            ans+=a[i];
            if(i!=1)a[i]+=a[i-1];
            //printf("%d\n",a[i]);
        }
        for(i=1;i<=n;i++)
        {
            b=abs(ans-a[i]*2);
            //printf("b=%d\n",b);
            if(b<mi)mi=b;
        }
    printf("%d\n",mi);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
using namespace std;
int main()
{
	int m,n;
	int i,j;
	char s1[105][20];
	char s2[105][20];
	int a[105];
	int b[105];
	int ans[105] = {0};
	scanf("%d", &n);
	for(i = 1 ; i <= n ; i++)
	{
		scanf("%s", s1[i]);
	}
	scanf("%d", &m);
	for(i = 1 ; i <= m ; i++)
	{
		scanf("%s", s2[i]);
	}
	for(i = 1 ; i <= n ; i++)
	{
		a[i] = 0;
	}
	for(i = 1 ; i <= n ; i++)
	{
		for(j = 1 ; j <= m ; j++)
		{
			if(strcmp(s1[i],s2[j]) == 0)
			{
				a[i]++;
			}
		}
	}
	for(i = 1 ; i<= n ; i++)
	{
		b[i] = 0;
	}
	for(i = 1 ; i <= n ; i++)
	{
		for(j = 1 ; j <= n ; j++)
		{
			if(strcmp(s1[i],s1[j]) == 0)
			{
				b[i]++;
			}
		}
	}
	for(i = 1 ; i <= n ; i++)
	{
		ans[i] = b[i] - a[i];
	}
	sort(ans + 1, ans + 1 + n);
	if(ans[n] < 0)
	{
		printf("0\n");
	}
	else
	{
		printf("%d\n",ans[n]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
using namespace std;
int N[1000005];
char Str[500005];
int nine[1000005], sum, limit;
void Read()
{
    cin.getline(Str, 500005);
    int len = strlen(Str);
    for(int i = len - 1; i >= 0; i--)
    {
        N[++N[0]] = Str[i] - '0';
    }
    limit = N[0];
}

void Add()
{
    int t = 0, i;
    for(i = 1; i <= N[0] || i <= nine[0] || t; i++)
    {
        if(nine[i] == 0 && t == 0)
            break;
        sum -= N[i];
        N[i] = (N[i] + nine[i] + t);
        t = N[i] / 10;
        N[i] %= 10;
        sum += N[i];
    }
    N[0] = i - 1;
}
void mul()
{
      int i, t = 0;
      for (i = 1; i <= N[0] || t; i++, t /= 10)
              N[i] = (t += N[i] * 9) % 10;
      N[0] = i - 1;
      for(int i = 1; i <= N[0]; i++)
        sum += N[i];
}
void Solve()
{
    mul();
    nine[0] = 1;
    nine[1] = 9;
    for(int k = 1; k <= limit; k++)
    {
        Add();
        if(sum <= 9 * k)
        {
            cout << k << "\n";
            return;
        }
    }
}
int main()
{
    Read();
    Solve();
    return 0;
}


Measured memory_bytes: 6528
N = int(input())
X = list(map(int, input().split()))
s = sum(X)
c = 1000000
P = 0
m = min(X)
M = max(X)
for i in range(m, M+1):
  a = abs(s - N*i)
  if a < c:
    c = a
    P = i
ans = 0
for i in range(N):
  ans += (X[i] - P)**2
print(ans)
  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb          push_back
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,i,j,k,l,flag=0,ans=0,a[401],v[101],m;
int dp[402][402];
int sum[402][402];
void solve(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		int s=0;
		for(int j=i;j<=n;j++){
			s+=a[j];
			sum[i][j]=s;
		}
	}
	for(int len=1;len<=n;len++){
		for(int i=1;i+len-1<=n;i++){
			int j = i+len-1;
			if(i==j){
				dp[i][j] = 0;
			}else{
				dp[i][j]=1e15;
				for(int k=i;k<j;k++){
					dp[i][j]= min(dp[i][k] + dp[k+1][j] + sum[i][j], dp[i][j]);
				}
			}
		}
	}
	cout<<dp[1][n]<<endl;
}
signed main()
{
    ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 2816
p=1
cnt=1
h,w,k=map(int,input().split())
for i in range(h):
	s=input()
	if s.count("#")==1:
		a=[]
		for j in range(w):
			a.append(p)
		p+=1
		for _ in range(cnt):
			print(*a)
		cnt=1
	elif s.count("#")==0:
		cnt+=1
	else:
		a=[]
		itigo=0
		for j in range(w):
			if s[j]=="#" and itigo==True:
				p+=1
				a.append(p)
			elif s[j]=="#":
				itigo=True
				a.append(p)
			else:
				a.append(p)
		for _ in range(cnt):
			print(*a)
		cnt=1
		p+=1
for i in range(cnt-1):
	print(*a)







Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    int cnt = 0;
    FOR(i, 1, n+1) {
        string s = to_string(i);
        if(s.length() % 2) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
a, b = gets.chomp.split($;).map(&:to_i)

result = -1

for i in 1..1300
  tax8 = i * 8 / 100
  tax10 = i * 10 / 100
  if tax8 == a and tax10 == b
    result = i
    break
  end
end

puts result

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

using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;
const ll mod = (int)1e9 + 7;

const int N = (int)3e5 + 100;
int cnt[2][N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s;
    int n;
    cin >> n >> s;

    int res = inf;

    for (int i = 1; i <= n; ++i) {
        if (s[i - 1] == 'W') {
            cnt[0][i]++;
        }
        cnt[0][i] += cnt[0][i - 1];
    }

    for (int i = n; i >= 1; --i) {
        if (s[i - 1] == 'E') {
            cnt[1][i]++;
        }
        cnt[1][i] += cnt[1][i + 1];
    }

    for (int i = 1; i <= n; ++i) {
        int cur = cnt[0][i - 1] + cnt[1][i + 1];
        res = min(res, cur);
    }

    cout << res;


    return 0;
}

Measured memory_bytes: 2964
// ABC061_C
#include <iostream>
#include <vector>
#include <algorithm>  // std::copy()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり

int main() {
    // input
    ll N, K, a, b, sum = 0, maxN = 100000 + 1;
    cin >> N >> K;
    vector<ll> num(maxN, 0);
    REP(i, N) {
        cin >> a >> b;
        num[a] += b;
    }
    
    // 各数が何個あるかの累積和を計算
    for (ll i = 0; i < maxN; ++i) {
        sum += num[i];
        if (K <= sum) {
            cout << i << "\n";
            return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 1024
h,w=map(int, input().split())

grid=[]
result=[]

for i in range(h):
    buf=input()
    if len(buf) == buf.count("."):
        continue
    else:
        grid.append(buf)

for x in zip(*grid):
    if len(x) == x.count("."):
        continue
    else:
        result.append(x)

for x in zip(*result):
    print("".join(x))

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

int N;
char S;
int main(){
	bool judge = false;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> S;
		if(S=='Y') judge = true;
	}
	if(judge) cout << "Four" << endl;
	else cout << "Three" << endl;
}

Measured memory_bytes: 256
//                                      KiSmAt
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 3 * 1e3 + 10;

ll res;
ll a[N];

double dp[N][N];

//create dp with exactly j heads with i coins;

void solve(){
    ll n;
    double x, ans;
    cin >> n;
    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i){
        cin >> x;
        for(int j = 0; j <= i; ++j){
            dp[i][j] = (j == 0 ? 0 : dp[i - 1][j - 1]) * x + dp[i - 1][j] * (1 - x);
        }
    }
    for(int i = 0; i <= n; ++i){
        if(n - i < i)   ans += dp[n][i];
    }
    cout << fixed << setprecision(10) << ans;
}
 
int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
// nEro

Measured memory_bytes: 69120
import math

N, K = map(int, input().split())

upper = (N-1)*(N-2) // 2
if upper < K:
    print(-1)
else:
    diff = upper - K
    edges = []
    for i in range(2, N+1):
        edges.append((1, i))
    j = 2
    while diff > 0:
        k = j + 1
        while k <= N and diff > 0:
            edges.append((j, k))
            k += 1
            diff -= 1
        j += 1
    print(len(edges))
    for e in edges:
        print(*e)



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



using namespace std;

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

int n,m;
int s[10],c[10];
int flag=true;
int ans;
string t;

int main(){
    cin >> n >> m;
    rep(i,m){
        cin >> s[i] >> c[i];
    }
    int idx = (int)(pow(10,n-1)+0.5);
    int sidx;
    if(idx == 1){
        sidx = 0;
    }
    else sidx = idx;
    // cout << idx << endl;
    for(int i=sidx;i<idx*10;i++){
        t = to_string(i);
        flag = true;
        rep(j,m){
            int tint = t[s[j]-1] - '0';
            // cout << tint << " " << c[j] << endl;
            if( tint != c[j]) flag = false;
        }
        if (flag) {
            ans = i;
            break;
        }
    }

    if(flag) cout << ans;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3812
K, A, B = map(int, input().split())

if B - A <= 2:
    print(1+K)
else:
    if A - 1 >= K:
        print(1+K)
    else:
        k = K - (A-1)
        ans = A + (k // 2) * (B-A) + (k&1)
        print(ans)


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>PP;
const ll MOD = 1000000007;
int main(){
  double r;
  cin>>r;

  cout<<r*3.141592653*2<<endl;

}

Measured memory_bytes: 3788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#define NIL -1
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int n;
int root;
int *p = new int[4000000];    //    p---|  Unit
int *left2 = new  int[4000000]; // left2 --|--------> T
int *right2 = new int[4000000];//right2---|
int *key = new int[4000000];  // key----|

void Init(){
  rep(i,4000000){
    p[i]=left2[i]=right2[i]=key[i]=NIL;
  }
}


int FindRoot(){
  rep(i,n){
    if(p[i] == NIL){
      return i;
    }
  }
}



void TREE_INSERT(int z){
  int y = NIL;  
  int x = root;

  while(x != NIL){
    y = x;
    if(key[z] < key[x]){
      x = left2[x];
    }
    else x = right2[x];
  }
  p[z]=y;
  if(y == NIL){
    root = z;
  }
  else if(key[z] < key[y]){
    left2[y] = z;
  }else{
    right2[y] = z;
  }

}

void InorderTreeWalk(int x){
  if(x != NIL){
    InorderTreeWalk(left2[x]);
    printf(" %d",key[x]);
    InorderTreeWalk(right2[x]);
  }
}

void PreorderTreeWalk(int x){
  if(x != NIL){
    printf(" %d",key[x]);
    PreorderTreeWalk(left2[x]);
    PreorderTreeWalk(right2[x]);
  }
}


int main(){
  int val;
  string op;
  int zr;                     


  scanf("%d",&n);
  Init();  
  root = -1;
  zr=0;
  while(n-- > 0){
    cin >> op;
    if(op == "insert"){
      scanf("%d",&val);
      key[zr]=val;         
      TREE_INSERT(zr);
      zr++;
    }else if(op == "print"){
      InorderTreeWalk(root);
      printf("\n");
      PreorderTreeWalk(root);
      printf("\n");
    }
  }

  delete [] p;
  delete [] left2;
  delete [] right2;
  delete [] key;

  return 0;
}

Measured memory_bytes: 63656
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n;
    cin >> n;
    int mx = 0;
    map <string, int> mp;
    while(n--){
        string tmp;
        cin >> tmp;
        ++mp[tmp];
        mx = max(mx,mp[tmp]);
    }
    vector <pair<string,int>> vs;
    for(auto i : mp){
        if(i.second == mx)
            vs.push_back({i.first,i.second});
    }
    sort(all(vs));
    for(auto &i : vs)
        cout << i.first << '\n';
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 28016
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*
*/

ll a,b,c;

void init(){
	cin>>a>>b;
}

int main(void){
	init();
	cout<<(a<b?0:10)<<endl;
	return 0;
}

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	if (s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba")
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  if (k>((n-1)*(n-2))/2) {
    printf("-1\n");
    return 0;
  }
  int m=n-1+((n-1)*(n-2))/2-k;
  printf("%d\n", m);
  for (int i=0; i<n-1; i++) printf("1 %d\n", i+2);
  m-=n-1;
  for (int i=1; m>0 && i<n-1; i++) {
    for (int j=i+1; m>0 && j<n; j++) {
      printf("%d %d\n", i+1, j+1);
      m--;
    }
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=2e5+10;
//记录最大值和次大值即可
int a[N];
int main()
{
    int n,maxm=0,maxm1; scanf("%d",&n);
    for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
		if(maxm<=a[i])
		{
			maxm1=maxm;
			maxm=a[i];
		}
	    else
		{
			 if(maxm1<a[i])
				maxm1=a[i];
		}
	}

	for(int i=0;i<n;i++)
		{
			 if(maxm!=a[i])
				cout<<maxm<<endl;
			 else
				cout<<maxm1<<endl;
		}

    return 0;
}


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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
vector<ll> d;

void input() {
  IN(N);
  REP(i, N) {
    ll temp;
    IN(temp);
    d.push_back(temp);
  }
}

void solve() {
  sort(ALL(d));
  ll a = d[N/2-1];
  ll b = d[N/2];
  PRINT(b-a);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 1400
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>pii;
typedef pair<long long, long long>pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 200050;
const double pi = acosl(-1); constexpr double EPS = 1e-10;
constexpr ll INF = 1e16;
void yes(bool c) { if (c)print("Yes"); else print("No"); };

//LRDU
int dx[4] = { -1,1,0,0 }, dy[4] = { 0,0,-1,1 };
char dir[4] = { 'L','R','D','U' };

void solve() {
	int N; cin >> N;
	vector<int>X(N), Y(N);
	set<int>st;
	REP(i, N) {
		cin >> X[i] >> Y[i];
		st.insert(abs(X[i] + Y[i]) % 2);
	}
	if (st.size() >= 2) {
		print(-1); return;
	}
	vector<int>v;
	REPR(i, 31) {
		v.push_back(1LL << i);
	}
	if (*st.begin() == 0)v.push_back(1);
	int M = v.size();
	print(M);
	print_space(v);
	REP(i, N) {
		ll x = 0, y = 0;
		string res;
		REP(j, M) {
			ll nd = 0;
			ll dif = 1e18;
			REP(k, 4) {
				ll nx = x + dx[k] * v[j];
				ll ny = y + dy[k] * v[j];
				ll d = abs(nx - X[i]) + abs(ny - Y[i]);
				if (d < dif) {
					dif = d;
					nd = k;
				}
			}
			res += dir[nd];
			x += dx[nd] * v[j];
			y += dy[nd] * v[j];
		}
		print(res);
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	char a;
	cin >> a;
	if (a >= 'a' && a <= 'z') {
		cout << "a" << endl;
	} else {
		cout << "A" << endl;
	}
}



Measured memory_bytes: 3620
N,M = gets.chomp.split.map(&:to_i)
Xs = gets.chomp.split.map(&:to_i).sort
dist = []
x_pre = Xs[0]
Xs.each do |x|
  dist.push((x_pre - x).abs)
  x_pre = x
end
dist.shift
if N >= M
  ans = 0
else
  dist.sort!.reverse!
  (N-1).times{dist.shift}
  ans = dist.inject(:+)
end
puts ans


Measured memory_bytes: 11376
# -*- coding: utf-8 -*-

# input
s = input()

# processing
count = 0

i = 0
j = len(s) - 1
while True:
    if i >= j:
        break
    
    if s[i] != s[j]:
        count += 1
    
    i += 1
    j -= 1

# output
print(count)

Measured memory_bytes: 2940