akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
using namespace std;

struct square{
	int w;
	int h;
};
int main(){
	square face[6];
	int i, j, ipow, jpow, T, F, R, Flags = 0;
	for (i = 0; i < 6; i++){
		cin >> face[i].h >> face[i].w;
		if (face[i].w > face[i].h) swap(face[i].w, face[i].h);
	}
	for (i = 0; i < 5; i++){
		for (j = i + 1; j < 6; j++){
			ipow = pow(2, i); jpow = pow(2, j);
			if (face[i].w == face[j].w && face[i].h == face[j].h && (Flags & ipow) == 0 && (Flags & jpow) == 0){
				Flags += ipow; Flags += jpow;
				T = i;
				break;
			}
		}
		if (j < 6) break;
	}
	if (i == 4 && j == 5){ cout << "no" << endl; return 0; }
	for (i = 0; i < 5; i++){
		for (j = i + 1; j < 6; j++){
			ipow = pow(2, i); jpow = pow(2, j);
			if (face[i].w == face[j].w && face[i].h == face[j].h && (Flags & ipow) == 0 && (Flags & jpow) == 0){
				Flags += ipow; Flags += jpow;
				F = i;
				break;
			}
		}
		if (j < 6) break;
	}
	if (i == 4 && j == 5){ cout << "no" << endl; return 0; }
	for (i = 0; i < 6; i++){ ipow = pow(2, i); if ((Flags&ipow) == 0){ Flags += ipow; R = i; break; } }
	for (i = 0; i < 6; i++){ ipow = pow(2, i); if ((Flags&ipow) == 0){ Flags += ipow; break; } }
	if (face[R].w != face[i].w || face[R].h != face[i].h){ cout << "no" << endl; return 0; }
	if (face[T].w == face[F].w && face[T].h == face[R].w && face[F].h == face[R].h){ cout << "yes" << endl; return 0; }
	if (face[T].w == face[F].w && face[T].h == face[R].h && face[F].h == face[R].w){ cout << "yes" << endl; return 0; }
	if (face[T].w == face[F].h && face[T].h == face[R].w && face[F].w == face[R].h){ cout << "yes" << endl; return 0; }
	if (face[T].w == face[F].h && face[T].h == face[R].h && face[F].w == face[R].w){ cout << "yes" << endl; return 0; }
	if (face[T].h == face[F].w && face[T].w == face[R].w && face[F].h == face[R].h){ cout << "yes" << endl; return 0; }
	if (face[T].h == face[F].w && face[T].w == face[R].h && face[F].h == face[R].w){ cout << "yes" << endl; return 0; }
	if (face[T].h == face[F].h && face[T].w == face[R].w && face[F].w == face[R].h){ cout << "yes" << endl; return 0; }
	if (face[T].h == face[F].h && face[T].w == face[R].h && face[F].w == face[R].w){ cout << "yes" << endl; return 0; }
	cout << "no" << endl;
	return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	int r,g,b;
	cin >> r >> g >> b;
	
	if((10*g+b)%4==0){
		puts("YES");
	}else{
		puts("NO");
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())

P = list(map(int, input().split()))

flag = True

tmp = 0
for i in range(N):
    if P[i] > tmp:
        tmp = P[i]
    else:
        flag = False
        break

if flag:
    print('YES')
    exit()

hogehoge = {}

for i in range(N):
    hogehoge[i+1] = P[i]

cnt = 0
for key, value in hogehoge.items():
    if key != value:
        cnt += 1

if cnt == 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
    char x[20];
    gets(x);

    if(x[0]==x[1] && x[2]==x[3] && x[0]!=x[2])
        printf("Yes\n");
    else if(x[1]==x[2] && x[0]==x[3] && x[0]!=x[1])
        printf("Yes\n");
    else if(x[1]==x[3] && x[0]==x[2] && x[0]!=x[1])
        printf("Yes\n");
    else if(x[0]==x[3] && x[1]==x[2] && x[0]!=x[1])
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<deque>
#include<climits>
#include<complex>

using namespace std;
//-------------------------------------

#define ll long long
#define ull unsigned long long
#define sc(x) scanf("%lld",&x)
#define sc2(x,y) scanf("%lld%lld",&x,&y)
#define sci(x) scanf("%d",&x)
#define sci2(x,y) scanf("%d%d",&x,&y)

#define rep(i,a,n) for(int i=a;i<n;i++)
#define mem(x) memset(x,0,sizeof x)
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define inf 999999999999999
#define mkp(x,y) make_pair(x,y)
#define pii pair<ll,ll>
#define pb(x)  push_back(x);

//---------------------------------------

#define MX 200007

#define pi 2*acos(0.00)

#define open       freopen("input.txt","r",stdin)
#define close      freopen ("output.txt","w",stdout)


int main()
{
    ll i, j, l, u, v, w, x, y, z, a, b, c, d, e, f, t = 1, tc;
    ll flg, sz, cnt, gt, ans, mx, mn;
    ll m, k, n;
    ll low, hi, md, inp[MX], sm, ff;

    sc(n);
    n*=2;
    for(i=0;i<n;i++) sc(inp[i]);
    sort(inp,inp+n);
//    for(i=0;i<n;i++) cout<<inp[i]<<" ";cout<<endl;
    ans = 0;
    for(i=0;i<n;i+=2) ans+=inp[i];
    cout<<ans<<endl;





    return 0;

}
/*








*/



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

using namespace std;

using ll = long long;

// ModInt begin

constexpr int MOD = 1e9 + 7;

class ModInt {
private:
  int x;
    int inverse() const {
    int a = x, b = MOD, u = 1, v = 0;
    while (b) {
      auto t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return u;
  }

public:
  ModInt() = default;
  ModInt(ModInt &&) = default;
  ModInt &operator=(ModInt &&) = default;
  ModInt(const ModInt &) = default;
  ModInt &operator=(const ModInt &) = default;
  ~ModInt() = default;

  template <typename T> ModInt(T x) : x(((x % MOD) + MOD) % MOD) {}

  auto value() const { return x; }

  ModInt &operator+=(const ModInt &mx) {
    x = (x + mx.x) % MOD;
    return *this;
  }
  ModInt &operator-=(const ModInt &mx) {
    x = (x - mx.x + MOD) % MOD;
    return *this;
  }
  ModInt &operator*=(const ModInt &mx) {
    x = (int)((ll)x * mx.x % MOD);
    return *this;
  }
  ModInt &operator/=(const ModInt &mx) {
    x = (int)((ll)x * mx.inverse() % MOD);
    return *this;
  }
};

bool operator==(const ModInt &lhs, const ModInt &rhs) {
  return lhs.value() == rhs.value();
}
ModInt operator+(const ModInt &lhs, const ModInt &rhs) {
  return ModInt(lhs) += rhs;
}
ModInt operator-(const ModInt &lhs, const ModInt &rhs) {
  return ModInt(lhs) -= rhs;
}
ModInt operator*(const ModInt &lhs, const ModInt &rhs) {
  return ModInt(lhs) *= rhs;
}
ModInt operator/(const ModInt &lhs, const ModInt &rhs) {
  return ModInt(lhs) /= rhs;
}
ostream &operator<<(ostream &os, const ModInt &mx) { return os << mx.value(); }
istream &operator>>(istream &is, ModInt &mx) {
  ll x;
  is >> x;
  mx = ModInt(x);
  return is;
}

template <typename T> class CumulativeSum {
  std::vector<T> _sums;

public:
  CumulativeSum(const vector<T> &v) : _sums(v) {
    _sums.insert(_sums.begin(), 0);
    for (int i = 1; i < (int)_sums.size(); ++i) {
      _sums[i] += _sums[i - 1];
    }
  }

  // sum of [1, index]
  T sum(int index) { return _sums[index]; }

  // sum of [left, right)
  T sum(int left, int right) { return sum(right - 1) - sum(left - 1); }
};

using mInt = ModInt;

int main() {
  int n;
  cin >> n;
  vector<mInt> v(n, 1);
  for (int i = 0; i < n; ++i) {
    v[i] /= i + 1;
  }
  CumulativeSum<mInt> cs(v);
  mInt ans = 0;
  for (int i = 0; i < n; ++i) {
    mInt a;
    cin >> a;
    ans += (cs.sum(n - i) + cs.sum(i + 1) - mInt(1)) * a;
  }
  for (int i = 0; i < n; ++i) {
    ans *= mInt(i + 1);
  }
  cout << ans << endl;
}

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

int main () {
  int a,b,c;
  cin >> a >> b >> c;
  int sum = a+b+c;
  if(sum<22) {
    cout << "win" << endl;
  }
  else {
    cout << "bust" << endl;
  }
}


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};

const ll MAX = 1e15;
const double INF = 1e18;

double f(ll x){
    ll sum = 0, tmp = x;
    while(tmp > 0){
        sum += (tmp % 10);
        tmp /= 10;
    }
    return (double)x / (double)sum;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll k; cin >> k;
    double minf = INF;
    ll tens[15];
    tens[0] = 1;
    for(int i=1;i<15;i++) tens[i] = tens[i-1] * 10;
    ll lower = 0;
    for(int i=0;i<12;i++) lower += 9 * tens[i];
    vector<ll> snuke;
    for(ll d=15;d>=3;d--){
        // upper 3
        for(ll i=9;i>=1;i--){
            for(ll j=9;j>=0;j--){
                for(ll k=9;k>=0;k--){
                    ll val = lower;
                    val += i * tens[d-1];
                    val += j * tens[d-2];
                    val += k * tens[d-3];
                    if(f(val) <= minf){
                        minf = f(val);
                        snuke.push_back(val);
                    }
                }
            }
        }
        if(d > 3) lower -= 9 * tens[d-4];
    }
    // d = 2
    for(ll i=9;i>=1;i--){
        for(ll j=9;j>=0;j--){
            ll val = 0;
            val += i * tens[1];
            val += j * tens[0];
            // cout << val << " " << f(val) << " " << minf << endl;
            if(f(val) <= minf){
                minf = f(val);
                snuke.push_back(val);
            }
        }
    }
    // d = 1
    for(ll i=9;i>=1;i--){
        ll val = i * tens[0];
        snuke.push_back(val);
    }
    sort(snuke.begin(), snuke.end());
    for(int i=0;i<k;i++) cout << snuke[i] << endl;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, K; cin >> N >> K;
    string s; cin >> s;
    int ans=0;
    int uhnum=0;
    rep(i, N-1){
        if(s[i] == s[i+1]) ans++;
        else uhnum++;
    }

    rep(i, K){
        if(uhnum == 0) break;
        if(uhnum == 1){
            ans++;
            break;
        }
        uhnum -= 2;
        ans += 2;
    }

    cout << ans << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

N = int(input())
S = list(input())
Q = int(input())


alphabet = "abcdefghijklmnopqrstuvwxyz"

bag = { l:[] for l in alphabet}

for i in range(N):
  bag[S[i]].append(i+1)


import bisect

for _ in range(Q):
  t,a,b = input().split()
  a = int(a)
  if int(t) == 1:
    if S[a-1]!=b:
      bag[S[a-1]].remove(a)
      S[a-1] = b
      bisect.insort(bag[b],a)
  else:
    count = 0
    b = int(b)
    for l in alphabet:
      if len(bag[l])>0:
        left = bisect.bisect_left(bag[l],a)
        if left != len(bag[l]):
          if bag[l][left] <= b:
            count += 1
    print(count)


Measured memory_bytes: 105176
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200, mod = 1e9 + 7;

set <int> S;
vector <int> g;
int n, m, k;
int a[N], b[N], cnta[N], cntb[N];
string ss;

void bad(){
	cout << 0;
	exit(0);
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	map <int, int> A, B;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (A[a[i]]) bad();
		A[a[i]] = 1;
	}
	for (int i = 0; i < m; i++){
		cin >> b[i];
		if (B[b[i]]) bad();
		B[b[i]] = 1;
	}
	sort(b, b + m);
	sort(a, a + n);
	int res = 1;
	for (int i = n * m; i >= 1; i--){
		if (A[i] && B[i]){ res *= 1;}
		else if (A[i]){
			int l = 0, r = m - 1, ans = 0; 
			while (l <= r){
				int mid = (l + r) / 2;
				if (b[mid] >= i){
					ans = m - mid;
					r = mid - 1;
				}
				else{
					l = mid + 1;
				}
			}
			(res *= ans) %= mod;
		}
		else if (B[i]){
			int l = 0, r = n - 1, ans = 0; 
			while (l <= r){
				int mid = (l + r) / 2;
				if (a[mid] >= i){
					ans = n - mid;
					r = mid - 1;
				}
				else{
					l = mid + 1;
				}
			}
			(res *= ans) %= mod;
		}
		else{
			//cout << i << endl;
			int ansa = 1;
			int l = 0, r = m - 1, ans = 0; 
			while (l <= r){
				int mid = (l + r) / 2;
				if (b[mid] >= i){
					ans = m - mid;
					r = mid - 1;
				}
				else{
					l = mid + 1;
				}
			}
			ansa = ans;
			l = 0, r = n - 1, ans = 0; 
			while (l <= r){
				int mid = (l + r) / 2;
				if (a[mid] >= i){
					ans = n - mid;
					r = mid - 1;
				}
				else{
					l = mid + 1;
				}
			}
			(ansa *= ans) %= mod;
			ansa = (ansa + mod - (n*m-i)) % mod;
			(res *= ansa) %= mod;
		}
		//cout << i << " " << res << endl;
	}
	cout << res;
	return 0;
}












Measured memory_bytes: 129408
#include <stdio.h>

int main(void)
{
    int n;
    int a[1000];
    int i;
    float sum=0;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    for(i=0;i<n;i++){
        sum += 1.0/a[i];
    }
    printf("%f\n",1.0/sum);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	double r; cin >> r;
	double pi = 22.0 / 7.0;

	pi *= 2.0;
	pi *= r;

	cout << ps(pi, 3) << '\n';
	return 0;
}

Measured memory_bytes: 3820
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    string s, ans = "";
    long k;
    cin >> s >> k;
    for(int i = 0; i < s.length(); i++){
        if(k-1 == i){
            ans = s[i];
            break;
        }
        if(s[i] == '1') continue;
        else{
            ans = s[i];
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = []

for i in range(n):
    x, y = map(int, input().split())
    s.append([x + y, x - y])

t = sorted(s)
u = sorted(s, key=lambda x: x[1])
res = 0

tmp1 = t[-1][0] - t[0][0]
tmp2 = u[-1][1] - u[0][1]

print(max(tmp1, tmp2))


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

const int LIM = 100000;
int n, a[LIM], b[LIM], ans, num;

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    vector<int> deff(n);
    rep(i, n) deff[i] = a[i] - b[i];
    sort(deff.begin(), deff.end());

    int idx = deff.size() - 1;
    while (deff.size()) {
        if (deff[0] >= 0) break;
        if (abs(deff[0]) > num) {
            if (idx <= 0 || deff[idx] <= 0) {
                cout << -1 << endl;
                return 0;
            } else {
                num += deff[idx--];
                deff.pop_back();
                ans++;
            }
        } else {
            num -= abs(deff[0]);
            ans++;
            deff.erase(deff.begin());
            idx--;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<string, string> P;
const ll MOD = 1000000007LL;
int to[26];
int main() {
	string S, T;
	cin >> S >> T;
	memset(to, -1, sizeof(to));
	for (int i = 0; i < S.size(); i++) {
		if (to[S[i] - 'a'] == -1) {
			to[S[i] - 'a'] = T[i];
		}
		else if(to[S[i]-'a']!=T[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = 0; i < 26; i++) {
		if (to[i] == -1) continue;
		for (int j = i + 1; j < 26; j++) {
			if (to[i] == to[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

#define pb push_back
#define mp make_pair
#define mod 1000000007

long double ans = 0;

void f(long double n,long double d,long double x) {
    if(n == 0) return;

    ans += (2*d+(2*n-1)*x)/2;

    f(n-1, (2*d*(n+1)+5*x)/(2*n), (n+2)*x/n);
}

int main() {
    long double n,d,x;
    cin>>n>>d>>x;

    f(n,d,x);
    printf("%Lf", ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define n_l '\n'

#ifndef ONLINE_JUDGE
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#endif

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define forn(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef double db;
typedef vector<vi> vvi;
const ll mod=1000000007;
const ll N=200005; //check this
int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll powb(ll a,ll b) {ll res=1;a ; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    ll dis=abs(a-b);
    if(v*t>=w*t+dis)cout<<"YES";
    else cout<<"NO";
    
}


Measured memory_bytes: 3640
from collections import OrderedDict

cards = OrderedDict()
cards['S'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
cards['H'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
cards['C'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
cards['D'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

cardnow = int(input())
for j in range(cardnow):
    s,n = [i for i in input().split()]
    n = int(n)
    cards[s].remove(n)

for k,v in cards.items():
    for vv in v:
        print('{} {}'.format(k,vv))

Measured memory_bytes: 7948
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int N = 2*Integer.parseInt(br.readLine().trim());

		String[] s = new String[N];
		for (int i = 0 ; i < N ; i++) {
			s[i] = (new StringBuilder(br.readLine().trim())).reverse().toString();
		}
		for (int i = 0 ; i < N ; i+=2) {
			String A, B;
			if (s[i].length() < s[i+1].length()) {
				A = s[i+1]; B = s[i];
			} else {
				A = s[i]; B=s[i+1];
			}
			StringBuilder sb = new StringBuilder(B);
			for (int j = 0 ; j < A.length()-B.length() ; j++) sb.append("0");
			B = sb.append("0").toString();
			A = A + "0";

			int[] As = new int[A.length()], Bs = new int[A.length()];
			for (int j = 0 ; j < A.length() ; j++) {
				As[j] = A.charAt(j)-48; Bs[j] = B.charAt(j)-48;
			}

			for (int j = 0 ; j < A.length()-1 ; j++) {
				As[j] += Bs[j];
				if (As[j] > 9) {
					As[j] -= 10; As[j+1]++;
				}
			}

			sb = new StringBuilder();
			for (int j = 0 ; j < A.length() ; j++) sb.append((char)(As[j]+48));
			sb.reverse();
			if (sb.charAt(0) == '0') sb.deleteCharAt(0);
			String S = sb.toString();

			if (S.length() > 80) System.out.println("overflow");
			else System.out.println(""+sb.toString());

		}

	}
}

Measured memory_bytes: 16924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define OK cout<<"OK";
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    cout<<min({n,n%k,k-(n%k)});
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    print(n * (n+1) // 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){
  int n,p;
  while(1){
    cin >> n >> p;
    if(n == 0 && p == 0)break;
    int pmax = p;
    int s[50]={0};
    int i = 0;
    while(1){
      if(p>0){
	s[i]++;
	p--;
      }else if(p==0){
	p = s[i];
	s[i]=0;
      }

      if(s[i]==pmax)break;
      
      
      if(i == n-1){
	i = 0;
      }else{
	i++;
      }
      
    }
    cout << i << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a,b;
        a = sc.nextInt();
        b = sc.nextInt();
        if(a<b)System.out.println("a < b");
        else if(a>b)System.out.println("a > b");
        else System.out.println("a == b");
    }
}


Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
int main(){
  ll n;
  cin >> n;
  vector<ll> vec(n);
  ll sum = 0;
  rep(i,n){
    cin >> vec[i];
    sum += vec[i];
    sum %= mod;
  }
  ll ans = 0;
  rep(i,n){
    sum -= vec[i];
    sum += mod;
    sum %= mod;
    ans += sum * vec[i];
    ans %= mod;
  }
  cout << ans << endl;
}

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

using namespace std;

#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define FORD(i, m, n) for (int(i) = (m); (i) >= (n); (i)--)
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REP1(i, n) for (int(i) = 0; (i) <= (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

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

	int n,k;
	cin>>n>>k;
	int a[200001]={0};
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(i>k){
			if(a[i]>a[i-k])cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	}

	return 0;
}

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

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

int main() {
  int H,W; cin >> H >> W;
  string S[100];
  for ( int i = 0; i < H; i++ ) cin >> S[i];
  
  for ( int i = 0; i < H; i++ ) {
    for ( int j = 0; j < W; j++ ) {
      int cnt = 0;
      if ( S[i][j] == '#' ) continue;
      if ( S[i][j] == '.' ) {
	for ( int d = 0; d < 8; d++ ) {
	  int ni = i + dy[d];
	  int nj = j + dx[d];
	    if ( 0 <= ni && ni < H && 0 <= nj &&
		 nj < W && S[ni][nj] == '#'  ) cnt++;
	}
	S[i][j] = (char)cnt + '0';
      }
    }
  }

  for ( int i = 0; i < H; i++ ) {
    cout << S[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>



int main (){
    int X,N;
    std::cin >> X >> N;
    int p[N];
    for (int i=0;i<N;i++){
        std::cin >> p[i];
    }
    bool key =true,key_int=true;
    int x_minus=X,x_plus=X;
    for (int i=0;i<N;i++){
            if (X == p[i]){
                key_int =false;
            }
        }
    if(key_int){
        std::cout << X << std::endl;
        return 0;
    }
    while (key){
        bool goal=true, goal2=true;
        x_minus--;
        x_plus++;
        for (int i=0;i<N;i++){
            if (x_minus == p[i]){
                goal=false;
            }
        }
        if (goal){
            std::cout << x_minus << std::endl;
            return 0;
        }
        for (int i=0;i<N;i++){
            if(x_plus == p[i]){
                goal2=false;
            }
        }
        if (goal2){
            std::cout << x_plus << std::endl;
            return 0;
        }
    }

        

}






Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		
		while (k > 0) {
			if (a >= b)
				b *= 2;
			else if (b >= c)
				c *= 2;
			k--;
		}
		
		String ans = a < b && b < c ? "Yes" : "No";
		System.out.println(ans);
		
		sc.close();
	}
	
}



Measured memory_bytes: 27044
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)

typedef long long ll;

int main() {
    
    int N, result;
    bool flg = true;
    vector<int> A;
    
    cin >> N;
    
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        A.push_back(num);
    }

    while(flg) {
        for (int i = 0; i < A.size(); i++) {
            if (A.at(i) % 2 != 0) {
                flg = false;
                break;
            } else {
                A.at(i) /= 2;
            }
            if (i == A.size() - 1) {
                result++;
            }
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 if 4 in x:s='B'
 elif 4 in y:s='C'
 elif 1 in y:s='DF'[a[y.index(1)][x.index(2)]]
 elif 1 in x:s='GE'[a[y.index(2)][x.index(1)]]
 else:s='A'
 print(s)
 try:input()
 except:break


Measured memory_bytes: 5616
N,M = map(int, raw_input().split())
x = [0]*N
y = [0]*N
z = [0]*N
for i in range(N):
  x[i],y[i],z[i] = map(int, raw_input().split())

ans = -10000000000*N
for xs in [-1,1]:
  for ys in [-1,1]:
    for zs in [-1,1]:
      T = []
      for i in range(N):
        T += [[x[i]*xs+y[i]*ys+z[i]*zs, x[i]*xs, y[i]*ys, z[i]*zs]]
      T = sorted(T)[::-1]
      a = 0
      xt = 0
      yt = 0
      zt = 0
      for j in range(M):
        a += T[j][0]
        xt += T[j][1]
        yt += T[j][2]
        zt += T[j][3]
      if xt>=0 and yt>=0 and zt>=0:
        ans = max(ans, a)
print ans


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

using namespace std;

typedef long long ll;

template<typename T>
void _dump(const char* s, T&& head)
{
  cerr << s << "=" << head << endl;
}

template<typename T, typename... Args>
void _dump(const char* s, T&& head, Args&&... tail)
{
  while (*s != ',')
    cerr << *s++;
  cerr << "=" << head << ",";
  _dump(s + 1, tail...);
}

template<typename T>
void _dumpv(const char* s, T&& v)
{
  cerr << *s << "=";
  for (auto it = v.begin(); it != v.end(); it++) {
    cerr << *it << " ";
  }
  cerr << endl;
}

#ifdef LOCAL
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__)
#define dumpv(...) _dumpv(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#define dumpv(...)
#endif

const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("d.3", "r", stdin);

  int N, W;
  cin >> N >> W;
  vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));
  vector<ll> weight(N + 1);
  vector<ll> value(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> weight[i] >> value[i];
  }
  // for (int i = 1; i <= N; i++) {
  //   for (int w = 0; w <= W; w++) {
  //     if (weight[i] <= w) {
  //       dp[i][w] = max(dp[i - 1][w - weight[i]] + value[i], dp[i - 1][w]);
  //     } else {
  //       dp[i][w] = dp[i - 1][w];
  //     }
  //   }
  // }
  for (int i = 1; i <= N; i++) {
    for (int w = W; 0 <= w; w--) {
      if (weight[i] <= w) {
        dp[0][w] = max(dp[0][w - weight[i]] + value[i], dp[0][w]);
      } else {
        // dp[0][w] = dp[i - 1][w];
      }
    }
  }
  dumpv(dp[0]);
  cout << dp[0][W] << endl;
  return 0;
}


Measured memory_bytes: 80256
#include<stdio.h>

int main()
{
    int H, W, n, i, j;

    for(n = 0; ; n++)
    {
        scanf("%d %d", &H, &W);

        if(H == 0 && W == 0)
        {
            break;
        }

        for(i = 1; i <= H; i++)
        {
            for(j = 1; j <= W; j++)
            {
                if( ( i + j) % 2 == 0)
                {
                    printf("#");
                }

                else
                {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");

    }

    return 0;
}


Measured memory_bytes: 2104
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  ll n, m, v, p;
  cin >> n >> m >> v >> p;
  vector<ll> a(n), sum(n + 1);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < n; ++i)
    sum[i + 1] = sum[i] + a[i];

  ll ans = p;
  for (int i = n - 1; i >= p; --i) {
    bool possible = false;
    ll maxa = a[i] + m;
    if (maxa < a[p - 1])
      continue;
    if (v <= p)
      possible = true;
    else {
      ll maxv =
          p * m + (n - i - 1) * m + maxa * (i - p + 1) - (sum[i] - sum[p - 1]);
      if (maxv >= v * m)
        possible = true;
    }
    if (possible) {
      ans = i + 1;
      break;
    }
  }
  cout << ans;
}

Measured memory_bytes: 1792
import collections
H,W=map(int,input().split())
table=[list(input()) for _ in range(H)]
ch=[]
for i in range(H):
    for j in range(W):
        ch.append(table[i][j])
c=collections.Counter(ch)
values=list(c.values())	#aのCollectionのvalue値のリスト(n_1こ、n_2こ…)
key=list(c.keys())	#先のvalue値に相当する要素のリスト(要素1,要素2,…)
count4=0
count2=0
count1=0
for i in values:
    if i%4==0:
        count4=count4+1
    elif i%2==0:
        count2=count2+1
    else:
        count1=count1+1
if (H%2==0)and(W%2==0):
    if count2+count1==0:
        print("Yes")
    else:
        print("No")
elif (H%2==1)and(W%2==1):
    if (count2<=((H+W-2)//2))and(count1==1):
        print("Yes")
    else:
        print("No")
else:
    if H%2==0:
        nu=H//2
    else:
        nu=W//2
    if (count2<=nu)and(count1==0):
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 39280
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
int k;

int main(){
    scanf("%d%d" , &n , &k);
    int xr = 0;
    for(int i = 1; i < (1 << n); i++){
        if(i == k)
            continue;
        xr ^= i;
    }
    if(k == 0){
        for(int i = 0; i < (1 << n); i++){
            printf("%d %d " , i , i);
        }
        return 0;
    } else if(n >= 2 && xr == k){
        printf("%d " , k);
        for(int i = (1 << n) - 1; i >= 0; i--){
            if(i == k)
                continue;
            printf("%d " , i);
        }
        printf("%d " , k);
        for(int i = 0; i < (1 << n); i++){
            if(i == k)
                continue;
            printf("%d " , i);
        }
        puts("");
        return 0;
    }
    puts("-1");
}


Measured memory_bytes: 1792
<?php
 fscanf(STDIN,"%d%d%d",$a,$b,$k);

   if($a<$k){
     $tmp_a = $a;
     $a = 0;
     $k -= $tmp_a;
   }else{
     $tmp_a = $a;
     $a -= $k;
     $k = 0;
   }

   if($b<$k){
     $tmp_b = $b;
     $b = 0;
     $k -= $tmp_b;
   }else{
     $tmp_b = $b;
     $b -= $k;
   }

echo $a." ".$b;
 
     
     
 

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  if (k % 2 == 0) {
    cout << (k / 2) * (k / 2) << endl;
  } else {
    cout << (k / 2) * (k / 2 + 1) << endl;
  }
}

Measured memory_bytes: 3612
# include <iostream>
# include <vector>
# include <limits>
# include <algorithm>
# include <map>
# include <string>
# include <functional>
int main() {
	int n;
	while (std::cin >> n&&n != 0) {
		std::vector<std::pair<int, int>> is;
		int a, b;
		for (int i = 0; i < n; i++) {
			std::cin >> a >> b;
			is.emplace_back(b, a);
		}
		std::sort(is.begin(), is.end());
		int tr = 0;
		for (int i = 0; i < n; i++) {
			tr += is[i].second;
			if (tr > is[i].first) {
				std::cout << "No" << std::endl;
				break;
			}
			if (i == n - 1) {
				std::cout << "Yes" << std::endl;
			}
		}
	}
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
template<class T>using numr=std::numeric_limits<T>;
template<std::size_t Idx, class Container, class Value = std::tuple_element_t<Idx, typename Container::value_type>>
auto project(Container const& container)
{
    std::vector<Value> ans(container.size());
    std::transform(ALL(container), ans.begin(), [](auto&& tuple){ return std::get<Idx>(tuple);});
    return ans;
}
auto cmx=[](auto&x,auto y){if(x<y)x=y;};
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::pair<lint,lint>>ai(n);
    for(lint i=0;i<n;i++){
        lint x;std::cin>>x;
        ai.at(i)={x,i};
    }
    std::sort(ALL(ai));
    auto a=project<0>(ai);
    auto ord=project<1>(ai);
    std::vector<std::vector<lint>>dp(n+1,std::vector<lint>(n+1,0));
    for(lint d=n;d>=1;d--){
        for(lint l=0;l<=n-d;l++){
            lint r=l+d;
            lint x=dp.at(l).at(r),y=a.at(d-1),j=ord.at(d-1);
            cmx(dp.at(l+1).at(r),x+y*std::abs(l-j));
            cmx(dp.at(l).at(r-1),x+y*std::abs(r-1-j));
        }
    }
    lint ans=0;
    for(lint i=0;i<=n;i++)cmx(ans,dp.at(i).at(i));
    std::cout<<ans<<'\n';
}


Measured memory_bytes: 34604
#include <bits/stdc++.h>
#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)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 1050

vector<int> G[MAX_N];
vector<int> ans[MAX_N];

int main() {
    int n,m; cin >> n >> m;
    rep(i,m){
        int a,b; cin >> a >> b;
        G[a].push_back(b);
    }

    
    int ans_flag = 0;

    srep(i,1,n+1){
        int par[n+1] = {};
        par[i] = -1;
        queue<int> que;
        que.push(i);
        while(que.size()>0){
            int x = que.front(); que.pop();
            rep(j,G[x].size()){
                if(G[x][j] == i){
                    ans_flag = i;
                    ans[i].push_back(x);
                    int y = x;
                    while(true){
                        y = par[y];
                        ans[i].push_back(y);
                        if(y == i)break;
                    }
                    
                    
                }
                if(ans_flag == i)break;
    
                if(par[G[x][j]] == 0){
                    par[G[x][j]] = x;
                    que.push(G[x][j]);
                }
            }
            if(ans_flag == i)break;
        }
    }

    if(ans_flag == 0){
        cout << "-1" << endl;
        return 0;
    }

    int mi = 99999999;
    int ar = 0;
    srep(i,1,n+1){
        if(ans[i].size() > 0 && ans[i].size() < mi){
            mi = ans[i].size();
            ar = i;
        }
    }

    cout << mi << endl;
    rep(ite,ans[ar].size()){
        cout << ans[ar][ite] << endl;
    }

    return 0;
}
 
 


Measured memory_bytes: 4352
while 1:
    n, m = map(int, input().split())
    if n == 0:
        break
    a = []
    for _ in range(m):
        a.append(list(map(int, input().split())))
    b = []
    for i in range(n):
        s = 0
        for j in range(m):
            s += a[j][i]
        b.append(s)
    print(max(b))


Measured memory_bytes: 7556
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#include<iomanip>

int main() {
	int n, k;
	cin >> n >> k;
	double ans(0);
	int omote = 1;
	int t = 1;
	int cnt(0);
	
	while (1) {
		t *= 2;
		cnt++;
		if (t >= k) {
			break;
		}
	}
	omote = cnt;
	for (int i = 1; i <= n; ++i) {
		if (i * pow(2, omote - 1) >= k)omote -= 1;
		if (omote <= 0)omote = 0;
		ans += 1.0 / double(n) * pow(0.5, omote);
		
	}
	cout << fixed <<setprecision(12) << ans;
	return 0;
}

Measured memory_bytes: 4116
import collections as col

n = int(input())

s = []

for i in range(n):
    s.append(input())
    
x = col.Counter(s)

m = 0

x = x.most_common()

ans = []

for i in x:
    if i[1]<m:
        break
    else:
        ans.append(i[0])
        m = i[1]
        
ans.sort()

for i in ans:
    print(i)

Measured memory_bytes: 49404
n = int(input())
a = [int(x) for x in input().split()]

a.sort()
if(a[0]==0):
    print(0)
    exit(0)

ans = 1
MX = 10**18
for x in a:
    ans *= x
    if ans > MX:
        print(-1)
        exit(0)

print(ans)



Measured memory_bytes: 85140
#include <iostream>

using namespace std;

int main(){
	while(true){
		int n, p;
		cin >> n >> p;
		if(n == 0 && p == 0){ break; }
		int answer = 0, q = p, stones[50] = { 0 };
		while(true){
			if(q > 0){
				if(++stones[answer] == p){ break; }
				--q;
			}else{
				q = stones[answer];
				stones[answer] = 0;
			}
			answer = (answer + 1) % n;
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 864