akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,b;
    cin >> n;
    ll ans = 0;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    rep(j, n-1){
        if(a[j]==a[j+1]){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;

  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (i <= k) {
      cnt += x;
    } else {
      cnt += y;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNextInt()){
				int a=Integer.parseInt(sc.next());
				int b=Integer.parseInt(sc.next());
				int digit = 1;
				int n=0;
				while((a+b)>=digit){
					digit=digit*10;
					n++;
				}
				System.out.println(n);
				
			}
		}
	}
}

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

int main(){
  ll l,r,d;cin >> l >> r >> d;
  ll ans = 0;
  for(ll i=l;i<=r;++i){
    if( i%d == 0 ) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

_LL getsub(vector<vector<_LL>> &connect, _LL p, _LL c, _LL d)
{
    _LL ret = d;
    vecrep(itr, connect[c])
    {
        if( *itr != p ) ret += getsub(connect, c, *itr, d + 1);
    }
    return ret;
}

_LL getdi(vector<pair<_LL,_LL>> &ans, _LL top, _LL n)
{
    vector<vector<_LL>> connect(n);
    vecrep(itr, ans)
    {
        connect[itr->first - 1].push_back(itr->second - 1);
        connect[itr->second - 1].push_back(itr->first - 1);
    }
    return getsub(connect, -1, top - 1, 0);
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); 
    _LL n; cin >> n;
    vector<pair<_LL,_LL>> d(n);
    rep(i, n)
    {
        cin >> d[i].first;
        d[i].second = i + 1;
    }

    sort(d.begin(), d.end(), greater<pair<_LL,_LL>>());
    map<_LL, _LL> vmap;
    vector<_LL> num(n + 1);
    vector<pair<_LL,_LL>> ans;
    if( d[0].first > (n - 1) * n / 2 ) 
    {
        cout << -1 << endl;
        return 0;
    }
    rep(i, n) {vmap[d[i].first] = d[i].second; num[d[i].second] = 1; }
    rep(i, n - 1)
    {
        _LL d1 = d[i].first;
        _LL n1 = num[d[i].second];
        num[d[i].second] = 0;
        _LL n2 = n - n1;
        _LL d2 = d1 + n1 - n2;
        if( vmap[d2] == 0 || num[vmap[d2]] == 0 )
        {
            cout << -1 << endl;
            return 0;
        }
        num[vmap[d2]] += n1;
        ans.emplace_back(d[i].second, vmap[d2]);
    }

    // check

    if( getdi(ans, d[0].second, n) == d[0].first )
    {
        vecrep(itr, ans) cout << itr->first << " " << itr->second << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 26560
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
#define vecout(v,n) for(int i=0; i<n; i++)cout<<v[i]<<" "; cout<<endl;

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}


int n, q, a, b;


signed main() {
	string s;
	cin >> s;
	cout << "ABC" + s << endl;
}



Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def f(n):
    n = str(n)

    return n[0] == n[1] == n[2]


def main():
    N = int(input())

    while not f(N):
        N += 1
    
    print(N)


main()


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

const int maxn=100010;
int n, fa[maxn];
vector<int> g[maxn];
int ans;

bool dfs(int x){
	// printf("%d\n", x);
	int ret=0;
	for(int i=0;i<g[x].size();i++){
		int v=g[x][i]; if(v==fa[x]) continue;
		fa[v]=x; 
		ret+=dfs(v);
	}
	if(ret>1) ans=1;
	return !ret;
}

int main(){

	scanf("%d",&n);
	int x, y;
	for(int i=1;i<n;i++) scanf("%d%d",&x,&y), g[x].push_back(y), g[y].push_back(x);
	ans=n&1;
	dfs(1);
	printf("%s\n", ans ? "First" : "Second");
	return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	long double a,b;
 	cin>>a>>b;
 	a*=b;
 	cout<<(long long)floorl(a)<<endl;
    return 0;
}

Measured memory_bytes: 3768
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,a,b;
    std::cin >> n>>a>>b;
    if(a>b){
        std::cout << 0 << std::endl;
        return 0;
    }
    if(n == 1 && a != b){
        std::cout << 0 << std::endl;
        return 0;
    }
    std::cout << b*(n-1)+a - (a*(n-1)+b) +1<< std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n,a[100],b[100],k,l,x=0,sum=0,y=-99;
cin>>n;
    for(i=0;i<n;i++){
    cin>>a[i];
   }
    for(j=0;j<n;j++){cin>>b[j];}
    for(k=0;k<n;k++){x+=a[k];
        sum=x;
   for(l=k;l<n;l++){
        sum+=b[l];
    }
     y=max(y,sum);
    }
 
cout<<y<<endl;

}

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

#define MOD (1000000007LL)

using namespace std;

long long exp(long long b, long long e){
    if(e == 0) return 1;
    long long ee = exp(b, e / 2);
    long long ans = ee * ee;
    ans %= MOD;
    if(e % 2 == 1) ans *= b;
    return ans % MOD;
}

long long inv(long long n){
    return exp(n, MOD - 2);
}

int main(void){
    long long n, a, b;
    cin >> n >> a >> b;
    long long A, B, C, D;
    A = exp(2LL, n);
    B = 1;
    C = 1;
    for(long long j = n; j > n - a; j--){
        C *= j;
        C %= MOD;
    }
    long long d = 1;
    for(long long j = 1; j <= a; j++){
        d *= j;
        d %= MOD;
    }
    C *= inv(d);
    C %= MOD;
    D = 1;
    for(long long j = n; j > n - b; j--){
        D *= j;
        D %= MOD;
    }
    d = 1;
    for(long long j = 1; j <= b; j++){
        d *= j;
        d %= MOD;
    }
    D *= inv(d);
    D %= MOD;
    A -= (B + C + D);
    A += 3 * MOD;
    cout << A % MOD << endl;
    return 0;
}


Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-15 14:33:51
*/

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

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

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

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

LL a, b, c;

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

    LL d = c - a - b;
    if (d > 0 && d*d > 4*a*b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

int main() {
	int N, M;
	vector<string> S;
	vector<int> t;

	cin >> N;
	for ( int i = 0; i < N; i++ ) {
		string s;
		cin >> s;

    int index = -1;
		for ( int j = 0; j < S.size(); j++ ) {
			if ( S.at(j) == s ) {
				index = j;
				break;
			}
		}

		if ( index == -1 ) {
			S.push_back(s);
			t.push_back(1);
		} else {
			t.at(index)++;
		}
	}

  cin >> M;
  for ( int i = 0; i < M; i++ ) {
  	string s;
  	cin >> s;

  	int index = -1;
  	for ( int j = 0; j < S.size(); j++ ) {
  		if ( S.at(j) == s ) {
  			index = j;
  			break;
  		}
  	}

  	if ( index == -1 ) {
  		S.push_back(s);
  		t.push_back(-1);
  	} else {
  		t.at(index)--;
  	}
  }

  int max = 0;
  for ( int i = 0; i < t.size(); i++ ) {
  	if ( t.at(i) > max ) max = t.at(i);
  }

  cout << max << endl;
}

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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int X, Y; cin >> X >> Y;
  if (X == 1 && Y == 1) {
    cout << 1000000 << endl;
    return 0;
  }
  auto f = [&](int p) {
    if (p == 1) return 300000;
    if (p == 2) return 200000;
    if (p == 3) return 100000;
    return 0;
  };
  int ans = f(X) + f(Y);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
function Main(input) {
    input = input.split("\n");
    const array= input[0].split('');

    let message = 'No';

    for (let i = 0, len = array.length; i < len; i++) {
        if (array[i] == '7') {
            message = 'Yes';
            break;
         }
    }

    

    console.log(message);
}

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

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

int main() {
  ll N, C;
  cin >> N >> C;

  vvi D(C, vi(C));
  for (ll i = 0; i < C; i++) {
    for (ll j = 0; j < C; j++) {
      cin >> D[i][j];
    }
  }

  vvi c(N, vi(N));
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < N; j++) {
      cin >> c[i][j];
      c[i][j] -= 1;
    }
  }

  vvi v(3);

  for (ll i = 0; i < 3; i++) {
    for (ll j = 0; j < N; j++) {
      for (ll k = 0; k < N; k++) {
        if ((j + k) % 3 == i) {
          v[i].push_back(c[j][k]);
        }
      }
    }
  }

  vvi v1(3, vi(C));

  for (ll i = 0; i < 3; i++) {
    for (ll j = 0; j < C; j++) {
      ll tmp = 0;
      for (auto k: v[i]) {
        tmp += D[k][j];
      }
      v1[i][j] = tmp;
    }
  }

  ll ans = INF;

  for (ll i = 0; i < C; i++) {
    for (ll j = 0; j < C; j++) {
      for (ll k = 0; k < C; k++) {
        if ((i - j) * (j - k) * (k - i) == 0) {
          continue;
        }

        ans = min(ans, v1[0][i] + v1[1][j] + v1[2][k]);
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 5120
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* overflow (ll vs int?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

// Author:: Subash Singha Roy
// Institution:: Jalpaiguri Government Engineering College

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (ll)(998244353)
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define frr(i,a,b) for(ll i=a-1;i>=b;i--)
#define tc(t) int t;cin >>t;while(t--)
#define pb(i) push_back(i)
#define rr return 0
#define mp make_pair
#define pr  pair <ll,ll>
#define ff first
#define ss second
#define inf 999999999999999999
ll mult(ll a,ll b, ll p=mod){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=mod){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = mod) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = mod) {return fpow(a, p - 2, p);}
bool sa(const pair<int,int> &a,const pair<int,int> &b){return (a.second<b.second);}
bool fd(const pair<int,int> &a,const pair<int,int> &b){return (a.first>b.first);}
bool sd(const pair<int,int> &a,const pair<int,int> &b){return (a.second>b.second);}
#define max_n (ll)(1e4+5)


int main(){
   fio;
   ll n,a,b;
   cin>>n>>a>>b;
   ll arr[n+5],c[3];
   fr(i,0,3){
       c[i]=0;
   }
   fr(i,0,n){
       cin>>arr[i];
   }
   sort(arr,arr+n);
   fr(i,0,n){
       if(arr[i]<=a){
           c[0]++;
       }
       else if(arr[i]>b){
           c[2]++;
       }
       else
       c[1]++;
   }
   sort(c,c+3);
   cout<<c[0];
   rr;}
    

Measured memory_bytes: 256
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   string S, T;
   cin >> S >> T;

   int res = 100000;
   const int N = S.size();
   for (int i = 0; i+SZ(T) <= N; ++i) {
      int cnt = 0;
      REP(j, SZ(T)) {
         cnt += S[i+j] != T[j];
      }
      DEBUG(i, cnt);
      res = min(res, cnt);
   }
   cout << res << endl;

   return 0;
}


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

const string YES = "Yes";

void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    vector<long long> G[N+1];
    for (int i = 0; i < M; i++) {
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    vector<int> vec(N+1);
    queue<int> queue;

    vec[1] = -1;
    int count = 0;
    queue.push(1);
    while (!queue.empty()) {
        int v = queue.front(); queue.pop();
        for (int u: G[v]) {
            // printf("%d -> %d\n", v, u);
            if (!vec[u]) {
                vec[u] = v;
                count += 1;
                queue.push(u);
            }
        }
    }
    if (count == N - 1) {
        cout << "Yes" << endl;
        for (int i = 2; i <= N; i++) {
            cout << vec[i] << endl;
        }
    } else {
        cout << "No" << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


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

int main (){
 int N,M,X;
 cin >> N>>M>>X;
 int u=0,d=0;
  
 for(int i=0;i<M;i++){
   int a;
   cin >> a;
   if (a>X){
     u++;
   }
   else{
     d++;
   }
 }
  
 if(u>d){
   cout << d << endl;
 }
  else{
    cout << u << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
#define rep_eq(i,n) FOR_EQ(i,0,n)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n;
    int a[n];
    bool flag[n];
    rep(i, n){
        cin >> a[i];
        flag[i] = false;
    }
    
    flag[0] = true;
    int button = 0;
    int count = 0;
    while(1){
        button = a[button] - 1;
        count++;
        if(button == 1){
            cout << count << endl;
            return 0;
        }
        if(flag[button])    break;
        flag[button] = true;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    int d[N];
    for(int k = 0;k < N;k++){
        cin >> d[k];
    }sort(d,d + N);
    int ans=0,mae=0;
    for(int i = 0; i < N; i++){
        if(d[i] != mae){
            ans ++;
        }mae = d[i];
    }cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

/**
 * @brief ３つの整数を読み込み、それらを値が小さい順に並べて出力する
 */
class SortingThreeNumber
{
private:
    int* data;

public:
    /**
     * @brief constructor
     */
    SortingThreeNumber();

    /**
     * @brief destructor
     */
    ~SortingThreeNumber();

    /**
     * @brief プログラムを開始する
     */
    bool Run();

private:

    bool Read();

    void Sort();

    void Write();

    /**
    * @brief 有効範囲内かチェックする
    * @param[in]    チェック対象
    * @return true  範囲外
    * @return false 範囲内
    */
    bool IsInvalid(int n);
};

SortingThreeNumber::SortingThreeNumber()
    : data(NULL)
{
    data = new int[3];
}

SortingThreeNumber::~SortingThreeNumber()
{
    delete[] data;
}

bool SortingThreeNumber::Run()
{
    if (!Read()) {
        return false;
    }

    Sort();

    Write();

    return true;
}

bool SortingThreeNumber::Read()
{
    const int END = 3;
    int count = 0;

    int t = 0;
    do {
        cin >> t;
        if (IsInvalid(t)) {
            return false;
        }
        data[count] = t;
        count++;
    } while (END > count);

    return true;
}

bool SortingThreeNumber::IsInvalid(int n)
{
    const int MIN = 1;
    const int MAX = 10000;

    if (MIN > n || MAX < n) {
        return true;
    }

    return false;
}

void SortingThreeNumber::Sort()
{
    for (int i = 0; i < 3; i++) {
        for (int j = i; j < 3; j++) {
            if (data[i] > data[j]) {
                int t = data[i];
                data[i] = data[j];
                data[j] = t;
            }
        }
    }
    
}

void SortingThreeNumber::Write()
{
    cout << data[0] << " " << data[1] << " " << data[2] << endl;
}

int main()
{
    if (!SortingThreeNumber().Run()) {
        return 1;
    }

    return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;

signed main() {
	int a, b, c, ans;
	cin >> a >> b >> c;
	ans = b / a;
	if (c <= ans) cout << c << endl;
	else cout << ans << endl;
}

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

#define Art Code
#define Artist Shivam Gupta
#define MoT This Art belongs to Artist
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FoR(i,s,x) for(i=s-1;i>=x;i--)
#define ForE(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define mod 1000000007
#define MAX 200005

ll n, m;
vll a;
vl(vl(pll)) dp;

pll solve(ll i, ll j) {
    if(dp[i][j].F!=-1) return dp[i][j];
    if(i==j) return dp[i][j]={a[i],0};
    pll x=solve(i,j-1), y=solve(i+1,j);
    pll A={x.S+a[j],x.F}, B={a[i]+y.S,y.F};
    dp[i][j] = A.F>B.F ? A:B;
    return dp[i][j];
}



int main() {
    FASTIO;
    ll t=1, i, j, k, l;
    // cin>>t;
    W(t--) {
        cin>>n;
        a.resize(n+1);
        dp.resize(n+1); Fore(i,1,n) dp[i].resize(n+1);
        Fore(i,1,n) Fore(j,1,n) dp[i][j].F=-1;
        Fore(i,1,n) cin>>a[i];
        pll ans=solve(1,n);
        // Fore(i,1,n) { Fore(j,1,n) pr(dp[i][j].F), pr(dp[i][j].S), pr('-'); nl; }
        pr(ans.F-ans.S);
        nl;
    }
    return 0;
}

Measured memory_bytes: 144148
// C - Exam and Wizard
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
int in(){int x;scanf("%d",&x);return x;}

int main(){
	int ans = 0, N = in(), C[N];
	long long minus = 0;

	rp(i, 0, N) C[i] = in();
	rp(i, 0, N) if((C[i] -= in()) < 0){ minus += C[i]; ans++; }

	sort(C, C+N);
	reverse(C, C+N);

	for(int c:C){
		if(c <= 0) break;
		if(minus >= 0) break;
		minus += c;
		ans++;
	}

	printf("%d\n", minus<0? -1:ans);
}

Measured memory_bytes: 640
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab = sorted(ab)
    ab = sorted(ab, key=lambda x: x[1], reverse=True)
    cd = [list(map(int, readline().split())) for _ in range(n)]
    cd = sorted(cd)
    cnt = 0
    for i in range(n):
        for j in range(n):
            if ab[i][0] <= cd[j][0] and ab[i][1] <= cd[j][1]:
                cnt += 1
                cd[j][0] = cd[j][1] = 0
                break
    print(cnt)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;

int a[N];
multiset<int> ms[N];
int uf[N];
int find(int x) {
    return uf[x] == x ? x : uf[x] = find(uf[x]);
}
void merge(int a, int b) {
    a = find(a); b = find(b);
    if (a == b) return;
    if (ms[a].size() < ms[b].size()) swap(a, b);
    uf[b] = a;
    for (int i : ms[b]) ms[a].insert(i);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    iota(uf, uf + N, 0);
    int n, m; cin >> n >> m;
    if (2 * (n - m - 1) > n) {
        puts("Impossible");
        return 0;
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ms[i].insert(a[i]);
    }
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        merge(u, v);
    }
    set<int> ts;
    for (int i = 0; i < n; i++) {
        ts.insert(find(i));
    }
    if (ts.size() == 1) {
        puts("0");
        return 0;
    }
    ll ans = 0;
    int rem = 2 * (n - m - 1);
    for (int i : ts) {
        ans += *ms[i].begin();
        ms[i].erase(ms[i].begin());
        rem--;
    }
    for (int i = 0; i < n-1; i++) {
        merge(i, i+1);
    }
    int k = find(0);
    while (rem--) {
        ans += *ms[k].begin();
        ms[k].erase(ms[k].begin());
    }
    cout << ans << nl;
    return 0;
}


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

ll GCD(ll a, ll b){
 if(b == 0){return a;}
  else{return GCD( b , a%b);}}
  
int main()
{int N ; cin >> N;
  vector<ll>A(N),left(N),right(N);
 for(int i = 0; i  < N; i++)
 {cin >> A[i];}
 left[0] = A[0];
 right[N-1] = A[N-1];
 
 for(int i = 0; i < N - 1 ;i++)
 {left[i+1] = GCD(left[i],A[i+1]);}
 
 for(int j = N - 2; j >=0 ; j--)
 {right[j] = GCD(right[j+1],A[j]);}
 //累積GCD定義
 
 ll max_gcd1 = 0;
 
 for(int i = 1; i< N - 1;i++)
 {ll gcd = GCD(left[i-1],right[i+1]);
  max_gcd1 = max(max_gcd1,gcd);}
 //i = 0 と　i = N -1を省く場合が残ってる
 ll max_gcd = max(max_gcd1,max(right[1],left[N-2]));
 
 cout << max_gcd << endl;
 return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

namespace std{
	bool operator < (const xy_t &a, const xy_t &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a)*b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(l.second - l.first, p - l.first) / norm(l.second - l.first);
	return l.first + t * (l.second - l.first);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a; c -= a;
	if(cross(b, c) > 0) return 1;
	if(cross(b, c) < 0) return -1;
	if(dot(b, c) < 0) return +2;
	if(norm(b) < norm(c) ) return -2;
	return 0;
}

bool intersectSP(const line &s, const xy_t &p){
	return abs(s.first - p) + abs(s.second - p) - abs(s.second - s.first) < EPS;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) * ccw(s.first, s.second, t.second) <= 0 &&
		ccw(t.first, t.second, s.first) * ccw(t.first, t.second, s.second) <= 0;
}


double distanceSP(const line &s, const xy_t p){
	xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

double distanceSS(const line &s, const line &t){
	if(intersectSS(s, t)) return 0.0;
	return min(min(distanceSP(s, t.first), distanceSP(s, t.second)),
		min(distanceSP(t, s.first), distanceSP(t, s.second)));
}

xy_t crosspoint(const line &l, const line &m){
	double a = cross(l.second - l.first, m.second - m.first);
	double b = cross(l.second - l.first, l.second - m.first);
	if(abs(a) < EPS && abs(b) < EPS) return m.first;
	if(abs(a) < EPS) assert(false);
	return m.first + b / a * (m.second - m.first);
}

int gcd(int u, int v){
	while(u > 0){
		if(u < v) swap(u, v);
		u %= v;
	}
	return v;
}

int main(){
	int p, n;
	while(cin >> p >> n && (n || p)){
		double l = 0.0;
		double u = 1e10;
		int bestx, besty;
		int bestu, bestv;
		double sqp = sqrt((double)p);
		for(int i = 1; i <= n; i++){
			int x = (int)(sqp * i);
			int u2 = (int)(sqp * i) + 1;
			while((double)(x + 1) / i < sqp) x++;
			while((double)(u2 - 1) / i > sqp) u2--;
			if(1 <= x && x <= n && gcd(x, i) == 1 && (double)x / i > l){
				l = (double)x / i;
				bestx = x;
				besty = i;
			}
			if(1 <= u2 && u2 <= n && gcd(u2, i) == 1 && (double)u2 / i < u){
				u = (double)u2 / i;
				bestu = u2;
				bestv = i;
			}
		}
		cout << bestu << "/" << bestv << " " <<  bestx << "/" << besty << endl;
	}
	return 0;
}

Measured memory_bytes: 872
#include <bits/stdc++.h>
#define rep(i,x,b) for(int i=x;i<(b);++i)
#define erep(i,x,b) for(int i=x;i<=(int)(b);++i)
#define per(i,x,b) for(int i=(x);i>(b);--i)
#define eper(i,x,b) for(int i=(x);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &x, const T &b) { if (x<b) { x = b; return 1; } return 0; }
template<class T>bool chmin(T &x, const T &b) { if (b<x) { x = b; return 1; } return 0; }
template<class T>void show(const vector<T> &x) { for (int i = 0; i < (int)x.size(); ++i) cout << x[i] << (i != (int)x.size()-1 ? " " : "\n"); }
template<class T>T gcd(T x, T b){ return b ? gcd(b, x % b) : x; }
template<class T>T lcm(T x, T b){ return x / gcd(x, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

ll n, k, x[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> k;
    rep(i, 0, n) cin >> x[i];
    ll ans = INF;
    rep(l, 0, n - k + 1) {
      int r = l + k - 1;
      ans = min({ans, abs(x[l]) + abs(x[l] - x[r]), abs(x[r]) + abs(x[r] - x[l])});
    }
    cout << ans << endl;
    return 0;
}



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

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

int n;
int a[200200];
map<int,int> m;

int main(){
#ifdef LZT
    freopen("in","r",stdin);
#endif
    n=read();
    for(int i=1;i<=n;i++) a[i]=read()-i;
    ll ans=0;
    sort(a+1,a+n+1);
    int mx=a[(n+1)/2];
    for(int i=1;i<=n;i++) ans+=abs(a[i]-mx);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T, class F>
T UpperBound(T i0, T i1, F f) {
    while (i0 < i1) {
        T i = i0 + (i1 - i0) / 2;
        if (f(i)) i0 = i + 1; else i1 = i;
    }
    return i0;
}

struct BIT {
    BIT(int n) : b(n + 1), n(n) {}
    void add(int i, int v) {
        for (int k = i + 1; k <= n; k += k & -k) b[k] += v;
    }
    int sum(int k) {
        int s = 0;
        for (; k > 0; k -= k & -k) s += b[k];
        return s;
    }
    void clear() {
        b.assign(n, 0);
    }
    vector<int> b;
    int n;
};

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

    int n;
    cin >> n;

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

    vector<int> b(a);
    sort(b.begin(), b.end());

    ll t = ((ll)n * (n + 1) / 2 + 1) / 2;
    BIT bt(n * 2 + 1);

    auto h = UpperBound<int>(1, n, [&](auto h) {
        int j = b[h];
        ll r = 0;
        int s = n;
        bt.clear();
        bt.add(s, 1);
        for (int i = 0; i < n; i++) {
            s += a[i] >= j ? 1 : -1;
            r += bt.sum(s + 1);
            bt.add(s, 1);
        }
        return r >= t;
    });

    cout << b[h - 1] << endl;

    return 0;
}

Measured memory_bytes: 1792
// IOI 2021
 
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

const int N = 5e3 + 5;

typedef bitset<N> bit;
int n, k, A[N], ans;

bit Add(bit b, int l, int r) {
	for (int i = l; i < r; i++) b |= (b << A[i]);
	return b;
}
void Build(int l, int r, bit b) {
	if (r - l < 2) {
		bool flag = false;
		for (int i = k - A[l]; i < k; i++) flag |= b[i];
		ans += !flag;
		return;
	}
	int md = (l + r) / 2;
	bit b1 = Add(b, l, md);
	bit b2 = Add(b, md, r);
	Build(l, md, b2);
	Build(md, r, b1);
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> A[i], A[i] = min(A[i], k);
	bit b; b[0] = 1;
	Build(0, n, b);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(decltype(N+k) i=k; i<N;i++)
#define rep(i,N) for(decltype(N) i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return 約数unordered_set 1 <= x <= n
auto divv = [](auto n) {
  unordered_set<decltype(n)> v;
  for(decltype(n) i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.insert(i);
      if(i*i != n) v.insert(n/i);
    }
  }
  return v;
};

// check prime (and n>=2) or not
auto isPrime = [](auto n){
  if(n <= 1) return false;
  for(decltype(n) i = 2; i <= sqrt(n); ++i) {
      if(n % i == 0) {
          return false;
      }
  }
  return true;
};

int main() {
    ll n;
    cin>>n;
    string s ,a;
    cin>>s>>a;
    rep(i, s.size()){
        cout<<s[i]<<a[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		int flag = 0;
		
		while (x >= 0 && y >= 0) {
			if (y / 4 == x && y % 4 == 0) {
				flag = 1;
				break;
			}
			x = x - 1;
			y = y - 2;
		}
		
		if (flag == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 35748
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	h := scanInt()
	w := scanInt()

	s := make([]string, h)
	for i := 0; i < h; i++ {
		s[i] = scanString()
	}

	done := make([][]bool, h)
	for i := 0; i < h; i++ {
		done[i] = make([]bool,w)
	}

	ans := 0

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if done[i][j] {
				continue
			}

			q := queue{point{j,i}}
			done[i][j] = true
			cnt := make(map[string]int, 2)
			for q.Len() != 0 {
				next := q.Pop()
				x, y := next.x, next.y
				cnt[string(s[y][x])]++

				for d := 0; d < 4; d++ {
					nx, ny := x+dx[d], y+dy[d]
					if nx >= 0 && nx < w && ny >= 0 && ny < h {
						if !done[ny][nx] && s[ny][nx] != s[y][x] {
							q.Push(point{nx,ny})
							done[ny][nx] = true
						}
					}
				}
			}

			// fmt.Fprintln(wr, cnt)
			ans += cnt["#"]*cnt["."]
		}
	}

	fmt.Fprintln(wr, ans)
}

var (
	dx = []int{1,0,-1,0}
	dy = []int{0,1,0,-1}
)

type point struct {
	x int
	y int
}

type queue []point

func (q queue) Len() int { return len(q) }
func (q *queue) Push(a point) { *q = append(*q, a) }
func (q *queue) Pop() point {
	res := (*q)[0]; *q = (*q)[1:]; return res
}


Measured memory_bytes: 5376
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    tw=0
    fo=0
    for i in range(N):
        if a[i]%4==0:
            fo+=1
        elif a[i]%2==0:
            tw+=1
    if tw>=1:
        tw-=1
     
    N2=N-tw
    if N2//2<=fo:
        print("Yes")
    else:
        print("No")

main()


Measured memory_bytes: 58608
n= int(raw_input())
a = map(int,raw_input().split())

M=max(a)
M_f = float(M)
a.sort()
index=0
for i in range(len(a)):
    if a[i]>=M_f/2:
        index = i
        break
if index==0:
    print str(M) + " " +str(a[index])
else:
    if a[index]==M_f/2:
        print str(M) + " " +str(a[index])
    elif M_f/2-a[index-1]<=a[index]-M_f/2:
        print str(M) + " " + str(a[index-1])
    else:
        print str(M) + " " + str(a[index])

Measured memory_bytes: 11324
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
int main()
{
	int a=read(),v=read(),b=read(),w=read(),t=read();
	if(1ll*t*(v-w)>=abs(b-a))	puts("YES"); else	puts("NO");	
	return 0;
}


Measured memory_bytes: 1512
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

input_n = lambda: int(readline())
input_nn = lambda: map(int, readline().split())
input_s = lambda: readline().rstrip().decode('utf-8')
input_ss = lambda: readline().rstrip().decode('utf-8').split()
input_nl = lambda N: [list(map(int, readline().split())) for _ in range(N)]


def main():
    N, M, C = input_nn()
    B = np.array(list(input_nn()), np.int32)
    A = np.array(input_nl(N), np.int32)

    ans = 0
    for i in range(N):
        if (A[i] * B).sum() + C > 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int powermod(int base, int exponent, int mod){
    int res = 1;
    for(;exponent;exponent>>=1, base=base*base%mod){
        if(exponent&1)res=res*base%mod;
    }
    return res;
}

int main(void){
    int N, P;
    char Cbuf;
    cin >> N >> P;
    int curmod = 0;
    vector<int> modp(P, 0);
    long long res = 0LL;
    if((P==2)||(P==5)){
        for(int i=0; i<N; i++){
            cin >> Cbuf;
            int Cint = Cbuf - '0';
            if(Cint % P == 0){
                res += i+1;
            }
        }
    }else{
        for(int i=0; i<N; i++){
            cin >> Cbuf;
            curmod *= 10;
            curmod += Cbuf - '0';
            curmod %= P;
            modp[curmod*powermod(10, N-i-1, P)%P]++;
        }
        for(int i=0; i<P; i++){
            res += (long long)modp[i]*(modp[i]-1)/2;
        }
    }
    cout << res + modp[0] << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  Get Everything.cpp
//  National Olympiad in Informatics in Provinces
//
//  Created by 黄子齐 on 2019/9/28.
//  Copyright © 2019 黄子齐. All rights reserved.
//

#include <stdio.h>
#include <algorithm>
#include <limits.h>
#include <string.h>
using std::min;
const int N = 1e3+10;
const int P = 5e3+10;
int f[N][P];
int n, m;
int t[N], v[N];
int s, x;
int main() {
//    freopen("mytestdata.in", "r", stdin);
    scanf("%d%d", &n, &m);
    for (int i=1; i<=m; i++) {
        scanf("%d%d", &v[i], &s);
        for (int j=1; j<=s; j++) {
            scanf("%d", &x);
            t[i] += 1<<x-1;
        }
//        printf("%d\n", t[i]);
    }
    memset(f, 0x3f, sizeof(f));
    f[0][0] = 0;
    for (int i=0; i<m; i++) {
        for (int j=0; j<=(1<<n)-1; j++) {
            f[i+1][j] = min(f[i+1][j], f[i][j]);
            f[i+1][j|t[i+1]] = min(f[i+1][j|t[i+1]], f[i][j]+v[i+1]);
        }
    }
    if (f[m][(1<<n)-1] == f[0][1]) {
        printf("-1\n");
    } else {
        printf("%d\n", f[m][(1<<n)-1]);
    }
    return 0;
}


Measured memory_bytes: 19968
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=100007;

int n,l,r,f;
ll s,x[N],sm[N],p[N];

int main(){
	scanf("%d%lld",&n,&s);
	for(int i=1;i<=n;++i)scanf("%lld%lld",&x[i],&p[i]);
	l=1,r=n;
	while(x[l]<s&&s<x[r]){
		if(p[l]>=p[r])p[l]+=p[r],sm[l]+=sm[r]+(x[r]-x[l])*(f!=1),f=1,--r;
		else p[r]+=p[l],sm[r]+=sm[l]+(x[r]-x[l])*(f!=-1),f=-1,++l;
	}
	printf("%lld\n",s<x[l]?(x[r]-s+sm[r]):(s-x[l]+sm[l]));
	return 0;
}


Measured memory_bytes: 3288