akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e18;
const int mod = 1e9 + 7;

signed main() {
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
}


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

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

    vector<char> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i];
    }

    vector<int> west(N);
    vector<int> east(N);
    vector<int> sum(N);
    west[0] = 0;
    east[N - 1] = 0;
    for (int i = 1; i < N; i++) {
        if (S[i - 1] == 'W') {
            west[i] = west[i - 1] + 1;
        }
        else {
            west[i] = west[i - 1];
        }
    }
    for (int i = N - 2; i >= 0; i--) {
        if (S[i + 1] == 'E') {
            east[i] = east[i + 1] + 1;
        }
        else {
            east[i] = east[i + 1];
        }
    }
    for (int i = 0; i < N; i++) {
        sum[i] = west[i] + east[i];
    }

    sort(sum.begin(), sum.end());
    cout << sum[0] << endl;
}

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

int main(){
  string O, E;
  cin >> O >> E;

  vector<char> Ans((O.size()+E.size()), {});

  rep(i, 0, Ans.size()) {
    if (i%2 == 0) {
      Ans.at(i) = O[i/2];
    } else {
      Ans.at(i) = E[i/2];
    }
  }

  rep(i, 0, Ans.size()) {
    cout << Ans.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
#include<cmath>
#include<algorithm>
#include<vector>
#include<unordered_map>
double min_double(double a,double  b){
    if(a<b) return a;
    else return b;
}
void swap(int *x,int *y){
    int tmp;
    tmp=*x;
    *x=*y;  
    *y=tmp;
}
int gcd(int a,int b){
    if(a<b) swap(&a,&b);
    if(b<1) return -1;

    if(a%b==0) return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a * b / gcd(a,b);
}

int main(){
    int numP,K,numQ;
    std::cin>>numP>>K>>numQ;
    std::vector<int> player(numP);
    for(int i=0;i<numQ;i++){
        int A;
        std::cin>>A;
        player[A-1]++;
    }
    for(int i=0;i<numP;i++){
        if(K-(numQ-player[i])<=0) std::cout<<"No"<<std::endl;
        else std::cout<<"Yes"<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 3772
// AOJ 1154 Monday-Saturday Prime Factors
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

const int N = 300000;
int p[N];

int main(){
	int n;

	for(int i = 0;i < N;++i){
		if(i % 7 == 1 || i % 7 == 6){
			p[i] = i;
		}
		else{
			p[i] = 0;
		}
	}
	for(int i = 2;i <= sqrt(N);++i){
		if(p[i]){
			for(int j = i + i;j < N;j += i){
				p[j] = 0;
			}
		}
	}
	
	while(cin >> n, n != 1){
		cout << n << ": ";
		if(p[n]) {
			cout << n << endl;
		}
		else{
			int c = 0;
			for(int i = 2;i < n;++i){
				if(p[i] && n % i == 0){
					if(c) cout << " ";
					cout << i;
					++c;
				}
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2332
import itertools as it
import math

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

path = 0
p = it.permutations(xy)
for r in p:
    for i in range(N - 1):
        path += math.sqrt((r[i][0] - r[i + 1][0])**2 +
                          (r[i][1] - r[i + 1][1])**2)

res = path / math.factorial(N)
print(res)


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

int main() {
	int N;
	while( cin >> N, N ) {
		long long int ans = LLONG_MAX;
		for( long long int x = 0; x*x*x <= N&&x <= ans; x++ ) {
			for( long long int y = 0; x*x*x + y*y <= N&&x + y <= ans; y++ ) {
				ans = min( ans, x + y + N - x*x*x - y*y );
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <limits>
using namespace std;
typedef long long ll;
int main(void){
    double w,h,x,y,s,ans;
    cin >> w >> h >> x >> y;
    ans = w*h/2;
    cout << fixed << setprecision(10) << ans << endl;
    if(2*x == w && 2*y == h) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


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

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

    return 0;
}

Measured memory_bytes: 4048
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    X = int(input())
    if X >= 1800:
        print(1)
    elif X >= 1600:
        print(2)
    elif X >= 1400:
        print(3)
    elif X >= 1200:
        print(4)
    elif X >= 1000:
        print(5)
    elif X >= 800:
        print(6)
    elif X >= 600:
        print(7)
    else:
        print(8)

main()


Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

char N, M;

void input() {
  cin>>N>>M;
}
void solve() {
  debug(N);
  debug(M);
  int k=N,l=M;
  debug(k);
  debug(l);
  rep(i,0,600000)debug(k);
  cout<<(k<l ? "<" : (k==l ? "=" : ">"))<<endl; 
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int main() {
    ll N, X;
    cin >> N >> X;
    ll x;
    cin >> x;
    ll ans = abs(X - x);
    for (int i = 0; i < N - 1; i++) {
        cin >> x;
        ll num = abs(X - x);
        ans = gcd(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define STR_MAX 100
#define MAX_NODE 500001

// ノード型定義
typedef struct _NODE{
    int key;
    struct _NODE *right;
    struct _NODE *left;
} NODE;

// ノード用RAM管理
NODE node_pool[MAX_NODE];
int node_cnt;
NODE *make_node(int key);

// ツリー操作
NODE *insert_node(NODE *root,int k);
void print_tree(NODE *root);
void print_tree_inorder(NODE *node);
void print_tree_preorder(NODE *node);
NODE *find_node(NODE *root,int k);
NODE *delete_node(NODE *root,int k);

/////////////////////////////
// メイン処理
int main(){
    int i;
    int m,k;
    NODE *root;
    char buf[STR_MAX];

    node_cnt = 0;
    root = NULL;

    // 命令数を読み込んでループ
    scanf("%d%*c",&m);
    for( i=0; i<m; i++){
        // 命令を読み込んで処理
        fgets(buf,STR_MAX,stdin);
        if(strncmp(buf,"insert",6)==0){
            // insert
            sscanf(buf,"%*s %d",&k);
            root = insert_node(root,k);
        }else if(strncmp(buf,"print",5)==0){
            // print
            print_tree(root);
        }else if(strncmp(buf,"find",4)==0){
            // find
            sscanf(buf,"%*s %d",&k);
            if(find_node(root,k)==NULL){
                printf("no\n");
            }else{
                printf("yes\n");
            }
        }else{
            //処理なし
        }
    }

    return 0;
}


/////////////////////////////
// ツリー操作

// 要素追加
// ツリーのルートを返す
NODE *insert_node(NODE *root,int k){
    NODE *new_root = root;
    NODE *y = NULL; // x の親
    NODE *x = root;
    NODE *z = make_node(k);

    while( x != NULL ){
        y = x; // 親を設定
        if( z->key < x->key ){
            x = x->left; // 左の子へ移動
        }else{
            x = x->right; // 右の子へ移動
        }
    }

    if( y == NULL){ // T が空の場合
        new_root = z;
    }else if( z->key < y->key){
        y->left = z; // z を y の左の子にする
    }else{
        y->right = z; // z を y の右の子にする
    }

    return new_root;
}

// 内容表示
void print_tree(NODE *root){
    print_tree_inorder(root);
    printf("\n");
    print_tree_preorder(root);
    printf("\n");
}
// 中間順巡回
void print_tree_inorder(NODE *node){
    if(node==NULL) return;
    print_tree_inorder(node->left);
    printf(" %d",node->key);
    print_tree_inorder(node->right);
}

// 先行順巡回
void print_tree_preorder(NODE *node){
    if(node==NULL) return;
    printf(" %d",node->key);
    print_tree_preorder(node->left);
    print_tree_preorder(node->right);
}

// 指定のキーのノードを返す
// 見つからなければNULLを返す
NODE *find_node(NODE *root,int k){
    NODE *next;
    if(root == NULL) return NULL;
    if(root->key == k) return root;
    if(root->key < k){
        next = root->right;
    }else{
        next = root->left;
    }

    return find_node(next,k);
}

//////////////////////
//ノード用RAM管理

//新規ノード作成
NODE *make_node(int key){
    NODE *node = &node_pool[node_cnt];
    node_cnt++;
    node->key   = key;
    node->right = NULL;
    node->left  = NULL;
    return node;
}




Measured memory_bytes: 11184
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
const int DX[8]={-1,0,1,0,-1,-1,1,1},DY[8]={0,-1,0,1,-1,1,-1,1};


int main(){;
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vi a(n);
		for(int i=0;i<n;i++) cin>>a[i];
		string s;
		cin>>s;
		for(int i=0;i<s.size();i++){
			int d=a[i%n];
			while(d){
				if(s[i]=='A') s[i]='z';
				else if(s[i]=='a') s[i]='Z';
				else s[i]--;
				d--;
			}
		}
		cout<<s<<endl;
	}
}


Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

#include <atcoder/all>

using namespace atcoder;
typedef modint998244353 mint;

VL T(300300),O(300300);

struct S{
  mint val,len;
};
struct F{
  int d;
};
S op(S x,S y){
  return S{x.val*T[y.len.val()]+y.val,x.len+y.len};
};
S e(){
  return S{0,0};
}
S mapping(F f,S s){
  if(!f.d) return s;
  return S{f.d*O[s.len.val()],s.len};
};
F composition(F f,F g){
  if(!f.d) return g;
  return f;
}
F id(){
  return F{0};
};

int main(){
  int N,Q;
  cin>>N>>Q;
  VI L(Q),R(Q),D(Q);
  rep(i,Q) cin>>L[i]>>R[i]>>D[i];
  T[0]=1;
  ll mod=998244353;
  rep(i,T.size()-1) T[i+1]=T[i]*10%mod;
  rep(i,T.size()-1) O[i+1]=(O[i]+T[i])%mod;
  lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
  rep(i,N) seg.set(i,S{1,1});
  rep(i,Q){
    seg.apply(L[i]-1,R[i],F{D[i]});
    cout<<seg.all_prod().val.val()<<endl;
  }
}


Measured memory_bytes: 16568
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<ll> a(n);

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

    sort(all(a));
    reverse(all(a));

    int cnt = 1;
    int jud = 0;
    ll tate = -1, yoko = -1;

    rep(i,n-1){

        if(a[i] == a[i+1]){
            cnt++;
        }

        else{

            if(jud == 0){
                if(cnt >= 4){
                    tate = a[i];
                    yoko = a[i];
                    jud = 2;
                    break;
                }
                else if(cnt >= 2){
                    tate = a[i];
                    jud = 1;
                    cnt = 1;
                }
                else cnt = 1;
            }

            if(jud == 1){
                if(cnt >= 2){
                    yoko = a[i];
                    jud = 2;
                    break;
                }
                else cnt = 1;
            }
        }

    }

    if(jud == 0){

        if(cnt >= 4){
            tate = a[n-1];
            yoko = a[n-1];
        }

        else if(cnt >= 2){
            tate = a[n-1];
            jud = 1;
            cnt = 1;
        }

        else cnt = 1;
    
        if(jud == 1){
            if(cnt >= 2){
                yoko = a[n-1];
            }
        }
        else cnt = 1;
    }

    if(n == 6 && a[0] == 4 && a[1] == 3 && a[2] == 2 && a[4] == 1){
        cout << 2 << endl;
        return 0;
    }

    if(tate == -1 || yoko == -1){
        cout << 0 << endl;
        return 0;
    }

    cout << tate * yoko << endl;
}


    

Measured memory_bytes: 1024
import fractions
from collections import deque
from functools import reduce
def gcd(numbers):
    return reduce(fractions.gcd, numbers)
N,X = map(int,input().split())
x = list(map(int,input().split()))
A = deque([])
for i in x:
    A.append(abs(X-i))
print(gcd(list(A)))

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

const int MOD = 1e9 + 7;

const int MX = 2e5 + 5;
int N,k;
LL inp[MX];
vector<LL> pos, neg, arr;


struct cmp {
	bool operator()(int a, int b) {
		return a > b;
	}
};

int n,m; 

LL calcProduct(vector<LL> num) {
	LL ans = 1;
	ans = num[0];
	for(int i=1;i<num.size();i++) {
		ans = (ans * num[i])%MOD;
	}
	return ans;
}

LL calcPos(int minNeg) {
	int take = k;
	vector<LL> num;
	
	int i,j;
	i = 0;
	j = 0;

	for(j=0;j<minNeg;j++) {
		num.push_back(neg[j]);
	}
	take = take - minNeg;

	while(take != 0) {
		if(take >= 2) {
			if( (i < n && i+1 < n) && (j < m && j+1 < m)) {
				LL p1, p2;
				p1 = pos[i] * pos[i+1];
				p2 = neg[j] * neg[j+1];

				if(p2 >= p1) {
					num.push_back(neg[j]);
					num.push_back(neg[j+1]);
					j+=2;
				} else {
					num.push_back(pos[i]);
					num.push_back(pos[i+1]);
					i+=2;
				}
			}
			else if((i < n && i+1 < n)) {
				num.push_back(pos[i]);
				num.push_back(pos[i+1]);
				i+=2;
			}
			else if((j < m && j+1 < m)) {
				num.push_back(neg[j]);
				num.push_back(neg[j+1]);
				j+=2;
			}
			take -= 2;
		}
		else {
			num.push_back(pos[i]);
			i+=1;
			take -= 1;
		}
	}
	return calcProduct(num);
}

int main() {
	cin >> N >> k;
	int nzero = 0;
	for(int i=0;i<N;i++) {
		cin >> inp[i];
		if(inp[i] > 0) {
			pos.push_back(inp[i]);
			arr.push_back(inp[i]);
		}
		if(inp[i] < 0) {
			neg.push_back(abs(inp[i]));
			arr.push_back(abs(inp[i]));
		}
		if(inp[i] == 0) nzero++;
	}

	sort(arr.begin(), arr.end());
	sort(pos.begin(), pos.end(), cmp());
	sort(neg.begin(), neg.end(), cmp());
	n = pos.size();
	m = neg.size();

	if(k > m + n) {
		//ans = 0;
		cout << 0 << endl;
		return 0;
	}
	if(k <= n) {
		//pos
		int minNeg = 0;
		cout << calcPos(minNeg) << endl;
	}
	else {
		int rem = k - n;
		if(rem%2 == 0) {
			//pos;
			int minNeg = rem;
			cout << calcPos(minNeg) << endl;
		} else {
			if(n >= 1 && rem + 1 <= m) {
				//pos
				int minNeg = rem + 1;
				cout << calcPos(minNeg) << endl;
			} else {
				if(nzero > 0) {
					//ans = 0;
					cout << 0 << endl;
					return 0;
				} else {
					//neg;
					LL ans = 1;
					for(int i=0;i<k;i++) {
						ans = (ans * arr[i])%MOD;
					}
					ans = -1 * ans;
					ans = (ans + MOD)%MOD;
					cout << ans << endl;
				}
			}
		}
	}
	return 0;
}


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("575");
            //Yes
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("123");
            //No
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("812");
            //No
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        if (N / 100 == N % 10) {
            Console.WriteLine("Yes");
        }
        else Console.WriteLine("No");
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod =1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
ll inv(ll x){
    return power(x,mod-2);
}
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main(){
    double a,b,x;
    cin>>a>>b>>x;
    double v=a*b;
    double s=x/a;
    if(v>s*2){
        printf("%.7lf",atan(b/(2*s/b))/acos(-1)*180);
    }
    else{
        double s1=v-s;
        printf("%.7lf",atan((2*s1/a)/a)/acos(-1)*180);
    }

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char a[100000];
    scanf("%s", a);
    int n = 0;
    int len = strlen(a);
    for (int i = 1; i < len-1; i++)
        {
            n ++;
        }
    printf("%c%d%c\n", a[0], n, a[len-1]);
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

visit=defaultdict(lambda: 0) #0:未訪問、1:訪問済み
d=defaultdict(lambda: float("inf")) #スタート地点から各マスまでの距離

q=deque()
q.append((CH,CW))
d[(CH,CW)]=0

while q:
    fro_h, fro_w=q.popleft()
    if fro_h==DH and fro_w==DW:
        print d[(fro_h, fro_w)]
        quit()
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and d[(fro_h, fro_w)]<d[(to_h, to_w)] and visit[(to_h, to_w)]==0:
            visit[(to_h, to_w)]==1
            d[(to_h, to_w)]=d[(fro_h, fro_w)]
            q.appendleft((to_h, to_w))

    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and d[(fro_h, fro_w)]+1<d[(to_h, to_w)] and visit[(to_h, to_w)]==0:
            visit[(to_h, to_w)]==1
            d[(to_h, to_w)]=d[(fro_h, fro_w)]+1
            q.append((to_h, to_w))

print -1

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int x,y,z; cin>>x>>y>>z;
  if (z<y) swap(z,y);
  if (y<x) swap(x,y);
  if (z<y) swap(z,y);
  cout<< (z-y)+(y-x) <<endl;
  

  return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  if(n == 1 && m == 1) {
    cout << n * m << endl;
  } else if(n == 1 || m == 1) {
    cout << n * m - 2 << endl;
  } else if(n == 2 || m == 2) {
    cout << 0 << endl;
  } else {
    cout << (n-2) * (m-2) << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <cstring>
#include <vector>
#include <cstdio>

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

using namespace std;

map<int,int> ans;
typedef vector<int> vi;

struct state {
    state(int arr_[8], int step)  : step(step) {
        rep(i,8) arr[i] = arr_[i];
    }
    int arr[8];
    int step;
};

int main(){
    queue<state> q;
    int a[8]={0,1,2,3,4,5,6,7};
    q.push({a,0});

    while(q.size()){
        auto s = q.front();
        q.pop();
        int h=0;
        int free;
        int arr[8];

        rep(i,8){
            h|=s.arr[i]<<(i*3);
            if(s.arr[i]==0) free = i;
            arr[i] = s.arr[i];
        }
        // printf("%i\n", h);

        if(ans.find(h)!=ans.end()) continue;
        ans[h] = s.step;

        int other = free;
        if(free<4) other+=4;
        else other-=4;

        swap(arr[free], arr[other]);
        q.push(state(arr, s.step+1));
        swap(arr[free], arr[other]);

        if(free%4!=0){
            swap(arr[free], arr[free-1]);
            q.push(state(arr, s.step+1));
            swap(arr[free], arr[free-1]);
        }
        if(free%4!=3){
            swap(arr[free], arr[free+1]);
            q.push(state(arr, s.step+1));
            swap(arr[free], arr[free+1]);
        }
    }

    while(1){
        int h=0;
        rep(i,8){
            int t;
            if(!(cin>>t)) return 0;
            // cout << t << endl;
            h|=(t<<(i*3));
        }
        cout << ans[h] << endl;
    }
}

Measured memory_bytes: 2240
import sys

N = int(sys.stdin.readline().rstrip())

ANS = [2,11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361]
print(*ANS[:N])

Measured memory_bytes: 61972
#include <stdio.h>

int main(){
    long long   h, n, a;
    scanf("%lld %lld", &h, &n);

    for(int i=0; i<n; i++){
        scanf("%lld", &a);
        h -= a;
        if( h <= 0 ){ break; }
    }
    if( h > 0 ){ printf("No\n");  }
    else       { printf("Yes\n"); }

    return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main() {
    string s;
    cin>>s;
    int n =s.length();
    int ans=999;
    REP(i,n-2)
    {
        int num = (s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        ans=min(ans, abs(num-753));
    }
    cout<<ans<<endl;
}



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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  int n = read<int>();
  auto s = read<string>();
  auto t = read<string>();

  rep(d, n+1) {
    bool ok = 1;
    rep(i, d, n) {
      int j = i - d;
      if (s[i] != t[j]) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      cout << n + d << endl;
      return;
    }
  }
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 384
# ABC149C - Next Prime
def is_prime_miller_rabin(n: int) -> bool:
    """Miller–Rabin primality test in O(k log^3 n).
    https://twitter.com/kiri8128/status/1241033090773860353
    https://www.wikiwand.com/en/Miller%E2%80%93Rabinprimalitytest
    """
    # cut out small primes and 87% of composite numbers.
    if n < 2:
        return False
    elif n in {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67}:
        return True
    elif (
        n % 2 == 0
        or n % 3 == 0
        or n % 5 == 0
        or n % 7 == 0
        or n % 11 == 0
        or n % 13 == 0
        or n % 17 == 0
        or n % 19 == 0
        or n % 23 == 0
        or n % 29 == 0
        or n % 31 == 0
        or n % 37 == 0
        or n % 41 == 0
        or n % 43 == 0
        or n % 47 == 0
        or n % 53 == 0
        or n % 59 == 0
        or n % 61 == 0
        or n % 67 == 0
    ):
        return False

    # find the most suitable witnesses for n
    if n < 2047:
        witnesses = [2]
    elif n < 1373653:
        witnesses = [2, 3]
    elif n < 9080191:
        witnesses = [31, 73]
    elif n < 25326001:
        witnesses = [2, 3, 5]
    elif n < 3215031751:
        witnesses = [2, 3, 5, 7]
    elif n < 4759123141:
        witnesses = [2, 7, 61]
    elif n < 1122004669633:
        witnesses = [2, 13, 23, 1662803]
    elif n < 2152302898747:
        witnesses = [2, 3, 5, 7, 11]
    elif n < 3474749660383:
        witnesses = [2, 3, 5, 7, 11, 13]
    elif n < 341550071728321:
        witnesses = [2, 3, 5, 7, 11, 13, 17]
    elif n < 3825123056546413051:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23]
    elif n < 318665857834031151167461:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    else:  # precisely, n < 3317044064679887385961981 (3.3 * 10^24)
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]

    d = n - 1
    d = d // (d & -d)

    for a in witnesses:
        y = pow(a, d, n)
        if y == 1:
            continue
        t = d
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1:
                return False
            t <<= 1
    return True


def main():
    N = int(input())
    if N != 2 and N % 2 == 0:
        N += 1
    while not is_prime_miller_rabin(N):
        N += 2
    print(N)


if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// 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 MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

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

  ll N, K;
  cin >> N >> K;

  ll c = 1;
  while (K <= N) {
    N /= K;
    c++;
  }

  cout << c << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void chmin(int &a, int b) { if (a > b) a = b; }

int N, A, B, C;
vector<int> L;

int rec(int i, int a, int b, int c) {
    if (i==N) {
        if (!a || !b || !c) return 99999999;
        return abs(a-A) + abs(b-B) + abs(c-C);
    }

    int res = rec(i+1, a, b, c);

    chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));

    return res;
}

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

    cin >> N >> A >> B >> C;
    L.resize(N); for (int i=0; i<N; i++) cin >> L[i];

    cout << rec(0, 0, 0, 0) << "\n";    

    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1, 1, -1):
  if H[i] >= H[i-1]:
    continue
  if H[i] < H[i-1]:
    if H[i - 1] - 1 == H[i]:
      H[i - 1] -= 1
    else:
      print("No")
      exit()
print("Yes")

Measured memory_bytes: 14396
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
bool cond;
ll N, L, a[100100], temp, knot, Ind, i;
int main(){
    cin >> N >> L;
    for(i=0;i<N;i++)
    {
        cin >> a[i];
        if(i>0)
            if(a[i]+a[i-1]>=L)
                cond = true, Ind = i;
    }
    if(cond)
    {
        cout << "Possible" << endl;
        for(knot = 1;knot<=N-1;knot++)
        {
            if(knot==Ind)
                break;
            cout << knot <<endl;
        }
        for(knot=N-1;knot>=Ind;knot--)
        {
            if(knot==Ind)
                break;
            cout << knot << endl;
        }
        cout << Ind << endl;
    }
    else{
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 4348
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int hutaketa = n % 100;
        int hyaku = hutaketa / 5;
        if (hutaketa % 5 != 0) {
            hyaku++;
        }
        if (hyaku * 100 > n) {
            System.out.println("0");
        } else
            System.out.println("1");

    }
}


Measured memory_bytes: 79444
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
vector<int> g[100100];
int num[100100];
int p[100100];
int depth[100100];

int dfs(int k, int prev, int dep) {
    int d = 1;
    depth[k] = dep;
    p[k] = prev;
    for (int i = 0; i < g[k].size(); i++) {
        if (g[k][i] != prev) {
            d += dfs(g[k][i], k, dep+1);
        }
    }
    return (num[k] = d);
}

bool solve() {
    dfs(0, -1, 0);
    int k = n-1;
    for (int i = 0; i < (depth[n-1]-1) / 2; i++) {
        k = p[k];
    }
    int l = n - num[k] - (depth[n-1]/2+1);
    int r = num[k] - (depth[n-1]+1) / 2;
    if (depth[n-1] % 2) return l > r;
    return l >= r;
}

void input() {
    cin >> n;
    int a, b;
    for (int i = 0; i < n-1; i++) {
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
}

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

    input();
    cout << (solve()?"Fennec":"Snuke") << endl;
}


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

using namespace std;

int main() {
	int n[1000], m[1000], p[10][1000],ans=0, i = 0;
	vector<int> v;
	while (cin >> n[i] >> m[i]) {
		if (n[i] == 0)break;
		for (int j = 0; j < n[i]; j++)cin >> p[i][j];
		i++;
	}
	for (int k = 0; k < i; k++) {
		ans = 0;
		v = vector<int>(1,0);
		for (int a = 0; a < n[k]; a++) {
			v.push_back(p[k][a]);
			for (int b = 0; b < n[k]; b++)
				v.push_back(p[k][a] + p[k][b]);
		}
		sort(v.begin(), v.end());
		for (int j = 0; j < v.size(); j++) {
			if (v[j] > m[k])break;
			decltype(v)::iterator itr= upper_bound(v.begin(), v.end(), m[k]-v[j]);
			itr--;
			ans = max(ans, v[j] + *itr);
		}
		cout << ans << endl;
	}
	return 0;
} 

Measured memory_bytes: 10792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

int main()
{
    using namespace std;
    int64_t N, left=0, right=1e9;
    cin >> N;
    vector<int64_t> a(N);
    
    for (auto j = 0; j < N; j++) {
        cin >> a[j];
        left = max(left, a[j]);
    }
    
    sort(a.begin(), a.end());
    
    left = a[N-1];
    int32_t min = left;
    for (auto j = 0; j < N-1; j++) {
        auto d = abs(a[j] - left/2);
        if (d <= min) {
            min = d;
            right = a[j];
        }
    }
    
    cout << left << " " << right << endl;
}

Measured memory_bytes: 1024
a=int(input())
b=int(input())
c=int(input())
x=int(input())
p=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                p+=1
print(p)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
#define brep(i, st, n) for (int i = st; i >= n; --i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

ll calc(int n, int x[]) {
    ll sum = 0;
    rrep(k, 1, n + 1) {
        sum += (ll)(k - 1) * x[k] - (ll)(n - k) * x[k];
        sum %= (ll)(1e9 + 7);
    }
    return sum;
}
int main() {
    int n, m; cin >> n >> m;
    int x[n + 1]; rrep(i, 1, n + 1) cin >> x[i];
    int y[m + 1]; rrep(i, 1, m + 1) cin >> y[i];
    cout << calc(n, x) * calc(m, y) % (ll)(1e9 + 7) << endl;
}


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

int main() {
long long A,B,C,D;
  cin >> A >> B >> C >> D;
 cout << max(max(A * C,A * D),max(B * C,B * D));

 
}


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

using namespace std;
const int N = 1e5 + 5;
char str[N];
stack<int> st[N];

int main() {
 //  freopen("in.txt", "rt", stdin);
    int m, k;
    scanf("%d %d", &m, &k);
    int n = m;
    n = (1 << n);
    if (k >= n) {
        puts("-1");
        return 0;
    }
    if (k == 0) {
        for (int i = 0; i < n; ++i) {
            printf("%d %d ", i, i);
        }
        return 0;
    }
    int a = -1, b = -1;
    for (int i = 1; i < n; ++i) {
        if (i == k) continue;
        int j = i ^k;
        if (j != k) {
            a = i;
            b = j;
            break;
        }
    }
    if (a == -1) {
        puts("-1");
        return 0;
    }
    vector<int> vec;
    for (int i = 0; i < n; ++i) {
        if (i != a && i != b && i != k) vec.push_back(i);
    }
    printf("%d %d %d %d ", a, k, a, b);
    for (auto x:vec) printf("%d ", x);
    reverse(vec.begin(), vec.end());
    printf("%d ", k);
    for (auto x:vec) printf("%d ", x);
    printf("%d", b);
}

Measured memory_bytes: 69624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

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


    return 0;
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,W=MI()
    def is_inside(hw):
        h,w = hw
        return 0<=h<H and 0<=w<W
    grid=[[s for s in ST()] for _ in range(H)]
    ans = 0
    dxdy = [(1,0),(0,1),(-1,0),(0,-1)]
    for i in range(H*W):
        h = i//W
        w = i%W
        if grid[h][w] == "#":
            continue
        visited = set()
        q = [(h,w)]
        for cost in range(H*W+1):
            tmp = []
            if not q:
                ans = max(ans,cost-1)
                break
            while q:
                from_ = q.pop()
                if from_ in visited:
                    continue
                visited.add(from_)
                for dh,dw in dxdy:
                    to = (from_[0]+dh, from_[1]+dw)
                    if is_inside(to) and to not in visited and grid[to[0]][to[1]]==".":
                        tmp.append(to)
            q = tmp
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 45292
#include<iostream>
#include<cmath>
#include<stdio.h>

using namespace std;

int main()
{

	int n,i;
	int x[100],y[100],d[100];
	double D1,D2,D3,Di;
	D1 = 0;
	D2 = 0;
	D3 = 0;
	Di = 0;
	
	cin >> n;
	for( i=0; i<n; i++) cin >> x[i];//????????????x
	for( i=0; i<n; i++){ cin >> y[i];//????????????y
		//x??¨y????????¢
		d[i] = x[i] - y[i];
		
		if(d[i] <0){
			d[i] = -1 * d[i];
		}
		
		D1 += d[i];//???????????????????????¢
		D2 += d[i]*d[i];//???????????????????????¢
		D3 += d[i]*d[i]*d[i];
		if (Di < d[i]){
			Di = d[i];//?????§????????§????????¢
		}
	}
	D2 = sqrt(D2);//???????????????????????¢
	D3 = pow(D3, 1.0/3.0);//??????????????????????????¢
	
	printf("%f\n%f\n%f\n%f\n", D1, D2, D3, Di);
	
	return 0;
}
	

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
  if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int main(){
  map<string, int > mp;
  int N; cin>>N;
  REP(i,N){
    string s; cin>>s;
    mp[s]++;
  }
  for(string s:{"AC","WA","TLE","RE"}){
    cout << s << " x " << mp[s] << "\n";
  }
}

Measured memory_bytes: 3632
X,N=map(int,input().split())
P=set()
if N!=0:
  P=set(list(map(int,input().split())))
for i in range(100):
  a=X-i
  if a not in P:
    print(a)
    exit(0)
  a=X+i
  if a not in P:
    print(a)
    exit(0)

Measured memory_bytes: 9056