akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int n,m,p,x,i,go,ans[100],t[100];
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&t[i]);
		go+=t[i];
	}
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d%d",&p,&x);
		ans[i]=go-t[p]+x;
	}
	for(i=0;i<m;i++){
		printf("%d\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 128
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');
let input = '';
process.stdin.on('data', function(chunk) {input += chunk;});
process.stdin.on('end', function() {main(input.split(/\r?\n/));});

function partition(A,p,r) {
	let x = A[r];
	let i = p - 1;
	let tmp;
	for (let j = p; j < r; j++) {
		if (A[j] <= x) {
			i++;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	i++;
	tmp = A[i];
	A[i] = A[r];
	A[r] = tmp;

	return i;
}

function main(lines){
	let n = Number(lines[0]);
	let A = lines[1].split(" ").map(Number);
	let target = partition(A,0,n-1);

	for (let i = 0; i < n; i++) {
		if (i === target) {
			process.stdout.write(`[${A[i]}]`);
		} else {
			process.stdout.write(String(A[i]));
		}
		if (i + 1 < n) process.stdout.write(" ");
	}
	console.log();
}



Measured memory_bytes: 80336
#include <bits/stdc++.h>
using namespace std;
string s;
long long sums,sumt;
int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i] == 'S') sums++;
        if((sums)&&(s[i]=='T'))
        {
            sums--;
            sumt+=2;
        }
    }
    cout<<s.size()-sumt<<"\n";
}

Measured memory_bytes: 640
#define $ for(i=0;i<n;i++)for(j=0;j<n;j++)
#define _(a)$ for(b[i][j]=l=0;l<n;)b[i][j]=(b[i][j]+a[i][l]*dp[l++][j])%m;$ a[i][j]=b[i][j];
long m=1e9+7,dp[50][50],a[50][50],b[50][50],k,s;i,j,l;main(n){scanf("%d%ld",&n,&k);$ a[i][i]=1;$ scanf("%d",dp[i]+j);for(;k;k/=2){if(k&1){_(a)}_(dp)}$ s+=a[i][j];printf("%d",s%m);}

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

typedef long long LL;
LL N, M, A[MAXN], S[MAXN], t, P, sum, L[MAXN];
bool can(LL x) {
  sum = 0, t = 0, P = 1;
  memset(L,-1,sizeof(L));
  for (LL i=N;i>0;--i) {
    while (P <= N && A[i] + A[P] < x) P++;
    if (P <= N) {
      L[i] = P;
      t += N-P+1ll;
      sum += S[P] + (N-P+1ll) * A[i];
    }
  }
  return t >= M;
}

int main () {
  scanf("%lld%lld",&N,&M);
  for (LL i=1;i<=N;++i) scanf("%lld",&A[i]);
  sort(A+1,A+N+1);
  for (LL i=N;i>0;--i) S[i] = A[i] + S[i+1];
  LL lo = 0, hi = 2ll * A[N];
  while (hi > lo) {
    LL mid = (hi + lo + 1ll) / 2;
    if (can(mid)) lo = mid;
    else hi = mid-1ll;
  }
  assert(can(lo));
  printf("%lld\n", sum - (t-M) * lo);
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<tuple<ll,ll>> vtl;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define be(x) (x).begin(),(x).end()
int n,ans;
string s;
void solve(){
    ll n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    ll tmp=1;
    ll ans=0;
    rep(i,n){
      if(a[i]==tmp)tmp++;
      else ans++;
    }
    if(tmp==1&&n==1)cout<<0<<endl;
    else if(tmp==1)cout<<-1<<endl;
    else cout<<ans<<endl;
}

int main(){
    cout<<std::fixed<<std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int n = s.size();
	vi  r;
	REP(i, n - 1) {
		if (s[i] == 'R' && s[i + 1] == 'L')r.push_back(i);
	}
	vi ans(n);
	REP(i, n) {
		if (s[i] == 'R') {
			int c = lower_bound(ALL(r), i) - r.begin();
			if ((r[c] - i) % 2 == 0) {
				ans[r[c]]++;
			}
			else {
				ans[r[c] + 1]++;
			}
		}
		else {
			int c = upper_bound(ALL(r), i) - r.begin();
			c--;
			if ((i - r[c]) % 2 == 0) {
				ans[r[c]]++;
			}
			else {
				ans[r[c]+1]++;
			}
		}
	}
	REP(i, n) {
		cout << ans[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1232
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B;

  cin >> A >> B;

  if (A <= 8 && B <= 8)
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n;
    cin >> n;
    int a[n];
    rep(i, n) { cin >> a[i]; }

    int b[n];
    rep(i, n) { b[a[i] - 1] = i + 1; }

    rep(i, n) { cout << b[i] << " "; }
    cout << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 1536
/* while(!success_achieved())
      work_hard(); 

   code by:aman_ayush
  */
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int MOD = 1e9+7;
const int MX = 2e5+5;
const ll inf =0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abs(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
    int n;
    cin>>n;
    int a[n+1],b[n];
    for(int i=1;i<n;i++)
     {
         cin>>b[i];
         if(i==1)
          a[i]=b[i];
         else
          a[i]=min(b[i],b[i-1]);
     }
     a[n]=b[n-1];
     int sum=0;
     for(int i=1;i<=n;i++)
      sum+=a[i];
      cout<<sum<<"\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;cin>>N;
    vector<int>b(N),ans;
    REP(i,N) cin>>b[i];
    while(!b.empty()){
        int best=-1;
        REP(i,b.size()){
            if(b[i]==i+1) best=i;
        }
        if(best==-1){
            cout<<-1<<endl;
            return 0;
        }
        ans.push_back(best+1);
        b.erase(b.begin()+best);
    }
    reverse(ans.begin(),ans.end());
    for(int v:ans) cout<<v<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,q;
  int i;
  scanf("%d%d",&n,&q);
  int count[120000]={};
  char s[n+100];
  scanf("%s",s);
  int l[q+100];
  int r[q+100];
  for(i=0;i<q;i++){
    scanf("%d%d",&l[i],&r[i]);
  }


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

    if(s[i-1]=='A'&&s[i]=='C'){
      count[i]++;
      count[i+1]=count[i];
    }else{
      count[i+1]=count[i];
    }
    }




  for(i=0;i<q;i++){

    printf("%d\n",count[r[i]-1]-count[l[i]-1]);

  }





  return 0;
}


Measured memory_bytes: 2048
#include<stdio.h>
int main()
{
   int N,K,n1,n2,ptB,flg1,flg2;
   char s[60];
   flg1=0;
   flg2 =0;
    //char s[101];
    // 整数の入力
    scanf("%d", &N);
    n1 = N/100;
    n2= N-n1*100;

    if(n1<=12&&n1>=1)
    {
        flg1=1;
    }
    if(n2<=12&&n2>=1)
    {
        flg2=1;
    }
    
    if(flg1==0)
    {
        if(flg2==1)
        {
            printf("%s\n","YYMM");
            return 0;
        }else
        {
            printf("%s\n","NA");
            return 0;
        }
    }else
    {
        if(flg2==1)
        {
            printf("%s\n","AMBIGUOUS");
            return 0;
        }else
        {
            printf("%s\n","MMYY");
            return 0;
        }
        
    }
    
    // 出力
    //printf("%d %s\n",a+b+c,s);
   return 0;
}


Measured memory_bytes: 128
package main

import "fmt"

func main(){
	var a[1000]int 
	var b[1000]int 
	var c[1000]int
	var N, M int

	fmt.Scan(&N, &M)
	
	for i := 0 ; i < M ; i++{
		fmt.Scan(&a[i], &b[i])	
	}

	for i := 0 ; i < M ; i++{
		c[a[i]]++
		c[b[i]]++
	}

	for i := 1 ; i <= N ; i++ {
		fmt.Println(c[i])
	}
}

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

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


int main(void) {
    int n;
    while (cin >> n) {
        if (n == 0) {
            break; 
        }
        int times = 0;
        bool status = 0;
        bool left = 0;
        bool right = 0;
        for (int i = 0; i < n; i++) {
            string act;
            cin >> act;
            if (act == "lu") {
                left = 1; 
            } else if (act == "ru") {
                right = 1; 
            } else if (act == "ld") {
                left = 0; 
            } else if (act == "rd") {
                right = 0; 
            }
            if (left == 1 && right == 1 && status == 0) {
                times++; 
                status = 1;
            } else if (left == 0 && right == 0 && status == 1) {
                times++; 
                status = 0;
            }
        }
        cout << times << endl;
    }
    return 0;
}

Measured memory_bytes: 3136
import numpy as np
import sys

N, Q = map(int, input().split(" "))
s = [np.nan] + list(input()) + [np.nan]
td = [input().split(" ") for _ in range(Q)]

l = 0
r = N+1

for i, j in td[::-1]:
    if s[l+1] == i and j == "L":
        l += 1
    elif s[l] == i and j == "R":
        l -= 1
    if s[r-1] == i and j == "R":
        r -= 1
    elif s[r] == i and j =="L":
        r += 1
ln = max(0, l)
rn = max(0, N+1-r)
print(N-ln-rn)

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

int main() {
    ll n,d,x,y;
    cin>>n>>d;
    ll cnt=0;
    rep(i,n){
        cin>>x>>y;
        if (x*x+y*y<=d*d) cnt++;
    }
    cout<<cnt<<"\n";
    return 0;
}



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

int n, a, b;
template <class T>
void readVector(int n, vector<T> &v){
    for(int i=0; i<n; ++i){
        T t;
        cin >> t;
        v.push_back(t);
    }
}
vector<long long> h;

int binarysearch(long long l, long long r){
//	cout << l << " " << r << "\n";
	if(r == l+1) return r;
	long long m = l + (r - l) / 2;
	long long t = m;
	bool f = true;
	for(int i=0; i<n; ++i){
		if(h[i] - t * b <= 0) break;
		m -= (h[i] - t * b + a - b - 1) / (a - b);
		if(m < 0){
			f = false;
			break;
		}
	}
//	cout << l << " " << r << " " << t << " " << m << "\n";
	if(f) return binarysearch(l, t);
	else return binarysearch(t, r);
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> a >> b;
	readVector(n, h);
	long long sum = 0;
	for(int i=0; i<n; ++i)
		sum += h[i];
	sort(h.begin(), h.end(), [](int x, int y){return x>y;});
	cout << binarysearch(0ll, (sum + b - 1) / b + 1) << "\n";
}

Measured memory_bytes: 1400
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] iroha = scan.nextLine().split("\\s");
        int one  = Integer.valueOf(iroha[0]);
        int two = Integer.valueOf(iroha[1]);
        int three = Integer.valueOf(iroha[2]);
        if(one + two + three == 17){
            if(one == 7 || one == 5){
                if(two == 5 || two == 7){
                    System.out.println("YES");
                }else{
                    System.out.println("NO");
                }
            }else{
                System.out.println("NO");
            }
        }else{
            System.out.println("NO");
        }
    }
}

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

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DLOG(...)
#endif

void debug(auto f) {
#if DEBUG
  f();
#endif
}

ll mPrime = 1000*1000*1000 + 7;
ll n, x;
vector<ll> s;
vector<ll> facts;
vector<ll> invFacts;
vector<vector<ll>> tbl;

ll mAdd(ll x, ll y) {
  ll z = x + y;
  if (z < mPrime)  return z;
  else             return (z - mPrime);
}

ll mSub(ll x, ll y) {
  ll z = x - y;
  if (z >= 0)  return z;
  else         return (z + mPrime);
}

ll mMul(ll x, ll y) {
  return (x * y) % mPrime;
}

ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

ll mInv(ll x) {
  ll s, t;
  eGCD(x, mPrime, s, t);
  return s < 0 ? s + mPrime : s;
}

ll countA(ll r, ll len);

// for all i < len.  r >= s[i]
ll countB(ll r, ll len) {
  DLOG("countB(%lld, %lld)\n", r, len);
  if (len == 0)  return r;
  ll retval = 0;
  for (ll i = 0; i < len; i++) {
    retval = mAdd(retval, countA(r % s.at(i), len-1));
  }
  return retval;
}

// general case
ll countA(ll r, ll len) {
  DLOG("countA(%lld, %lld)\n", r, len);
  if (len == 0)  return r;
  ll val = tbl.at(len).at(r);
  if (val >= 0)  return val;
  auto it = upper_bound(s.begin(), s.end(), r);
  ll len1 = distance(s.begin(), it);
  ll k = countB(r, len1);
  val = mMul(k, mMul(facts.at(len), invFacts.at(len1)));
  tbl.at(len).at(r) = val;
  return val;
}


int main() {
  cin >> n >> x;
  s.resize(n);
  for (ll i = 0; i < n; i++) {
    cin >> s.at(i);
  }
  facts.resize(n+1);
  invFacts.resize(n+1);
  facts.at(0) = invFacts.at(0) = 1;
  for (ll i = 1; i <= n; i++) {
    facts.at(i) = mMul(i, facts.at(i-1));
    invFacts.at(i) = mInv(facts.at(i));
  }

  tbl.resize(201, vector<ll>(100001, -1));

  sort(s.begin(), s.end());
  DLOG("start\n");
  ll ans = countA(x, n);
  cout << ans << endl;

  return 0;
}



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

int main(){
int a[10];

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

sort(a,a+10);

for(int i=9;i>=7;i--){
cout << a[i] <<endl;
}

return 0;
}

Measured memory_bytes: 3216
use std::io::stdin;

fn main() {
    let mut n = String::new();
    stdin().read_line(&mut n).unwrap();

    let mut ls = String::new();
    stdin().read_line(&mut ls).unwrap();
    let ls: Vec<isize> = ls.trim().split_whitespace().flat_map(str::parse).collect();
    let lngst = ls.clone().into_iter().max().unwrap();
    let mut v = -lngst;
    for l in ls.into_iter() {
        v += l;
        if v > lngst {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using ll = long long;
int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<ll> a(N);
    for (int i = 0; i < N; i++) { std::cin >> a[i]; }
    for (int i = 1; i < N; i++) { a[i] += a[i - 1]; }
    std::multiset<ll> A;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) { A.insert(a[j] - (i == 0 ? 0LL : a[i - 1])); }
    }
    ll ans = 0;
    for (int i = 40; i >= 0; i--) {
        int cnt = 0;
        for (const ll B : A) {
            if (B & (1LL << i)) { cnt++; }
        }
        if (cnt >= K) {
            ans += (1LL << i);
            std::multiset<ll> B;
            for (const ll e : A) {
                if (e & (1LL << i)) { B.insert(e); }
            }
            A = B;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 28928
#include <bits/stdc++.h>
#define int long long
#define dl long double
#define ff first
#define ss second
#define pb push_back
#define inf 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef pair<int,int> pii;


int32_t main(){
	fastio;
	int X,A;
	cin>>X>>A;
	if(X<A)cout<<0<<endl;
	else cout<<10<<endl;
}

Measured memory_bytes: 256
//
//AtCoder Beginner Contest 131
//D - Megalomania
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<pair<int, int>> ab(n);
    bool f = false;
    REP(i, n) {
        cin >> ab[i].second >> ab[i].first;
        if (ab[i].second>ab[i].first) f=true;
    }
    if (f){
        cout << "No" << endl;
        return 0;
    }
    sort(ALL(ab));

    string ans = "Yes";
    ll t=0;
    REP(i,n){
        t+=ab[i].second;
        if(t>ab[i].first) {
            ans = "No";
            break;
        }
    }

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


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

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; }

void solve_abc_a() {
	ll n, m;
	ll x, y;
	ll a, b, d;
	ll c;
	//char c;
	ll h, w;
	ll k;
	string s, t;
	//ll s, t;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> a >> b >> c >> d;

	l_ans = a * c;
	chmax(l_ans, a * d);
	chmax(l_ans, b * c);
	chmax(l_ans, b * d);

	cout << l_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
int main (){
    int n;
    scanf("%d",&n);
    long long a[n];
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    long long x;
    x=0;
    int y;
    y=0;
    if(a[0])y++;
    for(int i=0;i<n-1;i++){
        if(a[i+1]<=a[i])x+=a[i];
        if(a[i+1]>a[i]+1)y++;
    }
    if(y==0)printf("%lld\n",x+a[n-1]);
    if(y)printf("-1\n");
}

Measured memory_bytes: 1664
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<long long int> ans;
vector<int> a,b,c,d;
long long int max_score=0;
long long int n,m,q;

void gen_seq(int prev_ele,int len)
{
    if(len == n)
    {
        long long int temp=0;
        for(int i=0;i<q;i++)
        {
            if(ans[b[i]] - ans[a[i]] == c[i])
                temp += d[i];
        }
        max_score=max(max_score,temp);
        return ;
    }
    for(int i=prev_ele; i <= m ;i++)
    {
        ans.push_back(i);
        gen_seq(i,len+1);
        ans.pop_back();
    }
}
int main()
{
    cin>>n>>m>>q;
    a.resize(q);
    b.resize(q);
    c.resize(q);
    d.resize(q);
    for(int i=0;i<q;i++)
    {
        long long int p,q,r,s;
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;
        //ab.push_back(make_pair(a,b));
        //cd.push_back(make_pair(c,d));
    }
    gen_seq(1,0);
    cout<<max_score;
    return 0;
}


Measured memory_bytes: 3640
fn main() {
    let num = input();
    println!("{}", solve(num));
}

fn input() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.pop();
    buf
}

fn solve(num: String) -> String {
    for c in num.chars() {
        if c == '7' { return String::from("Yes"); }
    }
    String::from("No")
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 300010
ll n, a, b, c, d, e;

int main() {
	cin >> n >> a >> b >> c >> d >> e;
	ll ans = 0; a = min(a, min(b, min(c, d)));
	a = min(a, e);
	ans = (n - 1) / a + 5ll;
	cout << ans;
}

Measured memory_bytes: 256
def add_or_subtract(numbers, n)
  if numbers.length == 1
    if numbers[0] == n
      return numbers[0].to_s
    else
      return false
    end
  end
    last = numbers[-1]
    candidate1 = add_or_subtract(numbers[0..(numbers.length - 2)], n - last)
    candidate2 = add_or_subtract(numbers[0..(numbers.length - 2)], n + last)
    if candidate1
      return candidate1 + "+#{last.to_s}"
    elsif candidate2
      return candidate2 + "-#{last.to_s}"
    else
      return false
    end
end

numbers = gets.chomp.split("").map(&:to_i)
puts add_or_subtract(numbers, 7) + "=7"


Measured memory_bytes: 1788
#include <iostream>
#include <cmath>
using namespace std;
int n, a[2000010], ans=2100000000;
long long aa = 0, bb = 0, s;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        aa += a[i];
    }
    for (int i = 1; i < n; i++)
    {
        aa -= a[i];
        bb += a[i];
        s = abs(aa - bb);
        if (s < ans)ans = s;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){

	int N,score[100],common,index;
	char cards[101];

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

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

		common = 0;

		scanf("%s",cards);

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

			index = i%N;

			switch(cards[i]){
			case 'M':
				score[index]++;
				break;
			case 'S':
				common += score[index]+1;
				score[index] = 0;
				break;
			case 'L':
				score[index] += common + 1;
				common = 0;
				break;
			}
		}

		for(int i = 1; i <= N-1; i++){
			for(int k = N-1; k >= i; k--){
				if(score[k] < score[k-1])swap(score[k],score[k-1]);
			}
		}

		for(int i = 0; i < N; i++)printf("%d ",score[i]);
		printf("%d\n",common);
	}

	return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main() {
  int n; cin>>n;
  deque<ll> deq;
  
  rep(i,n){
    ll a; cin>>a;
    if(i%2==0) deq.push_back(a);
    else deq.push_front(a);
  }
  
  if(n%2==0){
    rep(i,n){
      cout<<deq.front()<<" ";
      deq.pop_front();
    }
  }
  else{
    rep(i,n){
      cout<<deq.back()<<" ";
      deq.pop_back();
    }
  }
  return 0;
  
}


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

int main() {
	long long A, B, K;
	cin >> A >> B >> K;

	if (A < K) {
		K -= A;
		A = 0;
		if (B < K) {
			B = 0;
		}
		else {
			B -= K;
		}
	}
	else {
		A -= K;
	}

	cout << A << " " << B << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main() {
  ll n;
  double a, sum;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    sum += (double)(1 / a);
  }

  printf("%.7lf", (double)(1 / sum));


  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    sort(l.begin(), l.end(), greater<int>());

    int sum = 0;
    for (int i = 0; i < k; ++i)
        sum += l[i];
    cout << sum << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define forx(i,j,n) for(int i=j;i<n;i++)
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define vvi vector<vi>
#define vvl vector<vl>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false)
#define testcase int t; cin>>t
#define inputi(xx) scanf("%d",&xx)
#define inputll(xx) scanf("%lld",&xx)
#define printi(xx) printf("%d",xx)
#define printll(xx) printf("%d",xx)


int main() {
    string str;
    int flg=1;
    cin>>str;
    forx(i,1,str.size()) if(str[i]==str[i-1]) flg=0;
    if(flg==0) cout<<"Bad";
    else cout<<"Good";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());  put as first line of main
int dp[100002];
ll a[105];
ll n;
int f(ll k)
{   //cout<<k<<"\n";
    if(k<a[0])
        return 0;
    if(dp[k]!=(-1))
        return dp[k];
    int p=1;
    ll i;
    for(i=0;i<n;i++)
    	{	if(k>=a[i])
        		{p&=f(k-a[i]);
        		}
    }
    if(!p)
        return dp[k]=1;
    else
        return dp[k]=0;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    ll k;
    cin>>n>>k;
    ll i;
    for(i=0;i<n;i++)
        cin>>a[i];
    dp[a[0]]=1;
    if(f(k))
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}

Measured memory_bytes: 3840
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[]A = new long[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		sc.close();
		Map<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i = 0; i < N; i++) {
			map.merge(A[i], 1, (v1, v2) -> v1 + v2);
		}
		long h = 0;
		long w = 0;
		for(long k : map.keySet()) {
			if(map.get(k) >= 4) {
				h = Math.max(h, k);
				w = Math.max(w, k);
			}else if(map.get(k) >= 2) {
				if(h > w) {
					w = Math.max(w, k);
				}else {
					h = Math.max(h, k);
				}
			}
		}
		System.out.println(h * w);
	}
}

Measured memory_bytes: 65660
fun main(args: Array<String>) {
    val (x, y, a, b, c) = readLine()!!.split(' ').map(String::toLong)
    val pList = readLine()!!.split(' ').map(String::toLong).sortedDescending()
    val qList = readLine()!!.split(' ').map(String::toLong).sortedDescending()
    val rList = readLine()!!.split(' ').map(String::toLong).sortedDescending()

    var eatList = pList.take(x.toInt()) + qList.take(y.toInt())
    eatList = eatList.sorted()
    var sum = eatList.sum()
    for (i in 0 until c.toInt()) {
        if (eatList[i] < rList[i]) {
            sum -= eatList[i]
            sum += rList[i]
        } else {
            break
        }
    }
    println(sum)
}


Measured memory_bytes: 98740
#include <stdio.h>

int main()
{
  int N,D,X;
  scanf("%d%d%d",&N,&D,&X);
  int A[N];
  int i,k;
  int sum;
  sum = X;
  i = 0;
  while (i < N)
  {
    scanf("%d",&A[i]);
    k = 0;
    while (1 + k*A[i] <= D)
    {
      //printf("sum:%d A[i]:%d\n",sum,A[i]);
      sum++;
      k++;
    }
    i++;
  }
  printf("%d",sum);
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int A, B; cin >> A >> B;
	int ans = 0;

	for (int i = A;i <= B;i++){
		string s = to_string(i);
		bool flag = true;
		for (int j = 0;j < s.size();j++){
			if(s[j] != s[s.size()-j-1]) flag = false;
		}
		if(flag) ans++;
	}

	cout << ans << endl;

	return 0;

}


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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long A, long long B) {
  if( A >= 13 ){
    cout << B << endl;
  }else if( A >= 6 ){
    cout << B / 2 << endl;
  }else{
    cout << 0 << endl;
  }
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


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

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
/*-------------------------------------------------*/
template <typename Monoid>
vector<Monoid> fzt(const vector<Monoid> &a, bool superset, const Monoid UNITY = 0, const function<Monoid(Monoid, Monoid)> fn = [](Monoid lhs, Monoid rhs) { return lhs + rhs; }) {
  int n = 1 << (32 - __builtin_clz(static_cast<int>(a.size()) - 1));
  vector<Monoid> res(a);
  while (res.size() < n) res.emplace_back(UNITY);
  for (int i = 1; i < n; i <<= 1) REP(j, n) {
    if ((j & i) == 0) {
      int bit = j | i;
      if (superset) {
        res[j] = fn(res[j], res[bit]);
      } else {
        res[bit] = fn(res[bit], res[j]);
      }
    }
  }
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  using P = pair<int, int>;
  vector<P> a(1 << n, {0, 0}); REP(i, 1 << n) cin >> a[i].first;
  function<P(P, P)> fn = [](P lhs, P rhs) {
    vector<int> tmp{lhs.first, lhs.second, rhs.first, rhs.second};
    sort(ALL(tmp), greater<int>());
    return make_pair(tmp[0], tmp[1]);
  };
  vector<P> f = fzt(a, false, {0, 0}, fn);
  vector<int> ans(1 << n);
  REP(i, 1 << n) ans[i] = f[i].first + f[i].second;
  FOR(i, 1, 1 << n) {
    ans[i] = max(ans[i], ans[i - 1]);
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 8192
n = int(input())
print('{}: '.format(n), end='')
A = []
i = 2
while n > 1:
    if n % i == 0:
        A.append(i)
        n //= i
    elif i**2 > n:
        A.append(n)
        break
    else:
        i += 1

print(*A)



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

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

int main(){

    int N,K;
    cin>>N>>K;
    LL A[N];
    REP(i,N)cin>>A[i];

    LL maxgcd=A[0];
    LL maxA =0;
    REP(i,N){
        maxgcd=gcd(maxgcd,A[i]);
        maxA=max(maxA,A[i]);
    }

    if(maxA-K<0){
        cout<<"IMPOSSIBLE"<<endl;
    }else{
        if((maxA-K)%maxgcd==0){
            cout<<"POSSIBLE"<<endl;
        }else{
            cout<<"IMPOSSIBLE"<<endl;
        }
    }

    return 0;
}

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

int main()
{
    int S, h, m, s;
    cin >> S;

    s = S % 60;
    S /= 60;
    m = S % 60;
    S /= 60;
    h = S;

    cout << h << ":" << m << ":" << s << endl;

    return 0;
}

Measured memory_bytes: 1164
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>str;
    if(str[0]==str[1]||str[2]==str[1]||str[2]==str[3]) cout<<"Bad";
    else cout<<"Good";
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define endl "\n"
#define ll long long
#define pb emplace_back
#define fi first
#define se second
#define pll pair<ll, ll>
#define ull unsigned long long
#define ld long double

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repa(i,a,b) for(ll i=(a);i<=(b);i++)
#define all(x) (x).begin(), (x).end()
#define ordered_set tree<int , null_type, less<int> , rb_tree_tag, tree_order_statistics_node_update>
/*
 Ordered set docs:
 order_of_key (k) : Number of items strictly smaller than k .
 find_by_order(k) : K-th element in a set (counting from zero).
*/
#define blc boost::lexical_cast<long long>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
const int MOD = 1e9+7;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}

ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}

ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}

ll powerLL(ll x, ll n, ll mod) 
{ 
    ll result = 1; 
    while (n) { if (n & 1) result = (result%mod * x%mod) % mod; n = n / 2; x = (x%mod * x%mod) % mod; } return result; 
} 

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

void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll res = 0;
    rep(i,n)
		cin>>a[i];
	ll maxi = a[0];
	rep(i,n)
	{
		if(a[i]>maxi)
			maxi = a[i];
		else
			res+=(maxi-a[i]);
	}
	cout<<res<<endl;
}
int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0; 
}

Measured memory_bytes: 4764
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] abcd = scanner.nextLine().split(" ", 4);
        int a = Integer.parseInt(abcd[0]);
        int b = Integer.parseInt(abcd[1]);
        int c = Integer.parseInt(abcd[2]);
        int d = Integer.parseInt(abcd[3]);

        int left = a + b;
        int right = c + d;
        if (left == right) {
            System.out.println("Balanced");
        } else if (left > right) {
            System.out.println("Left");
        } else {
            System.out.println("Right");
        }
    }
}


Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
ll a,b,c,d,e,f,g,ans=0;
const ll INF=99999999999999999;
int main(){
    ll n;
    vector<ll> q;
  cin>>n;
  q.push_back(0);
    while(n>0){
        q.push_back(n%10);
        n=n/10;
    }

    sort(q.begin(),q.end());
  reverse(q.begin(),q.end());

    if(q[1]==0&&q[0]==1){
        cout<<10<<endl;
    }
    else{
        rep(i,q.size()){
            ans+=q[i];
        }
        cout<<ans<<endl;
    }
    
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        String t = sc.next();

        for(int i = 0;i<n;i++){
            System.out.print(s.charAt(i)+""+t.charAt(i));
        }
        
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

signed main(){
    int n, m;
    cin >> n >> m;
    int max_l = 1, min_r = n;
    rep(i,m){
        int l, r;
        cin >> l >> r;
        max_l = max(max_l, l);
        min_r = min(min_r, r);
    }
    cout << max(0, min_r - max_l + 1) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] input = sc.intarr;

            int a = input[0];
            int b = input[1];
            int t = input[2];
            int count = 0;

            for(int i=1; i*a <= t; i++)
            {
                count += b;
            }

            wr.wri(count);
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF = 1e18;
const int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);
void coutY();
void coutN();
LL ave(LL, LL);
bool isMultiOf(LL, LL);

int main() {
	string s, t; cin >> s >> t;
	LL a, b; cin >> a>>b;
	string u; cin >> u;
	if (s == u) {
		cout << a - 1 << " " << b;
	}
	else {
		cout << a << " " << b - 1;
	}

}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}
void coutY() {
	cout << "Yes" << endl;
	return;
}
void coutN() {
	cout << "No" << endl;
	return;
}
LL ave(LL a, LL b) {
	return (a + b) / 2;
}
bool isMultiOf(LL a, LL b) {
	return a % b == 0;
}


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

int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S == U){
    cout << A - 1 << " " << B << endl;
  }
  else{
    cout << A << " " << B - 1 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int mat[3001][3001];

void seq(int n, int m, string str1, string str2) {
    if(n != 0 && m!= 0) {
        if(str1[n-1] == str2[m-1]) {
            seq(n-1, m-1, str1, str2);
            cout<< str1[n-1];
        }
        else if(mat[n-1][m] > mat[n][m-1]) 
            seq(n-1, m, str1, str2);
        else 
            seq(n, m-1, str1, str2);
    }
}

void lcs(string str1, string str2) {
    int n = str1.size();
    int m = str2.size();
    for(int i = 0; i<= n; i++) {
        for(int j=0; j<= m; j++) {
            if(i == 0 || j == 0) 
                mat[i][j] = 0;
            else if(str1[i-1] == str2[j-1])
                mat[i][j] = mat[i-1][j-1]+1;
            else
                mat[i][j] = max(mat[i-1][j], mat[i][j-1]);
        }
    }
    seq(n, m, str1, str2);
    cout<< endl;
   // return mat[n][m];
}

int main(){
    string str1, str2;
    cin>> str1>> str2;
    lcs(str1, str2);
}

Measured memory_bytes: 65664
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int value = sc.nextInt();
            if (value % 2 == 0) {
                if (value % 3 == 0 || value % 5 == 0) {
                    continue;
                }
                System.out.println("DENIED");
                return;
            }
        }

        System.out.println("APPROVED");
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007 
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN


ll po(ll x,ll n){
    if(n==0) return 1;
    else if(n%2 == 0) return po((x*x)%MOD,n/2);
    else return (x*po((x*x)%MOD,(n-1)/2))%MOD;
}



void init(){
    
}

void solve( ll  tst ){
    ll n,k;
    cin>>n>>k;
    ll off = po(10, 100);
    vector<pair<ll,ll>> p;
    ll pre[n+1] = {0};
    for( ll i=1;i<=n;i++ ) pre[i] = pre[i-1] + i;
    ll suf[n+1] = {0};
    suf[n] = n;
    for( ll i=n-1;i>=0;i-- ) suf[i] = suf[i+1] + i;
    ll ans = 0;
    for( ;k<=n+1;k++ ){
        ll rng = suf[n-k+1] - pre[k-1] + 1;
        ans += rng;
        
        /*if( rng >= MOD ){
            cout<<MOD<<endl;
            return;
        }
        ll st = off+pre[k-1];
        ll en = off+suf[n-k+1];
        st %= MOD;
        en %= MOD;
        if( st > en ){
            p.pb( mp(st,MOD-1) );
            p.pb( mp( 0LL, en) );
        }
        else{
            p.pb( mp(st, en) );
        }*/
    }
    cout<<ans%MOD<<endl;
    return;
    /*sort( p.begin(), p.end() );
    ll ans = 0;
    ll last = p[0].ff;
    for( ll i=0;i<p.size();i++ ){
        cout<<p[i].ff<<" "<<p[i].ss<<endl;
        if( last < p[i].ff ){
            ans += (p[i].ss - p[i].ff + 1);
        }
        else{
            ans += ( p[i].ss - last );
        }
        last = p[i].ss;
    }
    cout<<ans<<endl;
    return;*/
}

int main(){
    FAST;
    init();
    //cout<<"init"<<endl;
    ll t = 1;
    //cin>>t;
    for (ll i=1;i<=t;i++ ) solve(i);
    return 0;
} 

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

#define ff first
#define ss second
#define maxn 2000006
#define pb push_back
#define ll long long
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<=n;i++)

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

using namespace std;

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
	// Base Case
	if (a == 0)
	{
		*x = 0, *y = 1;
		return b;
	}

	ll x1, y1; // To store results of recursive call
	ll gcd = gcdExtended(b % a, a, &x1, &y1);

	// Update x and y using results of recursive
	// call
	*x = y1 - (b / a) * x1;
	*y = x1;

	return gcd;
}

ll modInverse(ll b, ll m)
{
	ll x, y; // used in extended GCD algorithm
	ll g = gcdExtended(b, m, &x, &y);

	// Return -1 if b and m are not co-prime
	if (g != 1)
		return -1;

	// m is added to handle negative x
	return (x % m + m) % m;
}

// Function to compute a/b under modlo m
ll modDivide(ll a, ll b, ll m)
{
	a = a % m;
	ll inv = modInverse(b, m);
	return (inv * a) % m;
}

// C function for extended Euclidean Algorithm (used to
// find modular inverse.

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

	ll n, k; cin >> n >> k;

	ll a[n];
	f(i, 0, n - 1)	cin >> a[i];

	ll si = 0;
	f(i, 0, n - 1) {
		ll cnt = 0;
		f(j, i + 1, n - 1) {
			if (a[j] < a[i]) cnt++;
		}

		si += cnt;
	}
	ll ci = 0;
	f(i, 0, n - 1) {
		ll cnt = 0;

		f(j, 0, n - 1) {
			if (a[j] < a[i]) cnt++;
		}

		ci += cnt;
	}

	ll q1 = ((k % MOD) * (si % MOD)) % MOD;

	ll q2 = (k * (k - 1) / 2) % MOD;
	ll q3 = ci % MOD;

	ll ans = (q1 % MOD + ((q2 % MOD * q3 % MOD) % MOD) % MOD) % MOD;
	cout << ans;

	return 0;
}

Measured memory_bytes: 256