akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		cout << "Case " << i+1 << ":" << endl;
		for (int j = 0; j < 10; j++) {
			string s;
			x *= x;
			string t = to_string(x);
			for (int k = 0; k < 8 - t.length(); k++) {
				s += '0';
			}
			s += t;
			x = stoi(s.substr(2, 4));
			cout << x << endl;

		}
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    int n;cin>>n;
    vector<string>s(n);
    vector<int>ans(27);
    rep(i,n){
        cin>>s[i];
    }
    string first=s[0];
    rep(i,(int)first.size()){
        ans[first[i]-'a']++;
    }
    for(int i=1;i<n;i++){
        string now=s[i];
        vector<int>tmp(27);
        rep(j,(int)now.size()){
            tmp[now[j]-'a']++;
        }
        rep(k,27){
            if(tmp[k]){
                if(ans[k]>tmp[k]){
                    ans[k]=tmp[k];
                }
            }else{
                ans[k]=0;
            }
        }
    }
    rep(i,27){
        if(ans[i]){
            rep(j,ans[i]){
                printf("%c",'a'+i);
            }
        }
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int DP1[200005], DP2[200005];
int DP[200005];

int main() {
  int N;
  string X;
  cin>>N>>X;
  int num=0;
  for(int i=0;i<N;++i) {
    if(X[i]=='1') num++;
  }
  if(num==0) {
    for(int i=0;i<N;++i) {
      cout<<1<<endl;
    }
    return 0;
  }
  if(num==1) {
    for(int i=0;i<N;++i) {
      if(X[i]=='1') cout<<0<<endl;
      else {
        if(i==N-1) cout<<2<<endl;
        else {
          if(X[N-1]=='1') cout<<2<<endl;
          else cout<<1<<endl;
        }
      }
    }
    return 0;
  }
  if(X[N-1]=='1') {
    DP1[N-1] = 1%(num+1);
    DP2[N-1] = 1%(num-1);
  }
  int two1=1, two2=1;
  for(int i=N-2;i>=0;--i) {
    two1 *= 2;
    two1 %= num+1;
    two2 *= 2;
    two2 %= num-1;
    if(X[i]=='1') {
      DP1[i] = (DP1[i+1]+two1)%(num+1);
      DP2[i] = (DP2[i+1]+two2)%(num-1);
    }
    else {
      DP1[i] = DP1[i+1];
      DP2[i] = DP2[i+1];
    }
  }
  int ans[N];
  two1 = 1;
  two2 = 1;
  for(int i=N-1;i>=0;--i) {
    if(X[i]=='1') {
      ans[i] = (DP2[0]-two2+(num-1))%(num-1);
    }
    else {
      ans[i] = (DP1[0]+two1)%(num+1);
    }
    two1 *= 2;
    two1 %= num+1;
    two2 *= 2;
    two2 %= num-1;
  }
  int tmp;
  for(int i=1;i<200005;++i) {
    num = 0;
    for(int j=0;j<30;++j) {
      if((i&(1<<j))!=0) num++;
    }
    DP[i] = 1+DP[i%num];
  }
  for(int i=0;i<N;++i) {
    cout<<1+DP[ans[i]]<<endl;
  }
}



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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
int main() {
  int n,m ; cin>>n>>m;
  vector<int>vec[100001];
  rep(i,n){
    int a,b; cin>>a>>b;
    vec[a].push_back(b);
  } 
  ll ans=0;
  priority_queue<int>pq;
  for(int i=1; i<=m; i++){
    for(auto t:vec[i]){
      pq.push(t);
    }
      if(!pq.empty()){
        ans+=pq.top();
        pq.pop();
      }
    
  }    
  cout<<ans<<endl; 
}


Measured memory_bytes: 5632
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a == b:
    print('YES')
elif v <= w:
    print('NO')
else:
    if t < abs(a - b) / (v - w):
        print('NO')
    else:
        print('YES')

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n;
    Problem(LL n):n(n){};

    void solve(){

    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0,m;
    cin >> n >> m;
    if(abs(n-m)<=1)cout <<"Brown" <<"\n";
    else cout << "Alice" <<"\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P 1000000007
#define ll long long
#define ld long double
#define N (1<<17)
#define pii pair<int, int>
#define F first
#define S second

using namespace std;

int n, h[3030];
ll d[3030][3030], s;

ll dp(int a, int b, bool t){
	if(a>b) return 0;
	if(d[a][b]) return d[a][b];

	if(t){
		d[a][b] = max(dp(a+1, b, 0)+h[a], dp(a, b-1, 0)+h[b]);
	} else {
		d[a][b] = min(dp(a+1, b, 1), dp(a, b-1, 1));
	}

	return d[a][b];

}

int main(){

	cin >> n;

	for(int i=0; i<n; i++){
		cin >> h[i];
		s += h[i];
	}

	ll x = dp(0, n-1, 1);

	cout << 2*x-s << endl;

	return 0;

}


Measured memory_bytes: 72064
#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 TRACE(x) cerr << #x << " " << x << endl
#define TRACE(x)
#define eb emplace_back
#define _ << " " <<
typedef long long ll;
typedef std::pair<int, int> ii;
#define X first
#define Y second
#define double long double
typedef double db;
using namespace std;

const int MaxN = 200100;
const int Mod = 1e9 + 7;

int N;
int a[MaxN];
ll p[MaxN];

ll sum(int x, int y) { //[]
  return p[y + 1] - p[x];
}

pair<pair <ll, ll>, pair <ll, ll>> bin(int first, int last) {
 
  TRACE(first _ last _ sum(first, last));
  ll target = sum(first, last);
  int lo = first + 1, hi = last;

  while (lo < hi) {
    int mid = (lo + hi) / 2;
   
    // prvo vece
    if (sum(first, mid - 1) * 2 < target) {
      lo = mid + 1;
    }
    else {
      hi = mid;
    }
  }

  ll x = sum(first, lo - 1);
  ll y = sum(lo, last);
  if (lo > first + 1) {
    ll x1 = sum(first, lo - 2);
    ll y1 = sum(lo - 1, last);
 //   if (abs(x1 - y1) < abs(x - y)) {
 //     x = y1;
 //     y = x1;
 //   }
    return {{x, y}, {y1, x1}};
  }

  assert(x + y == target);
  assert(x > 0 && y > 0);
  
  TRACE(x _ y);
  return {{x, y}, {x, y}};
}

void solve() {
  
  ll ret = (ll)Mod * (ll)Mod;
  for (int z = 2; z < N - 1; z++) { 
    auto PP = bin(0, z - 1);
    auto QQ = bin(z, N - 1);

    auto P = PP.first; 
    auto Q = QQ.first;
    ret = min(ret, max(max(P.first, P.second), max(Q.first, Q.second)) - min(min(P.first, P.second), min(Q.first, Q.second))); 
 
    P = PP.second, Q = QQ.first;
    ret = min(ret, max(max(P.first, P.second), max(Q.first, Q.second)) - min(min(P.first, P.second), min(Q.first, Q.second)));
 
    P = PP.first, Q = QQ.second;
    ret = min(ret, max(max(P.first, P.second), max(Q.first, Q.second)) - min(min(P.first, P.second), min(Q.first, Q.second)));
 
    P = PP.second, Q = QQ.second;
    ret = min(ret, max(max(P.first, P.second), max(Q.first, Q.second)) - min(min(P.first, P.second), min(Q.first, Q.second)));
 

  }

  cout << ret;
}

void load() {
  cin >> N;
  REP(i, N) {
    cin>>a[i];
    p[i + 1] = p[i] + a[i];
    TRACE(p[i + 1]);
  }
}

int main(){
 ios_base::sync_with_stdio(false);
  load();	
  solve();
  return 0;
}



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

int main(){
    typedef pair<int, int> P;
    int n,m;
    cin >> n >> m;
    int x,y;
    vector<P> a(m);
    for (int i = 0; i<m; i++){
        cin >> x >> y;
        a[i] = {x, y};
    }
    sort(a.begin(), a.end());
    int ans = 0;
    int right = 0;
    for (int i = 0; i<m; i++){
        x = a[i].first;
        y = a[i].second;
        if (right < x){
            ans++;
            right = y-1;
        }
        else right = min(right, y-1);
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
n,a,b = gets.chomp.split.map(&:to_i)
ans = 0

for i in 1..n
    x = i%10 + (i/10)%10 + (i/100)%10 + (i/1000)%10 + (i/10000)%10
    ans += i if a <= x && x <= b
end

p ans

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];

  long double div = 0;
  rep(i, N)
  {
    div += 1 / (long double)A[i];
  }

  cout << std::fixed << std::setprecision(10) << 1 / div << endl;

  return 0;
}


Measured memory_bytes: 3696
import itertools
import math
import fractions
import functools
import copy

n = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(1,n-1):
    if min([p[i-1],p[i],p[i+1]]) != p[i] and max([p[i-1],p[i],p[i+1]]) != p[i]:
        count += 1

print(count)

Measured memory_bytes: 66156
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int aI, aO, aT, aJ, aL, aS, aZ;
    cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ;

    int ret = 0;
    ret += aO;

    ret += (aI / 2) * 2;
    ret += (aJ / 2) * 2;
    ret += (aL / 2) * 2;

    int odd_cnt = 0;
    if (aI % 2 == 1) odd_cnt++;
    if (aJ % 2 == 1) odd_cnt++;
    if (aL % 2 == 1) odd_cnt++;

    if (odd_cnt == 3) {
        ret += 3;
    } else if (aI > 0 && aJ > 0 && aL > 0 && odd_cnt == 2) {
        ret += 1;
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

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

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}



int main()
{
	ll r;
	cin>>r;
	cout<<setprecision(20)<<2*pi*r;
}


Measured memory_bytes: 15472
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
	cin.tie(NULL);
	set<string> s;
	int n;
	string a,b;
	cin>>n;
	while(n--){
        cin>>a>>b;
        if(a=="insert"){
            s.insert(b);
        }else {
            if(s.count(b)){
                cout<<"yes\n";
            }else{
                cout<<"no\n";
            }
        }
	}
    return 0;
}



Measured memory_bytes: 29812
#include <bits/stdc++.h>
using namespace std;
int main() {
    double r;
    scanf("%lf" ,&r);
    double area = 3.141592653589 *r*r;
    double circ = 3.141592653589*2*r;
    printf("%f %f\n",area,circ);
    
}


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

using namespace std;

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

	int n; cin >> n;
	long long a[200005];
	vector<long long> sum;
	sum.push_back(0);

	for (int i = 0;i < n;i++){
		cin >> a[i];
		sum.push_back(sum[i]+a[i]);
	}

	sort(sum.begin(),sum.end());

	//cout << sum[n] << endl;

	long long flag = 0;
	long long cnt = 0;
	long long ans = 0;

	for (int i = 0;i < n;i++){
		if(sum[i] == sum[i+1]) {
			flag++;
			cnt += flag;
		}else{
			flag = 0;
			ans += cnt;
			cnt = 0;
		}
	}	

	ans += cnt;

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

class UnionFind {
public:
	vector<int> par;//親の番号
    vector<int> rank;//木の深さ
 
	UnionFind(int n){//全ての要素に対して自身が根となるように初期化, 木の深さは0になる
		rep(i,n){
            par.push_back(i);
            rank.push_back(0);
        }
	}
 
	int find(int x) {//木の根を求める
		if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
	}
 
	void unite(int x,int y){//xとyの属する集合を併合
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]){//木の深さが小さい方を大きい方へ繋げる
            par[x]=y;
        }else{
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(int x,int y){//xとyが同じ集合に属するか否か
        return find(x)==find(y);
    }
};
//x以下の要素への最小index, ソートしてから使ってね
template <class T> 
int former(const vector<T> &v, T x){
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> 
int latter(const vector<T> &v, T x){
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
template <class T>
T comb(T n,T k){
    T ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}
//素因数分解
template <class T>
map<T,T> prime_factor(T x){
    map<T,T> ans;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            ans[i]++;
        }
    }
    if (x!=1){
        ans[x]=1;
    }
    return ans;
}
//約数列挙
template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            res.push_back(i);
            if(i!=x/i){
                res.push_back(x/i);
            }
        }
    }
    return res;
}
//素数判定
template <class T>
bool is_prime(T x){
    for(T i=2;i*i<=x;i++){
        if(x%i==0){
            return false;
        }
    }
    return x!=1;
}

const ll inf=1e9+7;

ll mult(ll n,ll m){//n^m%infを求める
    if(m==1){
        return n%inf;
    }else if(m%2==0){//オーバーフロー防止のためにn^(m/2)*n^(m/2)を考える
        ll t=mult(n,m/2);
        return (t*t)%inf;
    }else{//奇数の時はn^(m-1)*nを考える
        ll t=mult(n,m-1);
        return (t*n)%inf;
    }
}

typedef pair<int,int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a;
    cin>>n>>a;
    n-=(n/500)*500;
    if(n>a){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
#define dbg3(x) cerr<<#x<<"\n"
using namespace std;
#define reg register
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
const int MN=2005,inf=1e9+5;
int N,K,Q;
int id[MN],a[MN];
bool cmp(int x,int y){return a[x]<a[y];}
int bel[MN],len[MN],cnt,bl;bool in[MN];
int solve(int pos)
{
    memset(in,0,sizeof in);
    cnt=bl=0;reg int i,j,k;
    for(i=1;i<=N;++i)
    {
        for(;i<=N&&a[i]<a[pos];++i);
        for(j=i;j<=N&&a[j]>=a[pos];++j);--j;//因为--j Wa了5次
        for(len[++bl]=j-i+1,k=i;k<=j;++k)
            bel[k]=bl,in[k]=true;
        i=j;
    }
    for(i=1;i<=N;++i)if(in[id[i]]&&len[bel[id[i]]]>=K)
    {
        --len[bel[id[i]]];
        if(++cnt==Q)return a[id[i]]-a[pos];
    }
    return inf;
}
int main()
{
    N=read();K=read();Q=read();
    reg int i;
    for(i=1;i<=N;++i)a[id[i]=i]=read();
    sort(id+1,id+N+1,cmp);
    int ans=inf;
    for(i=1;i<=N;++i) ans=min(ans,solve(i));
    return 0*printf("%d\n",ans);
}

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

int main() {
  int x;
  cin >> x;
  for (int64_t a = 0; a <= 1000; a++) {
    for (int64_t b = -1000; b <= 1000; b++) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int N=1e6+5;
const long long INF = 1e6;
const int mod=998244353;
int n,a[200005],b[200005];
struct ev{int a,b,idx;};
ev v[200005];
bool cmp(ev a,ev b)
{
    return a.a<b.a;
}
bool cmp2(ev a,ev b)
{
    return a.b>b.b;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i].a>>v[i].b;
        v[i].idx=i;

    }
    sort(v+1,v+n+1,cmp);
    if(n%2==1)
    {
        int maxmin=INT_MAX;
        maxmin=v[n/2+1].a;
        int minimax=INT_MAX;
       sort(v+1,v+n+1,cmp2);
       minimax=v[n/2+1].b;
       cout<<minimax-maxmin+1<<'\n';
    }
    else
    {
        int maxmin1=v[n/2].a;
        int maxmin2=v[n/2+1].a;
        sort(v+1,v+n+1,cmp2);
        int minimax1=v[n/2].b;
        int minimax2=v[n/2+1].b;
        int ans=minimax1+minimax2-maxmin1-maxmin2+1;
        cout<<ans<<'\n';


    }




}


Measured memory_bytes: 5992
#include <cstdio>
#include <cstdlib>
#include <cstring>

typedef struct elem {
    elem *prev;
    int key;
    elem *next;
} Elem;

typedef struct {
    Elem *nil;
} DL;

Elem *initElem(int x) {
    Elem *elem = (Elem *)malloc(sizeof(Elem));
    elem->key = x;
    elem->prev = elem->next = elem;
    return elem;
}

DL initialize() {
    DL dl;
    dl.nil = initElem(-1);
    return dl;
}

void printDL(DL *dl) {
    Elem *e = dl->nil->next;
    while (1) {
        printf("%d", e->key);
        e = e->next;
        if ( e == dl->nil ) {
            break;
        } else {
            printf(" ");
        }
    }
    printf("\n");
}

void insert(DL *dl, int x) {
    Elem *e = initElem(x);
    e->next = dl->nil->next;
    dl->nil->next->prev = e;
    dl->nil->next = e;
    e->prev = dl->nil;
}

Elem *dlSearch(DL *dl, int x) {
    Elem *e = dl->nil->next;
    while (dl->nil != e->next && e->key != x) {
        e = e->next;
    }
    return e;
}

void deleteElem(DL *dl, int x) {
    Elem *e = dlSearch(dl, x);
    if (e->key != dl->nil->key && e->key == x) {
        e->prev->next = e->next;
        e->next->prev = e->prev;
        free(e);
    }
}

void deleteFirst(DL *dl) {
    Elem *e = dl->nil->next;
    dl->nil->next = e->next;
    e->next->prev = dl->nil;
    free(e);
}

void deleteLast(DL *dl) {
    Elem *e = dl->nil->prev;
    dl->nil->prev = e->prev;
    e->prev->next = dl->nil;
    free(e);
}

int main()
{
    int n;
    DL dl = initialize();
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        char command[20]; int x;
        scanf("%s %d", command, &x);
        if (strcmp(command, "insert") == 0) {
            insert(&dl, x);
        }
        else if (strcmp(command, "delete") == 0) {
            deleteElem(&dl, x);
        }
        else if (strcmp(command, "deleteFirst") == 0) {
            deleteFirst(&dl);
        }
        else if (strcmp(command, "deleteLast") == 0) {
            deleteLast(&dl);
        }
    }
    printDL(&dl);

    return 0;
}

Measured memory_bytes: 32216
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

int main()
{
	string S;
	cin >> S;
	int N = S.length();
	vector<vector<bool>> change_history(100, vector<bool>(N, false));
	vector<int> change_count(100, 0);
	ll K;
	cin >> K;
	ll ans = 0;
	char last = '\0';
	bool shortcut_enabled = true;
	for(ll j = 0; j < K; j ++)
	{
		// ll count = 0;
		rep(i, N)
		{
			auto && c = S[i];
			bool is_same = c == last;
			if (is_same)
			{
				// count++;
				if (shortcut_enabled)
				{
					change_count[j]++;
				}
				ans++;
				last = '\0';
			}
			else
			{
				last = c;
			}

			change_history[j][i] = is_same;
		}

		if (shortcut_enabled)
		{
			for(ll k = 0; k < j; k++)
			{
				bool is_equal = true;
				rep(i, N)
				{
					if (change_history[k][i] != change_history[j][i])
					{
						is_equal = false;
						break;
					}
				}
				if (is_equal)
				{
					ll change_total = 0;
					for (ll m = k; m < j; m++)
					{
						change_total += change_count[m];
					}
					// k ... j までの j - k 個
					ll loop = j - k;
					// 残りのループ数
					ll loop_num = ((K-j-1) / loop);
					// 残りのループ数のあまり
					ll loop_mod = ((K - j - 1) % loop);

					ans += loop_num * change_total;

					for (ll p = 0; p < loop_mod; p++)
					{
						ans += change_count[(p + j + 1) % loop];
					}

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define Check system("pause")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)



int main()
{
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	for(int i=0;i<3;i++)
	cout<<s[i];
	return 0;
}




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

#define ll long long
#define pb push_back
#define INF 1'000'000'007
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

vector<bool> visited;
vector<ll> ans;

void dfs(ll v,vector<ll> adj[]) {
    visited[v] = true;
    for (ll u : adj[v]) {
        if (!visited[u])
            dfs(u,adj);
    }
    ans.push_back(v);
}

void topological_sort(vector<ll> adj[],ll n) {
    visited.assign(n+1, false);
    ans.clear();
    for (ll i = 1; i <= n; ++i) {
        if (!visited[i])
            dfs(i,adj);
    }
    reverse(ans.begin(), ans.end());
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	ll n,m;
	cin>>n>>m;
	vector<ll> G[n+1];
	ll u,v;
	while(m--){
		cin>>u>>v;
		G[u].pb(v);
	}

	topological_sort(G,n);
	ll dp[n+1]={0};
	for(auto i:ans){
		for(auto j:G[i]){
			dp[j]=max(dp[j],dp[i]+1);
		}
	}
	// for(auto i:ans){
	// 	test1(i)
	// }
	ll mx=0;
	rep(i,1,n+1){
		mx=max(mx,dp[i]);
	}
	cout<<mx;
	
	
	return 0;
}

Measured memory_bytes: 12604
a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.split(",")
print(a[int(input())-1])

Measured memory_bytes: 2940
n, k = map(int, input().split())
p = list(map(int, input().split()))

psum = [0]
for i in range(n):
    psum.append(psum[-1] + p[i])

ans = [psum[k+i] - psum[i] for i in range(n-k+1)]
print((max(ans)+k) / 2)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

int yote[1001];
int hose[1001];

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

	ll n;
	cin >> n;
	int a[1001][1001];
	rep(i, n)
	{
		rep(j, n - 1)
		{
			cin >> a[i][j];
		}
	}

	ll day = 0;
	bool flag = false;
	//	vector<vector<ll>> yote(n, vector<ll>(n - 1, 0));

	int hantei = 0;
	for (int j = n - 2; j >= 0;)
	{
		flag = false;
		for (int i = 0; i < n; i++)
		{
			if (j - hose[i] < 0)
			{
				continue;
			}

			yote[i] = a[i][j - hose[i]];

			if (yote[a[i][j - hose[i]]-1] == i + 1)
			{
				hose[a[i][j - hose[i]]-1]++;
				hose[i]++;

				flag = true;
			}
		}
		if (!flag)
			break;

		day++;
		for (int i = 0; i < n; i++)
		{
			yote[i] = 0;
			if (hose[i] >= n - 1)
				hantei++;
		}
		if (hantei == n)
			break;
		hantei = 0;
	}

	if (flag)
	{
		cout << day << endl;
	}
	else
	{
		cout << -1 << endl;
	}

}


Measured memory_bytes: 4224
n = int(input())
a = list(map(int, input().split()))
c1 = c2 = c3 = c4 = c5 = c6 = c7 = c8 = c9 = 0
for i in range(n):
    if 1 <= a[i] < 400:
        c1 = 1
    elif 400 <= a[i] < 800:
        c2 = 1
    elif 800 <= a[i] < 1200:
        c3 = 1
    elif 1200 <= a[i] < 1600:
        c4 = 1
    elif 1600 <= a[i] < 2000:
        c5 = 1
    elif 2000 <= a[i] < 2400:
        c6 = 1
    elif 2400 <= a[i] < 2800:
        c7 = 1
    elif 2800 <= a[i] < 3200:
        c8 = 1
    else:
        c9 += 1
print(max(1, c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8),
      c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9)


Measured memory_bytes: 3064
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const int MAX_N=pow(2,18)+2;

int main(){
    vector<int>x(5);
    REP(i,5)cin>>x[i];
    REP(i,5){
        if(x[i]==0){
            cout<<i+1<<endl;return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
const char endk = '\n';
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //const ll mod = 1e9 + 7;
    //const ll mod = 998244353;

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

	ll ans = a[n - 1];
	priority_queue<vector<ll>> pq;
	pq.push({a[n - 2], a[n - 1]});
	pq.push({a[n - 2], a[n - 1]});
	for (ll i = n - 3; i >= 0; i--) {
		ans += pq.top()[0];
		vector<ll> v = pq.top(); pq.pop();
		pq.push({a[i], v[0]});
		pq.push({a[i], v[1]});
	}
	cout << ans << endl;
}

Measured memory_bytes: 15764
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair 
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII; 
const double eps = 1e-9;
const double PI = acos(-1);
const LL INFF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;
const int MAX = 1e5+7;
int main(void){
	string s; cin >> s;
	LL v; cin >> v;
	int l = s.length();
	for(LL i = 0; i < l; i += v) printf("%c", s[i]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
source:
    ll n;
    cin >> n;

    ll a[n];
    rep(i, n) { cin >> a[i]; }

    rep(i, n) {
        if (a[i] % 2 == 1) {
            continue;
        }
        if (a[i] % 3 != 0 && a[i] % 5 != 0) {
            cout << "DENIED" << endl;
            return 0;
        }
    }

    cout << "APPROVED" << endl;

    return 0;
}



Measured memory_bytes: 256
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[] numArray = new int[Integer.parseInt(br.readLine())];
		for (int i = 0; i < numArray.length; i++) {
			numArray[i] = Integer.parseInt(br.readLine());
		}

		// ?卒???属???????????????
		int count = 0;
		boolean isPrime = false;
		for (int i = 0; i < numArray.length; i++) {
			if (numArray[i] == 1) {
				continue;
			}
			if (numArray[i] == 2 || numArray[i] == 3 || numArray[i] == 5
					|| numArray[i] == 7) {
				count++;
				continue;
			}
			for (int j = 2; j * j <= numArray[i]; j++) {
				if ((numArray[i] % j) == 0) {
					isPrime = false;
					break;
				}
				isPrime = true;
			}
			if (isPrime) {
				count++;
			}
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 22920
#include <iostream>
#include <string>

int main() {
    std::string S;
    std::cin >> S;
    for (int i = 0; i < 3; i++) {
        if (S.find('a' + i) == std::string::npos) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::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 < (ll)(n); i++)

int main()
{
    ll X;
    cin >> X;
    ll sum=0;
    ll ans = 0;
    while (true)
    {
        ans++;
        sum += ans;
        if (X <= sum){
            break;
        }
    }
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
	    int T = sc.nextInt();
	    int A = sc.nextInt();

	    double min = 1000;
	    int ans = 0;
	    for (int i=1; i<N+1; i++){
	    	double temp = T-0.006*sc.nextInt();
	    	if (Math.abs(temp-A)<min) {
	    		min = Math.abs(temp-A);
	    		ans = i;
	    	}
	    }
	    System.out.println(ans);
	}
	

}

Measured memory_bytes: 22228
#include <iostream>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main(void){
  string O, E;
  cin >> O >> E;
  // 入力終了

  // OとEを交互に出力
  rep(i, O.size()-1 ){
    cout << O[i] << E[i] ;
  }

  // Oの末尾
  cout << O[ O.size()-1 ];
  
  // 文字列長が同じならEの末尾も出力
  if(O.size() == E.size() )
    cout << E[ E.size()-1 ];
  
  cout << endl;  

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
    ll a,b;
    cin>>a>>b;
    a--;
    ll x,y;
    ll t1,t2;
    t1 = (a)%4;
    t2 = b%4;
    
    if(t1 == 0)
    x = a;
    else if(t1 == 1)
    x = 1;
    else if(t1 == 2)
    x = a+1;
    else
    x = 0;
    
    if(t2 == 0)
    y = b;
    else if(t2 == 1)
    y = 1;
    else if(t2 == 2)
    y = b+1;
    else
    y = 0;
    if(a!=-1)
    cout<<(x^y);
    else
    cout<<y;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
using namespace std;
int a[201000],ch[201000];
int main(){
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		ch[a[i]] = i;
	}
	int gap = 0;
	int dap = 0;
	int before = -1;
	for (int i = 1; i <= n; i++)
	{
		if (ch[i]>before) {
			before = ch[i];
			gap++;
		}
		else
		{
			before = ch[i];
			dap = max(gap, dap);
			gap = 1;
		}
	}
	dap = max(gap, dap);
	printf("%d\n", n-dap);
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int k;
    cin >> n >> k;
    vector<bool> d(10, true);
    rep (i, n) {
        int m;
        cin >> m;
        d[m] = false;
    }
    FOR (i, n, 10 * n + 1) {
        bool ok = true;
        string s = to_string(i);
        rep (j, s.size()) {
            if (d[s[j] - '0'] == false) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cout << i << endl;
            return 0; 
        }
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a, sum = 0, b = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
	cin >> a;
    if(a > b){
      b = a;
    }
    
    sum += a;
  }
    if (b < sum - b) {
      cout << "Yes" << endl;
    }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,Y,x=-1,y=-1,z=-1;
  cin>>N>>Y;
  Y/=1000;
  for(int i=0;i<=N;i++){
    if(10*i>Y)break;
    for(int j=0;j<=N-i;j++){
      if(10*i+5*j>Y)break;
      if(N+9*i+4*j==Y){
        x=i,y=j,z=N-x-y;
        break;
      }
    }
    if(x!=-1)break;
  }
  cout<<x<<" "<<y<<" "<<z<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b)
    {
        if(a < c)
        {
            swap(b, c);
            swap(a, b);
        }
        else if(b < c)
        {
            swap(b, c);
        }
    }
    else
    {
        swap(a, b);
        if(a < c)
        {
            swap(b, c);
            swap(a, b);
        }
        else if(b < c)
        {
            swap(b, c);
        }
    }
    cout << c << " " << b << " " << a << endl;
}


Measured memory_bytes: 1164
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

int N;
vector<int> L;
vector<int> A;

int main() {
  cin >> N;
  A.resize(3);
  for (int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  L.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  
  int res = 1e9;
  vector<int> bit(3);
  for (bit[0] = 1; bit[0] < (1 << N); bit[0]++) {
    for (bit[1] = 1; bit[1] < (1 << N); bit[1]++) {
      if (bit[0] & bit[1]) {
        continue;
      }
      for (bit[2] = 1; bit[2] < (1 << N); bit[2]++) {
        if (bit[0] & bit[2] || bit[1] & bit[2]) {
          continue;
        }
        
        vector<int> sums(3, 0), nums(3, 0);
        for (int i = 0; i < N; i++) {
          for (int j = 0; j < 3; j++) {
            if (bit[j] & (1 << i)) {
              sums[j] += L[i];
              nums[j]++;
            }
          }
        }
        
        int score = 0;
        for (int i = 0; i < 3; i++) {
          score += abs(sums[i] - A[i]);
          score += (nums[i] - 1) * 10;
        }
        res = min(res, score);
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
D, G = [int(x) for x in input().split()]
PC = [[int(x) for x in input().split()] for _ in range(D)]
ans = 100100
for i in range(2**D):
    cnt = 0
    point = 0
    for j in range(D):
        if (i >> j) & 1:
            cnt += PC[j][0]
            point += 100 * (j+1) * PC[j][0] + PC[j][1]
    if (point < G):
        rest = G-point
        for j in range(D)[::-1]:
            if (i >> j) & 1 == 0:
                if (rest < 100*(j+1)*PC[j][0]):
                    # 200点問題3問で500点
                    cnt += -(-rest // (100*(j+1)))
                    break 
                else:
                    cnt = 100100
                    break
    ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 40816
n,m=map(int,input().split())
now=[tuple(map(int,input().split())) for i in range(n)]
p=[tuple(map(int,input().split())) for i in range(m)]
for a in now:
  ans=10**10
  for i in range(m):
    if ans>abs(p[i][0]-a[0])+abs(p[i][1]-a[1]):
      ind=i
      ans=abs(p[i][0]-a[0])+abs(p[i][1]-a[1])
  print(ind+1)


Measured memory_bytes: 3064
// AOJ ALDS1_10_A Fibonacci Number
// 2018.4.27 bal4u

#include <stdio.h>

// バッファを経ずstdinから数値を得る
//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int dp[45];

int main()
{
	int n, i;

	n = in();
	dp[0] = 1, dp[1] = 1;
	for (i = 2; i <= n; i++) dp[i] = dp[i-1]+dp[i-2];
	printf("%d\n", dp[n]);
	return 0;
}



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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; ll D, A; cin >> N >> D >> A;
    pair<ll, ll> XH[N]; rep(i, N) cin >> XH[i].first >> XH[i].second;
    sort(XH, XH+N);
    vector<ll> X(N), H(N);
    rep(i, N){
        X[i] = XH[i].first; H[i] = XH[i].second;
    }
    ll damage[N+1] = {};
    ll bomb[N];
    rep(i, N){
        ll th = X[i]+D;
        //X[j] <= th+Dなるような最大のj
        ll ok = i, ng = N;
        ll m = (ok+ng)/2;
        while(abs(ok-ng) > 1){
            if(X[m] <= th+D) ok = m;
            else ng = m;
            m = (ok+ng)/2;
        }
        bomb[i] = ok;
    }
    ll ans = 0;
    rep(i, N){
        //i番目を攻撃
        ll rem = H[i] - damage[i];
        if(rem > 0){
            // need*A >= rem
            ll need = (rem + (A-1))/A;
            ans += need;
            damage[i] += need*A;
            damage[bomb[i]+1] -= need*A;
        }
        damage[i+1] += damage[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void draw(int h, int w){
    rep(i, h){
        if(i==0 || i==h-1) cout << string(w, '#') << endl;
        else cout << '#' + string(w-2, '.') + '#' << endl;
    }
    cout << endl;
}

int main() {
    while(true){
        int h, w;
        cin >> h >> w;
        if(h==0 && w==0) break;
        draw(h, w);
    }
    return 0;
}


Measured memory_bytes: 3224
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;

int main(void) {
	int a, b; cin >> a >> b;

	if (b%a == 0) {
		cout << a + b << endl;
	}
	else { cout << b - a << endl; }

	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

X=[]
b=a[0]
for i in range(1,n) :
    b^=a[i]

for i in range(n) :
    x=b^a[i]
    X.append(x)

for i in X :
    print(i,end=" ")


Measured memory_bytes: 31560
N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 0:
    print((B[N//2-1]+B[N//2])-(A[N//2-1]+A[N//2])+1)

else:
    print(B[N//2]-A[N//2]+1)

Measured memory_bytes: 25476
import java.util.*;
import java.lang.Math;
public class Main{
    public static long LCM(long a,long b){
        if(a==0 || b==0) return 0;
        long tmp;
        long r;
        long x;
        x=a*b;
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        r=a%b;
        while(r!=0){
            a=b;
            b=r;
            r=a%b;
        }
        x=x/b;
        return x;
      }
    public static long GCD(long a,long b){
        if(a==0 || b==0) return Math.max(a,b);
        else return (a*b)/LCM(a,b);
    }
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong();
        long b=sc.nextLong();
        System.out.println(GCD(a,b));
    }
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n; cin>>n;
    double t, a; cin>>t>>a;
    vector<double> h(n);
    for(int i=0; i<n; i++) cin>>h[i];

    double ans=1e9;
    int id;
    for(int i=0; i<n; i++){
        double x=t-0.006*h[i];
        if(abs(a-x)<ans){
            ans=abs(a-x);
            id=i+1;
        }
    }
    cout << id << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leadinz zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0){
        if(b&1)res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)return true;
    while(d!=n-1){
        x=(x*x)%n;
        d*=2;
        if(x==1)return false;
        if(x==n-1)return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)return false;
    if(n<=3)return true;
    ll d=n-1;
    while(d%2==0)d/=2;
    for(int i=0;i<k;i++){
        if(!miller_rabin(d,n))return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    ll d=accumulate(s.begin(),s.end(),0,[](int k,char ch){return k=k+(ch-'0');});
    ll sum=0;
    for(auto x: s){
        sum=10*sum+(x-'0');
        sum%=d;
    }
    if(sum==0)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256