akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int n, x, y, z;
int a[100010];
map<int, int>mp;
signed main() {
	scanf("%lld", &n);
	rep(i, n) {
		scanf("%lld", &a[i]);
		mp[a[i]]++;
	}
	sort(a, a + n);
	x = a[0], y = a[n / 3], z = a[n - 1];
	if (z == 0) cout << "Yes" << endl;
	else if (n % 3 != 0) cout << "No" << endl;
	else if (mp.size() == 2 && x == 0 && y == z && mp[x] == n / 3) cout << "Yes" << endl;
	else if (mp.size() == 3 && (x xor y xor z) == 0 && x != y && y != z && x != z && mp[x] == mp[y] && mp[y] == mp[z] && mp[x] == n / 3) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 5632
N,M=gets.split.map(&:to_i)

idxs = [0]
arr = [0]
M.times.map.each do
  a,_b = gets.split.map(&:to_i)
  c = gets.split.inject(0) {|n,i| n += 1 << (i.to_i-1) }

  idxs.length.times do |i|
    idx = idxs[i]
    if arr[idx|c].nil?
      idxs << (idx|c)
      arr[idx|c] = arr[idx]+a
    elsif arr[idx]+a < arr[idx|c]
      arr[idx|c] = arr[idx]+a
    end
  end
end

ret = arr[2**N-1] || -1
puts ret


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

using namespace std;
int main(){
  long long int ans = 0;
  long int N;
  cin >> N;
  vector<string> s(N);
  map<string,long int> p;
  for(int i = 0; i < N; i++) cin >> s[i];
  for(int i = 0; i < N; i++) sort(s[i].begin(),s[i].end());
  for(int i = 0; i < N; i++){
      p[s[i]] += 1;
  }
  map<string,int> q;
  for(int i = 0; i < N; i++){
      if(q[s[i]] == 0){  ans += ( (p[s[i]] - 1) * p[s[i]] ) / 2; q[s[i]] = 1; }
  }
 cout << ans;
 return 0;
}

Measured memory_bytes: 29184
'''
Accepted    　:No
difficult   　: 
ペナルティ　  　:5分
実際の回答時間  :分
WAの回数　     :回
合計時間　　  　:分
'''

def myAnswer(N:int,Q:int,S:str,L:list,R:list) -> None:
   pre = S[0]
   accum = [0]
   for s in S[1:]:
      if(pre == "A" and s =="C"):
         accum.append(accum[-1] + 1)
      else:
         accum.append(accum[-1])
      pre = s
   for l,r in zip(L,R):
      print(accum[r-1] - accum[l-1])


def modelAnswer():
   return
def main():
   N,Q = map(int,input().split())
   S =input()
   L = []
   R = []
   for _ in range(Q):
      l,r = map(int,input().split())
      L.append(l)
      R.append(r)
   myAnswer(N,Q,S,L,R)


if __name__ == '__main__':
   main()

Measured memory_bytes: 14204
al=[chr(ord('A') + i) for i in range(26)]

H, W = map(int, input().split())
S = [list(map(str, input().split())) for _ in range(H)]
h = 0
w = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == "snuke":
            h = i
            w = j

ans = al[w] + str(h+1)
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{double w,h,x,y,i;
while(~scanf("%lf%lf%lf%lf",&w,&h,&x,&y))
  {i=0;
printf("%lf ",w*h/2);
  if(y==h/w*x)i++;
  if(y==-h/w*(x-w))i++;
  if(y==h/2)i++;
  if(x==w/2)i++;
   if(i==4) printf("1\n");
     else printf("0\n");
  }
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int L;

  cin >> L;

  double ans = pow(L / 3.0, 3);

  printf("%.10lf\n", ans);

  return 0;
}

Measured memory_bytes: 4176
n,m,q=map(int,input().split())
grid=[]
for i in range(n+1):
  grid.append([])
  for j in range(n+1):
    grid[-1].append(0)
grid2=[]
for i in range(n+1):
  grid2.append([])
  for j in range(n+1):
    grid2[-1].append(0)
for i in range(m):
  l,r=map(int,input().split())
  grid[r][l]+=1
for sumxy in range(0,2*n+1):
  if sumxy>n:
    r=sumxy-n
  else:
    r=0
  for x in range(r,min(sumxy+1,n+1)):
    y=sumxy-x
    grid2[x][y]=grid2[x-1][y]+grid2[x][y-1]-grid2[x-1][y-1]+grid[x][y]
for i in range(q):
  p1,q1=map(int,input().split())
  print(grid2[q1][n]-grid2[q1][p1-1])

Measured memory_bytes: 80840
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, k;
	scanf("%d%d%d", &a, &b, &k);
	for(int i=1;i<=k;i++){
		if(i%2 == 1){
			if(a%2 == 1) a--;
			b += a/2;
			a/=2;
		}
		else{
			if(b%2 == 1) b--;
			a += b/2;
			b/=2;
		}
	}
	printf("%d %d\n", a, b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int mod = 1000000007;
  
  while (true) {
    
    string A, B, C;
    cin >> A;
    if (A == "0") break;
    cin >> B >> C;
    
    int n = A.size();
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    reverse(C.begin(), C.end());
    
    vector<vector<int>> dp(n+1, vector<int>(2, 0));
    dp.at(0).at(0) = 1;

     for(int i = 0; i < n; i++){
       
       for(int j = 0; j < 2; j++){
         if(dp.at(i).at(j) == 0) continue;
         
         for(int k = 0; k < 10; k++){
           if(i == n-1 && k == 0) continue;
           if(A.at(i) != '?' && A.at(i)-'0' != k) continue;
           
           for(int l = 0; l < 10; l++){
             if(i == n-1 && l == 0) continue;
             if(B.at(i) != '?' && B.at(i)-'0' != l) continue;
             
             if(C.at(i) == '?' || (j+k+l)%10 == C.at(i)-'0'){
               dp.at(i+1).at( (j+k+l)/10 ) += dp.at(i).at(j);
               dp.at(i+1).at( (j+k+l)/10 ) %= mod;
            }
             
          }
           
        }
         
      }
       
    }

  
    cout << dp.at(n).at(0) << endl;
    
  }
  return 0;
}


Measured memory_bytes: 3208
#include<cstdio>
#include<queue>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
#include<iomanip>
#include<vector>
#define pi acos(-1)
using namespace std;
typedef long long int LL;
const int inf=1e9+10;
const int N=1e5+10;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",a*b);
	return 0;
}


Measured memory_bytes: 3824
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();

    let ans = if (a * b) % 2 == 0 { "Even" } else { "Odd" };

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=1e5+10;
char str[maxn];
int main()
{
   cin>>str;
   int len=strlen(str);
   if (str[0]==str[len-1]){
       if (len&1){
         cout<<"Second\n";

       }
       else cout<<"First\n";

   }
   else {
      if (len&1){
         cout<<"First\n";
      }
      else cout<<"Second\n";
   }

   return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    ans += a[n - 1];
    n -= 2;
    for (int i = n; n > 0; i--)
    {
        if (n >= 2)
        {
            ans += 2 * a[i];
            n -= 2;
        }
        else
        {
            ans += a[i];
            n--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4032
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int h,i,pre,j;
	char s[400];
	while(1){
		fgets(s,300,stdin);
		if(strcmp(s,"END OF INPUT\n")==0)
		break;
		pre=0;
		h=strlen(s);
		for(i=0;i<h+1;i++){
			if(s[i]==' '){
					printf("%d",i-pre);
					pre=i+1;
					if(s[i+1]==' '){
					printf("0");
					i++;
					pre++;
				}
			}
			else if(s[i]=='\n'){
				printf("%d",i-pre);
				break;
			}
		}
		printf("\n");
		
	}
	
	return 0;
}

Measured memory_bytes: 0
n = int(input())
h = list(map(int, input().split()))
dp = [float('inf') for i in range(n)]
dp[0] = 0

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

for i in range(n-1):
    if i == 0:
        dp[i+1] = abs(h[i+1] - h[i])
    else:
        plus = min(dp[i] + abs(h[i+1] - h[i]), dp[i-1] + abs(h[i+1] - h[i-1]))
        dp[i+1] = chmin(dp[i+1], plus)
        #dp[i+1] = chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i])
        #dp[i+1] = chmin(dp[i+1], dp[i-1] + abs(h[i+1] - h[i-1]))
print(dp[n-1])

Measured memory_bytes: 13908
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	set<LL> s;
	LL A, B, K;
	cin >> A >> B >> K;
	LL i = 0;
	LL j = 1;
	while (A + i <= B && j<=K) {
		s.insert(A + i);
		i++;
		j++;
	}
	i = 0;
	j = 1;
	while (B - i >= A && j <= K) {
		s.insert(B - i);
		i++;
		j++;
	}
	FOR_ITR(s) {
		O(*itr);
	}

	return 0;
}

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

/* Typedefs */

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

/* Consts */

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll MX = 1000001;

int N, K;
ll ans = 0;

void solve() {
    cin >> N >> K;
    ll lb = 0, rb = 0, lcurr = K, rcurr = N - K;
    for (int i = 0; i < K; i++) {
        lb += i;
        rb += N - i;
    }
    while (lcurr <= N + 1) {
        // cout << lb << " " << rb << "\n";
        ans += (rb - lb + 1) % MOD;
        lb += lcurr++;
        rb += rcurr--;
    }
    cout << ans % MOD;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

class Combination {
private:
    int64_t mod; // 元, 素数でないとNG
    int64_t max_size; // 最大値, 10^7まで
    vector<int64_t> factorial; // 階乗
    vector<int64_t> inverse; // 逆元
    vector<int64_t> inverse_factorial; // 逆元の階乗

    void init() {
        // 値は1で初期化する
        factorial.assign(max_size, 1);
        inverse.assign(max_size, 1);
        inverse_factorial.assign(max_size, 1);
        for (auto i = 2; i < max_size; i++) {
            factorial[i] = factorial[i - 1] * i % mod;
            inverse[i] = mod - inverse[mod % i] * (mod / i) % mod; // 拡張Euclidの互除法の変形版
            // inverse[i] = modinv(i); // Fermatの小定理
            inverse_factorial[i] = inverse_factorial[i - 1] * inverse[i] % mod;
            // cout << i << " " << factorial[i] << " " << inverse[i] << " " << inverse_factorial[i] << endl;
        }
    };
public:;
    Combination(int64_t mod, int64_t max_size) {
        this->mod = mod;
        assert(max_size < 1e7);
        this->max_size = max_size + 1;
        // テーブル生成
        init();
    };
    virtual ~Combination(){};

    int64_t modpow(int64_t a, int64_t n) {
        int64_t ret = 1;
        while(n > 0) {
            if(n & 1) ret = ret * a % mod;
            a = a * a % mod;
            n >>= 1;
        }
        return ret;
    };
    int64_t modinv(int64_t a) { return modpow(a, mod - 2); };
    int64_t combination(int64_t n, int64_t k) {
        if (n < k) return 0;
        if (n < 0 or k < 0) return 0;
        // cout << factorial[n] << " " << inverse_factorial[k] << " " << inverse_factorial[n - k] << endl;
        return factorial[n] * (inverse_factorial[k] * inverse_factorial[n - k] % mod) % mod;
    };
};

int main(){
    int n, m, k;
    cin >> n >> m >> k;

    const int mod = 998244353;
    int64_t ans = 0;
    Combination c(mod, n);
    // n-1個のブロックからk個の左隣と同じ色となるブロックを選ぶ (n-1)C(k)
    // 色の塗り分け m * 1^k * (m - 1)^(n - 1 - k)
    // k以下なので0~kまで足し合わせ
    for (auto i = 0; i <= k; i++) {
        ans = (ans + (c.combination(n - 1, i) * (m * c.modpow(m - 1, n - 1 - i) % mod) % mod)) % mod;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7948
#include<stdio.h>

int main()
{
	int train[11];
	int i,c,t,n;
	c=0;

	while(scanf("%d",&t)!=EOF)
	{
		if(t==0){
			c--;
			printf("%d\n",train[c]);
		}
		else{
			train[c]=t;
			c++;
		}
	}

	return 0;
}

Measured memory_bytes: 600
module Main where
import Control.Exception (bracket, finally)
import Control.Monad (forM_)
import System.IO
import System.Environment

main :: IO ()
main = do
  a <- (read :: String -> Int) <$> getLine
  b <- (read :: String -> Int) <$> getLine
  c <- (read :: String -> Int) <$> getLine
  d <- (read :: String -> Int) <$> getLine

  print $ min a b + min c d 

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e6;
const ll llmx = 2e18;

int main(void){
  int ikisaki[mx];
  bool sokuseki[mx];
  ll step[mx];
  rep(i,mx) step[i] = -1;
  rep(i,mx) sokuseki[i] = false;
  
  ll N,K;
  cin >> N >> K;
  rep(i,1){
    rep(j,N){
      cin >> ikisaki[j];
    }
  }
  
  step[0] = K;
  sokuseki[0]=false;
  int loc = 1;
  bool devided = false;
  
  while(K>0){
    //cout << loc << " " << K<<"\n";
    if(sokuseki[loc-1] && !devided){
      //cout << " a" << step[loc-1]<<"-"<<K<<
      //  "="<<K%(step[loc-1]-K)<<"\n";//*/
      K = K%(step[loc-1]-K);
      devided = true;
      if(K!=0) loc = ikisaki[loc-1];
    }else{
      sokuseki[loc-1] = true;
      step[loc-1] = K;
      loc = ikisaki[loc-1];
    }
    K--;
  }
  
  cout << loc;
  
  return 0;
}


Measured memory_bytes: 21956
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    
	    for (int i=1; i<=9;i++) {
	    	for (int j=i; j<=9;j++) {
		    	if(N==i*j) {
		    		System.out.print("Yes");
		    		return;
		    	}
		    }
	    }



        System.out.print("No");

//        if (m%2==0) {
//        	System.out.println(m/2);
//        }else{
//        	System.out.println((m+1)/2);
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >>c;
    
    if (a==b || b==c || c==a){
        if (a == b && b==c)
            cout <<1;
        else
            cout <<2;}
    else cout << 3;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long n,x;
	scanf("%lld %lld",&n,&x);
	long long ans = n;
	long long h = n - x;
	while (1) {
		if (x < h) swap(x,h);
		if (h == x) {
			printf("%lld\n",ans + h);
			return 0;
		}
		ans += ((x-1) / h) * h * 2;
		x -= ((x-1) / h) * h;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A,B;
  cin >> A >> B;
  if(A == B){
    cout << "Draw" << endl;
  }
  
  if(A > B){
    if (B != 1){
      cout << "Alice" << endl;
    }
    
    else{
      cout << "Bob" << endl;
    }
  }
  
  if(A < B){
    if (A != 1){
      cout << "Bob" << endl;
    }
    
    else{
      cout << "Alice" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

int main() {
    ll N, K, in, idx = 0; cin >> N >> K;
    vector<ll> xs(N, 0);
    while (cin >> in) {
        xs[idx] = in;
        idx++;
    }
    
    ll ret = 1000000000000;
    for (int i = 0; i < xs.size() - K + 1; i++) {
        ret = min(ret, abs(xs[i]) + abs(xs[i] - xs[i + K - 1]));
        ret = min(ret, abs(xs[i + K - 1]) + abs(xs[i] - xs[i + K - 1]));
    }
    
    cout << ret << endl;
}



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

int main() {
	
	int t, x;
	cin >> t >> x;
	
	double ans = (double) t / x;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
int main(int argc, const char * argv[]) {
      
    while(true){
        int H,W;
        cin >> H >> W;
        if(H == 0 && W == 0){
            break;
        }
          
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(i == 0 || i == H-1 || j == 0 || j == W -1){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
                  
            }
            cout << endl;
        }
          
        cout << endl;
    }
      
    return 0;
}

Measured memory_bytes: 1152
import sys

while True:
    L = int(input())
    if L == 0:
        break
    savings = 0
    a = [map(int, sys.stdin.readline().split()) for _ in [0]*12]
    for i, (M, N) in enumerate(a, start=1):
        savings += M - N
        if savings >= L:
            print(i)
            break
    else:
        print("NA")


Measured memory_bytes: 5620
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    ans := Pair{-1, -1}

    s := nextString()
    for i:=0; i<len(s)-2; i++ {
        if s[i] == s[i+1]  || s[i+1] == s[i+2] || s[i] == s[i+2] {
            ans = Pair{i+1, i+3}
            break
        }
    }
 
    if len(s) == 2 && s[0] == s[1] {
        ans = Pair{1, 2}
    }
 
    fmt.Println(ans.a, ans.b)
}
 
/* templates */


func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  while(n != 0){
    n /= k;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()

	var s string
	fmt.Fscan(read, &s)

	n := len(s)
	for i := range s {
		if s[i] != s[n-1-i] {
			fmt.Fprintln(write, "No")
			return
		}
	}

	if s[:n/2] != s[n/2+1:] {
		fmt.Fprintln(write, "No")
	} else {
		fmt.Fprintln(write, "Yes")
	}

}


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

using namespace std;

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

	int ans = 0;
	for (int i = 0; i < n - 2; i++) {
		if (str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C') {
			ans++;
		}
	}
	
	cout << ans << endl;

	return 0;
}

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

typedef long long ll;
#define elif else if
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define For(i, a) for (int i = 0; i < (a); i++)
#define Ford(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define Fd(i, a) for (int i = (a)-1; i >= 0; i--)
#define nl    cout<<"\n";
const int INF=1e+18;
//ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
//bool Possible(bool p) { if(p) printf("YES\n"); else printf("NO\n");}
//bool possible(bool p) { if(p) printf("Yes\n"); else printf("No\n");}
int a[200001] = {0};
int main()
{
    ffast;
    //freopen("0in.txt","r",stdin);
    //freopen("0out.txt","w",stdout);


    int n;
    cin>>n;
    int x;
    while(cin>>x)
    {
        a[x]++;
    }

    for(int i=1; i<=n; i++) {cout<<a[i]; nl;}

    return 0;
}





Measured memory_bytes: 4376
#include <iostream>

using namespace std;

int main()
{
    int A, B, C, ok=1;
    cin>>A>>B>>C;

    if (A==B) ok++;
    if (A==C) ok++;
    if (B==C) ok++;

    if (ok==2)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] map = new char[h][w];
        for (int i = 0; i < h; i++) {
            map[i] = sc.next().toCharArray();
        }

        Set<Integer> ignoreX = new HashSet<>();
        for (int i = 0; i < h; i++) {
            boolean allS = true;
            for (int j = 0; j < w; j++) {
                if (map[i][j] == '#') allS = false;
            }
            if (allS) ignoreX.add(i);
        }

        Set<Integer> ignoreY = new HashSet<>();
        for (int i = 0; i < w; i++) {
            boolean allS = true;
            for (int j = 0; j < h; j++) {
                if (map[j][i] == '#') allS = false;
            }
            if (allS) ignoreY.add(i);
        }

        for (int i = 0; i < h; i++) {
            if (ignoreX.contains(i)) continue;
            for (int j = 0; j < w; j++) {
                if (ignoreY.contains(j)) continue;
                System.out.print(map[i][j]);
            }
            System.out.println("");
        }
    }
}

Measured memory_bytes: 26836
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	
	ll n,ans=0,i,j;
	//cin>>n;
	string s;
	cin>>s;
	ll l= s.size();
	n=0;
	
	for(i=0; i< l; i++)
	n= n*10 + (s[i]- '0');
	
	ll an[7];
	an[1]= 9;
	an[3]= 900;
	an[5]= 90000;
	
	
	an[2]= an[4]= an[6]= 0;
	for(i=1; i< l; i++)
	ans+= an[i];
	
	ll lng[7];
	lng[0]= 0;
	lng[2]= 99;
	lng[4]= 9999;
	
	if(l&1){
	    ll kk= n- lng[l-1];
	    ans+=kk;
	}
	
	cout<<ans;
    return 0;
}























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

int main(){
  int n,a,b;
  cin>>n;
  if(n>=2000){
    cout<<1;
  }else{
    a=n/100;
    b=n%100;
    if(0<=b&&b<=5*a){
      cout<<1;
    }else{
      cout<<0;
    }
  }
}

Measured memory_bytes: 256
from collections import*
s=enumerate(input())
t=enumerate(input())
d1=defaultdict(list)
d2=defaultdict(list)
for k,v in s:
    d1[v].append(k)
for k,v in t:
    d2[v].append(k)
print(["No","Yes"][set(tuple(i)for i in d1.values())==set(tuple(i)for i in d2.values())])

Measured memory_bytes: 23472
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    vector<int> a(x.begin(),x.end());
    sort(a.begin(),a.end());

    int ml=a[n/2-1];
    int mr=a[n/2];

    for(int i=0;i<n;i++){
        if(x[i]<=ml){
            cout << mr << endl;
        }
        else{
            cout << ml << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, n, ttl;
  cin >> h >> n;
  ttl = 0;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
    ttl += vec.at(i);
  }
  if (ttl>=h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define PI 4*atan(1)
#define INF 1e8

typedef long long ll;

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

int N;
ll dfs(int n, vector<ll> &a, ll pon, ll gon){
  ll res = abs(pon - gon);
  if(n == N)return res;
  return min(dfs(n + 1, a, pon + a[n], gon), dfs(n + 1, a, pon, gon + a[n]));
}

int main(){
  while(cin >> N, N){
    vector<ll> a(N);
    for(int i = 0; i < N; i++)cin >> a[i];
    cout << dfs(0, a, 0, 0) << endl;  
  }
}

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

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

    vector<int> l(q);
    vector<int> r(q);
    rep(i, q) {
        cin >> l[i];
        cin >> r[i];
    }

    // エラトステネスのふるい
    bitset<1000000> is_prime(0);
    for (int i = 2; i <= 100000; i++) is_prime.set(i);
    for (int i = 2; i <= 100000; i++) {
        if(is_prime[i]) {
            for(int j = i * 2; j <= 100000; j += i) {
                is_prime.reset(j);
            }
        }
    }

    bitset<1000000> is_like2017(0);
    for (int i = 2; i <= 100000; i++) {
        if(is_prime[i] && is_prime[(i+1)/2]) {
            is_like2017.set(i);
        }
    }

    vector<int> s(100001, 0);
    rep(i, 100000) s[i + 1] = s[i] + is_like2017[i];

    vector<int> ans(q);
    rep(i, q){
        ans[i] = s[r[i]+1] - s[l[i]];
        // cout << s[r[i]] << " " << s[l[i]] << endl;
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int x;
    cin >> x;
    for (int i=1; i * 100<=x; i++) {
        if (x <= i * 105) {
            cout << "1\n";
            return 0;
        }
    }
    cout << "0\n";
    return 0;
}

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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N, ans;
vector<vector<int>> A(30, vector<int>(30, 0));
vector<vector<int>> G(30, vector<int>());
vector<int> dp((1<<22), 0);
vector<bool> used(30);
vector<int> match(30);


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

    cin >> N;
    REP(i, N) {
        REP(j, N) {
            cin >> A.at(i).at(j);
        }
    }

    dp.at(0) = 1;

    for (ll S = 0; S < 1 << N; S++) {
        auto bs = bitset<30>(S);
        int cnt = bs.count() - 1;
        for (int i = 0; i < N; i++) {
            if (bs.test(i) && A.at(cnt).at(i)) {
                dp.at(S) += dp.at(S ^ (1 << i));
                dp.at(S) %= mod;
            }
        }
    }

    cout << dp.at((1 << N) - 1) << endl;
    
    return 0;
}

Measured memory_bytes: 16640
import sys
from io import StringIO
import unittest


def resolve():
    n = int(input())
    a = list(map(int, input().split()))

    b = [(aa, i + 1) for i, aa in enumerate(a)]

    b.sort()

    print(' '.join([str(bb) for i, bb in b]))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3
2 3 1"""
        output = """3 1 2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """5
1 2 3 4 5"""
        output = """1 2 3 4 5"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """8
8 2 7 3 4 5 6 1"""
        output = """8 2 4 5 6 7 3 1"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 27372
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = [a, b, c, d, e]
min_A = min(A)
result = math.ceil(n / min_A) - 1 + 5
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
    
    int n, i, x;
    cin >> n;
    for (i = 1; i <= n; i++) {
        if (i % 3 == 0 or i % 10 == 3) cout << " " << i;
        else {
            x = i;
            while (x > 0) {
                x /= 10;
                if (x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
            }
        }
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 3112
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
      ArrayList<String> list = new ArrayList<String>();
      int N , X;
      int i = 0; 
      while (scan.hasNextLine()) {
      String an = scan.nextLine();
      list.add(an);
      }
      String List[] = list.get(0).split(" ",0);
      X = Integer.parseInt(List[0]);
      N = Integer.parseInt(List[1]);
  //    System.out.println(N);
      int num[] = new int[N];
      if(N != 0){
      String Atai[] = list.get(1).split(" ",0);
      while(i < N){
        num[i] = Integer.parseInt(Atai[i]);
        i++;
      }
              
      Arrays.sort(num);
      check(num,X,N);
      }else{
       System.out.println(X);
        }

        scan.close();
    }
  
  public static void check(int[] num,int x,int n){
   //System.out.println(num[0]);
    List<Integer> numList = new ArrayList<Integer>(num.length);
    for (int i = 0; i < num.length; i++) {
       numList.add(num[i]);
    }
    int s,l;
     s = x;
     l = x;
    while(true) {
      if(numList.contains(s)){
        s = s-1;
        if(numList.contains(l)){
          l = l + 1;
         }else{
          System.out.println(l);
          break;
        }
        }else{
       System.out.println(s);
//       System.out.println("ok");
       break;
      }
     
      }
    }
}

Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double a, b;
  cin >>a >>b;
  
  int a2 = a, b2 = b;
  
  int d = a / b;
  int r = a2 % b2;
  double f = a / b;
  
  cout << d << ' ' << r << ' ' << fixed << setprecision(15) << f << endl;
}


Measured memory_bytes: 3296
//
// Created by yamunaku on 2019/12/29.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int ans = 1;
    repl(i,1,n){
        if(a[i-1]>=a[i]) ans++;
    }
    cout << ans << endl;
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <cmath>
#include <climits>
using namespace std;

#define rep(i,end)          rep2(i,0,(end))
#define rep2(i,beg,end)   for (int i=(beg);i<(end);i++)
#define all(cont)           begin(cont), end(cont)
#define inf                   LLONG_MAX
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef list<ll> li;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

string gets(bool skipnewline);
vi get_n_array(int n);

ll f(ll n)
{
    if (n == 0) return 0;
    ll s = 1;
    rep2(i, 2, n + 1)
    {
        s += i;
    }
    return s;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s = gets(false);
    int n = stol(s);
    typedef map<string, ll> msi;
    msi m;
    rep(i, n)
    {
        s = gets(false);
        sort(all(s));
        m[s]++;
    }
    ll cnt = accumulate(begin(m), end(m), 0LL, [](ll sum, auto p) {
        return sum + f(p.second - 1);
    });
    cout << cnt << endl;
    return 0;
}

string gets(bool skipToNextline)
{
    if (skipToNextline) gets(false);
    const int BUFF_MAX = 1024;
    char buf[BUFF_MAX];
    cin.getline(buf, sizeof(buf));
    return buf;
}

vi get_n_array(int n)
{
    vi v;
    while (n-- > 0) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    return v;
}

Measured memory_bytes: 11264
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int k=0;
		while(true) {
		int b=sc.nextInt();
		k++;
		if(b==0) {
			break;
		}else {
			System.out.println("Case "+k+": "+b);
		}
		}
	}
}



Measured memory_bytes: 41448
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i< n;i++)
    {
        cin>>v[i];
        
    }
    vector<int > dp(n);
    for(int i=1;i<n;i++)
    {
        dp[i]=dp[i-1]+abs(v[i]-v[i-1]);
        if(i>1) dp[i]=min(dp[i],dp[i-2]+abs(v[i]-v[i-2]));
    }
    cout<<dp[n-1]<<'\n';
    return 0;
}

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


int main (void)
{
    int n;

    scanf("%d", &n);

    switch (n % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            puts("hon");
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            puts("pon");
            break;
        case 3:
            puts("bon");
            break;
        default:
            break;
    }

    return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 1;

void solve() {
    ll n; cin >> n;
    string s; cin >> s;
    string t; cin >> t;
    string ans;
    for (int i = 0; i < n; ++i) {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 256
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N=ri()
X=rl()
Xs = sorted(X)
Xsl = Xs[:N//2]
Xsr = Xs[N//2:]
r = Xsr[0]
l = Xsl[-1]

for x in X:
    if x <= l:
            print(r)
    else:
            print(l)



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

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 (a > b) { a = b; return 1; } return 0; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<int>>board(h+1, vector<int>(w));
    rep(i, 0, h)rep(j, 0, w)cin >> board[i][j];
    int cnt=0;
    vector<pair<pii,pii>>ans;
    rep(i, 0, h){
        if(i%2==0){
            for(int j=0; j<w; j++){
                if(board[i][j]%2==1){
                    if(j==w-1){
                        board[i+1][j]++;
                        if(i==h-1)continue;
                        ans.push_back(pair<pii,pii>(pii(i,j),pii(i+1,j)));
                        cnt++;
                    }
                    else{
                        board[i][j+1]++;
                        ans.push_back(pair<pii,pii>(pii(i,j),pii(i,j+1)));
                        cnt++;
                    }
                    cnt++;
                }
            }
        }else{
            for(int j=w-1; j>=0; j--){
                if(board[i][j]%2==1){
                    if(j==0){
                        board[i+1][j]++;
                        if(i==h-1)continue;
                        ans.push_back(pair<pii,pii>(pii(i,j),pii(i+1,j)));
                        cnt++;
                    }
                    else{
                        board[i][j-1]++;
                        ans.push_back(pair<pii,pii>(pii(i,j),pii(i,j-1)));
                        cnt++;
                    }
                }
            }
        }
    }
    //cout << cnt << endl;
    cout << ans.size() << endl;
    for(auto i:ans){
        cout << i.first.first+1 << " " << i.first.second+1 <<
          " " << i.second.first+1 << " " << i.second.second+1 << endl;
    }
}

Measured memory_bytes: 6380
a, b, c, x, y = map(int, input().split())
each = 0
if x==y:
    each = 0
elif x>y:
    each = min(a, 2*c)*(x-y)
else:
    each = min(b, 2*c)*(y-x)

print(min(min(x, y)*2*c+each, min(a, 2*c)*x + min(b, 2*c)*y))


Measured memory_bytes: 9180
A, B, C = map(int, input().split())
x, y = abs(A-B), abs(B-C)
ans = 0
if x == 0 and y == 0 and A % 2 == 0:
  print(-1)
  exit()

if x == 0 and y == 0 and A % 2 == 1:
  print(0)
  exit()
  
while x % 2 == 0 and y % 2 == 0:
  x, y = x // 2, y // 2
  ans += 1
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define double long double
#define INF 1.0e12
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<double, P> Pd;
int main()
{
  int dx[4]={1, -1, 0, 0}, dy[4]={0, 0, 1, -1};
	int w, h;
  cin>>w>>h;
  double x1=0, x2=1.0e10;
  string s[500];
  int sx, sy, gx, gy;
  for(int i=0; i<h; i++){
    cin>>s[i];
    for(int j=0; j<w; j++){
      if(s[i][j]=='s'){
        sx=i, sy=j;
      }else if(s[i][j]=='g'){
        gx=i, gy=j;
      }
    }
  }
  for(int l=0; l<100; l++){
    double xmid=(x1+x2)/2;
    double d[500][500];
    priority_queue<Pd, vector<Pd>, greater<Pd> > que;
    que.push(Pd(0, P(gx, gy)));
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(s[i][j]=='g'){
          d[i][j]=0;
        }else if(s[i][j]=='*'){
          d[i][j]=xmid;
          que.push(Pd(xmid, P(i, j)));
        }else{
          d[i][j]=INF;
        }
      }
    }
    while(!que.empty()){
      Pd p=que.top();
      que.pop();
      int x=p.second.first, y=p.second.second;
      if(p.first>d[x][y]) continue;
      for(int i=0; i<4; i++){
        if(!(0<=x+dx[i] && x+dx[i]<h && 0<=y+dy[i] && y+dy[i]<w)) continue;
        if(s[x+dx[i]][y+dy[i]]=='#' || s[x+dx[i]][y+dy[i]]=='*') continue;
        if(d[x+dx[i]][y+dy[i]]>d[x][y]+1.0){
          d[x+dx[i]][y+dy[i]]=d[x][y]+1.0;
          que.push(Pd(d[x+dx[i]][y+dy[i]], P(x+dx[i], y+dy[i])));
        }
          
      }
    }
    if(l==99){
      printf("%.10Lf\n", d[sx][sy]);
      return 0;
    }
    double sum=0;
    int ct=0;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(s[i][j]=='.' || s[i][j]=='s'){
          ct++;
          sum+=d[i][j];
        }
      }
    }
    if(sum/(double)ct<xmid){
      x2=xmid;
    }else{
      x1=xmid;
    }
  }
	return 0;
}


Measured memory_bytes: 9904
import java.util.Scanner;

// 提出時にclass Main に書き換え
public class Main {
	public static void main(String[] args)  {
		// 標準入力を受け取る
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(); // int Nを受け取る

		int[] L = new int[N]; // L[N]を格納する配列

		for (int i = 0; i < N; i++) {
			L[i] = sc.nextInt(); // int L[i]を受け取る
		}
		sc.close(); // 標準入力を終了

		int ans = 0; // 解答の数

		for (int i = 0; i < N - 2; i++) {
			for (int j = i + 1; j < N - 1; j++) {
				for (int k = j + 1; k < N; k++) {
					// L[i],L[j],L[k]が全て異なる値かどうか判定
					if(L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
                       // 3辺の長さがL[i],L[j],L[k]の三角形があるかどうか判定
						if(Math.abs(L[i] - L[j]) < L[k] && L[k] < L[i] + L[j]) {ans += 1;}
					}
				}
			}
		}
		System.out.println(ans);
	}
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m, a[2020], b[2020];
i64 dp[2020][2020];
void solve(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < m; i++){
		cin >> b[i];
	}
	
	for(int i = 0; i <= n; i++) dp[i][0] = 1;
	for(int i = 0; i <= m; i++) dp[0][i] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
			if(a[i] != b[j]){
				dp[i+1][j+1] -= dp[i][j];
			}
			dp[i+1][j+1] = mod(dp[i+1][j+1], INF);
		}
	}
	cout << dp[n][m] << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 31872