akhauriyash/Code-Regression huggingface dataset:
using System;


class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long N = long.Parse(input[0]);
        long A = long.Parse(input[1]);
        long B = long.Parse(input[2]);

        if(A == 0)
        {
            Console.WriteLine(0);
        }
        else if (N <= A)
        {
            Console.Write(N);
        }
        else if (N <= A + B)
        {
            Console.Write(A);
        }
        else
        {
            long x = N / (A + B);
            long y = N % (A + B);

            if(A < y)
            {
                Console.Write((A * x) + A);
            }
            else
            {
                Console.Write((A * x) + y);
            }
        }
    }
}

Measured memory_bytes: 13140
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
s =  list(sys.stdin.readline().rstrip())
t =  list(sys.stdin.readline().rstrip())
c=0
for i in range(3):
    if s[i]==t[i]:
        c+=1
print(c)


Measured memory_bytes: 5856
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;

/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N ;
  int a[N ] ;
  int ans = 0 ;
  REP(i,N){
    cin >> a[i] ;
    ans += a[i] ;
  }
  cout << ans - N << endl ;
  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	double a, b;
	scanf("%lf %lf", &a, &b);
	int x, y;
	x = a;
	y = b;
	printf("%d %d %.5lf\n", x / y, x % y, a / b);
	return 0;
} 


Measured memory_bytes: 2752
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/cf17-final/tasks/cf17_final_c

//参考：https://www.hamayanhamayan.com/entry/2017/11/27/224728
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;
 
LL N;
LL D[50];
 
LL ans = 0;
 
void solve(){
	//時間iの人の人数をcount[i]とする
	vector<int> count(13,0);
	//時間iの人が存在するかどうか(詳しくは後述)
	vector<int> vis(24,0);

	for(int i=0;i<N;i++) count[D[i]]++;

	//count[0]>=1 = 高橋くんの都市と時差が0時間の都市が存在 = 答えは0
    if (count[0]) return;
    vis[0] = 1;//時間0にはすでに高橋くんがいる

    //時間i,jの人間が両方存在するならば
    //2人の時差をとる
    //というのを0<=i<=23,0<=j<=23について繰り返し、
    //時差の最小値を返す
    auto counter = [&](){
    	LL mi = INF_INT;
    	for(int i=0;i<24;i++){
    		for(int j=0;j<24;j++){
    			if(vis[i] && vis[j] && i!=j){
    				LL d1 = abs(i-j);
    				LL d2 = 24 - abs(i-j);
    				mi = min(mi,min(d1,d2));
    			}
    		}
    	}
    	return mi;
    };

 	// count[t] == 0ならば人はいない。
	// count[t] == 1ならば時間tか時間(24-t)のどちらかに人がいる。これは分からないので全探索で考える。
	// count[t] == 2ならば時間tか時間(24-t)のどちらにも人がいる。ここは確定。
	//        時刻の差のうちの最小値をsとし、考えうる最大値を求めているため、
	//        count[t]==2の時t,24-tどちらかに2人入れてしまうとs=0になってしまう
	//        このsは絶対に最大値の候補にはなり得ないので除外して良い
	// 2 ≦ count[t]ならば、どうやっても2人以上いる時間が出来てしまうので、答えは0
    vector<int> v;//全探索が必要な時間を格納(最大でも要素数は1~11の11個)
    for(int i=1;i<12;i++) {
        if(count[i] == 1) v.push_back(i);
        else if(count[i] == 2) vis[i] = vis[24 - i] = 1;
        else if(2 < count[i]) return;
    }
    if (count[12] == 1) vis[12] = 1;
    else if (2 <= count[12]) return;//時間12に2人以上いたらその差がどうやっても0になってしまう
 
    int M = v.size();
    if (M == 0) {
    	ans = counter();
        return;
    }

 	// count[t]==1である部分だけを全探索して、距離の最小をチェックする。
	// 全探索する可能性があるtは[1,11]の11通りで全部でO(2^11)、最小のチェックを愚直にやってO(N^2)。
	// 全部でO(2^11*50*50)なので間に合う。
    for(int bit=0;bit<(1<<M);bit++){
    	//bitのi[bit]目が1なら　vis[v[i]] = 1(高橋くんから見て時計回り)
    	//bitのi[bit]目が0なら　vis[24 - v[i]] = 1(高橋くんから見て反時計回り)
    	//となるようbit全探索

    	//以下のfor内で、ビット列bitに対応するよう円形に配置、
    	//ラムダ式counter()で人と人同士の距離の最小値をはかる
        for(int i=0;i<M;i++){//全探索が必要な時間がvに保管してある(vは要素数M)
            if (bit & (1 << i)) vis[v[i]] = 1, vis[24 - v[i]] = 0;
            else vis[v[i]] = 0, vis[24 - v[i]] = 1;
        }
        ans = max(ans,counter());
    }
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> D[i];
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long int;

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    int ans = 0;
    for(int i = 0; i < t.length(); i++){
        for(int j = i; j+(t.length()-i-1)< s.length(); j++){
            int coans = 0;
            for(int k = 0; i+k < t.length(); k++){
                if(t[i+k] == s[j+k]) coans++;
            }
            if(coans > ans) ans = coans;
        }
    }
    cout << t.length() - ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int p[n];
  for(int i=0;i<n;i++){
    cin >> p[i];
  }
  int x=0,y=0;
  for( int i=0; i<n-2 ;i++ ){
   if(p[i] < p[i+1] && p[i+1] < p[i+2])
      x++;
    if(p[i]>p[i+1] && p[i+1] > p[i+2])
      y++;
  }
  cout << x+y <<endl;
}

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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

int lowbit(int x) {return x&(-x);}

int n,k;
int a[110];
int dp[100010];

int getf(int cur) {
	if (cur==0) return 0;
	if (dp[cur]!=-1) return dp[cur];
	dp[cur]=0;
	for (int i=0;i<n;i++) {
		if (cur-a[i]<0) continue;
		if (getf(cur-a[i])==0) {
			dp[cur]=1;
			return 1;
		}
	}
	return dp[cur];
}

int main(){
	scanf("%d%d",&n,&k);
	for (int i=0;i<n;i++) scanf("%d",&a[i]);
	memset(dp,-1,sizeof(dp));
	if (getf(k)==1) printf("First");
	else printf("Second");
	return 0;
}


Measured memory_bytes: 5376
#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char a[1010101];
int main()
{
	int n,q,k;
	long long ans,sc,nowd,nowm,i;
	scanf("%d",&n);
	scanf("%s",a+1);
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d",&k);
		ans=0,sc=0,nowd=0,nowm=0;
		for(i=1;i<=n;i++)
		{
			if(a[i]=='C')
			{
				ans+=sc;
			}
			else if(a[i]=='M')
			{
				sc+=nowd;
				nowm++;
			}
			else if(a[i]=='D')
				nowd++;
			if(i-k+1>0)
			{
				if(a[i-k+1]=='D')
				{
					sc-=nowm;
					nowd--;
				}
				else if(a[i-k+1]=='M')
				{
					nowm--;
				}
			}
		}
		cout<<ans<<"\n";
	}
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	return 0;
}


Measured memory_bytes: 1280
function main()
	a = parse(readline())
	b = parse(readline())
	c = parse(readline())
	x = parse(readline())
	ca = 0
	count = 0
	while ca*500 <= x && ca <= a
		cb = 0
		y = x-ca*500
		while cb*100 <= y && cb <= b
			z = y-cb*100
			p = z%50
			q = (z-p)/50
			if q <= c && p == 0
				count +=1
			end
			cb += 1
		end
		ca += 1
	end
	print(count)
end


main()

Measured memory_bytes: 164744
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	string S; cin >> S;
	if (S == "AAA" || S == "BBB")cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}


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

template<typename integer>
integer __lcm(integer a, integer b) {
  return (a * b) / __gcd(a, b);
}

int main() {
  char N[4];
  cin >> N;

  int cnt = 0;
  int ans = 0;
  char prev_char = '*';

  rep (i, 4) {
    if (prev_char == N[i]) cnt++;
    else cnt = 1;

    ans = max(ans, cnt);
    prev_char = N[i];
  }

  if (ans >= 3) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;


int main()
{
    ll MOD = 1000000007;

    ll n, ans = 0;
    cin >> n;
    vector<ll> a(n), sum(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        if (i != 0) sum[i] = sum[i - 1] + a[i];
        else sum[i] = a[i];
    }

    for (ll i = 0; i < n - 1; i++) {
        ans = (ans + ((sum[n - 1] - sum[i]) % MOD) * a[i] % MOD) % MOD;
    }

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

Measured memory_bytes: 6428
n=int(input())
shogen=[]
a=[]
max=0
#正直者が1、不親切が0

for i in range(n):
	a.append(int(input()))
	kari=[]
	for j in range(a[-1]):
		kari.append(list(map(int,input().split())))
	shogen.append(kari)

for i in range(2**n):#全探索
	shojiki=[]
	for l in reversed(range(n)):
		shojiki.append(i//(2**l))
		i=i%(2**l)
	ninzu=0
	kekka=1
	#judge=[-1 for j in range(n)]
	for j in range(n):#全員調べる
		if shojiki[j]==1:
			ninzu+=1
			for k in range(a[j]):#j人目について
				# if judge[shogen[j][k][0]-1]==-1:
					# judge[shogen[j][k][0]-1]=shogen[j][k][1]
				# elif judge[shogen[j][k][0]-1]!=shogen[j][k][1]:
					# kekka=0
				if shojiki[shogen[j][k][0]-1]!=shogen[j][k][1]:
					kekka=0
					break
			if kekka==0:
				break
	if kekka==0:
		ninzu=0
	if ninzu>max:
		max=ninzu

print(max)
		

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

int main()
{
	int n;
	cin >> n;
	vector<int> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	int ans = 0;

	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0 && as[i] % 2 == 1)
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int count(int n);

int main(void){
	while (true){
		int n; cin >> n;
		if (!n){
			break;
		}
		cout << count(n) << endl;
	}
	return 0;
}

int count(int n){
	int ct = 0;
	while (n != 1){
		if (n % 2 == 0){
			n = n / 2;
		}
		else {
			n = n * 3 + 1;
		}
		ct++;
	}
	return ct;
}

Measured memory_bytes: 1160
//Author : Ayush Jain

#include <bits/stdc++.h>
using namespace std;

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	int a,b,i;
	char s[50];	
	cin>>a>>b;
	cin>>s;
	int n=strlen(s);
	bool ans=true;
	if(n!=(a+b+1)){
		cout<<"No\n";
		return 0;
	}
	for(i=0;i<a;i++){
		if(!(s[i]>='0' && s[i]<='9')) ans=false;
	}	
	if(s[a]!='-') ans=false;
	for(i=a+1;i<n;i++){
		if(!(s[i]>='0' && s[i]<='9')) ans=false;
	}
	if(ans) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
	
}

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

int main() {
  string S;
  cin >> S;
  
  bool flg = true;
  
  // cout << S << endl;
  
  string reverse_S = S;
  reverse(reverse_S.begin(), reverse_S.end());
  // cout << reverse_S << endl;
  
  for(int i = 0; i < S.size(); i++) {
    if (S.at(i) != reverse_S.at(i)) {
      // cout << "No" << endl;
      flg = false;
    }
  }
  
  int av = (S.size() -1) / 2;
  // cout << S.substr(0, av) << endl;
  string S2 = S.substr(0, av);
  string reverse_S2 = S2;
  reverse(reverse_S2.begin(), reverse_S2.end());
  // cout << reverse_S2 << endl;
  
  for(int i = 0; i < av; i++) {
    if (S2.at(i) != reverse_S2.at(i)) {
      // cout << "No" << endl;
      flg = false;
    }
  }
  
  if (flg) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll maxn=110;
const ll maxk=22;
const ll mod=1e9+7;
const ll inf=1e9+500;

struct hh{
    vector<ll> sar;
    vector<ll> tah;
    ll maxx;
};
hh f(ll n){
    hh ans;
    if(n==2){
        ans.sar.pb(1);
        ans.tah.pb(1);
        ans.maxx=1;
        return ans;
    }
    if(n%2==0){
        ans=f(n/2);
        ans.sar.pb(ans.maxx+1);
        ans.tah.pb(ans.maxx+1);
        ans.maxx++;
        return ans;
    }
    ans=f(n-1);
    ans.sar.pb(ans.maxx+1);
    ans.tah.pb(ans.maxx+1);
    for(ll i=ans.tah.size()-1;i>=1;i--){
        swap(ans.tah[i],ans.tah[i-1]);
    }
    ans.maxx++;
    return ans;
}
int main(){
    string s,t;
    ll n;
    cin>>n;
    n++;
    hh e=f(n);
    cout<<e.sar.size()+e.tah.size()<<endl;
    for(auto v:e.sar){
        cout<<v<<' ';
    }
    for(auto v:e.tah){
        cout<<v<<' ';
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int N[3];
	for (int i = 0; i < 3; i++)
	{
		cin >> N[i];
	}
	sort(N, N + 3);
	cout << N[0] + N[1];
}

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

main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int ans=b;
	if(a<=c)
	{
		ans+=a;
		c-=a;
	}
	else
	{
		ans+=c;
		c=0;
	}
	ans+=min(c,b+1);
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int m, d;


int main()
{
	int count = 0;
	scanf("%d%d", &m, &d);
	
	int d1, d10;
	
	for (int i = 1 ; i <= m ; i++)
	{
		for (int j = 10 ; j <= d ; j++)
		{
			d1 = j % 10;
			d10 = j / 10;
			
			if ((d1 < 2) || (d10 < 2))
				continue;
			
			if ((d1 * d10) == i)
			{
//				printf("%d %d\n", i, j);				
				count++;
			}
		}
	}
	

	printf("%d\n", count);
	
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;
#define en printf("\n");

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
    ll n,k;cin>>n>>k;ll arr[n];
    for(ll i=0;i<n;i++)
    cin>>arr[i];
    for(ll i=k;i<n;i++){
    if(arr[i-k]<arr[i])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;}
}


Measured memory_bytes: 5184
N = int(input())
data = list(map(int, input().split()))

pos_cnt = 1
remove_cnt = 0
for d in data:
    if d == pos_cnt:
        pos_cnt += 1
    else:
        remove_cnt += 1

if remove_cnt == N:
    print(-1)
else:
    print(remove_cnt)


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

int main(void){
    int N;
    cin >> N;
    int i = 1;
    int max = 0;
    int check = 1;

    for(int i = 1; i <= 100; i++){
        check = i;
        for(int j = 1; j <= 10; j++){
            check *= i;
            if(check >= max && check <= N)
                max = check;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 50+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
int x[N];
LL dp[N][N*N];//dp[i][j]表示前i个数相加值为j的方案数
int main(){
    int n,a;
    scanf("%d%d",&n,&a);
    for(int i=1;i<=n;i++)
        scanf("%d",&x[i]);

    dp[0][0]=1;
    for(int k=1;k<=n;k++){//n个物品
        for(int i=k-1;i>=0;i--){//每次取得的物品个数减少
            for(int j=0;j<=50*i;j++){//统计相加的值，最大为50*i
                dp[i+1][j+x[k]]+=dp[i][j];
            }
        }
    }

    LL res=0;
    for(int i=1;i<=n;i++){
        int val=i*a;//选择i个物品时他们平均值的总和
        res+=dp[i][val];
    }
    printf("%lld\n",res);

    return 0;
}


Measured memory_bytes: 1024
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;


#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
	FIO
	
	int n,m;cin >> n >> m;
	if(n == m)cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    a[i]=tmp;
    b[i]=tmp;
  }
  sort(b,b+n);
  // for(int i=0;i<n;i++){
  //   cout<<b[i]<<",";
  // }
  // cout<<endl;
  int med1=b[n/2-1],med2=b[n/2];
  // cout<<med1<<","<<med2<<endl;
  for(int i=0;i<n;i++){
    cout<<((a[i]<med2)?med2:med1)<<endl;
  }
  return 0;
}


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

int main() {
	int n;cin>>n;
	int p[n+1];
	for(int i=1;i<=n;i++){
		cin>>p[i];
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(p[i]==i){
			ans++;
			if(i!=n){
				p[i+1]=0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  std::string S;
  std::cin >> S;
  int cnt = 1;
  bool f = false;
  int i = 0;
  for (i = 1; i < S.size(); ++i)
  {
    if (S[i - 1] != S[i] || f)
    {
      cnt++;
      f = false;
    }
    else
    {
      i++;
      cnt++;
      f = true;
    }
  }
  if (f && i > S.size())
    cnt--;
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 640
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  printf("%d %d %d\n",z,x,y );
  return 0;
}


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

int h, w;
  
int main () {
  cin >> h >> w;
  vector<vector<char>> c(h, vector<char>(w));
    
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cin >> c[i][j];
    }
  }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cout << c[i][j];
    }cout << endl;
    for (int j = 0; j < w; j++){
      cout << c[i][j];
    }cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define mip map<int, pair<int,int> >
#define inf INT_MAX
#define inf1 LONGLONG_MAX
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define deb(x) cout<<#x<<"is "<<x<<endl;
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
   
/* brownsands :Arpit */			

void solve()
{   int a,b;
    cin >> a >> b;
    double x=(a*100)/8.00;
    int x2=x;
    int x1=x*0.08;
    double y=(b*100)/10;
    int y1=y*0.1;
    int y2=y;

    for(int i=min(x2,y2)-10;i<=max(x2,y2)+10;i++)
    {
        int q=i*(0.08);
        int w=i*0.1;
        if(q==a && w==b)
        {
            cout<<i<<endl;
            return;
        }
    }    

   
     cout<<"-1"<<endl;

}
signed main()
{
   boost
        int test=0,t;
		//cin>>t;
		t=1;
		while(test++ <t){
            //cout<<"Case "<<test<<": ";
            solve();
            //cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
               }		
} 
               
			
 

				
		
		




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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n;
    cin >> n;
    if (n == 3) {
        cout << "2 5 63" << '\n';
    } else if (n == 4) {
        cout << "2 5 20 63" << '\n';
    } else if (n == 5) {
        cout << "2 5 20 30 63" << '\n';
    } else {
        vector<int> res;
        ll sum = 0;
        int i = 2;
        for ( ; i<=30000 && (int)res.size()<n; ++i) {
            if (i%2 == 0 || i%3 == 0) {
                sum += i;
                res.push_back(i);
            }
        }
        int del = -1;
        if (sum%6 == 2) {
            del = 8;
            while (i%6 != 0) ++i;
            res.push_back(i);
        } else if (sum%6 == 3) {
            del = 9;
            while (i%6 != 0) ++i;
            res.push_back(i);
        } else if (sum%6 == 5) {
            del = 9;
            while (i%6 != 4) ++i;
            res.push_back(i);
        }
        for (int j=0; j<(int)res.size(); ++j) {
            if (res.at(j) != del) {
                cout << res.at(j);
                if (j == (int)res.size()-1) cout << '\n';
                else cout << ' ';
            }
        }
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;


int main(){
	int a, b;
	cin >> a >> b;
	if ((a*b)%2) cout << "Odd" << endl;
	else cout << "Even" << endl;
	return 0;
}



Measured memory_bytes: 3524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
int n;
int s[100005];
class A{
	public:int id,x;
};
int cmp(A a,A b){
	return a.x>b.x;
}
A v1[100005],v2[100005];
int main(){
	cin>>n;
	int k1=0,k2=0;
	for(int i=0;i<=100000;i++){
		v1[i].id=i;
		v2[i].id=i;
	}
	for(int i=1;i<=n;i++){
		scanf("%d",s+i);
		if(i%2){
			k1++;
			v1[s[i]].x++;
		}else{
			k2++;
			v2[s[i]].x++;
		}
	}
	sort(v1,v1+100000,cmp);
	sort(v2,v2+100000,cmp);
	if(v1[0].id==v2[0].id){
		cout<<n-max(v1[1].x+v2[0].x,v1[0].x+v2[1].x)<<endl;
	}else{
		cout<<n-v1[0].x-v2[0].x<<endl;
	}
	return 0;
}
//

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> point(n, k);
  rep(i, q) {
    int a;
    cin >> a;
    a--;
    point[a]++;
  }
  rep(i, n) {
    point[i] -= q;
    if (point[i] > 0)
      PYES;
    else
      PNO;
  }

  return 0;
}


Measured memory_bytes: 1024
function Main(input){
  // 文字列を格納
  input = input.trim().split(' ');
  let t_hp = parseInt(input[0]);
  let t_at = parseInt(input[1]);
  let a_hp = parseInt(input[2]);
  let a_at = parseInt(input[3]);

  let ans = 'Yes';

  while ((t_hp > 0) && (a_hp > 0)){
    a_hp -= t_at;
    if (a_hp <= 0) {
      break;
    }
    t_hp -= a_at;
    if (t_hp <= 0) {
      ans = 'No';
      break;
    }
  }

  console.log(ans);
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

int main()
{
    int n;cin>>n;
    int act[3][100005]={};
    int ans[3][100005]={};
    for(int j=0;j<n;j++){
        for(int i=0;i<3;i++){
            cin>>act[i][j];
        }
    }
    for(int i=0;i<3;i++){
        ans[i][0]=act[i][0];
    }
    for(int j=1;j<n;j++){
        for(int i=0;i<3;i++){int Max=0;
            for(int k=0;k<3;k++){
                if(i==k)continue;
                Max=max(Max,ans[k][j-1]);
            }
            ans[i][j]+=Max+act[i][j];
            //cout<<"["<<Max<<" "<<ans[i][j]<<"] ";
        }
       // cout<<endl;
    }
    int Max=0;
    for(int i=0;i<3;i++)
    Max=max(Max,ans[i][n-1]);
    cout<<Max<<endl;



}



/*3 10 40 70 20 50 80 30 60 90*/








Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

int main(){
    int n, k, q;
    scanf("%d%d%d", &n, &k, &q);
    lint a[n];
    rep(i, n) scanf("%lld", &a[i]);
    lint ans = 1e18;
    rep(i, n){
        int l = 0;
        int r = 0;
        vector<lint> t;
        while(l < n){
            vector<lint> v;
            while(r < n && a[r] >= a[i]){
                v.push_back(a[r]);
                ++r;
            }
            l = r+1;
            r = l;
            if(v.size() < k) continue;
            sort(v.begin(), v.end());
            rep(j, v.size()-k+1) t.push_back(v[j]);
        }
        if(t.size() < q) continue;
        sort(t.begin(), t.end());
        ans = min(ans, t[q-1] - a[i]);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 384
#define ll     long long int
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    ll n,i,j=0,k;
    string s;
    cin>>s;
    n=s.size();
    for(i=0;i<n;i++)
    {
        if(s[i]=='7')
        {
            j++;
            break;
        }
    }
    if(j>0)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;

}



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

int main() {
  int N,K;
  cin>>N>>K;
  vector<long long>H(N);
  for(int i=0;i<N;i++) cin>>H[i];
  sort(H.begin(),H.end());
  long long ans=0;
  for(int i=0;i<N-K;i++) ans+=H[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
using namespace std;

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

int main(){
  string S;
  cin >> S;
  int len = S.length();
  int ans = 0;
  for (size_t i = 0; i < len/2; i++)
  {
      if(S[i] != S[len-i-1]){
          ans++;
      }
  }
  cout<<ans;
  
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
typedef vector<tint> vtint;
typedef vector<vint> vvint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//↑templete
signed main(){

	int N;
	cin>>N;
	vint H;

	int now=0, ans=0;
	for(int i=0;i<N;i++){
		int h;
		cin>>h;
		
		ans+=max(0, h-now);
		now=h;
	}

	cout<<ans<<endl;

    return 0;
}

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

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

	const int n = 26;
	vector<int> num(n,0);

	for (int i = 0; i < s.size(); i++) {				
		num[(int)(s.at(i) - 'a')]++;
	}

	for (int i = 0; i < n; i++) {

		if (num[i] == 0) {

			cout << (char)(i + 'a') << endl;
			return 0;
			
		}

	}
	
	cout << "None" << endl;
	
	return 0;
}

Measured memory_bytes: 512
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll n,val=1,ans=0;
  cin >> n;
  if(n%2==1){
    cout << "0\n";
    return 0;
  }
  for(ll i=0;;i++){
    val*=5;
    if(val>n) break;
    ans += (n/val)/2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();

        long index = Math.min(B-1,N);
        
        long result = (long) (Math.floor(A * index / B) - A * Math.floor(index / B));
        System.out.println(result);

    }
}

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

int len,tmp,maxn;
char s[1000000];

int main()
{
	scanf("%*d%s",s);
	len = strlen(s);
	for(int i = 0;i < len;++i)
		switch (s[i]){
			case 'I':maxn = max(maxn,++tmp);break;
			case 'D':--tmp;break;
		}
	cout<<maxn<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >>n;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int x1,x2,x3;
  x1 = a[0];
  for(int i = 1; i < n; i++){
    if(a[i] != x1){
      x2 = a[i];
      break;
    }
  }
  for(int i = 0; i < n; i++){
    if((a[i] != x1) && (a[i] != x2)){
      x3 = a[i];
      break;
    }
  }
  int c1 = 0;
  int c2 = 0;
  int c3 = 0;
  int f = 0;
  //cout <<x1 <<x2 <<x3 <<endl;
  if(x1==0 && x2 == 0){
    cout << "Yes";
  }else{
  if((x1 != 0)&&(x2 != 0)){
  for(int i = 0; i < n; i++){
    if(a[i]==x1){
      c1++;
    }else if(a[i]==x2){
      c2++;
    }else if(a[i] == x3){
      c3++;
    }else{
      f=1;
    }
  }
  if(((x1 ^ x2)==x3)&&((x2 ^ x3)==x1)&&((x3 ^ x1)==x2)){
    if((c1==c2)&&(c2 == c3)&&(c3 ==c1)&&(f==0)){
      cout << "Yes" <<endl;
    }else{
      cout << "No" <<endl;
    }
  }else{
    cout << "No" <<endl;

  }
}else{
  for(int i = 0; i < n; i++){
    if(a[i]==x1){
      c1++;
    }else if(a[i]==x2){
      c2++;
    }else{
      f=1;
    }
  }
  if(((x1 ^ x2)==x1)||((x1 ^ x2)==x2)&&(((x1 ^ x1)==x2)) || ((x2 ^ x2)==x1)){
    if( ((c1==2*c2)||(c1*2 == c2)) && (f==0) ){
      cout << "Yes" <<endl;
    }else{
      cout << "No" <<endl;
    }
  }else{
    cout << "No" <<endl;
  }
}
}
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m, p;
  cin >> n >> m >> p;
  vector<vector<int>> rg(n);
  vector<long long> a(m), b(m), c(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    c[i] -= p;
    rg[b[i]].push_back(a[i]);
  }
  vector<int> reachable(n);
  reachable[n - 1] = true;
  queue<int> que;
  que.push(n - 1);
  while (que.size()) {
    int cur = que.front();
    que.pop();
    for (int nbr : rg[cur]) {
      if (reachable[nbr]) continue;
      reachable[nbr] = true;
      que.push(nbr);
    }
  }
  vector<vector<long long>> edge;
  for (int i = 0; i < m; i++) {
    if (reachable[a[i]] && reachable[b[i]]) {
      edge.push_back({a[i], b[i], -c[i]});
    }
  }
  //for (auto v : edge) {
    //cerr << v[0] << " " << v[1] << " " << v[2] << endl;
  //}
  const long long inf = 1LL << 60;
  vector<long long> dist(n, inf);
  dist[0] = 0;
  for (int i = 0; i < n; i++) {
     for (auto v : edge) {
       if (dist[v[0]] != inf && dist[v[1]] > dist[v[0]] + v[2]) {
         dist[v[1]] = dist[v[0]] + v[2];
         if(i == n - 1) {
           //cerr << "here" << endl;
           cout << -1 << endl;
           return 0;
         }
       }
     }
  }
  if (dist[n - 1] == inf) cout << -1 << endl;
  else cout << max(0LL, -dist[n - 1]) << endl;
  return 0;
}
    


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

int main(){
    int n;
    cin>>n;
    long long A[n+1];
    long long B[n];
    for(int i=0; i<=n; i++){
        cin>>A[i];
    }
    for(int i=0; i<n; i++){
        cin>>B[i];
    }
    long long co=0;
    for(int i=0; i<n; i++){
        if (B[i]<=A[i]) {
            co+=B[i];
        }
        else{
            co+=A[i];
            B[i]-=A[i];
            if (B[i]<=A[i+1]){
                co+=B[i];
                A[i+1]-=B[i];
            }
            else{
                co+=A[i+1];
                A[i+1]=0;
            }
        }

    }
    cout<<co<<endl;
}

Measured memory_bytes: 1792
import java.util.*;	
public class Main {	
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String line = sc.nextLine();	
      String str[] = line.split(" ");	
      double num = Double.parseDouble(str[0] + str[1]);
      double square = Math.sqrt(Double.parseDouble(str[0] + str[1]));
      if(num % square == 0){System.out.println("Yes");
      }else{System.out.println("No");
      }
    }
}

Measured memory_bytes: 21972
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>

#define p(a, b) pair<a, b>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    int val = 1;
    for(int i = 0; i < n; i++){
        val = min(2*val,val+k);
    }
    cout << val;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n, r = 0;
	int a, b, c, d;
	cin >> n;
	for (a = pow(n, 0.5); a; a--) {
		for (b = a; b >= 0; b--) {
			for (c = b; c >= 0; c--) {
				for (d = c; d >= 0; d--) {
					if (a * a + b * b + c * c + d * d == n) {
						r++;
					}
				}
			}
		}
	}
	if (r) {
		cout << r << endl;
		main();
	}
	return 0;
}

Measured memory_bytes: 1228
// AOJ ITP 1_4_C
#include<cstdio>

int main()
{
	int a, b;
	char op[2];
	while( scanf( "%d%s%d", &a, op, &b ), *op != '?' )
		printf( "%d\n", *op=='+' ? a+b : *op=='-' ? a-b : *op=='*' ? a*b : a/b );

	return 0;
}

Measured memory_bytes: 1028
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> ai = new ArrayList<>();
        int sum = 0;
        int prev = 0;
        ai.add(0);
        for (int i = 0; i < N; i++) {
            int tmp = sc.nextInt();
            ai.add(tmp);
            sum += Math.abs(tmp - prev);
            prev = tmp;
        }
        sum += Math.abs(prev);
        ai.add(0);

        for (int i = 1; i <= N; i++) {
            int a1 = Math.abs(ai.get(i - 1) - ai.get(i));
            int a2 = Math.abs(ai.get(i) - ai.get(i + 1));
            int a3 = Math.abs(ai.get(i + 1) - ai.get(i - 1));
            System.out.println(sum - (a1 + a2 - a3));
        }
    }
}


Measured memory_bytes: 67456
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

	int ans = 0;
	bool flag = false;
	for (int b = 1; b < 1000; b++) 
	{
		for (int p = 2; p < 1000; p++)
		{
			int _x = pow(b, p);
			
			if (_x <= X && ans < _x)
			{
				ans = _x;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    var (N, M) = nextLongList()
    var ans = 0L
    while (true) {
        val add = Math.min(N, M / 2)
        if (add == 0L) break
        ans += add
        N -= add
        M -= add * 2
        if (N == 0L) {
            N = M / 4
            M -= N * 2
        }
    }
    println(ans)
}

Measured memory_bytes: 37932
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def dist(a, b):
    sum = 0
    for i in range(len(a)):
        sum += (a[i]-b[i])**2
    return sum**(1/2)


def main():
    n, d = list(map(int, input().split()))
    x = [[] for i in range(n)]

    for i in range(n):
        x[i] = list(map(int, input().split()))
    count = 0
    for i in range(n-1):
        for j in range(i+1, n):
            dis = dist(x[i], x[j])
            # print(dis, math.floor(dis))
            if dis == math.floor(dis):
                count += 1

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 6352
N,K=map(int,input().split())
S=[0]*N
b=0

for i in range(K):
    d=input()
    A=list(map(int,input().split()))
    for j in A:
        S[j-1]+=1

for i in range(len(S)):
    if S[i]==0:
        b+=1
print(b)

Measured memory_bytes: 9108
#include <stdio.h>
int min(int a[], int num){
    int min = 9;
    int min_n = 0;
    for(int i = 0; i < num; i++){
        if((a[i]-1) % 10 < min){
            min = (a[i]-1) % 10;
            min_n = i;
        }
    }
    return min_n;
}


int main(void){
    int a[5];
    int sum = 0;
    for(int i = 0; i < 5; i++){
        scanf("%d", &a[i]);    
    }
    int min_n = min(a, 5);
    for(int i = 0; i < 5; i++){
        if(i != min_n){
            a[i] = ((a[i]-1) /10 + 1) * 10;
        }
        sum += a[i];
    }
    printf("%d\n", sum);
    return 0; 
}

Measured memory_bytes: 128
/*
AizuOnline A0543
Receipt
*/
#include <stdio.h>


main()
{
  int i;
  int kakaku,price;

  while(EOF != scanf("%d",&kakaku) && kakaku)
    {
      for(i=0;i<9;i++)
	{
	  scanf("%d",&price);
	  kakaku -= price;
	}

      printf("%d\n",kakaku);
    }
return(0);
}

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

int s[200005];

int main()
{
  int n, m;
  scanf("%d%d",&n, &m);
  for(int i=0;i<n;i++) {
    int x;
    scanf("%d",&x);
    s[x]++;
  }
  priority_queue<int> pq;
  for(int i=1;i<=n;i++)
    if(s[i])
      pq.push(-s[i]);
  int ans = 0;
  while(pq.size() > m) {
    ans -= pq.top();
    pq.pop();
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 2168
#include<stdio.h>

int main(void) {

	int a, b, d, r;
	double f;

	scanf("%d %d", &a, &b);

	d = a / b;
	r = a%b;
	f = 1.0 * a / b;

	printf("%d %d %.5lf\n", d, r, f);

	return(0);

}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
  
int N;
string S[100];
  
int rec(int& idx, int depth)
{
  if(isdigit(S[idx][depth])) {
    return(S[idx++][depth] - '0');
  } else if(S[idx++][depth] == '+') {
    int ret = 0;
    while(S[idx].size() > depth + 1) ret += rec(idx, depth + 1);
    return(ret);
  } else {
    int ret = 1;
    while(S[idx].size() > depth + 1) ret *= rec(idx, depth + 1);
    return(ret);
  }
}
  
int main()
{
  while(cin >> N, N) {
    for(int i = 0; i < N; i++) cin >> S[i];
    S[N] = "";
    int idx = 0;
    cout << rec(idx, 0) << endl;
  }
}

Measured memory_bytes: 3192
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
//#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n, m ;
    cin >> n >> m ;
    if(n == m) cout << "Yes" << endl ;
    else cout << "No" << endl ;
}
 
int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,cou=0;
  cin>>a;
  int b[a];
  for(int i=0;i<a;i++)
    cin>>b[i];
  for(int i=0;i<a-2;i++){
    if(b[i]<=b[i+1]&&b[i+1]<=b[i+2])
      cou++;
    else if(b[i]>=b[i+1]&&b[i+1]>=b[i+2])
      cou++;
  }
  cout<<cou<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC, task A, 2020/04/26
//ms, ac
/*
*/

int main(void){
  int S;
  int W;

  cin >>S >>W;
  if(S<=W) cout <<"unsafe";
  else     cout <<"safe";
  return 0;
}
/*
*/


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int X,Y;
    cin >> X >> Y;
    int flag = 0;
    for (int i=0;i<X+1;i++){
        int crane = i;
        int turtle = X - i;
        if(crane * 2 + turtle * 4 == Y){
            cout << "Yes";
            flag = 1;
        }
    }
    if(flag == 0) cout << "No";
}

Measured memory_bytes: 3572
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

n = int(sys.stdin.buffer.readline())
if n & 1:
    print(n * 2)
else:
    print(n)


Measured memory_bytes: 13632