akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 2000000;
const int inf = 1000000007;
const ll mod = 1000000007;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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



int k;
ll ans;

int main() {

	cin >> k;

	rrep(i, k) {
		rrep(j, k) {
			rrep(l, k) {
				ans += gcd(gcd(i, j), l);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3644
// AOJ 1030 Cubes Without Holes
// 2018.2.3 bal4u@uu

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

char buf[15], *p;
int in()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

char f[500][500][3];

int main()
{
	int n, h, a, b, i, ans;
	char *c;

	while (fgets(p=buf, 15, stdin) && *p != '0') {
		n = in(), h = in();

		memset(f, 0, sizeof(f));
		ans = n*n*n;
		while (h--) {
			fgets(p=buf, 15, stdin);
			c = p, p += 3, a = in()-1, b = in()-1;
			ans -= n;
			if (*c == 'x' && *(c+1) == 'y') {
				f[a][b][0] = 1, i = n; while (i--) if (f[a][i][1] || f[b][i][2]) ans++;
			} else if (*c == 'x' && *(c+1) == 'z') {
				f[a][b][1] = 1, i = n; while (i--) if (f[a][i][0] || f[i][b][2]) ans++;
			} else {
				f[a][b][2] = 1, i = n; while (i--) if (f[i][a][0] || f[i][b][1]) ans++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 2400
#include <cstdio>

typedef long long int lli;

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

int main()
{
	int N;
	lli t, ans = 1;
	scanf("%d", &N);
	while (N--) {
		scanf("%lld", &t);
		lli g = gcd(t, ans);
		ans *= t / g;
	}
	printf("%lld\n", ans);
}

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

int main(){
  int n, remainder;
  
  cin >> n;
  remainder = n % 10;
  
  if(remainder == 3) cout << "bon" << endl;
  else if(remainder == 0 || remainder == 1 || remainder == 6 || remainder == 8)
    cout << "pon" << endl;
  else cout << "hon" << endl;
  
  return 0;
}

Measured memory_bytes: 3632
N=int(input())
a_list = list(map(int, input().split()))
a_list2 = [a - i - 1 for i, a in enumerate(a_list)]
a_list2 = sorted(a_list2)
print(sum([abs(a-a_list2[len(a_list2)//2]) for a in a_list2]))


Measured memory_bytes: 27568
#include<cstdio>
#define int long long
#define min(a,b)((a)<(b)?(a):(b))
#define max(a,b)((a)>(b)?(a):(b))
const int N=1e5+3;
int n,m,a[N],b[N],ans1=-1e18,ans2=1e18,s;
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)
	  scanf("%lld",a+i),b[i]=a[i]+b[i-1];
	s=0;
	for(int i=m;i<=n;i++)s+=max(a[i],0);
	for(int i=m;i<=n;i++){
	  s=s-max(a[i],0)+max(a[i-m],0);
	  ans1=max(b[i]-b[i-m]+s,ans1);
	}
	s=0;
	for(int i=m;i<=n;i++)s+=min(a[i],0);
	for(int i=m;i<=n;i++){
	  s=s-min(a[i],0)+min(a[i-m],0);
	  ans2=min(b[i]-b[i-m]+s,ans2);
	}
	s=0;
	for(int i=1;i<=n;i++)s+=a[i];
	printf("%lld",max(ans1,s-ans2));
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int x;
    cin >> x;
    int n = x/100;
    if (x%100 <= 5*n) cout << 1 << endl;
    else cout << 0 << endl;
}

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

#define NDEBUG
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == 0) {
        v.clear();
        return 0;
    }
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    return i;
}


bool solve1(vector<ii>& w) {
    int lo = w[0].first, n_lo = w[0].second, n = n_lo;
    int hi = lo+1;
    if (n == hi) return true;

    int max_possible = n/2, min_possible = 1;
    return IN(lo, min_possible, max_possible);
}
bool solve2(vector<ii>& w) {
    int lo = w[0].first, n_lo = w[0].second,
        hi = w[1].first, n_hi = w[1].second,
        n = n_lo + n_hi;

    if (hi - lo != 1) return false;
    int max_possible = n_lo + n_hi/2, min_possible = n_lo + 1;
    return IN(hi, min_possible, max_possible);
}

bool solve(int N, vi& a) {
    map<int,int> st;
    rep(i,N) st[a[i]]++;
    if (st.size() > 2) return false;
    vector<ii> w(ALL(st));
    if (st.size() == 1) {
        return solve1(w);
    } else {
        return solve2(w);
    }
}

int main() {
    vi a;
    int N = loadvec(a);
    cout << (solve(N,a) ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#include <cstring>
#include <ctype.h>
#include<stdlib.h>

#define flin            freopen("input.txt", "r", stdin); 
#define flout           freopen("output.txt", "w", stdout);
#define ll              long long
#define ull             unsigned long long
#define fastio          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl              '\n'
#define nll             '\0'
#define pb              push_back
#define bdyptb          return 0;
#define sorted(x)       sort(x.begin(), x.end())
#define reversed(x)     reverse(x.begin(), x.end())
#define all(x)          x.begin(), x.end()
#define mset(a, b)      memset(a, b, sizeof(a));
#define testcase        ll t,tt; cin>>tt; for(t=1;t<=tt;t++)

#define pi acos(-1.00)   
#define mx 1000007

using namespace std;

int main()
{
	fastio;
	string s;
	cin>>s;
	int n=s.size();
	if(s[n-1]=='s')
		s+="es";
	else
		s+="s";

	cout<<s<<nl;
	 

    
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
const int MD=1e9+7;
vector<int> G[N];
int f[N],ans[N];
int n,a,b;
int quick_pow(int x,int y) {
	int ans=1;
	while(y) {
		if(y&1) ans=1LL*ans*x%MD;
		y>>=1;
		x=1LL*x*x%MD;
	}
	return ans;
}
void dfs(int u,int fa) {
	for(auto v:G[u]) {
		if(v==fa) continue;
		dfs(v,u);
		f[u]+=f[v];
	}
	f[u]++;
}
void cal(int u,int fa) {
	for(auto v:G[u]) {
		if(v==fa) continue;
		ans[v]=1LL*ans[u]*quick_pow(f[v],MD-2)%MD*(n-f[v])%MD;
		cal(v,u);
	}
}
int main() {
    //freopen("in.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		scanf("%d%d",&a,&b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(1,-1);
	ans[1]=1;
	for(int i=1;i<=n;i++) {
		ans[1]=1LL*ans[1]*f[i]%MD;
	}
	cal(1,-1);
	int t=1;
	for(int i=1;i<=n;i++) t=1LL*t*i%MD;
	for(int i=1;i<=n;i++) {
		printf("%d\n",1LL*t*quick_pow(ans[i],MD-2)%MD);
	}
    return 0;
}

Measured memory_bytes: 15604
n, k = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 10**9 + 7

def matmul(A, B):
    C = [[0] * len(B[0]) for _ in range(len(A))]
    for i in range(len(A)):
        for k in range(len(B)):
            for j in range(len(B[0])):
                C[i][j] += A[i][k] * B[k][j]
                C[i][j] %= mod
    return C

def matpow(A, n):
    B = [[0] * len(A[0]) for _ in range(len(A))]
    for i in range(len(A)):
        B[i][i] = 1
    while n:
        if n & 1:
            B = matmul(B, A)
        A = matmul(A, A)
        n >>= 1
    return B

A = matpow(a, k)
ans = 0
for Ai in A:
    for Aij in Ai:
        ans += Aij
        ans %= mod

print(ans)



Measured memory_bytes: 41452
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <utility>
#include <cstdlib>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
const int inf = 1e9;
typedef pair<lli, lli> pll;

int main(){
    int n,l;
    cin >> n >> l;
    vector<int> a(n);
    int ans = 0;
    int minabs = inf;
    int num = 0;
    for(int i=0; i<n; i++){
        ans += l+i;
        if(abs(l+i) < minabs){
            minabs = abs(l+i);
            num = l+i;
        }
    }
    ans -= num;
    cout << ans << endl;
    return 0;
}

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

int main(){
	int r,c;
	cin>>r>>c;
	int map[r][c];
	int retusum[r],gyousum[c];
	int sum=0;
	for(int i=0;i<r;++i)retusum[i]=0;
	for(int j=0;j<c;++j)gyousum[j]=0;
	int tmp;
	for(int i=0;i<r;++i){
		for(int j=0;j<c;++j){
			cin>>tmp;
			map[i][j]=tmp;
			retusum[i]+=tmp;
			gyousum[j]+=tmp;
		}
		sum+=retusum[i];
	}
	for(int i=0;i<r;++i){
		for(int j=0;j<c;++j){
			cout<<map[i][j]<<" ";
		}
		cout<<retusum[i]<<endl;
	}
	for(int j=0;j<c;++j)cout<<gyousum[j]<<" ";
	cout<<sum<<endl;
}


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

using namespace std;

int A, B, a[5000], b[5000], ans;

int calc(int ai, int bi){
  if(bi < B) for(int i=ai;i<A;i++) if(b[bi] == a[i]) return calc(i+1, bi+1) + 1;
  return 0;
}

main(){
  cin >> A >> B;
  for(int i=0;i<A;i++) cin >> a[i];
  for(int i=0;i<B;i++) cin >> b[i];
  for(int i=0;i<B;i++) ans = max(ans, calc(0, i));
  cout << ans << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
#define repi(i,a,b) for (int i=a;i<(b);i++)
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))
using namespace std;
typedef long long ll;
  
  int main(void){
    cin.tie(0); //cin高速化
    ios::sync_with_stdio(false); //cin高速化
	int n;
    cin >> n;
    int a[n];
    int p = 0;
    int Alice=0,Bob=0;
    rep(i,n){
      cin >> a[i];
    }
    sort(a,a+SIZE_OF_ARRAY(a),greater<>());
    rep(i,n){
      if(p==0){
        Alice+=a[i];
        p=1;
      }else{
        Bob+=a[i];
        p=0;
      }
    }
      cout << Alice-Bob << endl;
    return 0;
  } 

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

using namespace std;

int main() {
  string s;
  cin >> s;
  vector<int> v = { 0 };
  int j = 0;

  for( int i = 0; i < s.size(); i++ ) {
    if( s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C' ) {
      v[j] += 1;
    }
    else {
      j++;
      v.push_back( 0 );
    }
  }
  sort( v.begin(), v.end() );
  int max = v.back();
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string st;
	cin >> st;
	int num_0 = 0;
	int num_1 = 0;
	for (int i = 0; i < st.size(); ++i) {
		if (st[i] == '0') num_0++;
		if (st[i] == '1') num_1++;
	}
	cout << min(num_0, num_1)*2 << endl;
	return 0;
}


Measured memory_bytes: 512
n = int(input())
shops = []
for i in range(n):
    name, score = input().split()
    score = int(score)
    shops.append([name, score, i+1])

shops = sorted(shops, key=lambda x: -int(x[1]))
shops = sorted(shops, key=lambda x: x[0])

for shop in shops:
    print(shop[2])

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    ll ans=0;
    for(int i=0;i<=n/r;i++){
        for(int j=0;j<=(n-i*r)/g;j++){
            if((n-i*r-j*g)%b==0)ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def if_kai(s):
    n = len(s)
    l = 0
    r = n-1
    while(l<n//2):
        if s[l]!=s[r]:
            return 0
        l+=1
        r-=1
    return 1



s = input()
n = len(s)
if not if_kai(s):
    print('No')
    exit()
f = 1
l = 0
r = ((n-1)//2)-1
while(l<r):
    if s[l]!=s[r]:
        print('No')
        exit()
    l+=1
    r-=1
l = ((n+3)//2)-1
r = n-1
while(l<r):
    if s[l]!=s[r]:
        print('No')
        exit()
    l+=1
    r-=1
print('Yes')


    

Measured memory_bytes: 3064
"use strict";

function main(input) {
	input = input.trim().split("");
	let arr = []
	for (const s of input) {
		arr.push(s);
		if (arr.length === 3) break
	}
	console.log(arr.join(""))
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


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

int main() {
  int N;
    cin >>N;
  int sum=0;
  int M=0;
  for(int i=0;i<N;i++){
    int p;
      cin >>p;
    sum+=p;
    if(M<=p){
      M=p;
    }
    
}
 int resum=sum-M;
  if(M<resum){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

int main(){
  int N, Q;
  cin >> N >> Q;
  map<int, vector<int>> D;
  map<int, vector<int>> E;
  vector<int> p(1, 0);
  vector<long long> par(N, -1);
  vector<long long> counter(N, 0);
  par[0] = 0;
  int cnt, pnt, n, a, b, pp, x;
  for (int i=0;i<N;i++){
    D[i] = {};
    E[i] = {};
  }
  for (int i=1;i<N;i++){
    cin >> a >> b;
    D[a-1].push_back(b-1);
    D[b-1].push_back(a-1);
  }
  cnt = 1;
  pnt = 0;
  while (cnt < N){
    n = cnt;
    for (int i=pnt;i<cnt;i++){
      for (int j : D[p[i]]){
        if (par[j] == -1){
          E[p[i]].push_back(j);
          p.push_back(j);
          cnt += 1;
          par[j] = p[i];
        }
      }
    }
    pnt = n;
  }
  for (int i=0;i<Q;i++){
    cin >> pp >> x;
    counter[pp-1] += x;
  }
  p = {0};
  cnt = 1;
  pnt = 0;
  while (cnt < N){
    n = cnt;
    for (int i=pnt;i<cnt;i++){
      for (int j : E[p[i]]){
        counter[j] += counter[p[i]];
        p.push_back(j);
        cnt += 1;
      }
    }
    pnt = n;
  }
  for (int i=0;i<N-1;i++){
    cout << counter[i] << " ";
  }
  cout << counter[N-1] << endl;
  return 0;
}

Measured memory_bytes: 50036
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
  int D,E;
  int x,y;
  double sa;

  while (1){
    cin >> D >> E;
    if (D==0&&E==0)return 0;
    sa=500;
    for (x=0,y=D;x<=D;x++,y--)
      if (abs(sqrt(x*x+y*y)-E)<sa)sa=abs(sqrt(x*x+y*y)-E);
    printf("%.6f\n", sa );
  }
  return 0;
}

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

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    int ans = 0;
    for (int i = 0; i < 3; ++i) {
        if (s[i] == t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
B = [int(b) for b in input().strip().split()]

dp = [0] * N
dp[0] = B[0]
if len(B) > 1:
  dp[1] = min(B[0], B[1]) + dp[0]
else:
  dp[1] = B[0] + dp[0]
for i in range(2, N-1):
  dp[i] = min(B[i-1], B[i]) + dp[i-1]
dp[-1] = B[-1] + dp[-2]
print(dp[-1])
  

Measured memory_bytes: 38384
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define M 1050000/* your task*/
#define L 14

int m,n;
char H[M][L]; /* Hash Table */

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0,p=1, i,x,s;
  x=strlen(str);
  for ( i = 0; i < x; i++ ){
    if ( str[i] == 'A') s=1;
    else if ( str[i] == 'C') s= 2;
    else if ( str[i] == 'G') s= 3;
    else if ( str[i] == 'T') s= 4;
    sum += p*s;
    p *= 5;
  }
  return sum;
}

int h1(int k){ return k % M; }
int h2(int k){ return ( k % (M-1) ) + 1; }

int find(char str[]){
  long long f,i,h;

  f=getKey(str);
  
  for(i=0;;i++){
    h=(h1(f)+i*h2(f))%M;
    if(strcmp(H[h],str)==0)return 0;
    else if(strlen(H[h])==0)return -1;
  }
  return -1;

}

int insert(char str[]){

  long long k,i,h;

  k=getKey(str);

  for(i=0;;i++){
    h=(h1(k)+i*h2(k))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){ strcpy(H[h],str); return 0;}
  }
  return 0;
}
  
int main(){
  int i;
  char str[L], com[9];
    
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';  
  scanf("%d", &n);

    
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
	
    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)==0){
	printf("yes\n");
      } else {
	printf("no\n");
      }
    }
  }

  return 0;
}



Measured memory_bytes: 16144
struct MyIo{

}

impl MyIo{
    fn readline()->Vec<String>{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let ret:Vec<String> = buf.split_whitespace().map(|c|c.to_string()).collect();
        ret
    }
}


fn main() {
    let mut input = MyIo::readline().into_iter();
    let v1 = input.next().unwrap().parse::<u64>().unwrap();
    let v2 = input.next().unwrap().parse::<u64>().unwrap();

    let multi = 
    match v1{
        0=>{1},
        1=>{100},
        2=>{10000},
        _=>{0}
    };

    

    let mut answer = (1..101).map(|n| n*multi).nth((v2-1) as usize).unwrap();
    if v1 == 0 && (answer%100) == 0 {
        answer += multi;
    }
    if v1 == 1 && (answer%10000)==0 {
        answer += multi;
    }
    if v1 == 2 && (answer%1000000)==0 {
        answer += multi;
    }
    println!("{:?}",answer);

}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <type_traits>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }

void in_impl(){};
template < typename T, typename... TS > void in_impl( T &head, TS &... tail ){ cin >> head; in_impl( tail ... ); }
#define IN( T, ... ) T __VA_ARGS__; in_impl( __VA_ARGS__ );

template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define NUMBERED( name, number ) NUMBERED2( name, number )
#define NUMBERED2( name, number ) name ## _ ## number
#define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n )
#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a ) ( remove_all_extents< decltype( a ) >::type * )a, ( remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( remove_all_extents< decltype( a ) >::type )

#define SZ( v ) ( (int)( v ).size() )
#define EXISTS( c, e ) ( ( c ).find( e ) != ( c ).end() )

template < typename T > inline bool chmin( T &a, const T &b ){ if ( b < a ) { a = b; return true; } return false; }
template < typename T > inline bool chmax( T &a, const T &b ){ if ( a < b ) { a = b; return true; } return false; }

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 12 ) << fixed;

	IN( int, K );

	LL res = 0;
	REP( i, 1, K + 1 )
	{
		REP( j, 1, K + 1 )
		{
			REP( k, 1, K + 1 )
			{
				res += __gcd( i, __gcd( j, k ) );
			}
		}
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define FB(i,a,b) for(ll i=a;i>=b;i--)
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SC second
#define FS first
using namespace std;
const int N=2e5+5;

int ilA[N],ilB[N];
char S[N];

vector<int> G[N];

 int main()
 {
	int n,m;
	scanf("%d%d",&n,&m);

	char S[N];
	scanf("%s",(S+1));
	F(i,1,n) ilA[i]=0, ilB[i]=0;

	F(i,1,m)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		G[a].PB(b);
		G[b].PB(a);
		if(S[a]=='A') ilA[b]++;
		else ilB[b]++;

		if(S[b]=='A') ilA[a]++;
		else ilB[a]++;
	}

	int left=n;
	queue<int> kol;
	F(i,1,n)
	{
		if(ilA[i]==0||ilB[i]==0)
		{
			kol.push(i);
			ilA[i]=-1;
			ilB[i]=-1;
		}
	}	

	while(!kol.empty())
	{
		int v=kol.front();
		kol.pop();
		left--;

		for(auto z : G[v])
		{
			if(ilA[z]==-1) continue;
			if(S[v]=='A') ilA[z]--;
			else ilB[z]--;

			if(ilA[z]==0||ilB[z]==0)
			{
				kol.push(z);
				ilA[z]=-1;
				ilB[z]=-1;
			}
		}
	}

	if(left>0) printf("Yes\n");
	else printf("No\n");
 }



Measured memory_bytes: 12672
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, c; cin >> a >> b >> c;
	rep(i, 10) {
		cout << c * a - b << endl;
		c = c * a - b;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int n,x,ans[100010];
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++)
		read(x),ans[x]=i;
	for (int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int n, k;
  cin >> n >> k;

  int ans =0;
  for(int j=0; j+k<n; j++){
    ans++;
  }
  cout << ans+1 << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  auto conv = [](char c) {
    if (c == 'B') return 0;
    if (c == 'G') return 1;
    return 2;
  };
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<vi32> sums(3, vi32(n + 1));
  rep(i, 3) {
    rep(j, n) {
      sums[i][j + 1] += sums[i][j];
      if (conv(s[j]) == i) {
        sums[i][j + 1]++;
      }
    }
  }
  i64 ans = 0;
  string t = "BGR";
  do {
    i64 temp = 0;
    rep(i, n) {
      if (s[i] != t[1]) {
        continue;
      }
      temp += sums[conv(t[0])][i] * (sums[conv(t[2])][n] - sums[conv(t[2])][i + 1]);
      reps(j, 4000) {
        if (i - j < 0 || i + j >= n) {
          continue;
        }
        if (s[i - j] == t[0] && s[i + j] == t[2]) {
          temp -= 1;
        }
      }
    }
    ans += temp;
  } while (next_permutation(all(t)));
  cout << ans << endl;
}

Measured memory_bytes: 3700
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = IR(5)
    k = I()
    if max(s)-min(s) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    s = IR(5)
    s.sort(key = lambda x:-x%10)
    ans = 0
    i = 0
    k = 0
    while 1:
        if i%10 == 0:
            ans = i+s[k]
            i += s[k]-1
            k += 1
            if k == 5:break
        i += 1
    print(ans)
    return

#C
def C():
    n = I()
    a = IR(5)
    ans = 5+n//min(a)
    if n%min(a) == 0:ans -= 1
    print(ans)
    return

#D
def D():
    x,y,z,k = LI()
    a = LI()
    b = LI()
    c = LI()
    if k == x*y*z:
        l = []
        for i in a:
            for j in b:
                for m in c:
                    l.append(i+j+m)
        l.sort(reverse = True)
        for i in l:
            print(i)
        quit()
    l = []
    d = defaultdict(int)
    for i in b:
        for j in c:
            l.append(i+j)
            d[i+j] += 1
    l.sort(reverse = True)
    ans = []
    for i in range(x):
        for j in range(k):
            ans.append(a[i]+l[j])
    ans.sort(reverse = True)
    for i in ans[:k]:
        print(i)
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 226432
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto n = readln.chomp.to!int;

  auto a = new long[](n);
  auto b = new long[](n);

  long res;
  foreach (i; 0..n) {
    auto x = readln.chomp.split.to!(long[]);
    a[i] = x[0];
    b[i] = x[1];
  }
  foreach_reverse(i; 0..n) {
    auto s = (a[i] + res) % b[i];
    if (s == 0) continue;
    res += b[i] - s;
  }
  res.writeln;
}


Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    a--;b--;
    
    vector<vector<char>> black(50,vector<char>(100,'#'));
    rep(i,0,50){
        rep(j,0,100){
            if(i%2==1 && j%2==1 && a>0){
                black[i][j]='.';
                a--;
            }
        }
    }
    
    vector<vector<char>> white(50,vector<char>(100,'.'));
    rep(i,0,50){
        rep(j,0,100){
            if(i%2==1 && j%2==1 && b>0){
                white[i][j]='#';
                b--;
            }
        }
    }
    
    cout<<"100 100"<<endl;
    rep(i,0,50) rep(j,0,100){
        cout<<black[i][j];
        if(j==99) cout<<endl;
    }
    rep(i,0,50) rep(j,0,100){
        cout<<white[i][j];
        if(j==99) cout<<endl;
    }
}



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

int main(void){
    int n,k;
    cin >> n >> k;
    int x[n];
    for (size_t i = 0; i < n; i++)cin >> x[i];
    int ans=0;
    for (size_t i = 0; i < n; i++)ans+=(k-x[i]<x[i]?k-x[i]:x[i]);
    cout << ans*2 << endl;
    return 0;
}

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

int main() {
  char s[3][3];
  for(int i = 0; i < 3; ++i)
    for(int j = 0; j < 3; ++j)
      cin >> s[i][j];
  cout << s[0][0] << s[1][1] << s[2][2] << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import Counter
import sys

N = int(input())
D = list(map(int, input().split()))
D = sorted(D)
D_counter = Counter(D)


M = int(input())
T = list(map(int, input().split()))
T = sorted(T)
T_counter = Counter(T)



D_keylist = (list(D_counter.items()))

T_keylist = (list(T_counter.keys()))
T_Valuelist = (list(T_counter.values()))


ans = 0
T_index = 0

for i in D_keylist:
    D_key = i[0] # N個の問題案の中のi個めの問題案の番号
    D_value = i[1] # N個の問題案の中のi個めの問題案の難易度

    T_key = T_keylist[T_index] # M個の問題案の中のi個めの問題案の番号
    T_value = T_Valuelist[T_index] # M個の問題案の中のi個めの問題案の番号


    if D_key == T_key and (D_value >= T_value): #もしNとMの番号問題が一致しており、なおかつN個の問題の方が難易度が多かったら加算
        T_index = T_index + 1 #もし一致していたら、Mの問題番号を横にひとつずらす
        ans = ans + 1 #加算

        if T_index == M:
            break
    else:
        pass


if len(T_keylist) == ans: #M個の問題を作る事ができればYES,無理ならNO
    print("YES")
else:
    print("NO")

Measured memory_bytes: 68772
#include <iostream>
using namespace std;
 
bool is_prime(int n){
  if(n <= 1)
    return false;
 
  for(int i=2;i*i<=n;i++){
    if(n%i == 0)
      return false;
  }
  return true;
}
 
int main(){
    int n;
 
    bool is_prime[1000000];
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<1000000;i++){
      is_prime[i] = true;
    }
    for(int i=2; i*i<1000000; i++){
      if(is_prime[i]){
        for(int j=i*i;j<1000000; j+=i){
          is_prime[j] = false;
        }
      }
    }
 
    int n_prime[1000000];
 
    int cnt = 0;
    for(int i=0;i<1000000;i++){
      if(is_prime[i]){
        cnt++;
      }
      n_prime[i] = cnt;
    }
 
    while(1){
      int primen;
      cin >> n;
      if(cin.eof())
        break;
 
      for(int i=n-1;;i--){
        if(is_prime[i]){
          cout << i << " ";
          break;
        }
      }
 
      for(int i=n+1;;i++){
        if(is_prime[i]){
          cout << i << endl;
          break;
        }
      }
    }
 
}


Measured memory_bytes: 3944
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(ll i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	ll H, W;
	cin >> H >> W;
	ll h = H/2, w = W/2, ans = 1e11;
	if(H % 3 == 0 || W % 3 == 0){
		cout << 0;
	}else{
	reppp(i, 1, W/2+1){
		vector<ll> p(3);
		p[0] = H * i;
		p[1] = h * (W-i);
		p[2] = (H-h) * (W-i);
		ll tmp = *max_element(all(p)) - *min_element(all(p));
		if(tmp < ans) ans = tmp;
	}
	reppp(i, 1, H/2+1){
		vector<ll> p(3);
		p[0] = W * i;
		p[1] = w * (H-i);
		p[2] = (W-w) * (H-i);
		ll tmp = *max_element(all(p)) - *min_element(all(p));
		if(tmp < ans) ans = tmp;
	}
	cout << min(ans, min(H, W));
	}
}



Measured memory_bytes: 256
P = [list(map(int,input().split())) for i in range(3)]
Q=[P[i][j] for i in range(3) for j in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
TF_list=[(Q[i] in B) for i in range(9)]
if TF_list[0]+TF_list[1]+TF_list[2] ==3 or \
TF_list[3]+TF_list[4]+TF_list[5] ==3 or \
TF_list[6]+TF_list[7]+TF_list[8] ==3 or \
TF_list[0]+TF_list[3]+TF_list[6] ==3 or \
TF_list[1]+TF_list[4]+TF_list[7] ==3 or \
TF_list[2]+TF_list[5]+TF_list[8] ==3 or \
TF_list[0]+TF_list[4]+TF_list[8] ==3 or \
TF_list[2]+TF_list[4]+TF_list[6] ==3:
  print ('Yes')
else:
  print('No')

Measured memory_bytes: 3064
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repb(i,n) for(ll i=(n-1);i>=0;i--)
#define all(a) a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void a(){
    string x; cin >> x;
    ll s=0,c=0;

    rep(i,x.size()){
        if(x[i]=='S') s++;
        if(x[i]=='T'&&s>0) {
            s--;
            c++;
        }
    }

    cout << x.size() - c*2 << endl;


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

Measured memory_bytes: 640
/*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a
*/

//  io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
//#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
//  util
#include <string>
//#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
//#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
//#include <queue>
//#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//int modadd(int a, int b) { return ((a += b) < mod) ? a : (a - mod); }
//int modmult(int a, int b) { return (int)((a * b) % mod) }

//file input routed to stdinout
/*
std::ifstream inFile("input.txt");
std::ofstream outFile("output.txt");
std::cin.rdbuf(inFile.rdbuf());
std::cout.rdbuf(outFile.rdbuf());
*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a - b), a * b);
}


Measured memory_bytes: 256
import sys
 
n = int(input())
minv = int(input())
maxv = -1000000000
 
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
 
print(maxv)

Measured memory_bytes: 21912
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

long long int X;

int main(void) {


	cin >> X;

	long long int cur = 100;

	int ans = 0;
	while (1) {
		cur = cur + (cur / 100);
		ans++;
		if (cur >= X) { break; }
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, m; int ans = 0;
	cin >> n;
	while(n!=0){
	ans=0;
	cin >> m;
	string s;
	cin >> s;
	int ren = 0;
	char ba = s[0];
	for (int i = 0; i < m; i++){
		if (ba != s[i]) {
			ren++;
		}
		else if (s[i] == 'I') {
			ren = 1;
		}
		else {
			ren = 0;
		}
		if (ren % 2 == 1 and ren / 2 >= n) {
			ans++;
		}
		ba = s[i];
	}
	cout << ans << endl;
	cin >> n;
	}
}


Measured memory_bytes: 3844
n,m = map(int, input().split())
s = input()
now = 0
MIN = 0
ans = []
while now < n:
  for i in range(min(n-now,m),0,-1):
    nex = now + i
    if s[nex] == "0":
      now = nex
      MIN += 1
      break
  else:
    print(-1)
    exit()
now = 0
while now < n:
  for i in range(min(n-now,m),0,-1):
    nex = now + i
    if s[n-nex] == "0":
      now = nex
      ans.append(i)
      break
print(*reversed(ans))


Measured memory_bytes: 6384
n = int(input())
a = list(map(int, input().split()))
c = [0] * n
res = 0

for i in a:
    c[i-1] += 1

for i in range(n):
    res += c[i] * (c[i] - 1) // 2

for i in a:
    print(res - c[i-1] + 1)

Measured memory_bytes: 82380
from collections import deque


def resolve():
    H, W = map(int, input().split())
    maze = []
    cnt = 0
    for i in range(H):
        maze.append(list(input()))
        cnt += maze[-1].count('#')
    
    d = [[float('inf')] * W for _ in range(H)]
    dy = [1, 0, -1, 0]
    dx = [0, 1, 0, -1]
    q = deque([(0, 0)])
    d[0][0] = 0
    goal = 0

    while q:
        y, x = q.popleft()
        for i in range(4):
            ny = y + dy[i]
            nx = x + dx[i]
            if (1
                    and 0 <= ny < H
                    and 0 <= nx < W
                    and maze[ny][nx] != '#'
                    and d[ny][nx] == float('inf')):
                q.append((ny, nx))
                d[ny][nx] = d[y][x] + 1
        if d[H - 1][W - 1] != float('inf'):
            goal = d[H - 1][W - 1] + 1
            break
    if goal:
        print(H * W - goal - cnt)
    else:
        print(-1)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9428
def ExNo():
	print(-1)
	exit(0)

n = int(input())
A = [int(i) for i in input().split()]

A = [0] + A
n1 = n+1
#print(N, *A)

# 辞書
from collections import defaultdict
D = defaultdict(int)
for i in A[1:]:
	D[i] += 1
#print(D)

#チェック：i番目より大きいiがある → エラー
for i in range(1, n1):
	if A[i]>i: ExNo()
#print("OK:1")


#for k in D.keys():
#	print(k, D[k])


if D[1]==0 : ExNo()
#print("OK:0")



iSum=0
for i in range(1, n1):
	#print(i)
	iSum += D[i]
	if iSum<i: ExNo()
#print("OK:2")


#出力
B = A[1:]
C = []

iCount=0
while iCount < n:
	#print(*A)
	for i in range(len(A)-1, 0, -1):
		#print(i, A[i])
		if i==A[i]:
			#C.append(A[i])
			C = [A[i]] + C
			del A[i]
			break
	else:
		if len(A)>0:
			ExNo()
	iCount += 1


#print(*C, end="\n")
for i in C:
	print(i)
		

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

const int mod = 998244353;
const int inv2 = 499122177;

int a[3010];
int dp[3010], f[3010];

long long power(int a, int b) {
	if (!b) return 1;
	long long tmp = power(a, b >> 1);
	return b & 1 ? tmp * tmp % mod * a % mod : tmp * tmp % mod;
}

int main () {
	int n, S; scanf("%d%d", &n, &S);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	dp[0] = power(2, n);
	for (int i = 0; i < n; i++) {
		for (int j = S; j >= a[i]; j--) {
			dp[j] = (dp[j] + 1ll * dp[j - a[i]] * inv2) % mod;
		}
	}
	printf("%d\n", dp[S]);
	return 0;
}


Measured memory_bytes: 3864
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(ll i = 0;i < n;i++)
#define FOR(i,a,b) for(ll i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

struct edge { ll to, cost; };

int main() {
	IOS;
	string s;
	cin >> s;
	ll cnt = 0;
	bool isW = s[0] == 'W';
	FOR(i, 1, s.size()) {
		if (isW && s[i] == 'B') {
			cnt++;
			isW = !isW;
		}
		else if (!isW && s[i] == 'W') {
			cnt++;
			isW = !isW;
		}
	}
	dump(cnt);
}




Measured memory_bytes: 512
#include <stdio.h>

int selection_sort(int n, int *a)
{
	int i, j, minj, x;
int ans = 0;

	for (i = 0; i < n; i++) {
		minj = i;
		for (j = i; j < n; j++) {
			if (a[j] < a[minj]) minj = j;
		}
		if (i != minj) {
			x = a[i], a[i] = a[minj], a[minj] = x;
ans++;
		}
	}
return ans;
}

//#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 a[102];

int main()
{
	int N, i, k;

	N = in();
	for (i = 0; i < N; i++) a[i] = in();
	k = selection_sort(N, a);
	printf("%d", a[0]);
	for (i = 1; i < N; i++) printf(" %d", a[i]);
	putchar('\n');
	printf("%d\n", k);
	return 0;
}






Measured memory_bytes: 2116
#include <iostream>

using namespace std;

int a, b, c;
int main()
{
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
        c = (a + b) / 2;
        cout << c << endl;
    } else {
        cout << "IMPOSSIBLE"<< endl;
    }
    return 0;
}


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

int main(void)
{
    int n;
    int h[100000];

    int i;
    int ans, g_ans;

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

    ans = 0;
    g_ans = 0;
    for(i=1;i<n;i++){
        if(h[i] <= h[i-1]){
            ans++;
        }else{
            if(g_ans < ans){
                g_ans = ans;
            }
            ans = 0;
        }
    }
    if(g_ans < ans){
        g_ans = ans;
    }

    cout << g_ans;

    return 0;

}

Measured memory_bytes: 640