akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

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

int n,m;
vint divs;
void set_divs(){
  for(int i=1;i*i<=m;++i){
    if(m%i==0){
      divs.push_back(i);
      if(i*i!=m)divs.push_back(m/i);
    }
  }
}
signed main(){
  cin >> n >> m;
  set_divs();
  int ans=0;
  for(auto div:divs){
    if(m>=div*n) chmax(ans,div);
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i, a, b) for (ll i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

bool u[10];
ll sll, p10;
ll cv = 0, bv = 0, bdiff = 0;

void dfs(ll left) {
	//cout << left << " " << cv << endl;

	if (left == 0) {
		ll diff = min(abs(cv - sll), p10 - abs(cv - sll));
		if (diff > bdiff || diff == bdiff && cv < bv) {
			bv = cv;
			bdiff = diff;
		}
		return;
	}

	rep(i, 0, 10) if (!u[i]) {
		u[i] = 1;
		cv = (cv * 10) + i;
		dfs(left - 1);
		cv /= 10;
		u[i] = 0;
	}
}

int main() {
	cin.sync_with_stdio(false); cin.tie(0);
	cin.exceptions(cin.failbit);

	string s; cin >> s;
	sll = stoll(s);
	p10 = 1;
	rep(i, 0, s.length()) p10 *= 10;
	dfs(s.length());
	string ans = to_string(bv);
	if (ans.length() < s.length())
		ans = "0" + ans;
	cout << ans << endl;
}



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

int main(){
  int N,T,A,kyuuden=0;
    double Atonosa=100000;
  cin >> N >> T >> A;
  for(int i=0;i<N;i++){
    int H;
    double kion;
    cin >> H;
    kion=T-H*0.006;
    if(Atonosa>abs(A-kion)){
      Atonosa=abs(A-kion);
      kyuuden=i+1;
    }
  }
  cout << kyuuden << endl;
}

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

int main () {
	int a1,a2,a3,a4,b1,b2,b3,b4;
	int S,T;
	cin>>a1>>a2>>a3>>a4>>b1>>b2>>b3>>b4;	
	S=a1+a2+a3+a4;
	T=b1+b2+b3+b4;
	if(S>T){
		cout<< S <<'\n';
	}else{if(S<T){
		cout<< T <<'\n';
	}else{
		cout<< S <<'\n';
	}
}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int maxn = 110;
#define ll long long
ll arr[maxn], n;

int main()
{
    scanf("%lld", &n);
    double avg = 0, eps = 1e9;
    int idx = 1e9;
    for (int i = 1; i <= n; i++)
        scanf("%lld", &arr[i]), avg += arr[i];
    avg /= n;
    for (int i = 1; i <= n; i++)
        if (abs(arr[i] - avg) < eps)
            idx = i, eps = abs(arr[i] - avg);
    printf("%d", idx - 1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    int a,b,c;
    cin>>a>>b>>c;

    int finala = min(a,b+c);
    int transfer = finala - b;
    int rem = c - transfer;
    cout<<rem,nl;

    return 0;
}

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

int main()
{
    int n;
    string s;
    cin>>n>>s;
    vector<ll> w(n);//←
    vector<ll> ww(n);
    vector<ll> e(n);
    vector<ll> ee(n);
    for(int i=0;i<n;i++){
        if(s[i]=='W'){
            w.at(i)++;
        }
        if(i!=0){
            w.at(i)+=w.at(i-1);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='W'){
            ww.at(i)++;
        }
        if(i!=n-1){
            ww.at(i)+=ww.at(i+1);
        }
    }
    for(int i=0;i<n;i++){
        if(s[i]=='E'){
            e.at(i)++;
        }
        if(i!=0){
            e.at(i)+=e.at(i-1);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='E'){
            ee.at(i)++;
        }
        if(i!=n-1){
            ee.at(i)+=ee.at(i+1);
        }
    }
    ll ans=n+10;
    for(int i=0;i<n;i++){
        
            ans=min(ans,ee.at(i)+w.at(i)-1);
            //cout<<"W"<<ee.at(i)+w.at(i)-1<<endl;
        
        
    }

    cout<<ans<<endl;

}


Measured memory_bytes: 9988
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();


		if(x>=400 && x<=599) {
			System.out.println(8);
		}else if(x>=600 && x<=799){
			System.out.println(7);
		}else if(x>=800 && x<=999) {
			System.out.println(6);
		}else if(x>=1000 && x<=1199) {
			System.out.println(5);
		}else if(x>=1200 && x<=1399) {
			System.out.println(4);
		}else if(x>=1400 && x<=1599) {
			System.out.println(3);
		}else if(x>=1600 && x<=1799) {
			System.out.println(2);
		}else {
			System.out.println(1);
		}

		scanner.close();

	}

}


Measured memory_bytes: 35616
class SegmentTree:
    #for pypy
    #treeは1-based-index,queryは0-based-index
    __slots__=["size","func","default_val","tree","first_idx"]
    def __init__(self,initial_value_list,func,default_val,first_index=0):
        n=len(initial_value_list)
        self.first_idx=first_index
        self.size=1<<(n-1).bit_length()
        self.func=func#適用関数
        self.default_val=default_val#初期値
        self.tree=[default_val for i in range(2*self.size)]
        # 木の構築
        for i in range(n):
            self.tree[self.size+i]=initial_value_list[i]
        for i in range(self.size-1,0,-1):
            self.tree[i]=self.func(self.tree[2*i],self.tree[2*i+1])

    def update(self,k,x):
        k+=self.size-self.first_idx
        self.tree[k]=x
        while k>1:
            k>>=1
            self.tree[k]=self.func(self.tree[2*k],self.tree[2*k+1])
    def query(self, l, r):
        #res->func[l,r)
        l+=self.size-self.first_idx
        r+=self.size-self.first_idx
        lret,rret=self.default_val,self.default_val
        while l<r:
            if l&1:
                lret=self.func(lret,self.tree[l])
                l+=1
            if r&1:
                r-=1
                rret=self.func(self.tree[r], rret) # モノイドでは可換律は保証されていないので演算の方向に注意
            l>>=1
            r>>=1
        return self.func(lret, rret)
n,k=map(int,input().split())
MAX=300050
seg=SegmentTree([0]*300050,max,0,0)
for _ in range(n):
    a=int(input())
    seg.update(a,seg.query(max(a-k,0),min(MAX,a+k)+1)+1)
print(seg.query(0,MAX))

Measured memory_bytes: 145028
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int
#define vi vector<int> 
#define vl vector<ll> 
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pair<ll,ll>>
#define umap unordered_map
#define uset unordered_set
#define all(c) c.begin(), c.end()
#define maxarr(A) *max_element(A, A+n) 
#define maxvec(v) *max_element(all(v)) 
#define minarr(A) *min_element(A, A+n);
#define minvec(v) *min_element(all(v));
#define lb(v,elem) lower_bound(all(v),elem)
#define ub(v,elem) upper_bound(all(v),elem)
#define pb push_back 
#define ff first 
#define ss second
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define debug(v) for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<"sum = "<<sum<<endl;
#define mod 1000000007
#define INF (ll)1e18
#define endl "\n"
#define pi 3.142857142857143

  
ll binpow(ll a, ll b) {
	if (b == 0)
		return 1;
	ll res = binpow(a, b / 2);
	if (b % 2)
		return res * res * a;
	else
		return res * res;
}

ll modexpo(ll x, ll y, ll p){  
	ll res = 1;  
	x = x % p; 
	if (x == 0) return 0;
	while (y > 0){   
		if (y & 1)  
			res = (res*x) % p;  
		y = y>>1;
		x = (x*x) % p;  
	}  
	return res;  
}

vector<int> getPrimes(int M){
	
	vi p(M,1);
	vector<int>prime;
	for(int i=2; i*i <= M; ++i){
		if(p[i]){
			for(int j = i*i; j<=M; j+=i) 
				p[j] = 0;
		}
	}
	rep(i,2,M) if(p[i]) prime.push_back(i);
	return prime;
}


int main() { 
	FASTIO;
	//freopen("1.in","r",stdin);
	//vi pm = getPrimes(100005);
	int t=1;
	//cin>>t; 
	while(t--){
		char c;
		cin>>c;
		if(c<97) cout<<'A'<<endl;
		else cout<<'a'<<endl;
	}

  return 0;
} 


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int h,w;
int t[10][10];

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

bool in(int x, int y){
    if(0 > x || x >= h) return false;
    if(0 > y || y >= w) return false;
    return true;
}

void change(int c){ //g[0][0]を色cに変える

    int bef = t[0][0];
    if(bef == c)return;
    queue<pii> q;
    q.push(pii(0,0));
    while(q.size()){
        int x = q.front().first;
        int y = q.front().second;

        t[x][y] = c;
        q.pop();
        rep(i,4){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(in(nx,ny) && t[nx][ny] == bef){
                q.push(pii(nx,ny));
            }
        }
    }
}

int count(int c){ //色cの連結成分の大きさを調べる

    int ret = 0;
    rep(i,h)rep(j,w)if(t[i][j] == c){
        int cnt = 0;
        queue<pii> q;
        q.push(pii(i,j));
        while(q.size()){
            int x = q.front().first;
            int y = q.front().second;
            q.pop();
            if(t[x][y] < 0)continue;

            cnt++;
            t[x][y] = -1;
            rep(k,4){
                int nx = x + dx[k];
                int ny = y + dy[k];
                if(in(nx,ny) && t[nx][ny] == c ){
                    q.push(pii(nx,ny));
                }
            }
        }

        ret = max(ret, cnt);
    }

    return ret;
}

int main(void) {
    int col;
    while(cin >> h >> w >> col, h){
        col--;
        int g[10][10];
        rep(i,h)rep(j,w)cin >> g[i][j],g[i][j]--;
        int ans = 0;
        rep(a,6)rep(b,6)rep(c,6)rep(d,6)rep(e,6){
            rep(i,h)rep(j,w)t[i][j] = g[i][j];
            change(a);
            change(b);
            change(c);
            change(d);
            change(e);
            ans = max(ans, count(col));
        }
        cout << ans << endl;
    }
}



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

int main() {
	string s;
	cin>>s;
	int x=0;
	for (int i=0; i<s.size()-2; i++) {
		if (s[i]==s[i+1]&&s[i]==s[i+2]) {
			cout<<"Yes";
			x++;
			break;
		}
	}
	if (x==0) {
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

int main(void) {

	int n;
	cin >> n;

	cout << 48 - n << endl;

	return 0;
}

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

int n;
int a[200055];
int l[200055], r[200055];

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

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);

	{
		stack<int> sta;

		for (int i = 0; i < n; i++) {
			while (!sta.empty() && a[sta.top()] > a[i]) sta.pop();

			if (sta.empty()) l[i] = 0;
			else l[i] = sta.top() + 1;

			sta.push(i);

		}
	}

	{
		stack<int> sta;

		for (int i = n - 1; i >= 0; i--) {
			while (!sta.empty() && a[sta.top()] > a[i]) sta.pop();

			if (sta.empty()) r[i] = n - 1;
			else r[i] = sta.top() - 1;

			sta.push(i);
		}
	}

	long long res = 0ll;

	for (int i = 0; i < n; i++) {
		res += 1ll * (i - l[i] + 1) * (r[i] - i + 1) * a[i];
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3456
#include<stdio.h>
 
int main(){
 
    int card[4][14],n,i,j,d;
    char c; 
    scanf("%d",&n);
     
    for(i=0; i<4; i++){
        for(j=1; j<14; j++){
            card[i][j]=0;
        }
    }
    for(i=0; i<n; i++){
        scanf(" %c %d",&c,&d);
        if(c=='S') card[0][d]=1;
        else if(c=='H') card[1][d]=1;
        else if(c=='C') card[2][d]=1;
        else if(c=='D') card[3][d]=1;
    }
    for(i=0; i<4; i++){
        for(j=1; j<14; j++){
            if(card[i][j]==0){
                if(i==0) printf("S");
                else if(i==1) printf("H");
                else if(i==2) printf("C");
                else if(i==3) printf("D");
             
            printf(" ");
            printf("%d\n",j);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 600
def main():
    X, Y, A, B, C = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))

    sorted_p = sorted(p, reverse=True)[:X]
    sorted_q = sorted(q, reverse=True)[:Y]
    sorted_r = sorted(r, reverse=True)

    p_itr, q_itr, r_itr = X-1, Y-1, 0
    
    while r_itr < C:
        look_p = sorted_p[p_itr]
        look_q = sorted_q[q_itr]
        look_r = sorted_r[r_itr]

        if look_p <= look_q and p_itr >=0:
            if look_p <= look_r:
                sorted_p[p_itr] = look_r
                p_itr -= 1
                r_itr += 1
            else:
                break

        elif q_itr >= 0:
            if look_q <= look_r:
                sorted_q[q_itr] = look_r
                q_itr -= 1
                r_itr += 1
            else:
                break

        else:
            break

    res = sum(sorted_p) + sum(sorted_q)
    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 99356
void main() {
  problem();
}

void problem() {
  const A = scan!long;
  const B = scan!long;
  const N = scan!long;

  long calc(long x) {
    return (A*x / B) - A*(x/B);
  }

  long solve() {
    if (B > N) {
      return calc(N);
    }

    const k = N / B;
    return calc(B * k - 1);
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
import std.bigint, std.functional;

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


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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  
  if ( (g * 10 + b) % 4 == 0) {
     cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
// 以下をテスト
// https://qiita.com/drken/items/dc53c683d6de8aeacf5a#e-%E5%95%8F%E9%A1%8C---knapsack-2
#include <iostream>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

const int MAX_N = 110;
const int MAX_V = 100100;

// 入力
int N;
long long W, weight[MAX_N], value[MAX_N]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[MAX_N][MAX_V];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    // 初期化
    for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;

    // 初期条件
    dp[0][0] = 0;

    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {

            // i 番目の品物を選ぶ場合
            if (sum_v - value[i] >= 0) chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);

            // i 番目の品物を選ばない場合
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }

    // 最適値の出力
    long long res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
        if (dp[N][sum_v] <= W) res = sum_v;
    }
    cout << res << endl;
}

Measured memory_bytes: 89676
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = map(int, input().split())

s1 = set(prime_factorize(a))
s2 = set(prime_factorize(b))

ans = len(s1 & s2) + 1
print(ans)

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

int main() {
    string S, T; cin >> S >> T;
    int ans = 0;
    rep(i, 3){
        if(S[i] == T[i])ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int n, A[50];

int solve (int i, int m)
{
	if( m == 0 ) return 1;
	if( i >= n ) return 0;
	int res = solve(i+1, m) || solve(i+1, m-A[i]);
	return res;
}

int main(int argc, char const *argv[])
{
	int q, m, i;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>A[i];
	}
	cin>>q;
	for (int i = 0; i < q; ++i)
	{
		cin>>m;
		if(solve(0,m)) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 105000;
const int mod = (int) 1e9 + 7;

int n;
vector<int> g[MAXN];
int dp[MAXN][2];

int calc(int v, int parBlack, int p = -1) {
  if (dp[v][parBlack] != -1) {
    return dp[v][parBlack];
  }
  long long resW = 1;
  long long resB = (parBlack ? 0 : 1);
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    resW = 1ll * resW * calc(to, 0, v) % mod;
    resB = 1ll * resB * calc(to, 1, v) % mod;
  }
  dp[v][parBlack] = (resW + resB) % mod;
  return dp[v][parBlack];
}

int main() { 

  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int from, to;
    scanf("%d %d", &from, &to);
    from--; to--;
    g[from].push_back(to); g[to].push_back(from);
  }
  for (int i = 0; i < n; i++) {
    dp[i][0] = dp[i][1] = -1;
  }

  cout << calc(0, 0) << endl;

  return 0;
}


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

using namespace std;

typedef long long int lli;

int main() {
    int n, k;
    string str;

    cin >> n >> k >> str;

    switch (str[k-1]) {
        case 'A':
        str[k-1] = 'a';
        break;
        case 'B':
        str[k-1] = 'b';
        break;
        default:
        str[k-1] = 'c';
        break;
    }
    

    cout << str << endl;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = [1] * (n + 1)
    for _ in range(m):
        idx = int(input())
        a[idx] = 0

    dp = [0] * (n + 1)
    dp[0] = 1
    dp[1] = 1
    for i in range(2, n + 1):
        dp[i] = a[i - 1] * dp[i - 1] + a[i - 2] * dp[i - 2]
        dp[i] %= mod

    print(dp[-1] % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 42204
import numpy as np
N = int(input())
a = [int(_) for _ in input().split()]
a = np.array(a)
a = np.sort(a)
min = 0
max = 100

for i in range(8):
    set_1 = set(np.where(i*400<=a)[0])
    set_2 = set(np.where(a<(i+1)*400)[0])
    match = list(set_1 & set_2)
    if len(match)>0:
        min+=1
if min==0:
    min=1
    max = N
else:
    if len(np.where(a>=3200)[0])==0:
        max = min
    else:
        max = min + len(np.where(a>=3200)[0])
print (min, max)

Measured memory_bytes: 19100
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;



int main()
{
	int n;
	int res;

	cin >> n;
	res = n * (n + 1) / 2;

	cout << res << endl;


}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scan = null;
        try {
            scan = new Scanner(System.in);
            String str = scan.nextLine();
            if (str != null && str.equals("ABC")) {
                System.out.println("ARC");
            } else {
                System.out.println("ABC");
            }
        } finally {
            scan.close();
        }
    }
}


Measured memory_bytes: 35704
#include<stdio.h>
int main(void)
{
	long long a,b,c;
	scanf("%lld %lld",&a,&b);
	if(a%b<=-((a%b)-b)) printf("%lld\n",a%b);
	else printf("%lld\n",-((a%b)-b));
	return 0;
}

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

int main(){
    vector<vector<int>> A(3, vector<int>(3));
    vector<vector<bool>> B(3, vector<bool>(3, false));
    rep(i, 3) rep(j,3) cin >> A[i][j];
    int N;
    cin >> N;
    rep(i, N){
        int num;
        cin >> num;
        rep(i, 3) rep(j,3) if(num == A[i][j]) B[i][j] = true;
    }
    if(B[0][0] && B[0][1] && B[0][2]) cout << "Yes" << endl;
    else if(B[1][0] && B[1][1] && B[1][2]) cout << "Yes" << endl;
    else if(B[2][0] && B[2][1] && B[2][2]) cout << "Yes" << endl;
    else if(B[0][0] && B[1][0] && B[2][0]) cout << "Yes" << endl;
    else if(B[0][1] && B[1][1] && B[2][1]) cout << "Yes" << endl;
    else if(B[0][2] && B[1][2] && B[2][2]) cout << "Yes" << endl;
    else if(B[0][0] && B[1][1] && B[2][2]) cout << "Yes" << endl;
    else if(B[0][2] && B[1][1] && B[2][0]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// 7/1 解き直し
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

P dp[2000][2000];

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    rep(i, H) cin >> field[i];

    rep(h, H) rep(w, W) dp[h][w] = P(-1, -1);

    // cout << "here?" << endl;

    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (field[h][w] == '#') continue;

            if (h > 0) dp[h][w].first = dp[h-1][w].first;
            if (w > 0) dp[h][w].second = dp[h][w-1].second;

            // 上端または１つ上が障害物の時は、新しく縦向きに走査する。
            if (h == 0 || dp[h][w].first == -1) {
                int nh = h;
                while (nh < H && field[nh][w] != '#') nh++;
                dp[h][w].first = nh - h;  // 自分を含む。[h, nh)
            }

            // 左端または左側が障害物の時は、新しく横向きに走査する。
            if (w == 0 || dp[h][w].second == -1) {
                int nw = w;
                while (nw < W && field[h][nw] != '#') nw++;
                dp[h][w].second = nw - w;
            }
        }
    }

    // cout << "here?2" << endl;

    int res = 0;
    rep(h, H) {
        rep(w, W) {
            if (field[h][w] == '#') continue;
            int now = dp[h][w].first + dp[h][w].second - 1;
            res = max(res, now);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 42344
k = int(input())
line = input().split()
a = int(line[0])
b = int(line[1])

q_a, mod_a = divmod(a, k)
q_b, mod_b = divmod(b, k)

if mod_a == 0 or mod_b == 0 or q_a != q_b:
  print("OK")
else:
  print("NG")

Measured memory_bytes: 9204
#include <cstdio>

 
int main()
{
    int N, A, B = 0;

    scanf("%d%d%d", &N, &A, &B);

    int sum = 0;
    for (int i = 0; i <= N; ++i)
    {
        int s = (i % 10) + (i % 100) / 10 + (i % 1000) / 100 + (i % 10000) / 1000 + (i % 100000) / 10000;
        if ( s >= A && s <= B)
        {
            sum += i;
        }
    }

    // Output
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 128
<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
    $map=[];
    $a = trim(fgets($handle));
    $a=explode(' ',$a);
    $b = trim(fgets($handle));
    $b=explode(' ',$b);
    $s= trim(fgets($handle));
    $map[$a[0]]=$b[0];
    $map[$a[1]]=$b[1];
    $map[$s]-=1;
    foreach ($map as $m)
    {
        echo $m." ";
    }
    echo "\n";
?>

Measured memory_bytes: 4728
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>


#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

using namespace std;


int main()   {
    cout.precision(17);
    ll modd = 1000 * 1000 * 1000 + 7;
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readll(a);
        readdouble(b);

        ll b100 = (ll) round(b*100);

        cout << (a*b100)/100 << endl;
        
    }
    return 0;
}


Measured memory_bytes: 3748
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	string S;
	cin >> S;

	for (int i = 1; i < S.size(); i++) {
		if (S[i] == S[i - 1]) {
			cout << i << " " << i + 1 << endl;
			return 0;
		} else if (i >= 2 && S[i - 2] == S[i]) {
			cout << i - 1 << " " << i + 1 << endl;
			return 0;
		}
	}

	printf("-1 -1\n");

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <queue>
#include <numeric>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	bool bad = false;
	for (int i = 1; i < s.size(); ++i)
		if (s[i] == s[i - 1]) bad = true;
	if (bad)
		cout << "Bad\n";
	else
		cout << "Good\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;
const int MN=5e5+10;
int n, q, D[MN], t[MN], last[MN], ans[MN];
vector<pair<pair<int, int>, int> > que;

void akt(int ile, int x){
    if(x>n) return;
    D[x]+=ile;
    akt(ile, x+(x&(-x)));
}
int sum(int x){
    if(x==0) return 0;
    return D[x]+sum(x-(x&(-x)));
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin>>n>>q;
    for(int i=1; i<=n; ++i) cin>>t[i];
    for(int i=0; i<q; ++i){
        int l, r;
        cin>>l>>r;
        que.push_back({{r, l}, i});
    }
    for(int i=1; i<=n; ++i) last[i]=-1;
    sort(que.begin(), que.end());
    int wsk=0;
    for(int i=1; i<=n; ++i){
        if(last[t[i]]!=-1) akt(-1, last[t[i]]);
        last[t[i]]=i;
        akt(1, i);
        while(que[wsk].st.st==i&&wsk<q){
            auto p=que[wsk];
            ans[p.nd]=sum(p.st.st)-sum(p.st.nd-1);
            wsk++;
        }
        if(wsk>=q)break;
    }
    for(int i=0; i<q; ++i) cout<<ans[i]<<'\n';
    return 0;
}


Measured memory_bytes: 17584
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF = 1e12+1;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

int n;

int main() {
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    ll sum = 0;
    ll res = 1e18+1;
    ll count = 0;
    
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 0) {
            if (sum <= 0) {
                count += 1 - sum;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                count += sum + 1;
                sum = -1;
            }
        }
    }
    chmin(res,count);

    count = sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 1) {
            if (sum <= 0) {
                count += 1 - sum;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                count += sum + 1;
                sum = -1;
            }
        }
    }
    chmin(res,count);

    cout << res << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

vector<ll> enum_div(ll n) {
  vector<ll> ret;
  for(ll i = 2LL; i*i <= n; i++) {
    if(n%i == 0LL) {
      ret.push_back(i);
      if(i != 1LL && i*i != n) {
        ret.push_back(n/i);
      }
    }
  }
  ret.push_back(n);
  sort(ret.begin(), ret.end());
  return ret;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vll v = enum_div(m);
  ll ans = 1LL;
  rep(i,v.size()) if(m/v[i]>=n) ans = max(ans,v[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;

#define rep(i, N) for(ll i=0; i<N; ++i)

ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(a[i-1] == a[i]) {
      ans++;
      a[i] = -1;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    vector<ll> b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<ll> asum(n+1, 0);
    rep(i, n) {
        asum[i+1] = asum[i] + a[i]; 
    }
    vector<ll> bsum(m+1, 0);
    rep(i, m) {
        bsum[i+1] = bsum[i] + b[i];
    }
    //rep(i, n+1) {
    //    cout << asum[i] << " " ;
    //}
    //cout << endl;
    //rep(i, m+1) {
    //    cout << bsum[i] << " ";
    //}
    //cout << endl;
    ll ans = 0;
    rep(i, n+1) {
        ll t = k - asum[i];
        if (t < 0) continue;
        ll idx = lower_bound(bsum.begin(), bsum.end(), t) - bsum.begin();
        //cout << idx << endl;
        if (idx < 0 || idx >= m + 1) continue;
        if (bsum[idx] + asum[i] == k) {
            ans = max(ans, (ll)i + idx);
        }
        else {
            ans = max(ans, (ll)i + idx - 1LL);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATherefore solver = new ATherefore();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATherefore {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int search = n % 10;
            if (search == 2 || search == 4 || search == 5 || search == 7 || search == 9)
                out.println("hon");
            else if (search == 0 || search == 1 || search == 6 || search == 8)
                out.println("pon");
            else
                out.println("bon");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32472
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#define ll long long
#define ull unsigned long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x7f7f7f7f
#define lson o<<1
#define rson o<<1|1
const double E=exp(1);
const int maxn=1e3+10;
const int mod=1e9+7;
using namespace std;
int a[maxn];
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	int x,y;
	while(m--)
	{
		cin>>x>>y;
		a[x]++;
		a[y]++;
	}
	for(int i=1;i<=n;i++)
		cout<<a[i]<<endl;
	return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left != NIL)
    x = x->left; 
  //else return treeMinimum(x->left);

  if(x->left == NIL) return x;

}

Node treeMaximum(Node x){

  if(x->right == NIL) return x;
  else return treeMaximum(x->right);

}

Node treeSearch(Node x, int k){
  if(x == NIL || k == x->key) return x;
  if(k < x->key) return treeSearch(x->left, k);
  else return treeSearch(x->right, k);

}

Node treeSuccessor(Node x){

  Node y;

  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z){
    z->key = y->key;
  }


}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  //z->parent = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }

  z->parent = y;

  if(y == NIL) root = z;
  else if((z->key) < (y->key)) y->left = z;
  else y->right = z;

}

void inorder(Node u){

  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}
void preorder(Node u){

  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      //printf("%d\n",root);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
#include<stdio.h>
using namespace std;

int main(){
	int index,jndex;
	for(index = 1; index <= 9 ; index++){
		for(jndex = 1 ; jndex <= 9 ; jndex++){
			//cout<<index<<"x"<<jndex<<"="<<index*jndex<<endl;
			printf("%dx%d=%d\n",index,jndex,index*jndex);
		}
	}
	
} 

Measured memory_bytes: 2576
#include <iostream>
     
    using namespace std;
     
    int main() {
     
    	int x, y;
    	cin >> x >> y;
     
    	int sum = 0;
     
    	if(x==1)
    		sum += 300000;
    	if(x==2)
    		sum += 200000;
    	if(x==3)
    		sum += 100000;
    	if(y==1)
    		sum += 300000;
    	if(y==2)
    		sum += 200000;
    	if(y==3)
    		sum += 100000;
     
    	if(x==1 && y==1)
    		sum += 400000;
     
    	cout << sum << endl;
     
     
     
    }

Measured memory_bytes: 256
import java.io.*;
 
class Main{
    public static void main(String[] args) throws Exception{
        int x, ans;
     
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        x = Integer.parseInt(br.readLine());
         
        ans = x*x*x;
        System.out.println(ans);
    }
}

Measured memory_bytes: 24400
#include <bits/stdc++.h>
using namespace std;
#define ll long long  
#define pb push_back
#define mk make_pair
#define mod 998244353
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define all(x) x.begin(),x.end()
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0); 
    string s;
    cin>>s;
    int flag=1;
    if(s[2]==s[3]&&s[4]==s[5])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}
//make all values ll



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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

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

    string ans = "";
    rep(i, n){
        ans += s[i];
        ans += t[i];
    }
    OP(ans);
}


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

  int A,B;

  char op;

  cin >> A >> op >> B ;

  if(op=='+') cout << A+B << endl;

  else if(op=='-') cout << A-B << endl;

  return 0;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $N);
$S = str_split(trim(fgets(STDIN)));

# 初期位置の右側の全ての白石
$count_white = 0;
for ( $i = 0 ;$i < $N ;$i++ ) {
    if ($S[$i] == '.') {
        $count_white++;
    }
}

# 初期位置の左側の全ての黒石（初期位置はゼロなので0）
$count_black = 0;

$ans[] = $count_white + $count_black;

for ( $i = 0 ;$i < $N ;$i++ ) {
    if ($S[$i] == '#') {
        $count_black++;
    }
    if ($S[$i] == '.') {
        $count_white--;
    }
    $ans[] = $count_white + $count_black;
}

echo min($ans);


Measured memory_bytes: 27252
using System;
using System.Collections.Generic;
class Program{
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		string[] a=new string[n];
		int ans=0;
		for(int i=0;i<n;i++){a[i]=Console.ReadLine();}
		bool b=true;
		for(int j=0;j<n-1&&b;j++){
			for(int k=j+1;k<n;k++){
				if(a[j][k]!=a[k][j]){b=false;break;}
			}
		}
		if(b){ans++;}
		for(int i=1;i<n;i++){
			for(int j=0;j<n;j++){
				a[j]+=a[j][0];
				a[j]=a[j].Remove(0,1);
			}
			b=true;
			for(int j=0;j<n-1&&b;j++){
				for(int k=j+1;k<n;k++){
					if(a[j][k]!=a[k][j]){b=false;break;}
				}
			}
			if(b){ans++;}
		}
		Console.WriteLine("{0}",ans*n);
	}
}

Measured memory_bytes: 23008
n, m, x, y = map(int, input().split())
xs = map(int, input().split())
ys = map(int, input().split())

max_x = max(xs)
min_y = min(ys)

res = 'War'
for z in range(-100, 101):
    if max_x < z and x < z and z <= y and z <= min_y:
        res = 'No War'
        break
    else:
        pass
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n; 
	cin >> n; 
	for(int i=1; i<=n; ++i)
		for(int j=i+1; j<=n; ++j){
			for(int o=0; (1<<o)<=n; ++o)
				if((i&(1<<o)) != (j&(1<<o))){
					cout << o+1; 
					break;
				}
			if(j == n) cout << endl; 
			else cout << ' '; 
		}
	return 0; 
}

Measured memory_bytes: 512
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

long long const MOD = 1000000007LL;

int dp[100001];

int sixPower;
int ninePower;

int power6(int n) {
    if (n < 6) return -1;
    while (1) {
        if (sixPower > n) break;
        sixPower *= 6;
    }
    return sixPower /= 6;
}

int power9(int n) {
    if (n < 9) return -1;
    while (1) {
        if (ninePower > n) break;
        ninePower *= 9;
    }
    return ninePower /= 9;
}

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

    dp[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        sixPower = 6;
        ninePower = 9;
        int six = power6(n - i);
        int nine = power9(n - i);
        // cout << "six = " << six << ", nine = " << nine << endl;
        if (six == -1) dp[i] = dp[i + 1] + 1;
        else if (nine == -1) dp[i] = min(dp[i + 1], dp[i + six]) + 1;
        else dp[i] = min(dp[i + 1], min(dp[i + six], dp[i + nine])) + 1;
        // cout << "dp[" << i << "] = " << dp[i] << endl;
    }

    cout << dp[0] << endl;
}


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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if (x < r or y < r or x+r > w or y+r > h) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
    return 0;
}


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

using namespace std;
int main(void){
    int A, B, C, K, total, answer;
    total = 0;
    answer = 0;
    cin >>A >>B >>C >>K;
    for (int i = 0; i <= A; ++i) {
        int num_500 = i;
        for (int i = 0; i <= B; ++i) {
            int num_100 = i;
            for (int i = 0; i <= C; ++i) {
                int num_50 = i;
                total = 500 * num_500 + 100 * num_100 + 50 * num_50;
                if (total == K) answer += 1;
                
            }
        }
    }
    cout << answer <<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		String str = "";
		String[] res = new String[2*h];
		for (int i = 0; i < h; i++) {
			str = sc.next();
			res[2*i + 0] = str;
			res[2*i + 1] = str;
		}
		
		
		for (int i = 0; i < 2*h; i++) {
			System.out.println(res[i]);
		}
		
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
using namespace std;
//const int N = 2e5 + 5;
typedef long long ll;
const ll inf=1e15;
#define pb push_back
const int INF=(0x3f3f3f3f);
const int N = 10000000;
int lp[N+1];
vector<int> pr;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);
  
  
for (int i=2; i<=N; ++i) {
	if (lp[i] == 0) {
		lp[i] = i;
		pr.push_back (i);
	}
	for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
		lp[i * pr[j]] = pr[j];
}
 ll x;
 cin>>x;
 for(int i=0;i<pr.size();i++){
  if(pr[i]>=x){
    cout<<pr[i]<<'\n';
    return 0;
  }
 }
}

Measured memory_bytes: 45424