akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
 
 
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
using namespace std;
const int INF = 1e9 + 5;
signed main() {
    FAST_IO;
 
    int n,W;
    cin>>n>>W;
    int v[n]={0};
    int w[n] = {0};
    long long int dp[n+1][W+1] = {0};
    for (int i = 0; i < n; i++) cin>>w[i]>>v[i];
    for (int i = 0; i <=n; i++){
        for(int j=0;j<=W;j++){
            if(i==0||j==0)
                dp[i][j]=0;
            else if(w[i-1]<=j)
                dp[i][j] = max(v[i-1]+dp[i-1][j-w[i-1]], dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[n][W];
    return 0;
}

Measured memory_bytes: 82460
/*****Enigma_27*****/
#include<bits/stdc++.h>
#define ll          long long
#define all(a)      (a).begin(),(a).end()
#define pb          push_back
#define INF         10000000000000000
using namespace std;
ll i,j,k,n,x,mid,sum1=0,sum2=0,ans,l[300005],r[300005];
vector<ll> v(300005);
int main()
{
    cin>>n;
	for(i=0;i<3*n;i++){
		cin>>v[i];
	}
	priority_queue<int> pq; //max_heap for first half
	priority_queue<int,vector<int>,greater<int> > pq2; //min_heap for second half
	ll csum=0;
	for(i=0;i<3*n;i++){
		pq2.push(v[i]);
		csum+=v[i];
		if(pq2.size()>n){
			csum-=pq2.top();pq2.pop();
		}
		if(pq2.size()==n)l[i]=csum;else l[i]=-INF;
	}
	csum=0;
	for(int i=3*n-1;i>=0;i--){
		pq.push(v[i]);
		csum+=v[i];
		if(pq.size()>n){
			csum-=pq.top();pq.pop();
		}
		if(pq.size()==n) r[i]=csum;else r[i]=INF;
	}
	ll ans=-INF;
	for(i=0;i<3*n-1;i++){
		ans=max(ans,l[i]-r[i+1]);
	}
	cout<<ans<<endl;

    return 0;
}


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

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

	int N;

	cin >> N;// >> ;
	
	int ans=N*N*N;

	cout << ans << "\n";

    }

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

int main() {
   int a,b,c,d,e,k;
   cin >>a>>b>>c>>d>>e>>k;
   int diff=e-a;
   if(diff<=k){
      cout<<"Yay!"<<endl;

   }else{
      cout<<":("<<endl;
   }
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int64_t A, B, N;
    std::cin >> A >> B >> N;

    int64_t starter = N / B;
    starter *= B;
    if (starter == 0)
        starter = B;
    int64_t max_num = 0;
    for (int64_t x = starter; x <= N; x += B)
    {
        int64_t calcx = x - 1;
        int64_t first = A * calcx / B;
        int64_t second = calcx / B;

        int64_t result = first - A * second;
        if (max_num < result)
            max_num = result;
    }
    int64_t calcx = N;
    int64_t first = A * calcx / B;
    int64_t second = calcx / B;

    int64_t result = first - A * second;
    if (max_num < result)
        max_num = result;

    std::cout << max_num;
}

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

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

	ll n,m;
	cin>>n>>m;
	priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>> > pq;
	unordered_map<ll,ll> cnt;
	for(ll i=0; i<n; ++i){
		ll x; cin>>x; cnt[x]++;
	}
	for(auto i : cnt ){
		pq.push({i.first,i.second});
	}
	for(ll i=0; i<m; ++i){
		ll b;
		ll c;
		cin>>b>>c;
		ll cnt_with_c = 0;
		while(true){
			if(pq.empty()){ break; }
			if( b <= 0 ){ break; }
			auto x = pq.top();
			if( x.first >= c ){ break; }
			else{
				if( x.second <= b ){ pq.pop(); cnt_with_c += x.second; b -= x.second; }
				else{
					pq.pop();
					// pq.push({c,b});
					cnt_with_c += b;
					pq.push({x.first,x.second-b});
					b = 0;
				}
			}
		}
		pq.push({c,cnt_with_c});
	}
	ll ans = 0;
	while(!pq.empty()){
		ans += (pq.top().first * pq.top().second); pq.pop();
	}
	cout<<ans<<'\n';
	return 0;
}


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

int main() {
	int  k, n;
	cin >> n >> k;
	int a;
	vector<bool>judge(n);
	int ans = 0;
	int d;
	for (int i = 0; i < k; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a;
			judge[a - 1] = true;
		}
	}
	for (int i = 0; i < n; i++) {
		if (judge[i] == false)ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int d[n + 2][2];
    for(int i = 1; i <= n; i++){
        cin >> d[i][0] >> d[i][1];
    }
    int k = 0;
    for(int i = 1; i <= n - 2; i++){
        if(d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1]){
            k = 1;
        }
    }
    if(k == 1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int 
#define append push_back
#define mp make_pair
#define endl "\n"
#define MOD 1e9+7 

template <typename T>
void print(T AA[], int nn){for(int ii=0; ii<nn; ii+=1){cout<<AA[ii]<<" ";}cout<<endl;}
template <typename T> inline void print(T nn){ cout << nn << endl;}
/* ----------------------------------------------------------------------------------- */

const int N = 1e5+1;
int A[N], cache[N], n, k;

int fn(int i){
    if(i==n-1) return 0;
    if(cache[i] != -1) return cache[i];
    int ans = LONG_MAX;
    for(int j=1; j<=k; j+=1){
        if(i+j<n) ans = min(ans, abs(A[i]-A[i+j])+fn(i+j));
    }
    cache[i] = ans;
    return ans;
}

int32_t main(){

    IOS
    
    memset(cache, -1, sizeof(cache));
    cin >> n >> k;
    for(int i=0; i<n; i+=1) cin >> A[i];
    print(fn(0));  
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   
    
    
    int n, k;
    cin >> n >> k;
    
    ll sum = 0;
    
    rep3(b, 1, n + 1) { // 割る数
        int p = n / b;
        int r = n % b;
        sum += (ll)max(b - k, 0) * p;
        if (k == 0) sum--;
        sum += max(r + 1 - k, 0);
    }
    
    out(sum);
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        char s[4];

        scanf("%s",s);
        if(s[0]=='S'){
               if(s[1]=='U')    printf("7\n");
               else             printf("1\n");
        }
        else if(s[0]=='M') printf("6\n");
        else if(s[0]=='T'){
               if(s[1]=='U')      printf("5\n");
               else if(s[1]=='H') printf("3\n");
        }
        else if(s[0]=='W') printf("4\n");
        else if(s[0]=='F') printf("2\n");
        return 0;
}


Measured memory_bytes: 128
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    n: i8, m: i8,
  }
  
  println!("{}", if n == m { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#include<iostream>
#include<stack>

using namespace std;

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

int main() {
  string str;
  while (true) {
    getline(cin, str);
    if (str == ".") break;
    stack<char> st;
    bool ok = true;
    rep (i, str.size()) {
      if (str[i] == '(') st.push('(');
      if (str[i] == '[') st.push('[');
      if (str[i] == ')') {
	if (st.empty()) {
	  ok = false;
	  break;
	}
	char c = st.top();
	st.pop();
	if (c != '(') {
	  ok = false;
	  break;
	}
      }
      if (str[i] == ']') {
	if (st.empty()) {
	  ok = false;
	  break;
	}
	char c = st.top();
	st.pop();
	if (c != '[') {
	  ok = false;
	  break;
	}
      }
    }
    if (!st.empty()) ok = false;
    if (ok) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}

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

int main(){
	int N, M, h, m;
	list<int> l;

	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> h >> m;
		l.push_back(h * 60 + m);
	}
	
	cin >> M;
	for (int i = 0; i < M; i++){
		cin >> h >> m;
		l.push_back(h * 60 + m);
	}

	l.sort();
	l.unique();

	list<int>::iterator it = l.begin();
	for (int i = 0; it != l.end(); i++){
		cout.width(1);
		cout << *it / 60 << ":";
		cout.width(2);
		cout.fill('0');
		cout << *it % 60;
		cout.width(1);
		if (i != l.size() - 1){
			cout << ' ';
		}
			it++;
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 1212
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll n;
    cin >> n;
    vll G(n);
    rep(i, n){
        ll u, k;
        cin >> u >> k;
        u--;
        rep(j, k){
            ll a;
            cin >> a;
            a--;
            if(a < 0) continue;
            G[u].push_back(a);
        }
    }
    
    vl dist(n, -1);
    queue<ll> que;
    dist[0] = 0;
    que.push(0);
    while(!que.empty()){
        ll v = que.front();
        que.pop();

        for(auto nv : G[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    rep(i, n){
        cout  << i+1 << " " <<  dist[i] << endl;
    }
}


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

int main() {
  string s,t;
  cin >> s >> t;
  int sum = 0;
  for(int i=0;i<3;i++){
    if(s.at(i) == t.at(i))
      sum ++;
  }
  cout << sum;
}

Measured memory_bytes: 256
##実装のバグがとれぬ　答えを見る

N = int(input())
ab = []
cd = []
for i in range(N):
    a,b = map(int,input().split())
    ab.append([b,a,i])
for i in range(N):
    c,d = map(int,input().split())
    cd.append([c,d,i])

ab.sort()
cd.sort()

ans = 0
flag_ab = [1]*N
for i in range(N):
    pos = -1
    for j in range(N):
        if ab[j][0] < cd[i][1] and ab[j][1] < cd[i][0] and flag_ab[j]:
            pos = max(pos,j)
    if pos != -1:
        flag_ab[pos] = 0
        ans += 1

print(ans)

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

using namespace std;

int main(){
   	int a, b, n, i;
   	cin >> a >> b;

   	// if (b / a == 1)
   	// {
   	// 	if (b % a == 0)
   	// 	{
   	// 		cout << 1;
   	// 	}
   	// 	else{
   	// 		cout << 2;
   	// 	}
   	// }
   	if (b / a == 0)
   	{
   		if (b == 1)
   		{
   			cout << 0;
   		}
   		else{
   			cout << 1;
   		}
   	}
   	else
   	{
    	i = 1;
    	// cout << n << endl;
    	while ((a*i) - (i - 1) < b)
    	{
    		i++;
    	}

    	cout << i;
   	}
 	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define endl '\n'

using namespace std;
struct custom_hash 
{
    static unsigned long long splitmix64(unsigned long long x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(unsigned long long x) const 
    {
        static const unsigned long long FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
mt19937 random_generator(chrono::steady_clock::now().time_since_epoch().count());

int a, b, c, k; 
void read()
{
	cin >> a >> b >> c >> k; 
}

void solve()
{
	if (a >= k)
	cout << k << endl;
	
	else 
	if (a + b >= k)
	cout << a << endl; 
	
	else 
	cout << a - (k - a - b) << endl; 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	read();
	solve();
}


Measured memory_bytes: 3616
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=100000007;
const llint big=1e9;
const llint red=0xE869120;
const llint pro=1002001;
int main(void){
	int a,b,i,j,ans=0,gen,bmax,bmin,q,w,n,m;
	string str;
	vector<int> vec;
	cin>>n;
	vec.res(n);
	for(i=0;i<n;i++){cin>>vec[i];}
	sort(vec.begin(),vec.end());
	cout<<(vec[n-1]-vec[0])<<endl;
	return 0;
}

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

using namespace std;

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

#define PII pair<int, int>

#define ALL(v) v.begin(), v.end()

#ifdef DBG
#define _log(item) cout << #item << " = " << item << endl
#define _loga(array, val) cout << #array << "[" << val << "] = " << array[val] << endl
#else
#define _log(item)
#define _loga(array, val)
#endif

inline int gcd(int number1, int number2)
{
    int m = number1;
    int n = number2;
    if (number2 > number1) {
        m = number2;
        n = number1;
    }
    while (m != n) {
        int temp = n;
        n = m - n;
        m = temp;
    }
    return m;
}
inline int lcm(int number1, int number2)
{
    return number1 * number2 / gcd(number1, number2);
}

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

priority_queue<int> pq;

int n;
int m;

int ans = 0;

signed main()
{
    cin >> n >> m;

    rep(i, n){
        int a;
        cin >> a;
        pq.push(a);

        ans += a;
    }

    rep(i, m){
        int w = pq.top(); pq.pop();
        int u =  w / 2;
        pq.push(u);
        ans -= w - u;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, a, b, x, y; cin >> a >> b;
	cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> x >> y;
		if (a <= x && b <= x) {
			n == n;
		}
		else if (a >= y && b >= y){
			n == n;
		}
		else {
			cout << '1' << endl;
			return 0;
		}
	}
	cout << '0' << endl;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
  ll d;cin >> d;
  vl c(26);rep(i,26)cin >> c[i];
  vvl s(d,vl(26));rep(i,d)rep(j,26)cin >> s[i][j];
  vector<set<ll>> ch(26);rep(i,26)ch[i].ins(-1),ch[i].ins(d);
  vl days(d);
  ll pre=0;
  rep(i,d){
    ll t;cin >> t;t--;
    pre+=s[i][t];
    ch[t].ins(i);
    days[i]=t;
  }
  ll q;cin >> q;
  while(q--){
    ll x,y;cin >>x >> y;
    x--;y--;
    pre-=s[x][days[x]];
    ch[days[x]].erase(x);
    days[x]=y;
    pre+=s[x][y];
    ch[y].ins(x);
    ll p=0;
    rep(i,26){
      ll mini=0;
      ll pp=-1;
      for(auto a:ch[i]){
        mini+=(a-pp)*(a-pp-1)/2;
        pp=a;
      }
      //cout << mini <<endl;
      p+=c[i]*mini;
    }
    cout << pre-p <<endl;
  }
}   

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

string max_string(string s, string t){
    if(s.size() > t.size()) return s;
    else if(s.size() < t.size()) return t;
    else{
        rep(i, s.size()){
            if(s[i] > t[i]) return s;
            else if(s[i] < t[i]) return t;
        }
        return s;
    }
}

string s;
string dp[55][55];

string dfs(int l, int r){
    if(dp[l][r] != ".") return dp[l][r];
    if(l == r) return dp[l][r] = "#";

    if(count_if(s.begin() + l, s.begin() + r, [](char c){return c != '?' && !isdigit(c);}) == 0){
        if(r - l != 1 && s[l] == '0') return dp[l][r] = "#";

        string ret = s.substr(l, r - l);
        For(i, l, r) ret[i - l] = (s[i] == '?' ? '9' : s[i]);
        return ret;
    }
    else{
        if(r - l < 6) return dp[l][r] = "#";
        if(s[l] != '?' && s[l] != 'L' && s[l] != 'R') return dp[l][r] = "#";
        if(s[l+1] != '?' && s[l+1] != '(') return dp[l][r] = "#";
        if(s[r-1] != '?' && s[r-1] != ')') return dp[l][r] = "#";

        dp[l][r] = "#";
        For(i, l+3, r-2)if(s[i] == '?' || s[i] == ','){
            string lhs = dfs(l+2, i);
            if(lhs == "#") continue;

            string rhs = dfs(i+1, r-1);
            if(rhs == "#") continue;

            if(s[l] == 'L'){
                if(dp[l][r] == "#") dp[l][r] = lhs;
                else dp[l][r] = max_string(dp[l][r], lhs);
            }
            else if(s[l] == 'R'){
                if(dp[l][r] == "#") dp[l][r] = rhs;
                else dp[l][r] = max_string(dp[l][r], rhs);
            }
            else{
                string tmp = max_string(lhs, rhs);
                if(dp[l][r] == "#") dp[l][r] = tmp;
                else dp[l][r] = max_string(dp[l][r], tmp);
            }
        }
        return dp[l][r];
    }
}

int main(){
    cin >> s;
    rep(i, 55)rep(j, 55) dp[i][j] = '.';
    string ans = dfs(0, s.size());
    cout << (ans == "#" ? "invalid" : ans) << "\n";
}


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

using namespace std;

int main(void) {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a){
        cout << k << endl;
    }
    else if((a < k) && (k <= (a + b))){
        cout << a << endl;
    }
    else{
        cout << a - (k - (a + b)) << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int N = 4e5+5, P = 998244353;
int n, f[N], s[N], ans; char X[N], Y[N]; void fix(int &x) { x<P?0:x-=P; }
int G(int T)
{
    for(int i = 1, j = 0; i <= n; i += T>>1, j ^= 1) for(int k = 0; k < T>>1; ++k) Y[i+k] = X[k+1]^j;
    bool flg = true; for(int i = 1; i <= n&&flg; ++i) if(X[i] < Y[i]) flg = false; else if(X[i] > Y[i]) break;
    return s[T>>1]+flg;
}
int main()
{
    scanf("%d%s", &n, X+1);
    for(int i = 1; i <= n; ++i) X[i] -= '0', fix(s[i]=s[i-1]<<1|X[i]);
    for(int i = 1; i <= 2*n; ++i) if((2*n)%i == 0&&n%i != 0) f[i] = G(i);
    for(int i = 2; i <= n<<1; i += 2) if(f[i]) for(int j = i<<1; j <= n<<1; j += i) 
        if((2*n)%j == 0&&n%j != 0) fix(f[j]+=P-f[i]);
    for(int i = 2; i <= n<<1; i += 2) if(f[i]) fix(ans += (i64)f[i]*i%P);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 5020
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    int win = 0;
    for(int i = 0; i < S.length(); i++){
      if(S.charAt(i) == 'o'){
        win++;
      }
    }
    
    win += 15 - S.length();
    
    System.out.println(win >= 8 ? "YES" : "NO");
  }
}

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

public class Main {

    public Main(FastScanner in, PrintWriter out, int test) {
        int N = in.nextInt();
        // find smallest prime fators of all numbers in [2:N]
        int[] spf = new int[N + 1];
        for (int i = 2; i <= N; i++) {
            if (spf[i] > 0)
                continue;
            spf[i] = i;
            for (int j = i + i; j <= N; j += i) {
                if (spf[j] == 0)
                    spf[j] = i;
            }
        }

        long res = 1;
        for (int k = 2; k <= N; k++) {
            long fk = f(k, spf);
            res += k * fk;
        }
        out.println(res);
    }

    private int f(int x, int[] spf) {
        int cnt = 1, p = spf[x], cur = 0;
        while (x > 1) {
            if (spf[x] != p) {
                cnt *= 1 + cur;
                cur = 0;
                p = spf[x];
            }
            cur++;
            x /= p;
        }
        cnt *= 1 + cur;
        return cnt;
    }

    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        // Scanner in = new Scanner(
                // new BufferedReader(new InputStreamReader(System.in)));
        FastScanner in = new FastScanner(System.in);

        // int T = in.nextInt();
        for (int t = 1; t <= 1; t++) {
            Main sol = new Main(in, out, t);
        }

        out.close();
    }
}


class FastScanner{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

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

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

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

    boolean isEndline(int c)
    {
        return c=='\n'||c=='\r'||c==-1;
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

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

    String next(){
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isSpaceChar(c));
        return res.toString();
    }

    String nextLine(){
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isEndline(c));
        return res.toString();
    }
}

Measured memory_bytes: 71852
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N,M,Q,l,r,d[500][500];
    cin>>N>>M>>Q;
    rep(i,N) rep(j,N) d[i][j]=0;
    rep(i,M){
        cin>>l>>r;
        d[l-1][r-1]+=1;
    }

    rep(i,N){
        Rep(j,N-1){
            d[i][j]+=d[i][j-1];
        }
    }
    Rep(i,N-1){
        rep(j,N){
            d[N-i-1][j]+=d[N-i][j];
        }
    }

    rep(i,Q){
        cin>>l>>r;
        cout<<d[l-1][r-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1920
n,m=map(int,input().split())
if abs(n-m)>1:exit(print(0))
f1,f2,mod=1,1,10**9+7
for i in range(1,n+1):
  f1=(f1*i)%mod
for i in range(1,m+1):
  f2=(f2*i)%mod
ans=(f1*f2)%mod
if n==m: ans=(ans*2)%mod
print(ans)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		for(int i = 0;i<m;i++){
			n-= sc.nextInt();
		}
		if(n<0){
			System.out.println(-1);
		}else{
			System.out.println(n);
		}
	}
	
}

Measured memory_bytes: 46380
#include <cstdio>
int main() {
  int N, a, A[100000]{};
  scanf("%d", &N);
  for (int i = 0; i != N; ++i) scanf("%d", &a), ++A[a];
  A[0] += N % 2;
  for (int i = (N + 1) % 2; i < N; i += 2)
    if (A[i] != 2) {
      printf("0\n");
      return 0;
    }
  N /= 2, a = 1;
  while (N--) a = a * 2 % 1000000007;
  printf("%d\n", a);
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p )
{
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v )
{
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu ()
{
    cerr << endl;
}

template <typename T>
void faltu( T a[], int n )
{
    for(int i = 0; i < n; ++i)
        cerr << a[i] << ' ';
    cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}


int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}
int lcm(int a,int b)
{
    return (a*( b/ gcd(a,b)));
}

void f()
{
    int s,i=1;
    cin>>s;
    map<int,int>m;

    while(true)
    {
        m[s]++;
        if(m[s]==2)
        {
            cout<<i<<nl;
            return;
        }
        if(s%2==0)
        {
            s=s/2;
        }
        else
        {
            s=3*s+1;
        }
        i++;
    }
}

int main()
{
    su;
    f();
    return 0;
}


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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> road(2*m);
  
  for(int i=0;i<m*2;i++){
    cin >> road.at(i);
  }
  
  for(int i=0;i<n;i++){
    int count=0;
    for(int j=0;j<m*2;j++){
      if(road.at(j)==(i+1)){
      count++;
	  }
    }
    cout << count << endl;
  }

}

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

int main(){
    ll A, B;
    cin >> A >> B;
    ll c = 1;
    rep(i, 0, 100){
        if(c >= B){
            cout << i << endl;
            return 0;
        }
        c += A - 1;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
int ceil(int a,int b){
    return (a+b-1)/b;
}
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int m=n,s=0;
  while ( m ) {
    s+=m%10;
    m/=10;
  }
  if ( n%s==0 ) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0; 
}


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

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

  int c;
  if (b<=9) c=a*10+b;
  else if (b==100) c=a*1000+b;
  else c=a*100+b;

  int i=1;
  while (i*i<=c) {
    if (i*i==c) {
      cout << "Yes" << endl;
      return 0;
    }
    i++;
  }

  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	if(a<0&&b<=0){
		printf("%d\n",c*(b-a));
	}else if(a<0&&b>0){
		printf("%d\n",(-a)*c+d+b*e);
	}else{
		printf("%d\n",(b-a)*e);
	}
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{

	int all3 = 0, i, c[9];	//c11,c12,c13,c21...
	
	//c[0], c[1], c[2]
	//c[3], c[4], c[5]
	//c[6], c[7], c[8]

	for (i = 0; i < 9; ++i){
		cin >> c[i];
		all3 += c[i];
	}

	if (all3 % 3 != 0)
		cout << "No" << endl;
	else
	{
		all3 /= 3;

		int c2[9];
		c2[0] = all3 - c[4] - c[8];
		c2[1] = all3 - c[3] - c[8];
		c2[2] = all3 - c[4] - c[6];

		c2[3] = all3 - c[1] - c[8];
		c2[4] = all3 - c[0] - c[8];
		c2[5] = all3 - c[0] - c[7];
		
		c2[6] = all3 - c[2] - c[4];
		c2[7] = all3 - c[0] - c[5];
		c2[8] = all3 - c[0] - c[4];
		
		if (c[0] == c2[0] && c[1] == c2[1] && c[2] == c2[2] &&
			c[3] == c2[3] && c[4] == c2[4] && c[5] == c2[5] &&
			c[6] == c2[6] && c[7] == c2[7] && c[8] == c2[8])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;

	}

	return 0;

}

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();
    char c[] = s.toCharArray();
    int a = 0;
    for(int i=0 ; i<s.length() ; i++){
      a = (int)c[i]+n;
      if(a<=90){
        System.out.print((char)a);
      }else{
        System.out.print((char)(a-90+64));
      }
    }
    System.out.println();
  }
}


Measured memory_bytes: 26452
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,m,a[MAXN];
int fact[MAXN],invf[MAXN];
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
int pow_mod(int a,int i)
{
    int s=1;
    while(i)
    {
        if(i&1) s=1LL*s*a%MOD;
        a=1LL*a*a%MOD;
        i>>=1;
    }
    return s;
}
int comb(int n,int k)
{
    if(n<k) return 0;
    return 1LL*fact[n]*invf[k]%MOD*invf[n-k]%MOD;
}
int main()
{
    fact[0]=invf[0]=1;
    for(int i=1;i<=200000;i++) fact[i]=1LL*fact[i-1]*i%MOD;
    invf[200000]=pow_mod(fact[200000],MOD-2);
    for(int i=199999;i>=1;i--) invf[i]=1LL*invf[i+1]*(i+1)%MOD;
    int s1=0,s2=0,denom=1;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
    {
        int res=denom; dec(res,s1); add(res,s2);
        denom=2LL*denom%MOD;
        res=1LL*res*pow_mod(denom,MOD-2)%MOD;
        printf("%d\n",res);
        s1=2LL*s1%MOD; s2=2LL*s2%MOD;
        if(i>=n) add(s1,comb(i-1,i-n));
        if(i>=m) add(s2,comb(i-1,i-m));
    }
    return 0;
}



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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Description: ????????????
// Verifyed: various problem 
const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
const P O=0.0L;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P p;R c;};

istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline int sdot(P o,P a,P b){return sgn(dot(o,a,b));}
inline int sdet(P o,P a,P b){return sgn(det(o,a,b));}

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/(l.t-l.s)); return (1-u)*l.s+u*l.t;}

// closest point pair Verify AOJ CGL_5_A
R cpp(VP a,int flag=1){
	const int n=a.size(),m=n/2;
	if(n<=1) return INF;
	
	if(flag){
		auto cmp_x=[](P a,P b)->bool{return sgn(real(a)-real(b))?sgn(real(a)-real(b))<0:sgn(imag(a)-imag(b)<0);};
		sort(begin(a),end(a),cmp_x);
	}
	
	VP b(begin(a),begin(a)+m),c(begin(a)+m,end(a)),e;
	R x=real(a[m]),d=min(cpp(b,0),cpp(c,0));
	
	auto cmp_y=[](P a,P b)->bool{return sgn(imag(a)-imag(b))?sgn(imag(a)-imag(b))<0:sgn(real(a)-real(b)<0);};	
	sort(_all(a),cmp_y);

	rep(i,n){
		if(abs(real(a[i])-x)>=d) continue;	
		rrep(j,e.size()){
			if(imag(a[i]-e[j])>=d) break;
			chmin(d,abs(a[i]-e[j]));
		}
		e.emplace_back(a[i]);
	}
	return d;
}

int main(void){
	int n;
	cin >> n;
	VP pol;
	rep(i,n){
		P p;
		cin >> p;
		pol.push_back(p);
	}
	cout.precision(20);
	cout << fixed << cpp(pol) << endl;
	return 0;
}

Measured memory_bytes: 21764
def CountingSort(A,B,k):
    
    C = [0]*10001
    """
    for i in range(k+1):
        C[i] = 0
    """
    
    for i in A:
        C[i] += 1
    
    for i in range(1,k+1):
        C[i] += C[i-1]

    for j in reversed(range(len(A))):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

n = int(input())
a = tuple(map(int,input().split()))

b = [0 for i in range(n)]
CountingSort(a,b,max(a))
print(*b)


Measured memory_bytes: 224832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String C11 = sc.next();
		String C22 = sc.next();
		String ans = " ";

		if ( C11.charAt(0) == C22.charAt(2) && C11.charAt(1) == C22.charAt(1) && C11.charAt(2) == C22.charAt(0)) {
			ans = "YES";
		} else {
			ans = "NO";
		}

		System.out.println( ans );
	}
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>

int main(void)
{
    int n;
    int i,j;

    char a[6];

    scanf("%s",a);

    if(a[2]==a[3]&&a[4]==a[5])
        printf("Yes");
    else
        printf("No");

    


	return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			int H, W;
			ArrayList<int[]> list = new ArrayList<int[]>();
			do {
				int[] ret = new int[2];
				String[] input = br.readLine().split(" ");
				H = Integer.parseInt(input[0]);
				W = Integer.parseInt(input[1]);
				if (H == 0 && W == 0) {
					break;
				} else {
					ret[0] = H;
					ret[1] = W;
					list.add(ret);
				}
			} while (true);

			int x, y;
			for (int[] e : list) {
				H = e[0];
				W = e[1];
				for (x = 1; x <= H; x++) {
					for (y = 1; y <= W; y++) {
						if ((x + y) % 2 == 0) {
							System.out.print("#");
						} else {
							System.out.print(".");
						}
					}
					System.out.println();
				}
				System.out.println();
			}

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

Measured memory_bytes: 25916
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<cstring>
#include<string>
using namespace std;
char a[55],b[55];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%s",a);
	scanf("%s",b);
	int l1=strlen(a),l2=strlen(b),l=min(l1,l2);
	for(int i=0;i<l;i++){
		printf("%c%c",a[i],b[i]);
	}
	l1-=l;
	l2-=l;
	if(l1>0){
		for(int i=l;i<l+l1;i++){
			printf("%c",a[i]);
		}
	}
	if(l2>0){
		for(int i=l;i<l+l2;i++){
			printf("%c",b[i]);
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static final int BALL_NUM = 10;
	int[] ball;
	void run(){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			//????????????????????????
			ball = new int[BALL_NUM];
			for(int j = 0;j < BALL_NUM;j++)
				ball[j] = scan.nextInt();
			String result = solve()?"YES":"NO";
			System.out.println(result);
		}
	}
	boolean solve(){
		int b = 0,c = 0;
		for(int i = 0;i < BALL_NUM;i++){
			if(c >= ball[i])return false;
			if(b < ball[i]){
				b = ball[i];
			}else{
				c = ball[i];
			}
		}
		return true;
	}

	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 26408
#include <stdio.h>
#include <algorithm>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(n, i) for (int i = n - 1; i > -1; --i)

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

    int A[N];
    REP(i, N) {
        scanf("%d", &A[i]);
    }
    sort(A, A + N);

    int B[N];
    REP(i, N) {
        scanf("%d", &B[i]);
    }
    sort(B, B + N);

    int C[N];
    REP(i, N) {
        scanf("%d", &C[i]);
    }
    sort(C, C + N);

    long ans = 0;
    long a = 0;
    long c = 0;
    REP(b, N) {
        while (A[a] < B[b] && a < N) {
            a++;
        }

        while (B[b] >= C[c] && c < N) {
            c++;
        }

        // printf("%d * (%d - %d) = %d\n", a, N, c, a * (N - c));
        ans += a * (N - c);
    }


    printf("%ld\n", ans);

    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
int main (void){
	int a,b,c,t;
scanf("%d%d%d",&a,&b,&c);
t=0;

	while(1){
		if(a==b+1)break;
else if (c%a==0)
	t=t+1;
	a=a+1;}
	printf("%d\n",t);
	return 0;
}

Measured memory_bytes: 596
// https://atcoder.jp/contests/abc067/tasks/abc067_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    REP(i, n) cin >> v[i];
    ll sum = accumulate(ALL(v), 0LL);
    ll minv = 1e18;
    ll now = 0;
    REP(i, n - 1) {
        now += v[i];
        minv = min(minv, abs(sum - 2 * now));
    }
    cout << minv << endl;

    return 0;
}


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

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


Measured memory_bytes: 3116
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int visited[400005];
ll cnt,sum;
V<int> g[400005];
void dfs(int cur,int c){
    if(c==1)cnt++;
    sum++;
    visited[cur]=c;
    for(int v:g[cur]){
        if(visited[v]==0){
            dfs(v,-c);
        }
    }
}
const int dy=200005;
int main(){
    ll n;
    cin>>n;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        g[x].push_back(y+dy);
        g[y+dy].push_back(x);
    }
    for(int i=0;i<100005;i++){
        if(visited[i]!=0)continue;
        cnt=0;sum=0;
        dfs(i,1);
        ans+=cnt*(sum-cnt);
    }
    ans-=n;
    cout<<ans<<"\n";
}

Measured memory_bytes: 19800
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  double a,b;
  cin >> a >> b;
  cout << fixed << a/b << endl;
  return 0;
}


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

public class Main{
	public static void main(String[] augs){

	    int a,b;

	    Scanner scan = new Scanner(System.in);
	    a = Integer.parseInt(scan.next());
	    b = Integer.parseInt(scan.next());
	    if(a >= -1000 && b <= 1000){
	    if(a > b){
	    	System.out.println("a > b");
	    }else if(a < b){
	    	System.out.println("a < b");
	    }else if(a == b){
	    	System.out.println("a == b");
	    }
	    }
	
	}


}

Measured memory_bytes: 26032
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)


#define all all(v) v.begin(),v.end()
#define INF i<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;

typedef long long ll;
int s[30][10];
int H,W;
int ans = 0;
void drop(int iy,int x){
	for (int y = iy; y > 0; --y)
	{
		s[y][x] = s[y-1][x];
	}
}
void kesu(int y){
	int c = 1;
	int tmp = 0;
	for(int x = 0;x<7;x++){
		if(s[y][x]==tmp) c++;
		else{
			if(c>=3){
				if(tmp==0) continue;
				ans += tmp*c;
				for (int tx = x-1; tx > x-1-c ; --tx)
				{
					s[y][tx]=0;
				}
			}
			c = 1;
			tmp = s[y][x];
		}
	}
	// cout << "kesu:"<<ans<< endl;
}
int main(){
	while(1){
		cin >> H;
		if(H==0) break;
		ans = 0;
		rep(i,H+1){
			if(i==0){
				rep(j,7){
					s[i][j] = 0;
				}
			}else{
				rep(j,7){
					if(j==0) s[i][j]=0;
					else if(j==6) s[i][j]=0;
					else{
						cin >> s[i][j];
					} 
				}
			}
			
		}
		// rep(i,H+1){
		// 	rep(j,7){
		// 		cout<< s[i][j];
		// 	}
		// 	cout << endl;
		// }
		while(1){
			int tmpans = ans;
			rep(y,H+1){
				kesu(y);
			
			}
			// cout << tmpans << " " << ans << endl;
			if(tmpans==ans) break;
			for (int y = 1; y < H+1; ++y)
			{
				for(int x=1;x<6;++x){
					if(s[y][x]==0){
						drop(y,x);
					}
				}
			}
		}

		// rep(i,H+1){
		// 	rep(j,7){
		// 		cout<< s[i][j];
		// 	}
		// 	cout << endl;
		// }
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int N;
    cin >> N;
    vector<ll> w(N+1);
    rep2(i, 1, N+1) {
        cin >> w.at(i);
        w.at(i) += w.at(i-1);
    }
    
    vector<vector<ll> > dp(N+1, vector<ll>(N+1, INF)), k(N+1, vector<ll>(N+1));

    rep(i, N){
        dp[i][i] = 0;
        k[i][i] = i;
    }

    // dp[left][right] その部分をすべて1cmに切るときの最小コスト
    for(int len = 2; len <= N; len++) {
        for(int left = 0; left <= N-len; left++) {
            int right = left + len - 1;
            for(int mid = k[left][right-1]; mid <= k[left+1][right]; mid++){
                ll tmp = dp[left][mid] + dp[mid+1][right] + w[right+1] - w[left];
                if(tmp < dp[left][right]) {
                    dp[left][right] = tmp;
                    k[left][right] = mid;
                }
            }
        }
    }
    
    cout << dp[0][N-1] << endl;
}


Measured memory_bytes: 253444
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>b)
	printf("a > b\n");
	if(a<b)
	printf("a < b\n");
	if(a==b)
	printf("a == b\n");
	
	return 0;
}

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

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

    int n,d;
    cin>>n>>d;

    int ans=(n-1)/(d*2+1)+1;

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3644