akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
typedef tuple<int, int, int> TP;

int N;
vector<TP> v;
int X0, Y0, H0;

bool check(int cx, int cy, int H) {
  for (auto [x, y, h] : v) {
    int a = max(0, H - abs(x-cx) - abs(y-cy));
    if (a != h) return false;
  }
  return true;
}

int main() {
  H0 = 0;
  cin >> N;
  v.resize(N);
  for (int i = 0; i < N; ++i) {
    int x, y, h; cin >> x >> y >> h;
    v[i] = {x, y, h};
    if (H0 == 0 && h != 0) {
      X0 = x, Y0 = y, H0 = h;
    }
  }

  for (int cx = 0; cx <= 100; ++cx) {
    for (int cy = 0; cy <= 100; ++cy) {
      int H = (H0 == 0) ? 1 : H0 + abs(cx-X0) + abs(cy-Y0);
      if (check(cx, cy, H)) {
        cout << cx << " " << cy << " " << H << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}
 
int main(){
 
	string s;
	cin >> s;
	int ans = 0;
	int cur = 0;
	for (int i = 0; i < (int)s.length(); i++) {
		if (s[i] == 'S') {
			cur++;
		} else {
			if (cur) {
				cur -= 1;
			} else {
				ans += 1;
			}
		}
	}

	ans += cur;
	printf("%d\n", ans);
 
	return 0;
}

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

int main(){
  long long n;
  cin >> n;
  long long i,j;
  long long ans;
  ans=1e18;
  for(i=1; i<=sqrt(n); i++){   
    if(n%i!=0) continue;
      j=n/i;
      ans=min(ans,i+j-2);
  }
  
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().rstrip().split(" "))
ans = []
K = (N - 1) // 2
if K % 2 == 0:
    for i in range(K // 2):
        ans.append([K // 2 - i,K // 2 + i + 1])
    for i in range(K // 2):
        ans.append([N - K // 2 -1  - i,N - K // 2 + i + 1])
else:
    for i in range(K // 2 + 1):
        ans.append([K // 2 + 1 - i,K // 2 + i + 2])
    for i in range(K // 2):
        ans.append([N - K // 2 - 1  - i,N - K // 2 + i + 1])
for i in range(M):
    print(str(ans[i][0]) + " " + str(ans[i][1]))

Measured memory_bytes: 22364
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

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

  string s;
  cin >> s;
  sort(s.begin(),s.end());
  for(int i = 1; i < s.size(); i++){
    if(s[i-1] == s[i]){
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
  
}

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

int h, w, a, b;
int main(){
	scanf("%d %d %d %d", &h, &w, &a, &b);
	
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			int x = (i < b);
			int y = (j < a);
			
			printf("%d", x ^ y);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define MAXN 3010010
#define Max 25
using namespace std;
 
int arr[MAXN];
int Sum[MAXN];
int Xor[MAXN];
int BitCount[Max];

int main()
{	
		   // freopen("in.txt" , "r" , stdin);
	       int N;
	       cin >> N;
	       for(int i = 1 ; i <= N ; i++) cin >> arr[i];
	       for(int i = 1 ; i <= N ; i++) Sum[i] = Sum[i - 1] + arr[i] , Xor[i] = Xor[i - 1] ^ arr[i];
	       int l = 1;
	       long long Ans = 0;
	       for(int r = 1 ; r <= N ; r++) {
	       		for( ; (Sum[r] - Sum[l - 1]) != (Xor[r] ^ Xor[l - 1]) ; l++);
	       		Ans += r - l + 1;
	       }	
	       cout << Ans << endl;
}

Measured memory_bytes: 7168
import numpy as np
import itertools
import math
N = int(input())
x_list = [0] * N
y_list = [0] * N
for i in range(N):
    x_list[i], y_list[i] = map(int, input().split())

x_p_list = list(itertools.permutations(x_list))
y_p_list = list(itertools.permutations(y_list))

n = math.factorial(N)

ans_list = []
for i in range(n): #順列
    ans=0
    for j in range(N-1): #その組み合わせ内
        x_l2 = (x_p_list[i][j] - x_p_list[i][j+1]) ** 2
        y_l2 = (y_p_list[i][j] - y_p_list[i][j+1]) ** 2
        ans += np.sqrt(x_l2 + y_l2)
    ans_list.append(ans)

print(sum(ans_list) / n)





Measured memory_bytes: 23136
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i500 in range(a+1):
  for i100 in range(b+1):
    for i50 in range(c+1):
      total = (i500*500) + (i100*100) + (i50*50)
      if total == x:
        cnt += 1

print(cnt)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> road(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    road[a].push_back(b);
    road[b].push_back(a);
  }
  queue<int> visit;
  vector<int> orient(n, -1);
  visit.push(0);
  //orient[0] = 0;
  while (!visit.empty()) {
    int cur = visit.front();
    visit.pop();
    for (int d : road[cur]) {
      if (orient[d] != -1) continue;
      visit.push(d);
      orient[d] = cur;
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; i++)
    cout << orient[i] + 1 << endl;
  return 0;
}

Measured memory_bytes: 10036
s = input()
t = input()
ans = 1000
for i in range(0,len(s)-len(t)+1):
  cnt = 0
  for (m,n) in zip(s[i:i+len(t)],t):
    if m!=n : cnt += 1
  ans = min(ans,cnt)
  
print(ans)

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

int main(){
    int A,B;
    double a1,a2,b1,b2;
    cin >> A >> B;
    
    a1 = 12.5 * A;
    a2 = 12.5 * ( A + 1 );
    b1 = 10 * B;
    b2 = 10 * ( B + 1 );
    
    int ans = -1;
    for ( int i = 1; i < 2000; ++i){
        if ( a1 <= i and i < a2 and b1 <= i and i < b2){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100
#define INFTY 2000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, m[MAX][MAX];

int prim(void);

int main()
{
  int i, j, e;

  scanf("%d", &n);
  for(i=0; i<n; i++) {
    for(j=0; j<n; j++) {
      scanf("%d", &e);
      if(e == -1)
        m[i][j] = INFTY;
      else
        m[i][j] = e;
    }
  }
  printf("%d\n", prim());

  return 0;
}

int prim()
{
  int i, v, u, minv, sum;
  int d[MAX], p[MAX], color[MAX];

  for(i=0; i<n; i++) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }
  d[0] = 0;
  while(1) {
    minv = INFTY;
    u = -1;
    for(i=0; i<n; i++) {
      if(minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if(u == -1)
      break;
    color[u] = BLACK;
    for(v=0; v<n; v++) {
      if(color[v] != BLACK && m[u][v] != INFTY) {
        if(d[v] > m[u][v]) {
          d[v] = m[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
  sum = 0;
  for(i=0; i<n; i++) {
    if(p[i] != -1)
      sum += m[i][p[i]];
  }

  return sum;
}

Measured memory_bytes: 636
a,b,c,x,y = map(int,input().split())
print(min((min(x,y)*min(a+b,2*c) + (max(x,y)-min(x,y))*(max(x,y)==y)*b + (max(x,y)-min(x,y))*(max(x,y)==x)*a), max(x,y)*2*c))

Measured memory_bytes: 9000
process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const N = +lines[0];
	const S = lines[1];
	
	const nB = S.match(/#/g) ? S.match(/#/g).length : 0;
	const nW = N - nB;
	
	let ans = nW;
	let bestAns = nW;
	for(let i=0; i<N; i++){
		S[i]=="#" ? ans++ : ans--;
		bestAns>ans && (bestAns=ans);
	}
	
	console.log(bestAns);
});

Measured memory_bytes: 13868
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<double> v(N);
    for(auto &x : v) cin >> x;
    sort(WHOLE(v));
    double ans = v[0];
    for(int i = 1; i < N; i++) {
        ans = (ans + v[i]) / 2;
    }
    cout << std::fixed << std::setprecision(10) << ans << endl;
    return 0;
}

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

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

  ll creatures[100005], sum[100005];
  for(int i=1; i<=n; i++){
    cin >> creatures[i];
  }

  sort(creatures+1, creatures+n+1);
  creatures[n+1] = 0;
  sum[0] = 0;
  for(int i=1; i<=n; i++) sum[i] = sum[i-1] + creatures[i];

  int ans = 0;
  for(int i=n; i>=1; i--){
    if(sum[i]*2 < creatures[i+1]){
      break;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
# define ll int64_t
#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll facctorial(ll k){
    ll sum = 1;
    rrep(i,k) {
        sum*=i;
    }
    return sum;
}

int main(){
    ll n,a=1,b=1;
    cin>>n;
    vector<ll> p(n),q(n);
    
    rep(i,n){
        cin>>p[i];
    }
    rep(i,n){
        cin>>q[i];
    }
        
    
    rep(i,n){
        ll c=1;
        for(ll j=i+1;j<n;j++) if(p[i]>p[j]) c++;
        a += facctorial(n-1-i)*c;
        c=1;
        for(ll j=i+1;j<n;j++) if(q[i]>q[j]) c++;
        b += facctorial(n-1-i)*c;
        }
    cout<<abs(a-b)<<endl;
    return 0;
}



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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

ll XOR(ll a){
    if(a % 4 == 1)return 1;
    else if(a % 4 == 3)return 0;
    else if(a == 0)return 0;
    else return (XOR(a-1)^a);
}
signed main()
{   
    gearup;
    int a,b,c; cin >> a >> b >> c;
    vector<int> d;
    for(int i=1;i<=a*b;i++){
        if(a%i == 0 && b%i == 0)d.push_back(i);
    }   
    cout << d[d.size()-c] << endl;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}


signed main(){

    int X,Y;
    cin>>X>>Y;

    int ans=0;
    if(X<=3)ans+=4-X;
    if(Y<=3)ans+=4-Y;
    if(X==1&&Y==1)ans+=4;
    ans*=100000;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const int INF = (1LL<<30);
#else
const ll INF = (1LL<<60);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

int dp[500010];
signed main(void)
{
  int n;
  string s;
  cin >> n >> s;

  REP(i, n) {
    if(s[i] == '0') {chmax(dp[i+1], dp[i]); continue;}
    if(i != 0 && s[i-1] == '0') {
      // 左に探索
      // 11111111111111101みたいなのを
      for(int j=i-2; j>=0; --j) {
        if(s[j] == '0') break;
        chmax(dp[i+1], dp[j] + i-j-1);
      }
    }
    if(i<n-1 && s[i+1] == '0') {
      // 10111111111111みたいなのをね
      FOR(j, i+2, n) {
        if(s[j] == '0') break;
        chmax(dp[j+1], dp[i]+j-i-1);
      }
    }
    chmax(dp[i+1], dp[i]);
  }

  // REP(i, n) cout << dp[i] << " "; cout << endl;
  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
 
const int MOD = 1e9 + 7;
 
void setIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
 
//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//alt r is search & replace
//alt d is delete a line


int main(){
    setIO();
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] != t[i]){
            ++ans;
        }
    }
    cout << ans << "\n";
}      

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int Pow(int a) {
    int ret = 1;
    for(int i = 0;i < a;i++) {
        ret *= 2;
    }
    return ret;
}

struct edge {
    int to;
    int cost;
};

int main() {
    int L;
    cin >> L;
    int N;
    int cnt = 0;
    for(int i = 0;i < 20;i++) {
        if(cnt + Pow(i) >= L) {
            N = i + 1;
            break;
        }
        cnt += Pow(i);
    }
    cnt++;
    vector<edge> ret[N];
    for(int i = 0;i < N - 1;i++) {
        ret[i].push_back(edge{i + 1,0});
        ret[i].push_back(edge{i + 1,Pow(i)});
    }
    while(cnt != L) {
        int cnt3 = cnt;
        for(int i = 0;i < N;i++) {
            if(cnt3 + Pow(i) >= L) {
                ret[i].push_back(edge{N - 1,cnt});
                break;
            }
            cnt3 += Pow(i);
        }
        cnt = cnt3 + 1;
    }
    int ret2 = 0;
    for(int i = 0;i < N;i++) {
        ret2 += ret[i].size();
    }
    cout << N << " " << ret2 << endl;
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < ret[i].size();j++) {
            cout << i + 1 << " " << ret[i].at(j).to + 1 << " " << ret[i].at(j).cost << endl;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
map<char,int>mp;
map<char,int>::iterator itr;
int i;
cin>>str;
for(i=0;i<str.size();i++)
{
if(mp.find(str[i])==mp.end())
mp[str[i]]=1;
else mp[str[i]]++;
}
int flag=0;
for(itr=mp.begin();itr!=mp.end();itr++)
{
if(itr->second%2==1)
{cout<<"No"<<endl;exit(0);}

}
cout<<"Yes"<<endl;
}

Measured memory_bytes: 3548
#include <iostream>

using namespace std;

int main(){
    int a[4];
    for (int i = 0; i < 4; i++)
    {
        scanf("%d", &a[i]);
    }
    int vec_1;
    int vec_2;
    vec_1 = a[2] - a[0];
    vec_2 = a[3] - a[1];
    /*printf("%d %d\n", vec_1, vec_2);*/
    
    int x3, x4, y3, y4;
    x3 = a[2] - vec_2;
    y3 = vec_1 + a[3];

    x4 = a[0] - vec_2;
    y4 = a[1] + vec_1;
    printf("%d %d %d %d\n", x3, y3, x4, y4);
    return 0;
}

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

namespace Sorting
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            List<int> l = new List<int>();
            foreach (string i in ss)
                l.Add(int.Parse(i));
            l = sort(l);
            string ans = "";
            for (int i = 0; i < l.Count; i++)
               ans += l[i].ToString() + " ";
            Console.WriteLine(ans.Trim());
        }
        static List<int> sort(List<int> sl)
        {
            if (sl.Count <= 1) return sl;
            int middle = (sl.Count - 1) / 2;
            int mid = sl[middle];
            sl.RemoveAt(middle);
            List<int> s = new List<int>();
            List<int> b = new List<int>();
            foreach (int i in sl)
                if (i < mid)
                    s.Add(i);
                else
                    b.Add(i);
            List<int> final = new List<int>();
            List<int> sa = sort(s);
            List<int> sb = sort(b);
            for (int i = 0; i < sb.Count; i++)
                final.Add(sb[i]);
            final.Add(mid);
            for (int i = 0; i < sa.Count; i++)
                final.Add(sa[i]);
            return final;
        }
    }
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3+50;
typedef long long ll;
string s,t;
int dp[maxn][maxn];
pair<int,int> g[maxn][maxn];
bool taken[maxn][maxn];
int main(){
    cin>>s>>t;
    for (int i=0;i<s.length();i++){
        for (int j=0;j<t.length();j++){
            if (dp[i+1][j] > dp[i][j+1]){
                g[i+1][j+1] = {i+1,j};
            }else{
                g[i+1][j+1] = {i,j+1};
            }
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
            if (s[i] == t[j] && dp[i][j] + 1 > dp[i+1][j+1]){
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j] + 1);
                g[i+1][j+1] = {i,j};
                taken[i+1][j+1] = 1;
            }else if (dp[i][j] > dp[i+1][j+ 1]){
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]);
                g[i+1][j+1] = {i,j};
            }
        }
    }
    string ans = "";
    int i = s.length(),j = t.length();
    while (i && j){
        if (taken[i][j]){
            ans += s[i-1];
        }
        tie(i,j) = g[i][j];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	long long A, B, K;
	std::cin >> A >> B >> K;
	if (K > A) {
		std::cout << "0 " << std::max(B + A - K, 0LL) << std::endl;
	}
	else {
		std::cout << A - K << " " << B << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath> 
#include <queue>
#include <functional>

using namespace std;
//typedef long long ll;
//typedef pair<int, int> P;
//static const int dx[4] = {1, -1, 0, 0};
//static const int dy[4] = {0, 0, 1, -1};

//static const ll MOD = 1e+9 + 7;
//static const int MAX = 10001;

int main() {

    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    sort(A.begin(), A.end());
    A.push_back(A[0]);

    bool can = true;
    for (int i = 1; i < N; i++) {
        if (A[i] != (A[i-1] ^ A[i+1]))
            can = false;
    }
    

    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        mp[A[i]]++;
    }

    int s = mp.size();
    if (s == 1) {
        if (mp[0] == N) 
            can = true;
    }
    else if (s == 2) {
        int a = 0;
        for (auto& x:mp) {
            if (x.first == 0) {
                if (x.second == N/3)
                    a++;
            }
            else {
                if (x.second == N/3 * 2)
                    a++;
            }
        }
        if (a == 2)
            can = true;
    }
    else if (s == 3) {
        int a[3];
        int i=0;
        bool can2 = true;
        for (auto& x:mp) {
            a[i] = x.first;
            i++;
            if (x.second != N /3)
                can2 = false;
        }

        if (can2) {
            if ((a[0] ^ a[1]) == a[2] and (a[0] ^ a[2]) == a[1] and (a[2] ^ a[1]) == a[0])
                can = true;
        }
    }
 

    if (can) cout << "Yes\n";
    else cout << "No\n";

}



Measured memory_bytes: 4176
#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){
	ll n,a,b,c,d;
	cin >> n >> a >> b >> c >> d;

	bool ok = false;
	for(ll i = 0; i < n-1;++i){
		const ll j = n-1 - i;	
		if(c*i - d*j <= b-a and b-a <= d*i - c*j) ok = true;
	}

	if(ok)
		puts("YES");
	else
		puts("NO");

	return 0;
}

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

A = [[0] * m for i in range(n)]
b = [0] * m

cntn = 0

while cntn <= n - 1:
    A[cntn] = list(map(int, input().split()))
    cntn += 1

cntm = 0

while cntm <= m - 1:
    b[cntm] = int(input())
    cntm += 1

for idxn in range(n):
    result = 0
    for idxm in range(m):
        result += A[idxn][idxm] * b[idxm]
    print(result)


Measured memory_bytes: 5948
#include <iostream>
using namespace std;
#define MAX 2000000

int parent(int i){return i/2;
} 

int left(int i){return 2*i;
}

int right(int i){return 2*i+1;
}

int H,A[MAX+1]; 

void maxHeapify(int i){
	int largest;
	int l = left(i);
	int r = right(i);
	if((l<=H)&&(A[l]>A[i]))
		 largest = l;
		else 
		 largest = i;
		 
	if((r<=H)&&(A[r]>A[largest]))
		 largest = r;

	if(largest!=i){
		swap(A[i],A[largest]);
		maxHeapify(largest);
	}
}

void buuldMaxHeap(int A[]){
	for(int i=H/2;i>=1;i--){
		maxHeapify(i);
	}
}



int main(){
	int i;
	
	cin>>H;
	
	for(i=1;i<=H;i++){
		cin>>A[i];
	}
	
	buuldMaxHeap(A);
	for(int i=1;i<=H;i++){
		cout<<" "<<A[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 5060
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)


int main(){
  int n;cin >> n;
  int ans = 0, ab = 98765432, aa=98765432;
  FOR(i,0,n-1){
    int b; cin >> b;
    ab = min(ab, b);
    aa = min(aa, b);
    ans += ab;
    swap(aa,ab);
    aa = 98765432;
  }
  ans += ab;
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
long long n,a,b;
int main() {
	scanf("%lld%lld%lld",&n,&a,&b);
	long long a1=n/(a+b);
	long long ans=a1*a;
	long long n1=a1*(a+b);
	if(n-n1>=a) ans+=a; else if (n-n1>0) ans+=n-n1;
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 128
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        long n=fsc.nextLong(), k=fsc.nextLong();
        fsc.close();
        // if(k==0){
        //     System.out.println(n*n);
        //     return;
        // }
        long ans=0;
        for(long b=k+1;b<=n;b++){
            long pass=-1, fail=(n+1);
            while(fail-pass>1){
                long mid=pass+(fail-pass)/2;
                if(mid*b+(b-1)<=n) pass=mid;
                else fail=mid;
            }
            ans+=(b-k)*(pass+1);
            ans+=Math.max(0, n-(pass+1)*b-k+1);
            if(k==0) ans--;
        }
        System.out.println(ans);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 21460
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

//座標圧縮
ll*b;
int cocomp(ll*a,int n){
	//0～cnt-1に圧縮
	b=(ll*)malloc(sizeof(ll)*n);
	memcpy(b,a,sizeof(ll)*n);
	sortup(b,n);
	int cnt=1;
	rep(r,1,n)if(b[r]!=b[cnt-1])b[cnt++]=b[r];
	rep(i,0,n){
		int l=0,r=cnt;
		while(r-l>1){int m=(l+r)/2;if(b[m]>a[i])r=m;else l=m;}
		a[i]=l;
	}
	return cnt;
}



//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a,s;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=x.a+y.a;//sum
	r.s=x.s+y.s;//sum
//	r.a=min(x.a,y.a);//min
	return r;
}
//↑ここを変える

int segNUM;
atai segN[1<<19],*seg;
void seguse(int n){segNUM=n;seg=segN+segNUM;}

//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	if(l==r){
		atai x={0};
		return x;
	}
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで
//*/

int flag[200010];
ll aa[200010];
ll bb[200010];
int main(){
	ll q;
	scanf("%lld",&q);
	rep(i,0,q){
		scanf("%lld",flag+i);
		if(flag[i]==1)scanf("%lld%lld",aa+i,bb+i);
	}
	aa[q]=-INF;
	cocomp(aa,q+1);
	seguse(1<<18);
	

	ll sa=0,sb=0,cnt=0;
	rep(i,0,q){
		if(flag[i]==2){
			if(cnt==0)puts("0");
			else{
				//区間和が(cnt+1)/2以上
				ll ng=0;
				ll ok=200010;
				while(ok-ng>1){
					ll m=(ok+ng)/2;
					ll temp=segcalc(0,m).a;
					if(temp>=(cnt+1)/2)ok=m;
					else ng=m;
				}
//				printf("%lld %lld ",sa,sb);
				atai left=segcalc(0,ok);
				atai right=segcalc(ok,200010);
				//leftに(cnt-1)/2,rightにcnt/2になるまで調整
				ll lans=left.s-(left.a-(cnt-1)/2)*b[ok-1];
				ll rans=right.s-(right.a-cnt/2)*b[ok-1];
				printf("%lld %lld\n",b[ok-1],rans-lans-(cnt%2==0?b[ok-1]:0)+sb);
			}
		}else{
			atai x=segcalc(aa[i],aa[i]+1);
			x.a++;
			x.s+=b[aa[i]];
			segupdate(aa[i],x);
			sa+=b[aa[i]];
			sb+=bb[i];
			cnt++;
		}
	}
}

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

int main(void){
    string s;
    int al[26];
    cin>>s;
    for(int i=0;i<26;i++)
        al[i]=0;

    for(int i=0;i<s.size();i++){
        al[s[i]-'a']++;
    }
    for(int i=0;i<26;i++){
        if(al[i]>1){
            cout<<"no"<<endl;
            return 0;
        }
    }
    cout<<"yes"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  	int A,B,C,D;
  	cin>>A>>B>>C>>D;
  if(A+B>C+D)
    cout<<"Left";
  else if(A+B<C+D)
    cout<<"Right";
  else
    cout<<"Balanced";
}
  

Measured memory_bytes: 3572
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<set>
#include<cstdlib>
#include<deque>
#include<queue>
#include<bitset>
#include<functional>
#include<utility>
#include<list>
#include<iomanip>
#include<ctime>
#include<cassert>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
const int INF=1e9+1;
int cnt[100005],ans;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		cnt[a]++;
		cnt[a-1]++;
		cnt[a+1]++;
	}
	for(int i=0;i<100005;i++)
	{
		ans=max(ans,cnt[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll calc(ll a, ll b, ll c) {
    return (b / c) - (a / c) + (a % c == 0);
}
ll lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}
ll solve(ll a, ll b, ll c, ll d) {
    ll _lcm = lcm(c, d);
    ll A = calc(a, b, c);
    ll B = calc(a, b, d);
    ll C = calc(a, b, _lcm);
    return  A + B - C;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << b - a + 1 - calc(a, b, c) - calc(a, b, d) + calc(a, b, lcm(c, d));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
typedef long long int ll;

int main()
{
    int x,a,b;

    while(scanf("%d%d%d",&x,&a,&b) != EOF)
    {
        if(abs(x-a) > abs(x-b)) printf("B\n");
        else printf("A\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include<vector>
#include<cstring>
#include<set>
#include <cstdio>
#include<queue>
#include<map>
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define endl '\n'
#define forup(i,a,n) for( int i =a; i < n; i++)
#define llforup(i,a,n) for( ll i =a; i < n; i++)
#define fordown(i,a,n) for( int i =a; i >= n; i--)
#define fornot(i,a,n) for( int i=a;!n;i++)
#define mod  (ll)(1e9+7)
#define ifempty(a)  if(!a)
using namespace std;
typedef long long ll;
inline int readnum()
{
	int p, data = 0; char ch = 0;
	while ((ch != ' - ') && ch < '0' || ch>'9') ch = getchar();//相当于正则表达式的搜索，跳过不需要的字符
	if (ch == '- ')p = -1, ch = getchar();
	else p = 1;
	while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();//搜索需要的字符
	return data * p;
}
//E-mail 374656045@qq.com
#define MAX 1400
int DPtile[MAX][MAX];
class solve
{
private:
	int H, W;
	int maxWidth=0;
	bool None=true;
	char ch;
public:
	solve()
	{
		H = readnum(); W = readnum();
		forup(i,0,H)
			forup(j, 0, W)
		{
			ch = getchar();
			while (ch == ' ' || ch == '\n')
				ch = getchar();
			DPtile[i][j] = (ch == '0') ? 1 : 0;//这样就不用再对第一行/列进行重复赋值预处理
		}
		forup(i, 0, W)if (DPtile[0][i]) { None = false; maxWidth |= DPtile[0][i];goto loop; }
		forup(i, 0, H)if (DPtile[i][0]) {None = false; maxWidth |= DPtile[i][0]; goto loop;}
		//OK单元测试通过
		/*对应的二次数据是
0 0 0 0
0 0 1 0
0 1 1 1
0 0 1 0
0 0 0 0*/
	loop:forup(i,1,H)
			forup(j, 1, W)
		{
			if(DPtile[i][j]==0)continue;
			else//手写max逻辑 分别是[i-1][j],[i-1][j-1],[i][j-1]
			{//上比左小
				if (DPtile[i - 1][j] <= DPtile[i][j - 1])
				{
					if (DPtile[i - 1][j] <= DPtile[i - 1][j - 1])DPtile[i][j] = DPtile[i - 1][j] + 1;
					else DPtile[i][j] = DPtile[i - 1][j - 1] + 1;
				}
				else
				{//左比左上小
					if (DPtile[i][j - 1] <= DPtile[i - 1][j - 1])DPtile[i][j] = DPtile[i][j - 1]+1;
					else DPtile[i][j] = DPtile[i - 1][j - 1] + 1;
				}
				if (DPtile[i][j] > maxWidth)maxWidth = DPtile[i][j];//手写避免多次赋值
			}
		}
	if (None&&maxWidth==0)cout << 0 << endl;
	else
	cout << maxWidth * maxWidth << endl;
	}

};
int main(void)
{
	//ios_base::sync_with_stdio(0); cin.tie(0);//慎用，cin和scanf混用会导致非MSC++WA
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve solution;
#ifdef DEBUG
	fclose(stdin);//关闭文件 
	fclose(stdout);//关闭文件 
#endif
	return 0;

}




Measured memory_bytes: 10724
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MN 262150
using namespace std;
struct node{int x,y;}b[MN];
int t[MN<<1],a[MN];
int MQ,INF,n,m,ans,f0;

inline int read()
{
	int n=0,f=1; char c=getchar();
	while (c<'0' || c>'9') {if(c=='-')f=-1; c=getchar();}
	while (c>='0' && c<='9') {n=n*10+c-'0'; c=getchar();}
	return n*f;
}

inline void grw(int x,int y) {for (x+=MQ;x;x>>=1) if (t[x]>y) t[x]=y; else return;}
inline int gmn(int x,int y)
{
	int sm=INF;
	for (x+=MQ,y+=MQ;x<=y;x>>=1,y>>=1)
	{
		if ( x&1) sm=min(sm,t[x++]);
		if (~y&1) sm=min(sm,t[y--]);
	}
	return sm;
}
bool cmp(const node& a,const node& b) {return a.x<b.x || a.x==b.x && a.y>b.y;}

int main()
{
	register int i,j;
	n=read(); for (i=1;i<=n;++i) a[i]=read(),ans+=(a[i]==0),a[i]=a[i]?1:-1;
	m=read(); for (i=1;i<=m;++i) b[i].x=read(),b[i].y=read();
	sort(b+1,b+m+1,cmp); memset(t,100,sizeof(t)); INF=t[0]; f0=0;
	for (MQ=1;MQ<n;MQ<<=1); --MQ;
	for (i=j=1;i<=n;f0=min(f0+a[i],t[i+MQ]),++i)
		for (;j<=m&&b[j].x==i;++j)
			grw(b[j].y,min(gmn(i,b[j].y),f0));
	printf("%d",ans+f0);
}

Measured memory_bytes: 4608
from scipy.misc import comb
#from scipy.special import comb

N, K = map(int, input().split())
B = K
R = N - K
for i in range(1, K+1):
    # R+i C i
    tmp1 = comb(R+1, i, exact = True)
    # i H rest
    tmp2 = comb(B-1, i-1, exact = True)

    ans = int((tmp1*tmp2)%1000000007)
    print(ans)

Measured memory_bytes: 15176
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
 
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
 
    string a,b;
 
    cin >> a >> b;
 
    for(int i = 0;i < a.length();i++)
    {
        if(a==b){ cout << "Yes"; return 0; }
        string b = a;
        a = b.substr(0,b.size()-1);
        a = b[b.size()-1]+a;
    }
 
    cout << "No";
cout << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.AtCoder_Beginner_Contest_111
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Console.ReadLine().ToCharArray();
            var str = string.Empty;

            if (int.Parse(new string(num)) > int.Parse(string.Concat(Enumerable.Repeat(int.Parse(num[0].ToString()), num.Length))))
                str = string.Concat(Enumerable.Repeat(int.Parse(num[0].ToString()) + 1, num.Length));
            else
                str = string.Concat(Enumerable.Repeat(int.Parse(num[0].ToString()), num.Length));

            Console.WriteLine(str);
        }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////




int main() {

	ll N;
	cin >> N;

	ll ans = 0;

	repn(i, N) {
		ll div = 0;
		repn(j, N) if (i%j == 0) { div++; }
		if (div == 8 && i % 2 == 1) { ans++; }
	}

	cout << ans;

	
	system("PAUSE");
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll d, n; cin >> d >> n;
    ll ans = n;
    rep(i, d) ans *= 100;
    if(n == 100) cout << ans + ll(pow(100, d)) << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3768
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int64_t a, b, c;
    cin >> a >> b >> c;

    int poison = min(c, a + b + 1);
    cout << (b + poison) << endl;
}


Measured memory_bytes: 256
from collections import deque

n = int(input())
a = list(map(str,input().split()))
b = deque()

for i in range(n):
  if i%2== 0:
    b.append(a[i])
  else:
    b.appendleft(a[i])

if len(a)%2 == 0:
  B = ' '.join(b)
  print(B)
else:
  b.reverse()
  B = ' '.join(b)
  print(B)

Measured memory_bytes: 26684
#include <bits/stdc++.h>
using namespace std;
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
std::vector<int> v(5);
int main(){
  int ans=0;
  cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4];
  for (int i = 0; i < 5; i++) {
    int mini,minx=INT_MAX;
    for (int l = 0; l < 5; l++) {
      if(minx >= (v[l]%10 != 0 ? ((v[l]-(v[l]%10))+10)-v[l] : 0) && v[l] != -1){
        minx = (v[l]%10 != 0 ? ((v[l]-(v[l]%10))+10)-v[l] : 0);
        mini = l;
      }
    }
    ans += v[mini];
    if(i<4) ans = (v[mini]%10 != 0 ? ((ans-(ans%10))+10) : ans);
    v[mini] = -1;
  }
  cout << ans << endl;
}


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

int main() {

  ll I;
  scanf("%lld",&I);
  ll L=50-I;
  printf("50\n");
  for(int i=0;i<50;i++) {
    printf("%lld ",L+51ll*(I/50+(i<I%50))-1);
  }

}


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

using namespace std;

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

	vector<int> a;
	int b[n];

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

	if(n%2==0){
		for(int i=0;i<n/2;i++){
			b[i]=a[n-1-2*i];
		}
		for(int i=n/2;i<n;i++){
			int j=i-n/2;
			b[i]=a[2*j];
		}
	}
	else{
		for(int i=0;i<n/2+1;i++){
			b[i]=a[n-1-(2*i)];
		}
		for(int i=n/2+1;i<n;i++){
			int j=i-n/2;
			b[i]=a[2*j-1];
		}
	}


	for(int i=0;i<n;i++){
		cout<<b[i]<<" ";
	}
	return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;
using LL = long long;

LL solve(const int p[6], LL x) {
    LL ret = 0;
    for (int i = 0; i < 6; i++) {
        if (p[i]) {
            LL p_ = p[i];
            for (int j = 0; j < i; j++) {
                p_ *= x;
            }
            ret += p_;
        }
    }
    return ret;
}

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

    S = "+" + S;
    S += "x^0";

    int P[6]{};

    for (int i = 0; i < S.length(); i++) {
        int pos = S.find_first_of('x', i);
        if (pos == S.npos) break;
        int e, c = 0;
        //
        if (S[pos + 1] != '^') {
            e = 1;
        } else {
            e = S[pos + 2] - '0';
        }
        //
        for (int j = pos - 1, k = 1;; j--, k *= 10) {
            if (S[j] != '+' && S[j] != '-') {
                c += (S[j] - '0') * k;
            } else {
                if (c == 0) c = 1;
                if (S[j] == '-') c = -c;
                break;
            }
        }
        P[e] = c;
        i = pos + 1;
    }

    vector<int> ans;

    for (int x = -abs(P[0]); x <= abs(P[0]); x++) {
        if (x == 0 || P[0] % x != 0) continue;
        if (solve(P, x) == 0) ans.push_back(-x);
    }

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

    for (int x : ans) {
        printf("(x%+d)", x);
    }

    cout << endl;
}


Measured memory_bytes: 3328
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int num[];
		num = new int[3];
		
		int i = 0;
		
		for(i = 0;i < 3;i++){
			num[i] = sc.nextInt();
		}
		
		Arrays.sort(num);
		
		int ans = num[2] * 10 + num[1] + num[0];
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//


int main() {

    int r, D, x;
    cin >> r >> D >> x;

    rep(i,10) {
        x = r * x - D;
        out(x);
    }


    return 0;
}






Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static boolean[] vis = new boolean[60];

    public static void main(String[] args) throws Exception {

    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	long[] trees = new long[N];
    	for(int i = 0; i < N; i++){
    		trees[i] = sc. nextLong();
    	}
    	Arrays.sort(trees);
    	sc.close();
    	long min = trees[N-1];
    	for(int i = 0; i < N - (K - 1); i++){
    		min = Math.min(min, (trees[i + (K - 1)] - trees[i]));
    	}
    	System.out.println(min);
    }
}

Measured memory_bytes: 50364
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<iostream>
using namespace std;

int main(){
  string S,T;
  int N;
  cin >> N;
  cin >> S >> T;
  string A ="";
  for (int i = 0 ; i<N;i++){
    A=A + S[i];
    A=A + T[i];
  }
  cout << A <<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>A[i];
        A[i]-=(i+1);
    }

    sort(A,A+n);

    ll res = 0;

    for(int i=0;i<n;i++)
        res+=(ll)abs(A[i]-A[n/2]);

    cout<<res<<"\n";


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

#define int64 long long

using namespace std;

int main()
{
	int64 aa, bb, kk;
	cin >> kk;
	cin >> aa >> bb;
	for(int64 ii = kk;ii <= bb;ii += kk)
	{
		if(aa <= ii && ii <= bb)
		{
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}

int main(){
  ll n,x;cin >> n >> x;
  if(x==1||x==n*2-1)cout << "No" <<endl;
  else{
    cout << "Yes" <<endl;
    ll p=x-n;
    rep(i,2*n-1){
      cout << (2*n-1+i+p)%(2*n-1)+1 <<endl;
    }
  }
}

Measured memory_bytes: 1536