akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main() {
	int sx,sy,tx,ty,i;
    cin >> sx >> sy >> tx >> ty;
    for(i=0;i<tx-sx;i++){
        cout << "R";
    }
    for(i=0;i<ty-sy;i++){
        cout << "U";
    }
    for(i=0;i<tx-sx;i++){
        cout << "L";
    }
    for(i=0;i<(ty-sy)+1;i++){
        cout << "D";
    }
    for(i=0;i<(tx-sx)+1;i++){
        cout << "R";
    }
    for(i=0;i<(ty-sy)+1;i++){
        cout << "U";
    }
    cout << "LU";
    for(i=0;i<(tx-sx)+1;i++){
        cout << "L";
    }
    for(i=0;i<(ty-sy)+1;i++){
        cout << "D";
    }
    cout << "R" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL -1
#define Max 100005

struct Node { int p , l, r;};
struct Node T[Max];

int n,D[Max];

void print(int u){
  int i,a;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0,a=T[u].l;a!=NIL;i++,a=T[a].r){
    if(i) printf(", ");
    printf("%d",a);
  }

  printf("]\n");

}

void rec(int u, int p){
  D[u]=p;
  if(T[u].r!=NIL) rec(T[u].r,p);
  if(T[u].l!=NIL) rec(T[u].l,p+1);
}


int main(){

  int d,v,c,l,r,n,i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].p=T[i].l=T[i].r=NIL;
  }

  for(i=0;i<n;i++){
     scanf("%d",&v);
     scanf("%d",&d);

     for(j=0;j<d;j++){
       scanf("%d",&c);

       if(j==0)T[v].l=c;
       else T[l].r=c;
       l=c;
       T[c].p=v;
     }
  }

  for(i=0;i<n;i++){
    if(T[i].p==NIL)r=i;
  }

  rec(r,0);
  for(i=0;i<n;i++)print(i);

  return 0;
}


Measured memory_bytes: 6404
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

using ll = long long;

int main() {
    int n;
    ll a;
    cin >> n >> a;
    
    vector<ll> x(n);
    
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    
    ll ans = 1LL << 60;
    
    reverse(x.begin(), x.end());
    
    x.resize(2 * n);
    
    vector<ll> c(2 * n + 1);
    
    for (int i = 0; i < 2 * n; i++) {
        c[i + 1] = c[i] + x[i];   
    }
    
    for (int i = 1; i <= n; i++) {
        ll s = 0;
        
        int ind = 0;
        for (int j = 0; j < (n + i - 1) / i; j++) {
            ll t = c[ind + i] - c[ind];
            ind += i;
            
            if (j == 0) {
                s += 5 * t;
            } else {
                s += (2 * j + 3) * t;
            }
            
            if (s > ans) {
                break;
            }
        }
        
        ans = min(ans, s + a * i);
        
    }
    
    cout << ans + a * n << endl;
}


Measured memory_bytes: 6500
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
char s[N];

int main() {
  scanf("%s", s);
  int n = strlen(s);
  vector<ii> a;
  for (int i = 0, j; i < n; i = j) {
    for (j = i + 1; j < n && s[j] == s[i]; ++j);
    a.push_back({i, j});
  }
  vector<int> ret(n);
  for (int i = 0; i < a.size(); i += 2) {
    int X = a[i].second - a[i].first;
    int Y = a[i + 1].second - a[i + 1].first;
    int u = a[i].second - 1;
    if ((X + Y) % 2 == 0) {
      ret[u] = ret[u + 1] = (X + Y) / 2;
    } else {
      ret[u] = (X + Y) / 2 + 1;
      ret[u + 1] = ret[u] - 1;
      if (X % 2 == 0) swap(ret[u], ret[u + 1]);
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d%c", ret[i], " \n"[i + 1 == n]);
  }
  return 0;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;



int main() {

    string S;
    cin >> S;
    if(S[2] == S[3] && S[4] == S[5] ){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{


  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;
    String[]       in_str_split;

    int in_A;
    int in_B;
    int in_C;


    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));

      /*----------------
       * 引数
       *----------------*/
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");

      in_A = Integer.parseInt(in_str_split[0]);
      in_B = Integer.parseInt(in_str_split[1]);
      in_C = Integer.parseInt(in_str_split[2]);


      /*----------------
       * 計算
       *----------------*/
      if( in_C <= (in_A + in_B) )
      {
        System.out.println("Yes");
      }
      else
      {
        System.out.println("No");
      }

    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }

}


Measured memory_bytes: 22996
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

def cal(x)
    ret=0
    while x!=0 and (x%2).zero?
      ret+=1
      x/=2 
    end
    return ret
end
N=gets.to_i
ans=1
max=0
(N+1).times do|i|
  if i.even?
    val=cal(i) 
    if max<val
        ans=i
        max=val
    end
  end
end
puts ans

Measured memory_bytes: 3836
yaku = ["one pair", "full house", "three card", "two pair", "four card"]
while card = gets
  card = card.split(",").map(&:to_i).sort
  a = 1
  b = 1
  temp = 0
  card.each{|i|
    if i == temp
      a += 1
    elsif a != 1
      b = (b + b * a) + (5 - b) / 4 * (a - b - b * a)
      a = 1
    end
    temp = i
  }
  temp = card[0]
  if a + b == 2
    bool = true
    card[1..-1].each{|i|
      bool &= (temp + 1 == i)
      temp = i
    }
    if bool or card == [1,10,11,12,13]
      puts "straight"
    else
      puts "null"
    end
  else
    puts yaku[(a + b + a * b) % 5]
  end
end

Measured memory_bytes: 6108
// Problem : B - Go to Jail
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define mod 998244353
#define bug cout<<"HY"<<endl
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define numize(A) A.numize(unique(A.begin(), A.end()) - A.begin())
typedef pair<int,int> P;
int power(int a,int b)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return (power((a*a)%mod,b/2))%mod;
    return (a*(power((a*a)%mod,b/2))%mod)%mod;
}
int modInv(int n)
{
    return power(n, MOD-2);
}
int nCr(int n, int r, int p=MOD)
{
   if (r==0)
      return 1;
    int Fact[n+1];
    Fact[0] = 1;
    for (int i=1 ; i<=n; i++)
    {
        Fact[i] = (Fact[i-1]*i)%p;
    }
    return (((Fact[n]* modInv(Fact[r])) % MOD) *(modInv(Fact[n-r]) % MOD)) % MOD;
}
double PI=3.14159265359;
void solve()
{
	int n,i;
	cin>>n;
	int cnt=0;
	for(i=0;i<n;i++)
	{
		int a,b;
		cin>>a>>b;
		if(a==b)
			cnt++;
		else
			cnt=0;
		if(cnt>=3)
		{
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}
int32_t main()
{
    boost;
    int  t=1;
    // cin>>t;
    while(t--)
    {
    	solve();
    }
}


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

int main() {

	int a, b, c;

	cin >> a >> b >> c;

	int x = a + b, y = b + c, z = a + c;

	//if (a == A && b == B);

	if (x <= y && x <= z) { cout << x << endl; };

	if (y < x && y < z) { cout << y << endl; };

	if (z < x && z < y) { cout << z << endl; };
}

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;

void solve() {
	int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
	cin >> m >> n;
	int a[n];
	for (i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum > m) sum = m + 1;
	cout << m - sum;
	return ;
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// int t; cin >> t; while (t--)
	solve();
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;

int main(){
  int d;
  cin >> d;
  vector<int> c26(26);
  vector<vector<int>> si(d, vector<int>(26));
  for(int i=0; i<26; ++i) cin >> c26[i];
  for(int i=0; i<d; ++i) for(int j=0; j<26; ++j) cin >> si[i][j];
  
  vector<vector<int>> koho(d);
  for(int i=0; i<26; ++i){
    int hindo;
    if(c26[i] <=10) hindo = 50;
    else if(c26[i] <=30) hindo = 30;
    else if(c26[i] <=60) hindo = 15;
    else hindo = 7;
    
    int j = 0;
    while(j<d-1){
      int cnt = 0;
      int mxday = min(j+hindo, d-1);
      for(int k=mxday; k>j; --k){
        if(si[k][i] >= 15000){
          koho[k].push_back(i);
          ++cnt;
          for(int l=j+1; l<=k; ++l){
            si[l][i] += (l-j) *(l-j) *c26[i];
          }
          j = k;
          break;
        }
      }
      if(cnt == 0){
        for(int l=j+1; l<=mxday; ++l){
          si[l][i] += (l-j) *(l-j) *c26[i];
        }
        if(mxday != d-1) koho[mxday].push_back(i);
        j = mxday;
      }
    }
  }
  
  vector<int> ans(d);
  for(int i=0; i<d; ++i){
    vector<P> koho2(0);
    if(koho[i].size() == 0){
      for(int j=0; j<26; ++j){
        koho2.push_back(make_pair(si[i][j], j));
      }
    }else{
      for(int n: koho[i]){
        koho2.push_back(make_pair(si[i][n], n));
      }
    }
    sort(koho2.begin(),koho2.end());
    reverse(koho2.begin(),koho2.end());
    ans[i] = koho2[0].second;
  }
  for(int i=0; i<d; ++i){
    cout << ans[i]+1 << endl;
  }
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define ull unsigned long long
#define pi acos(-1)
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f;
const ll maxn = 1e7+5;
const ll mod = 1e9+7;
ll a[2010]={0,0,0,1,1};
int main(){
	int s;
	cin>>s;
	for(int i=4;i<=s;i++) a[i]=(a[i-1]%mod+a[i-3]%mod)%mod;
	cout<<a[s]<<'\n'; 
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll n,i,k,j;
	cin >> n >> k;
	ll h[n];
	fr(i,0,n)
		cin >> h[i];
	ll dp[n];
	fr(i,0,n)
		dp[i] = 1000000000000000;
	dp[0] = 0;
	fr(i,1,min(n,k+1))
		dp[i] = abs(h[i] - h[0]);
	fr(i,k+1,n)
	{
		if(i >= n)
			break;
		fr(j,1,k+1)
			dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
	}	 
	cout << dp[n-1];
}


Measured memory_bytes: 1792
#最大公約数(ユークリッドの互余法)
def euclid_gcd(a,b):
    while b:
        a, b = b, a % b
    return a

#最小公倍数(ユークリッドの互余法)
def euclid_lcm(a, b):
    return a * b // euclid_gcd(a, b)
    
A,B,C,D = map(int,input().split())

X = euclid_lcm(C,D)
A = A-1

Y = A//C + A//D - A//X
Z = B//C + B//D - B//X
 
print(B-Z - (A-Y))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    int tmp = 0;
    int r = 1;
    for(int l = 0; l < n ; l++){
        if(tmp == 0) tmp = a[l];
        if(l == r) r++;
        while(r < n){
            if((tmp & a[r]) == 0){
                tmp ^= a[r];
                r++;
            }
            else{
                ans += r - l;
                tmp ^= a[l];
                break;
            }
        }
        if(r == n){
            ans += r - l;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pii pair<int, int>
#define mp make_pair
const int maxn = 3e5 + 10;
struct Node{
	int num, y;
	bool operator < (const Node &A) const {
		return num == A.num ? y < A.y : num > A.num;
	}
};
int n, m, k;
int row[maxn], line[maxn];
vector<int> boom[maxn];
set<Node> s;

int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1, x, y; i <= k; ++i) {
		scanf("%d%d", &x, &y);
		++row[x]; ++line[y];
		boom[x].push_back(y);
	}
	int ans = 0;
	for (int i = 1; i <= m; ++i)
		s.insert((Node) { line[i], i });
	for (int i = 1, tmp; i <= n; ++i) {
		tmp = row[i];
		for (int y : boom[i]) {
			auto q = s.find((Node) { line[y], y });
			s.erase(q);
			s.insert((Node) { line[y] - 1, y });
		}
		tmp += s.begin()->num;
		for (int y : boom[i]) {
			auto q = s.find((Node) { line[y] - 1, y });
			s.erase(q);
			s.insert((Node) { line[y], y });
		}
		ans = max(ans, tmp);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 36588
n=int(input())
def defs(b):
	if b<=26:
		return chr(64+b)
	elif b%26==0:
		return defs(b//26-1)+chr(90)
	else:
		return defs(b//26)+chr(64+b%26)

a=defs(n).lower()
print(a)

Measured memory_bytes: 9192
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

 

int main() {
	int N; cin >> N;
	int base = 111;
	for (int i = 1; i <= 9; i++) {
		if (base*(i - 1) < N&&base*i >= N) { print(base*i); return 0; }
	}


	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    int n,k;

    private void solve() {
        try {
            n = sc.nextInt();
            k = sc.nextInt();

            double psum = 0;
            for (int i = 1; i <= n; i++) {
                if (i > k -1) { psum += 1; continue; }
                double p = 1 / Math.pow(2, Math.ceil(Math.log(k/(double)i)/Math.log(2)));
                psum += p;
            }

            System.out.println(String.format("%.20f", psum/n));


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

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


int main(){
    int i = 0, a, b, c;
    cin >> a >> b >> c;
    
    for (int x = a ; x <= b ; x++){
        
        if ( (c % x) == 0 ) i++;
        
        
    }
    
    cout << i <<endl;
    
    return 0;
    
}

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

int main() {
    int n;
    cin >> n;
    ll a[n + 1], b[n];
    rep(i, n + 1) cin >> a[i];
    rep(i, n) cin >> b[i];

    ll ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (b[i] >= a[i + 1]) {
            ans += a[i + 1];
            b[i] -= a[i + 1];
        } else {
            ans += b[i];
            b[i] = 0;
        }

        if (b[i] >= a[i]) {
            ans += a[i];
            a[i] = 0;
        } else {
            ans += max(0ll, b[i]);
            a[i] -= max(0ll, b[i]);
        }
    }

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


Measured memory_bytes: 1792
from collections import Counter

N = int(input())
S = Counter()
for _ in range(N):
    s = input()
    S[s] += 1

keys, values = zip(*S.most_common())

v_pre = values[0]
end_idx = None
for i in range(1, len(values)):
    if v_pre == values[i]:
        continue
    else:
        end_idx = i
        break

if end_idx is None:
    answer = keys
else:
    answer = keys[:end_idx]

answer = sorted(answer)
for a in answer:
    print(a)


Measured memory_bytes: 57960
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a%2 == 0 || b%2 == 0 || c%2==0){
        cout << "0" << endl;
    } else {
        ll ans = min(min(a*b,a*c),(b*c));
        cout << ans << endl;
    }
   
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SC second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}


int main()
{
  string s ;
  cin >> s ;
  int n = SZ(s) ;
  vector<char> vec(n) ;
  vector<char> vecvec(n) ;
  int cnt1=0 ;
  int cnt2=0 ;
  
  if(n%2==0){
    REP(i,n/2){
      vec.at(2*i)='0' ;
      vec.at(2*i+1)='1' ;
      vecvec.at(2*i) ='1' ;
      vecvec.at(2*i+1)='0' ;
    }
  }
  else{
    REP(i,n/2){
      vec.at(2*i)='0' ;
      vec.at(2*i+1)='1' ;
      vecvec.at(2*i) ='1' ;
      vecvec.at(2*i+1)='0' ;
    }
    vec.at(n-1) ='0' ;
    vecvec.at(n-1)='1' ;
  }
  
  REP(i,n){
    if(s.at(i)!=vec.at(i)){
      cnt1++ ;
    }
    if(s.at(i)!=vecvec.at(i)){
      cnt2++ ;
    }
  }
  
  cout << min(cnt1,cnt2) <<endl ;
     

  return 0 ;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;


int main(){
    // あとで消す
    //std::ifstream in("bin2.txt");
    //std::cin.rdbuf(in.rdbuf());

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

    if(a<b){
        for(size_t i=0;i<b;i++){
            printf("%d",a);
        }
        printf("\n");
    }else{
        for(size_t i=0;i<a;i++){
            printf("%d",b);
        }
        printf("\n");
    }
    return 0;
}


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

#define sci(a) scanf("%d", &a)
#define fto(i, a, b) for (int i = a; i <= b; ++i)
#define fdto(i, a, b) for (int i = a; i >= b; --i)
#define scii(a, b) scanf("%d %d", &a, &b)
#define ll long long
#define ff first
#define ss second
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define pii pair<int, ii>
#define maxN 100005
#define oo 1000000007
#define mp make_pair
#define pb push_back
#define bug(a) cout << #a << "= " << a << endl;
#define bug2(a, b) cout << #a << "= " << a << "; " << #b << "= " << b << endl
#define pri(a) printf("%d", a)
#define pril(a) printf("%d\n", a)

using namespace std;

ii a[maxN];
int f[1005][5005];

int main() {
//    #ifndef ONLINE_JUDGE
//    freopen("cf.inp", "r", stdin);
//    freopen("cf.out", "w", stdout);
//    #endif

    int n, m;
    scii(n, m);
    fto(i, 1, m) {
        int w, k;
        scii(w, k);
        int tmp = 0;
        fto(j, 1, k) {
            int x;
            sci(x);
            tmp |= (1 << (x-1));
        }
        a[i] = mp(w, tmp);
    }
    fto(i, 0, m) fto(j, 0, (1<<n)-1) f[i][j] = oo;
    f[0][0] = 0;
    fto(i, 1, m) {
        fto(j, 0, (1<<n)-1) {
            f[i][j] = min(f[i][j], f[i-1][j]);
            f[i][j|a[i].ss] = min(f[i-1][j]+a[i].ff, f[i][j|a[i].ss]);
//            bug2(i, k);
//            bug(j);
//            bug(f[i][k]);
        }
    }
    if(f[m][(1<<n)-1]==oo) pril(-1);
    else pril(f[m][(1<<n)-1]);
    return 0;
}


Measured memory_bytes: 19840
#include <iostream>

long f(long x)
{
	return x * x;
}

long integral(long x_begin, long x_end, long delta)
{
	long result = 0;
	for (long x = x_begin; x < x_end; x += delta) {
		result += f(x) * delta;
	}
	return result;
}

int main()
{
	int input;
	while (std::cin >> input) {
		std::cout << integral(0, 600, input) << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main() {
	int a, b, c;
	int ans;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	int max;
	
	max = a;
	if (max < b) max = b;
	if (max < c) max = c;

	printf("%d", a+b+c-max);

	
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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;}
template <class T> inline void dump(T &v){irep(i, v){cout<<(*i)<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 998244353;//1000000007;
constexpr ld EPS = 1e-11;



int main() {
    
    int ans=0;
    int n;

    cin>>n;
    string s;
    cin>>s;
    int r=n-1;
    for(int i=0;i<n&&i<r;i++){
        if(s[i]=='R')continue;
        while(r>=0&&s[r]=='W'){
            r--;
        }
        if(i<r){
            swap(s[i],s[r]);
            ans++;
        }
    }
    fin(ans);
}


Measured memory_bytes: 3752
#include <iostream>
#include <cmath>
#include <cstring>
const int maxn=1000010;
using namespace std;

char c[maxn];
int a[maxn];

int main(){
	cin>>c;
	int len=strlen(c);
	for(int i=0;i<len;i++){
		a[i]=c[i]-'0';
	}
	int ans=0;
	int cur=0; 
	for(int i=len-1;i>0;i--){
		a[i]+=cur;
		cur=0;
		if(0<= a[i] && a[i]<=4){
			ans+=a[i];
		}
		else if(6<=a[i] &&a[i]<=9){
			ans+=10-a[i];
			cur=1;
		}
		else if(a[i]==10){
			cur=1;
		}
		else{
			ans+=5;
			if(a[i-1]>=5) cur=1;
		}
	}
	a[0]+=cur;
	ans+=min(a[0],11-a[0]);
	cout<<ans;
}

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

#define f(i, a, b, c) for(int i = a ; i < b ; i += c)
#define fr(i, a, b, c) for(int i = a ; i >= b ; i -= c)
#define fit(it, v) for(auto it = v.begin() ; it != v.end() ; ++it)
#define frit(it, v) for(auto it = v.rbegin() ; it != v.rend() ; ++it)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define NL '\n'
#define modn 1000000007
#define EPS 1e-9

using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< lli > vli;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< char > vc;
typedef vector< string > vs;
typedef vector< bool > vb;
typedef set< int > si;
typedef set< ii > sii;

vi pr, sz;

int findParent(int nd){
	return (nd == pr[nd] ? nd : pr[nd] = findParent(pr[nd]));
}

void Union(int a, int b){
	int x = findParent(a), y = findParent(b);
	if (x != y){
		if (sz[x] < sz[y]){
			pr[x] = y;
			sz[y] += sz[x];
		}
		else{
			pr[y] = x;
			sz[x] += sz[y];
		}
	}
}

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

	#ifdef LOCAL_TEST
		ifstream h("in");
		ofstream g("out");
		clock_t z = clock();
	#else
		#define h cin
		#define g cout
	#endif//LOCAL_TEST

	int n, m;
	h >> n >> m;
	sz.resize(n + 1);
	fill(all(sz), 1);
	pr.resize(n + 1);
	iota(all(pr), 0);
	f(i, 0, m, 1){
		int  x, y;
		h >> x >> y;
		Union(x, y);
	}
	f(i, 1, n + 1, 1)
		pr[i] = findParent(i);
	g << *max_element(all(sz));

	#ifdef LOCAL_TEST
		cerr << "Time taken is: " << double(clock() - z) / CLOCKS_PER_SEC << NL;
		h.close();
		g.close();
	#endif//LOCAL_TEST
}


Measured memory_bytes: 4648
#include <stdio.h>
int area(int a, int b) //面積を求める関数
{
    int s = a * b;
    return s;
}
int length(int a, int b) //周りの長さを求める関数
{
    int l = a * 2 + b * 2;
    return l;
}
void area_length(int a, int b, int *s, int *l) //面積と周りの長さ両方求める関数
{
    *s = area(a, b);
    *l = length(a, b);
}
int main(void)
{
    int a, b;
    int area, length;

    scanf("%d %d", &a, &b);

    area_length(a, b, &area, &length);

    printf("%d %d\n", area, length);

    return 0;
}


Measured memory_bytes: 2624
lists = list(map(int,input().split()))
a = lists[0]
b = lists[1]
c = lists[2]
d = lists[3]
e = a*d
f = a*c
g = b*c
h = b*d
list2 = [e,f,g,h]
list2.sort()
print(list2[3])

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b,c,i,j,h,m;
	long double ah,am,an,as,ans;
	cin>>a>>b>>h>>m;
	ah=h*30 + m*0.5;
	am=m*6;
	if(ah>180){
		ah-=360;
	}
	if(am>180){
		am-=360;
	}
	an=fabs(ah-am)/180;
	an=an*M_PI;
	as=a*a+b*b-(2*a*b*cos(an));
	ans=sqrt(as);
	printf("%.20Lf\n",ans);
	//cout<<ans<<endl;
	return 0;
}



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

int main(void){
	int i, j, k;
	char s[81];
	while (fgets(s, 81, stdin) != 0){
		char t[3][5] = { "the", "this", "that" };
		for (i = 1; i<27; i++){
			for (j = 0; j<3; j++){
				for (k = 0; k<strlen(t[j]); k++)
					t[j][k] = (t[j][k] - 'a' + 1) % 26 + 'a';
				if (strstr(s, t[j]) != 0){
					for (j = 0; j<strlen(s); j++)
						if ('a' <= s[j] && s[j] <= 'z')
							for (k = 0; k<i; k++)
								s[j] += 26 * (s[j] - 'a' - 1<0) - 1;
					printf("%s", s);
					break;
				}
			}
			if (j != 3)
				break;
		}
	}
	return 0;
}

Measured memory_bytes: 532
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ArrayList<String> input = new ArrayList<String>();
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            String s = sc.nextLine();
            input.add(s);
        }
        sc.close();

        String output = "";

        String f = input.get(0).substring(0, 2);
        String b = input.get(0).substring(2);

        if (ym(f).equals(ym(b)) && ym(f).equals("MM")) {
            output = "AMBIGUOUS";
        } else if (ym(f).equals(ym(b)) && ym(f).equals("YY")) {
            output = "NA";
        } else if (ym(f).equals("MM")) {
            output = "MMYY";
        } else if (ym(f).equals("YY")) {
            output = "YYMM";
        }

        System.out.println(output);
    }

    private static String ym(String str) {
        String s;
        int a = Integer.parseInt(str);
        if (a >= 1 && a <= 12) {
            s = "MM";
        } else {
            s = "YY";
        }
        return s;
    }
}


Measured memory_bytes: 21844
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try{
	    String st;
	    int sum = 0, wa = 0, count = 0;
	    while((st=sc.readLine())!=null){
		String[] a = st.split(",");
		sum += Integer.valueOf(a[0])*Integer.valueOf(a[1]);
		wa += Integer.valueOf(a[1]);
		count++;
	    }
	    System.out.println(sum);
	    System.out.println((int)((double)wa/count+0.5));
	}catch (Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

ll dp[13][111111];

int main()
{
    string s;
    cin>>s;
    dp[0][0] = 1ll;
    REPALL(i,s) {
        if (s[i] == '?') {
            REP(num,10) {
                REP (j,13) {
                    dp[(j*10+num)%13][i+1]
                        = (dp[(j*10+num)%13][i+1] + dp[j][i]) % MOD;

                }
            }
        } else {
            int num = s[i] - '0';
            REP (j,13) {
                dp[(j*10+num)%13][i+1]
                        = (dp[(j*10+num)%13][i+1] + dp[j][i]) % MOD;
            }
        }
    }
    //REP(i,s.size()+1) {REP(j,13) {cout<<dp[j][i]<<" ";} putchar('\n');}
    cout<<dp[5][s.size()]<<endl;

    return 0;
}


Measured memory_bytes: 11392
//
// ABC119B
//

#include <iostream>
using namespace std;

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

	double  x;
	string u;
	double sum=0;

	for(int i=0; i<N; i++) {
		cin >> x >> u;

		if (u=="BTC") sum+= 380000 * x;
		else          sum += x;
	}
	cout << sum << endl;

	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  vector<ll> a(n+1);  rep(i, 0, n+1) cin >> a[i];
  vector<ll> b(n);  rep(i, 0, n) cin >> b[i];
  
  ll ans = 0;
  rep(i, 0, n) {
    if(b[i] < a[i]) {
      ans += b[i];
      a[i] -= b[i];
    }
    else {
      b[i] -= a[i];
      ans += a[i];
      ans += min(a[i+1], b[i]);
      a[i+1] = max(a[i+1]-b[i], 0LL);
    }    
  }
  cout << ans << "\n";
}

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

bool sosu(int n) {
  if(n < 2) return false;//2以下除く
  else if(n == 2) return true;//2は素数
  else if(n % 2 == 0) return false;//偶数除く
  int root = sqrt(n);
  for(int i=3; i<=root; i+=2) {//奇数で割る
    if(n % i == 0) return false;
  }
  return true;
}

int main() {
  int n; cin >> n;
  int sum = 0;
  for(int i=0; i<n; i++) {
    int x;
    cin >> x;
    if(sosu(x) == true) sum++;
  }
  cout << sum << endl;
}



Measured memory_bytes: 3084
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Long sum = 1L;
    Long max = 0L;
    Long b = 1000000000000000000L;
    Long [] a = new Long[N];
    for(int i = 0; i<N ;i++){
      a[i] = sc.nextLong();
      if(a[i]==0){
        System.out.println(0);
        return;
      }
    }
    for(int i = 0; i<N ;i++){
      sum = sum * a[i];
      if(sum>=max && sum<=b){
        max = sum;
      }else{
        System.out.println(-1);
        return;
      }
    }  
    System.out.println(sum);
  }
}




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

int main(){
	string s;
	cin>>s;
	map<char,int> mp;
	if(s=="zyxwvutsrqponmlkjihgfedcba"){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i++){
		mp[s[i]]++;
		if(mp[s[i]]==2){
			cout<<-1<<endl;
			return 0;
		}
	}
	
	if(s.size()!=26){
		cout<<s;
		for(int i=0;i<26;i++){
			char x='a'+i;
			if(mp[x]==0){
				cout<<x<<endl;
				return 0;
			}
		}
	}
	
	string x=s;
	
	next_permutation(x.begin(), x.end());
	
	for(int i=0;i<s.size();i++){
		cout<<x[i];
		if(x[i]!=s[i])break;
	}
	cout<<endl;
	
}

Measured memory_bytes: 256
import copy

h, w, x = map(int, input().split())
c = []
for i in range(h):
    c.append(list(input()))

ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        cc = copy.deepcopy(c)
        for k in range(h):
            for l in range(w):
                if ((i >> k) & 1):
                    for m in range(w):
                        cc[k][m] = "1"
                if ((j >> l) & 1):
                    for n in range(h):
                        cc[n][l] = "1"
        cnt = 0
        for o in range(h):
            for p in range(w):
                if cc[o][p] == "#":
                    cnt += 1
        if cnt == x:
            ans += 1

print(ans)


Measured memory_bytes: 9148
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

f(A, B) :- A mod 2 =:= 1, B mod 2 =:= 1.

main :-
    get_number(A),
    get_number(B),
    f(A, B) -> writeln("Yes") ; writeln("No").


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

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

typedef long long ll;
using namespace std;

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

  string O, E;
  cin >> O >> E;
  int o_l = O.length();
  int e_l = E.length();
  int l = max(o_l, e_l);
  REP(i, l){
    cout << O.at(i);
    if(i < e_l){
      cout << E.at(i);
    }
  }
  
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 1; i <= (int)(n); i++)

int showAll(map<int, int> mp) {
  map<int, int>::iterator itr;
  for (itr = mp.begin(); itr != mp.end(); itr++) {
    cout << itr->first << " => " << itr->second << " / ";
  }
  cout << endl;
  return 0;
}
int main() {
  int n;
  cin >> n;
  int a;
  map<int, int> mp;
  mp[1] = mp[2] = mp[4] = 0;
  rep (i, n) {
    cin >> a;
    if (a % 4 == 0) {
      mp[4]++;
    } else if (a % 2 == 0) {
      mp[2]++;
    } else {
      mp[1]++;
    }
  }
  // showAll(mp);

  int prev = 0;
  int flag = 0;
  rep (i, n) {
    if (prev == 1) {
      if (mp[4] > 0) {
        mp[4]--;
        prev = 4;
      } else {
        flag = 1;
        break;
      }
    } else if (prev == 2) {
      if (mp[2] > 0) {
        mp[2]--;
        prev = 2;
      } else if (mp[4] > 0) {
        mp[4]--;
        prev = 4;
      } else {
        flag = 1;
        break;
      }
    } else if (prev == 4) {
      if (mp[1] > 0) {
        mp[1]--;
        prev = 1;
      } else if (mp[2] > 0) {
        mp[2]--;
        prev = 2;
      } else if (mp[4] > 0) {
        mp[4]--;
        prev = 4;
      } else {
        flag = 1;
        break;
      }
    } else if (prev == 0) {
      if (mp[1] > 0) {
        mp[1]--;
        prev = 1;
      } else if (mp[2] > 0) {
        mp[2]--;
        prev = 2;
      } else {
        mp[4]--;
        prev = 4;
      }
    }
  }
  if (flag) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0, w = 0;
    for(auto c : s) {
        if(c == 'R') {
            r++;
        } else {
            w++;
        }
    }
    int ans = 0;
    for(int i = 0; i < r; i++) {
        if(s[i] == 'W') {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3772
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){function t(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=[],n=!0,o=!1,u=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return t}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}e.exports=function(e){var r=t(e.split("\n")[0].split(" ").map(function(e){return Number(e)}),2),n=r[0],o=(r[1]-n)/2;o%1==0?console.log(n+o):console.log("IMPOSSIBLE")}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 7372
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	defer wt.Flush()
	a, b, c := nextInt(), nextInt(), nextInt()
	if a == b && b == c && (a&1) == 0 {
		puts(-1)
		return
	}
	ans := 0
	for ((a & 1) | (b & 1) | (c & 1)) == 0 {
		a, b, c = (b+c)/2, (c+a)/2, (a+b)/2
		ans++
	}
	puts(ans)
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

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

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
N,M = map(int, input().split())
ps = []
AC = [0]*N
WA = [0]*N
WA_sum = 0
for _ in range(M):
  ps.append(list(input().split()))
for i in range(M):
  if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:
    AC[int(ps[i][0])-1] = 1
  if ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:
    WA[int(ps[i][0])-1] += 1
for i in range(N):
  if AC[i] == 1:
    WA_sum += int(WA[i])
print(sum(AC), WA_sum)

Measured memory_bytes: 27444
#include<iostream>
#include<algorithm>
using namespace std;
int n;
char s[1010];
int main()
{
    
    cin >> s+1;
    int len=0;
    for (int i = 1; s[i] != '\0'; i++)
        len++;
    int len1 = len / 2;
    int len2 = (len + 3) / 2;
   // cout << len << " " << len1 << " " << len2;
    int f = 1, f1 = 1, f2 = 1;
    for (int i = 1; i < len / 2; i++)
    {
        if (s[i] != s[len - i + 1]) { f = 0; break; }
    }
    if (f)
    {
        for (int i = 1; i <= len1 / 2; i++)
        {
            if (s[i] != s[len1 - i + 1]) { f1 = 0; break; }
        }
    }
    if (f1)
    {
        for (int i = len-len1+1; i <= len/2+1+(len-len2+1)/2; i++)
        {
            if (s[i] != s[len - i + 1]) { f2 = 0; break; }
        }
    }
    if (f && f1 && f2)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define pbb pop_back
#define make_pair mp
#define all(x) x.begin(), x.end()
#define mem(array, value) memset(array, value, sizeof(array))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a,b))*b
#define line cout << "==========" << endl
#define mod 1000000007
#define SIZE 1000001

int main ()
{
    int ara[3];
    for (int i = 0; i<3; i++)
        cin >> ara[i];
    sort (ara, ara+3);
    int k;
    cin >> k;
    k = pow(2, k);
    ara[2]*= k;
    int sum = 0;
    for (int i = 0; i<3; i++)
        sum+=ara[i];
    cout << sum << endl;
    return 0;
}


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

int main()
{
  string s;
  cin >> s;

  string a;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') a.push_back('1');
    if(s[i] == '0') a.push_back('0');
    if(s[i] == 'B'){
      if(a.size()) a.pop_back();
    }
  }

  cout << a << endl;

  return 0;

}


Measured memory_bytes: 256