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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int dp[10100][110][2];

signed main() {
  string K;
  int D;
  cin >> K >> D;

  m0(dp);
  dp[0][0][0] = 1;

  for (int i = 0; i < K.size(); i++) {
    for (int j = 0; j < D; j++) {
      for (int f = 0; f < 2; f++) {

        if (f == 0) {
          for (int k = 0; k <= (K[i] - '0'); k++) {

            if (k < K[i] - '0') {
              dp[i + 1][(j + k) % D][1] += dp[i][j][0];
              dp[i + 1][(j + k) % D][1] %= MOD;

            } else {
              dp[i + 1][(j + k) % D][0] += dp[i][j][0];
              dp[i + 1][(j + k) % D][0] %= MOD;
            }
          }

        } else {
          for (int k = 0; k <= 9; k++) {
            dp[i + 1][(j + k) % D][1] += dp[i][j][1];
            dp[i + 1][(j + k) % D][1] %= MOD;
          }
        }
      }
    }
  }

  cout << ((dp[K.size()][0][0] + dp[K.size()][0][1]) % MOD - 1 + MOD) % MOD << endl;
  return 0;
}


Measured memory_bytes: 17664
n,c,k=map(int,input().split())
t=[int(input()) for _ in range(n)]
t.sort()
ans=0
num=0
for i in range(n+3):
    if num>=n:
        break
    num2=t[num]+k
    ans+=1
    for j in range(c-1):
        num+=1
        if num==n:
            break
        if t[num]>num2:
            num-=1
            break
    num+=1
print(ans)


Measured memory_bytes: 13256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


int main() {
  ll n; cin >> n;
  Vll a(n); cin >> a;

  ll m = n/2;

  if (n % 2 == 1) {
    VVll dp(m+1, Vll(3));
    rep(i, m) {
      dp[i+1][2] =      dp[i][2] + a[2*i+2];
      chmax(dp[i+1][2], dp[i][1] + a[2*i+2]);
      chmax(dp[i+1][2], dp[i][0] + a[2*i+2]);

      dp[i+1][1] =      dp[i][1] + a[2*i+1];
      chmax(dp[i+1][1], dp[i][0] + a[2*i+1]);
      
      dp[i+1][0] =      dp[i][0] + a[2*i];
    }

    ll ans = *max_element(all(dp[m]));
    cout << ans << endl;
  }
  else {
    VVll dp(m+1, Vll(2));
    rep(i, m) {
      dp[i+1][1] =      dp[i][1] + a[2*i+1];
      chmax(dp[i+1][1], dp[i][0] + a[2*i+1]);
      
      dp[i+1][0] =      dp[i][0] + a[2*i];
    }

    ll ans = *max_element(all(dp[m]));
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 10276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
 
int main(){
  int n;
  cin >> n;
  VI a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  map<int ,int> b;
  for(int x:a){
    if(b.count(x)){
      b.at(x)++;
    }
    else{
      b[x]=0;
    }
  }
  cout << b.size() << endl;
      
}

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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmp=0;
vector<ll> A;

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        if(i==0&&a!=0) {
            cout << -1 << endl;
            return 0;
        }
        if(tmp+1<a) {
            cout << -1 << endl;
            return 0;
        }
        else {
            if(tmp+1>a) {
                ans += a;
            }
            else {
                ans += a-tmp;
            }
        }
        tmp = a;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<vector<int>> g;
int n;

vector<int> bfs(int s){
	vector<int> dist(n, -1);
	queue<int> que;
	dist[s] = 0;
	que.push(s);

	while(!que.empty()){
		auto v = que.front();
		que.pop();
		for(auto nv : g[v]){
			if(dist[nv] != -1)continue;
			dist[nv] = dist[v] + 1;
			que.push(nv);
		}
	}

	return dist;
}


int main(){
  int x, y;
  cin >> n >> x >> y;
  --x;
  --y;
  g.resize(n);
  for(int i = 0; i < n - 1; ++i){
  	g[i].push_back(i + 1);
  	g[i + 1].push_back(i);
  }
  g[x].push_back(y);
  g[y].push_back(x);

  map<int, int> dist_map;
  for(int i = 0; i < n - 1; ++i){
  	auto dist = bfs(i);
  	for(int j = i + 1; j < n; ++j){
  		++dist_map[dist[j]];
  	}
  }

  for(int i = 1; i < n; ++i){
  	cout << dist_map[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 512
package main

import (
	"fmt"
)

var n int

func main() {
	fmt.Scan(&n)
	bits := make([]int, 0)

	for n != 0 {
		if abs(n)%2 == 1 {
			bits = append(bits, 1)
			n--
		} else {
			bits = append(bits, 0)
		}
		n /= 2
		n *= -1
	}

	if len(bits) == 0 {
		fmt.Println(0)
		return
	}
	for i := len(bits); i > 0; i-- {
		fmt.Printf("%d", bits[i-1])
	}
	fmt.Print("\n")
}

func abs(n int) int {
	if n > 0 {
		return n
	} else {
		return -n
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstring>
using namespace std;

#define N 500

int main(void){
	string str;
	string word[N];
	int n = 0;
	
	getline(cin, str);
	for(int i = 0; i < str.length(); ++i) {
		if(str[i] == ',' || str[i] == '.') str[i] = ' ';
	}
	
	istringstream iss(str);
	string s;
	
	while(iss >> s) {
		int len = s.length();
		if(3 <= len && len <= 6) {
			word[n] = s;
			++n;
		}
	}
	for(int i = 0; i < n; ++i) {
		cout << word[i];
		if(i + 1 < n) cout << ' ';
	}
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 3100
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        long A = sc.nextLong();
        long B = sc.nextLong();
        sc.close();

        long n = gcd(A, B);
        long max = n;
        long count = 1;
        for(int i = 2; i <= Math.sqrt(max); i++){
            if(n%i == 0){
                while(n%i == 0){
                    n /= i;
                }
                count++;
            }
        }
        if(n != 1)
            count++;
        System.out.println(count);
    }
    static long gcd(long a, long b){
        if(a < b){
            return gcd(b, a);
        } else {
            if(b == 0)
                return a;
            else
                return gcd(b, a%b);
        }
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d,m;
  while(cin>>n>>d,n||d){
    int i,j,k;
    vector<int> v[n];
    int sum[n];
    int ma=0,mi=1000000000;
    for(i=0;i<n;i++){
      cin >> m;
      sum[i]=0;
      for(j=0;j<m;j++){
	cin >> k;
	sum[i]+=k;
	v[i].push_back(k);
      }
      ma=max(ma,sum[i]);
      mi=min(mi,sum[i]);
    }
    bool f=true,ff=false;
    while(f){
      f=false;
      ff=true;
      for(i=0;i<n;i++){
	if(v[i].size()==0) continue;
	ff=false;
	k=v[i][v[i].size()-1];
	ma=0;mi=1000000000;
	for(j=0;j<n;j++){
	  if(i==j) continue;
	  ma=max(ma,sum[j]);
	  mi=min(mi,sum[j]);
	}
	if(abs(ma-(sum[i]-k))<=d&&abs(mi-(sum[i]-k))<=d){
	  //cout << k << endl;
	  sum[i]-=k;
	  v[i].pop_back();
	  f=true;
	  break;
	}
      }
      
    }
    if(ff) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

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


using namespace std;
int flag[26];
int main() {

    string a;
    cin>>a;

    for(int i=0;i<26;i++) {
        flag[i]=0;
    }
    for(int i=0;i<a.size();i++) {
        int x=a[i]-'a';
        flag[x]++;

    }
    for(int i=0;i<26;i++) {
        if(flag[i]==0) {
            cout<<char('a'+i);
            return 0;
        }
    }

    cout<<"None"<<endl;


return 0;
}


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

using namespace std;

#define endl "\n"
typedef long long int ll;

inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}

//DEBUG
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;

ll INF = 1e10;
int MOD = 1e9+7;

int n;
vector<int> a;
vector<ll> pre;

ll dp[3001][3001][2];

ll calcts(int l, int r, int chance){
    if(l > r) return 0;
    if(l == r) return (n%2==1) ? a[l] : 0;
    ll seg = pre[r+1] - pre[l];
    if(dp[l][r][chance] > 0) return dp[l][r][chance];
    if(chance == 0){
        ll cr = calcts(l,r-1,1) + a[r];
        ll cl = calcts(l+1,r,1) + a[l];
        ll jiroR = seg - cr;
        ll jiroL = seg - cl;
        dp[l][r][chance] = (cr - jiroR > cl - jiroL) ? cr : cl;
    }
    else{
        ll taroR = calcts(l,r-1,0);
        ll cr = seg - taroR;
        ll taroL = calcts(l+1,r,0);
        ll cl = seg - taroL;
        dp[l][r][chance] =  (taroR - cr > taroL - cl) ? taroL : taroR;
    }
    return dp[l][r][chance];
}

int main(){
    #ifndef ONLINE_JUDGE
        freopen("debug.txt", "w", stderr);
    #endif
    fastio();
    cin>>n;
    a.resize(n);
    pre.resize(n+1);
    for(int i=0;i<n;++i){
        cin>>a[i];
        pre[i+1] = pre[i]+a[i];
    }
    memset(dp, -1, sizeof(dp));
    ll ts = calcts(0,n-1,0);
    dbg(ts);
    cout<<(2*ts - pre[n]);
    return 0;
}


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

int main() {
	int N, X; cin >> N >> X;
	vector<int> D(N + 1);
	D[0] = 0;
	for (int i = 0; i < N; ++i) {
				int x; cin >> x;
		D[i + 1] = D[i] + x;
	}
	int ans = 0;
	for (int i = 0; i <= N; ++i) {
				if (D[i] <= X) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define ull unsigned long long
#define ll long long
#define null NULL
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define ff first
#define ss second

int main (){
	IOS
	ll s , w ;
	cin >> s >> w ;
	if(w>=s)cout <<"unsafe" ;
	else cout <<"safe" ;
	return 0 ;
}
		

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
    char s;
    cin >> s;
    if(isupper(s))
        cout << "A" << endl;
    else
    {
        cout << "a" << endl;
    }
    
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <tuple>
#include <iomanip>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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


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

	if (b % a == 0){
		cout << a + b << endl;
	}
	else {
		cout << b - a << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
typedef  pair<int, int> iPair; 
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
   
}
    
ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}
 
ll minl(ll a,ll b){
    if(a>b)return b;
    return a;
}
 
ll mod = 998244353;
 
ll mulmod(ll a, ll b,ll c){ 
    ll res = 0; 
    a = a % c; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % c;
        }
        a = (a * 2) % c; 
        b /= 2; 
    } 
    return res % c; 
}
 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
} 
 
int a[100005];
int tree[200005];
 
void build(int st,int low,int high){
    if(low==high){
        tree[st] = a[high]%2;
        return;
    }
    int mid = low+(high-low)/2;
    build(2*st,low,mid);
    build(2*st+1,mid+1,high);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
void update(int st,int start,int end,int ind,int val){
    if(start==end){
        tree[st] = val%2;
        return;
    }
    int mid = start+(end-start)/2;
    if(ind<=mid){
        update(2*st,start,mid,ind,val);
    }
    else update(2*st+1,mid+1,end,ind,val);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
int query(int st,int start,int end,int low,int high){
    if(start>high || end<low)return 0;
    int mid = start + (end-start)/2;
    if(start==low && end==high){
        return tree[st];
    }
    if(low>mid)return query(2*st+1,mid+1,end,low,high);
    if(high<=mid)return query(2*st,start,mid,low,high);
    return query(2*st,start,mid,low,mid)+query(2*st+1,mid+1,end,mid+1,high);
}

int main()
{
        ios_base::sync_with_stdio(false);
        ll n,m;
        cin >> n >> m;
        ll a[n];
        priority_queue<ll> pq;
        for(int i=0;i<n;i++){
            cin >> a[i];
            pq.push(a[i]);
        }
        ll ans = 0;
        for(int i=0;i<m;i++){
            ll temp = pq.top();
            pq.pop();
            temp/=2;
            pq.push(temp);
        }
        while(!pq.empty()){
            ans+=pq.top();
            pq.pop();
        }
        cout << ans << endl;
        
        return 0;
}

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

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

def main():
    mod=10**9+7
    N=I()
    from collections import defaultdict
    dd = defaultdict(int)
    
    a=LI()
    for i in range(N):
        
        dd[a[i]]+=1
        dd[a[i]-1]+=1
        dd[a[i]+1]+=1
        
    ans=0
    for k,v in dd.items():
        ans=max(ans,v)
        
    print(ans)

main()


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

void Csum(vector<ll> &x){
  for(int i=0;i<x.size()-1;i++){
      x[i+1]+=x[i];
  }
  return ;
}


int main() {
  ll N;
  cin>>N;
  vector<ll> big(N);
  for(ll i=0;i<N;i++){
    cin>>big[i];
  }
  sort(big.begin(),big.end());
  Csum(big);
  ll cnt=1;
  for(int i=1;i<N;i++){
    if(big[i-1]*3>=big[i]){
      cnt++;
    }
    else{
      cnt=1;
    }
    
    if(i==N-1){
      cout<<cnt;
    }
  }
}

Measured memory_bytes: 1024
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <random>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n,c,k;
	cin >> n >> c>>k;
	if (c == 1) {
		cout << n << endl;
		return 0;
	}
	vector<int> sorter;
	REP(i, n) {
		int hoge;
		cin >> hoge;
		sorter.push_back(hoge);
	}
	sort(sorter.begin(), sorter.end());
	int now_back = 0;
	int now_cnt = 0;
	int ans = 0;
	now_back = sorter[0];
	now_cnt++;
	for (int i = 0;i < n-1;++i) {
		int a = sorter[i+1];
		if (now_back == 0) {
			now_back = a;
		}
		if (a - now_back > k) {
			now_back = a;
			ans++;
			now_cnt = 0;
		}
		now_cnt++;
		if (now_cnt == c) {
			ans++;
			now_cnt = 0;
			now_back = 0;
		}
	}
	if (now_back != 0) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string O, E;
    cin >> O >> E;
    int o = O.length();
    int e = E.length();

    if (o == e){
        for (int i = 0; i < o; i++){
        cout << O[i] << E[i];
        }
        cout << endl;
    }
    else{
        for (int i = 0; i < e; i++){
        cout << O[i] << E[i];
        }
        cout << O[o-1] << endl;
    }

}

Measured memory_bytes: 764
#include <stdio.h>
#include <string.h>
#include <algorithm>

const int kN = 4000 + 5;
int n, k;
int sum[2][kN][kN];

int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++ i) {
        int x, y;
        char s[2];
        scanf("%d%d%s", &x, &y, s);
        x %= 2 * k;
        y %= 2 * k;
        int b = s[0] == 'B';
        sum[b][x][y] ++;
        sum[b][x + 2 * k][y] ++;
        sum[b][x][y + 2 * k] ++;
        sum[b][x + 2 * k][y + 2 * k] ++;
    }
    for (int b = 0; b < 2; ++ b)
        for (int i = 4 * k; i >= 0; -- i)
            for (int j = 4 * k; j >= 0; -- j)
                sum[b][i][j] += sum[b][i + 1][j] + sum[b][i][j + 1] - sum[b][i + 1][j + 1];
    int result = 0;
    auto calc = [&](int b, int x, int y) {
        return sum[b][x][y] - sum[b][x + k][y] - sum[b][x][y + k] + sum[b][x + k][y + k];
    };
    for (int lx = 0; lx < k * 2; ++ lx) {
        for (int ly = 0; ly < k * 2; ++ ly) {
            int candidate = calc(0, lx, ly) + calc(0, lx + k, ly + k) + calc(1, lx + k, ly) + calc(1, lx, ly + k);
            result = std::max(result, candidate);
        }
    }
    printf("%d\n", result);
}


Measured memory_bytes: 125568
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
#define mn -
#define mod %
#define E =
#define EE ==

/**  '' "\n" - ^ **/
template<class T>  T diff(T a, T b)
{
    return a - b;
}

template<class T>  void eql(T &a, T b)
{
    a=b;
}

template<class T>  bool equal(T a, T b)
{
    return ( a==b);
}

typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;


int main() {
    int n;
    cin>>n;
    vi a(n);
    int f,s;
    eql<int>(f,0);
    eql<int>(s,0);
    in(i,n)
    {
        cin>>a[i];
        if(a[i]>f)
        {
            eql<int>(s,f);
            eql<int>(f,a[i]);
        }
        else if(a[i]>s)
        {
            eql<int>(s,a[i]);
        }
        //cout<<s;ps();cout<<f<<endl;
    }
    in(i,n)
    {
        if(equal(a[i],f))
        {
            pf(s);
        }
        else
        {
            pf(f);
        }
    }
}


Measured memory_bytes: 2432
#include<stdio.h>
#include<string.h>
#define LEN 100000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P);
P dequeue();

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n+1;
  while(head != tail) {
    u = dequeue();
    if(u.t > q) {
      elaps += q;
      u.t -= q;
      enqueue(u);
    } else {
      elaps += u.t;
      u.t = 0;
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

void enqueue(P x){
  Q[tail] = x;
  if(tail == LEN) tail = 1;
  else tail++;
}

P dequeue(){
  P x = Q[head];
  if(head == LEN) head = 1;
  else head++;
  return x;
}

Measured memory_bytes: 10756
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;

vector<ll>graph[100010];
ll vertice;
ll dp[100010][2];

void DFS(ll start,ll parent)
{
    ll size=graph[start].size();
    dp[start][0]=dp[start][1]=1;
    if(size==1 && graph[start][0]==parent)
    {
        return;
    }
    ll store;
    for(ll i=0;i<size;i++)
    {
        store=graph[start][i];
        if(store!=parent)
        {
            DFS(store,start);
        }
    }
    ll val;
    for(ll i=0;i<size;i++)
    {
        store=graph[start][i];
        if(store==parent)
        {
            continue;
        }
        val=dp[store][0]+dp[store][1];
        dp[start][0]=(dp[start][0]*val)%MOD;
        val=dp[store][0];
        dp[start][1]=(dp[start][1]*val)%MOD;
    }
}

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

    ll vert1,vert2;    
    cin>>vertice;
    for(ll i=1;i<vertice;i++)
    {
        cin>>vert1>>vert2;
        graph[vert1].push_back(vert2);
        graph[vert2].push_back(vert1);
    }
    DFS(1,-1);
    ll ans=(dp[1][1]+dp[1][0])%MOD;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    int x,two=0,four=0;
    rep(i,n){
        in(x);
        if(x%4==0){
            four++;
        }else if(x%2==0){
            two++;
        }
    }
    int ryoiki=0;
    ryoiki+=2*four;
    if(two>=2){
        ryoiki+=two-1;
    }
    yn(ryoiki>=n-1);
}

Measured memory_bytes: 3772
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(map(int,readline().split()))

if N == 2:
  print(max(A))
  exit(0)

def gcd(a,b):
  if a < b:
    a,b = b,a
  while a%b > 0:
    a,b = b,a%b
  return b

left = [None] * N
left[0] = A[0]
for i in range(1, len(A)):
  left[i] = gcd(left[i - 1],A[i])

right = [None] * N
right[-1] = A[-1]
for i in range(len(A) - 2,-1,-1):
  right[i] = gcd(right[i + 1],A[i])

ans = max(left[-2],right[1])
for i in range(1, len(A) - 1):
  g = gcd(left[i - 1],right[i + 1])
  if ans < g:
    ans = g
print(ans)


Measured memory_bytes: 14196
#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 lo(i,a,b) for(int i=a;i<b;i++)
#define rlo(i,n) for(int i=n-1;i>=0;i--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define pr(a) {for(auto x:a)cout<<x<<" ";cout<<nl;}
#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);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

void f()
{
  string s;
  int r=0;
  cin>>s;
  for(int i=0;i<sz(s);i++)
  {
    r+=(s[i]-'0')%9;
  }
  if(r%9==0)
    yes;
  else
    no;
}

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


Measured memory_bytes: 3740
n,k = map(int,input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = 0
#con = cmb(n,k,mod)
#print(con)
for i in range(min(k+1,n+1)):
    ans += cmb(n,i,mod)*cmb(n-1,i,mod)
    ans %= mod
    
print(ans)

Measured memory_bytes: 27068
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final long a = scanner.nextInt();
        final long b = scanner.nextInt();
        final long c = scanner.nextInt();
        final long d = scanner.nextInt();

        System.out.println(max(a * c, a * d, b * c, b * d));
    }

    private static long max(final long... l) {
        Arrays.sort(l);
        return l[l.length - 1];
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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


Measured memory_bytes: 32808
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on

int M, N;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  vector<string> A(N), B(M);
  REP(i, N) cin >> A[i];
  REP(i, M) cin >> B[i];

  bool flag = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      flag = true;
      for (int k = 0; k < M; k++) {
        for (int l = 0; l < M; l++) {
          if (i + k >= N || j + l >= N) {
            flag = false;
            break;
          }
          if (A[i + k][j + l] != B[k][l]) {
            flag = false;
            break;
          }
        }
      }
      if (flag) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MX = 200005;
vector<int> to[MX];
vector<int> to2[MX]; 
vector<int> group[MX];
vector<int> group2(MX);
void dfs(int v, int i,int p = -1) {
	group[i].push_back(v);
	group2[v] = i;
	for (int u : to[v]) {
		if (u == p) continue;
		if (0 == group2[u]) {
			dfs(u, i, v);
		}
	}
	//cout <<v<<" "<<in[v]<<" "<<out[v]<<endl;
	return;
}

int main() {
	int N, M, K;
	cin >>N>>M>> K;
	vector<pair<int,int>>P;
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		to[a].push_back(b);
		to[b].push_back(a); 
		P.push_back(make_pair(a, b));
	}	
	for (int i = 0; i < K; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		to2[a].push_back(b);
		to2[b].push_back(a);
		P.push_back(make_pair(a, b));
	}
	int num = 1;
	for (int n = 0;n < N;++n) {
		if (0 == group2[n]) {
			dfs(n, num);
			num++;
		}
	}
	vector<int> Ans(N);
	for (int i = 1;i<num;++i) {
		for (int j = 0; j < group[i].size();++j) {
			Ans[group[i][j]] = group[i].size()-1;
		}
	}
	for (int i = 0;i<P.size();++i) {
		if (group2[P[i].first] == group2[P[i].second]) {
			Ans[P[i].first]--;
			Ans[P[i].second]--;
		}
	}


	for (int i = 0; i < N; ++i) {
		if (0 != i) {
			cout << " ";
		}
		cout << Ans[i];
	}
	return 0;
}

Measured memory_bytes: 28228
fn main() {
    loop {
        let (n, x) = read_tuple::<i64>();

        if n == 0 && x == 0 {
            break;
        }

        println!("{}", dfs(n, x, &mut vec![]));
    }
}

fn dfs(n: i64, x: i64, seq: &mut Vec<i64>) -> i64 {
    if seq.len() == 3 {
        return (seq.iter().sum::<i64>() == x) as i64 
    }

    let mut ans = 0;
    let v: i64 = *seq.last().unwrap_or(&0) + 1;
    for i in v..(n + 1) {
        seq.push(i);
        ans += dfs(n, x, seq);
        seq.pop();
    }

    ans
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let temp = read_vec();
    (temp[0], temp[1])
}



Measured memory_bytes: 5032
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<int> A(N, 0);
	int all_xor = 0;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		all_xor ^= A[i];
	}

	for (int i = 0; i < N; i++)
	{
		cout << (all_xor ^ A[i]) << " ";
	}
	
	return 0;
}


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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> ans( N );
	for( int i = 0; i < M; i++ ) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		ans[a]++;
		ans[b]++;
	}

	for( int i = 0; i < N; i++ ) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 3604
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int x,a,b;
	scanf("%d",&x);
	if(x == 1)
		{printf("Hello World\n");}
	else {
		   scanf("%d %d",&a,&b);
		   printf("%d\n",a + b);}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main() {
	int A[MAX], B[MAX];
	
	int C[VMAX + 1];
	int n, i, j;
	scanf("%d", &n);
	for ( i = 0; i < VMAX; i++ ) C[i] = 0;
	
	for ( i = 0; i < n; i++ ) {
		scanf("%d", &A[i + 1]);
		C[A[i + 1]]++;
	}
	
	for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];
	
	for( j = 1; j <= n; j++ ) {
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	
	for ( i = 1; i <= n; i++ ) {
		if ( i > 1 ) printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");
	
	return 0;
} 


Measured memory_bytes: 18288
#include<iostream>
using namespace std;
int main()
{
    int d,n;
    cin >> d >> n;
    if(n == 100)
    {
        n++;
    }
    if(d == 0)
    {
        cout << n << endl;
    }
    if(d == 1)
    {
        cout << 100 * n << endl;
    }
    if(d == 2)
    {
        cout << 10000 * n << endl;
    }
}

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

int main(){
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        string x, y;
        cin >> x >> y;
        vector<vector<int>> dp(x.size()+1, vector<int>(y.size()+1, 0));
        
        for(int j = 1; j <= x.size(); j++){
            for(int k = 1; k <= y.size(); k++){
                if(x[j-1] == y[k-1]) dp[j][k] = dp[j-1][k-1]+1;
                dp[j][k] = max(dp[j][k], max(dp[j-1][k], dp[j][k-1]));
            }
        }

        cout << dp[x.size()][y.size()] << endl;
    }   
}


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

int main() {
	int	N, Q;
	cin >> N >> Q;
	vector<queue<int>> vec(N);
	rep(i, Q)
	{
		int a, b;
		cin >> a >> b;
		if (a == 0)
		{
			int	c;
			cin >> c;
			vec.at(b).push(c);
		}
		else if (!vec.at(b).empty())
		{
			if (a == 1)
				cout << vec.at(b).front() << endl;
			else if (a == 2)
				vec.at(b).pop();

		}
	}
}



Measured memory_bytes: 4320
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=100005;
const int maxm=200005;

struct Edge
{
    int u,v,dist;
    Edge(){}
    Edge(int u,int v,int d):u(u),v(v),dist(d){}
    bool operator<(const Edge &rhs)const
    {
        return dist < rhs.dist;
    }
};
 struct node
 {
     int x,y,id;
 }p[maxn];
 bool cmp(node a,node b)
 {
     return a.x<b.x;
 }
 bool cmp2(node a,node b)
 {
     return a.y<b.y;
 }
struct Kruskal
{
    int n,m;
    Edge edges[maxm];
    int fa[maxn];
    int findset(int x){ return fa[x]==-1? x:fa[x]=findset(fa[x]); }

    void init(int n)
    {
        this->n=n;
        m=0;
        memset(fa,-1,sizeof(fa));
    }

    void AddEdge(int u,int v,int dist)
    {
        edges[m++]=Edge(u,v,dist);
    }

    ll kruskal()
    {
        ll sum=0;
        int cnt=0;
        sort(edges,edges+m);

        for(int i=0;i<m;i++)
        {
            int u=edges[i].u, v=edges[i].v;
            if(findset(u) != findset(v))
            {

                sum +=edges[i].dist;
                fa[findset(u)] = findset(v);
                if(++cnt>=n-1) break;
            }
        }
        if(cnt<n-1) return -1;
        return sum;
    }
}KK;



int main()
{
    int n;
    while(scanf("%d",&n)==1)
    {
        KK.init(n);
        for(int i=1;i<=n;i++)
            {scanf("%d%d",&p[i].x,&p[i].y);
        p[i].id=i;
    }
    sort(p+1,p+n+1,cmp);
    for(int i=1;i<n;i++)
       KK.AddEdge(p[i].id,p[i+1].id,abs(p[i+1].x-p[i].x));
    sort(p+1,p+n+1,cmp2);
    for(int i=1;i<n;i++)
        KK.AddEdge(p[i].id,p[i+1].id,abs(p[i+1].y-p[i].y));
    printf("%lld\n",KK.kruskal());
    }
    return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
    cs
    int n;bool b=1;ll t=0;
    cin>>n;
    vector<pair<int,int>> v(n);
    rep(i,n) cin>>v[i].second>>v[i].first;
    sort(v.begin(),v.end());
    rep(i,n) {
        t+=v[i].second;
        if(t>v[i].first) {b=0;break;}
    }
    b==1 ? cout<<"Yes" : cout<<"No";
}

Measured memory_bytes: 1792
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "PP.hpp"
#define deb(x...) cerr << "[" << #x << "] = " << x << "\n";
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
  	
	int n;string s;
	cin >> n >> s;
	if(n < 3200)puts("red");
	else cout << s << '\n';
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
const int _N = (int)1e5 + 5;
const long long MOD = (long long)1e9 + 7;

int n, arr[_N], res = 0;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	for (int i = 1; i <= n; i++) {
		if (arr[arr[i]] == i) res++;
	}
	cout << res / 2 << endl;
	return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

const int MAX_N = 14;
const int INF = 1<<29;

int N;
string strs[MAX_N+1];
int memo[MAX_N+1][1<<(MAX_N+1)];
bool visited[MAX_N+1][1<<(MAX_N+1)];
int cross[MAX_N+1][MAX_N+1];

bool init(){
	scanf("%d ", &N);
	if(!N){
		return false;
	}
	
	memset(visited, false, sizeof(visited));
	for(int i=0; i<N; i++){
		char buf[22];
		scanf("%s ", buf);
		strs[i] = string(buf);
	}
	
	return true;
}

//aªbÉ®SÉÜÜêé©Ç¤©
bool is_included(const string& a, const string& b){
	if(a.length() > b.length()){
		return false;
	}
	
	for(int i=0; i+(int)a.length() <= (int)b.length(); i++){
		if(b.substr(i, a.length()) == a){
			return true;
		}
	}
	
	return false;
}

//d¡âïÜÖWÉ éàÌðæè­
void pre(){
	bool valid[MAX_N];
	memset(valid, true, sizeof(valid));
	for(int i=0; i<N; i++){
		for(int j=i+1; j<N; j++){
			if(strs[i] == strs[j]){
				valid[j] = false;
			}
		}
	}
	
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(i!=j && valid[i] && valid[j] && is_included(strs[i], strs[j]) ){
				valid[i] = false;
			}
		}
	}
	
	string tmp[MAX_N];
	for(int i=0; i<N; i++){
		tmp[i] = strs[i];
	}
	
	int p = 0;
	for(int i=0; i<N; i++)if(valid[i]){
		strs[p++] = tmp[i];
	}
	N = p;
	
	if(0)for(int i=0; i<N; i++){
		puts(strs[i].c_str());
	}
}


int sub(const string& a, const string& b){
	int ret = b.length();
	//dÍð··é¶
	for(int d=1; d<(int)min(a.length(), b.length()); d++){
		if(a.substr((int)a.length()-d) == b.substr(0, d)){
			ret = (int)b.length() - d;
		}
	}
	return ret;
}

//aÌãÉbðu­Æ½¶LÑé©ðcross[a][b]Éüêé
void pre2(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++)if(i!=j){
			cross[i][j] = sub(strs[i], strs[j]);
		}
	}
	for(int i=0; i<N; i++){
		cross[N][i] = strs[i].length();
	}
}

//¡ÌæªðpÉµÄAgpÏÈàÌªbit
int rec(int p, int bit){
	//»
	if(visited[p][bit]){
		return memo[p][bit];
	}
	visited[p][bit] = true;
	
	int& ret = memo[p][bit];
	ret = INF;
	
	//îê
	if(bit == (1<<N)-1){
		return ret = 0;
	}
	
	for(int i=0; i<N; i++)if( !((bit>>i)&1) ){
		ret = min(ret, rec(i, bit | (1<<i)) + cross[p][i]);
	}
	
	return ret;
}

int solve(){
	pre();
	pre2();
	return rec(N, 0);
}

int main(){
	while(init()){
		printf("%d\n", solve());
	}
	
	return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env python3
import sys
import collections

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Y = map(int, readline().split())
assert Y % 1000 == 0
Y //= 1000


def solve2():
    for x1 in range(N + 1):
        for x2 in range(N - x1 + 1):
            x3 = N - x1 - x2
            if 10 * x1 + 5 * x2 + 1 * x3 == Y:
                print(x1, x2, x3)
                return
    print(-1, -1, -1)



if __name__ == "__main__":
    solve2()


Measured memory_bytes: 3316
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        BigInteger X = BigInteger.valueOf(x);
        for(int a = -1000;a<=1000;a++){
            for(int b=-1000;b<=1000;b++){
                BigInteger A = BigInteger.valueOf(a);
                A = A.pow(5);
                BigInteger B = BigInteger.valueOf(b);
                B = B.pow(5);
                if(A.subtract(B).equals(X)){
                    System.out.println(a+" "+b);
                    return;
                }
            }
        }
        throw new Error();
    }

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


Measured memory_bytes: 61308
N = int(raw_input())
d = map(int, raw_input().split())

sum1 = 0
for i in range(N):
    sum1 = sum1 + d[i]

sum1 = sum1*sum1

sum2 = 0
for i in range(N):
    sum2 = sum2 + d[i]**2

print (sum1 - sum2)/2

Measured memory_bytes: 2568
///created: 29/May/2019 08:42:56

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 3;
int h[N], n, k;

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &h[i]);
	sort(h + 1, h + 1 + n);
	int ans = 1e9 + 7;
	for (int i = 1; i <= n - k + 1; ++i)
		ans = min(ans, h[i + k - 1] - h[i]);
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 640
import itertools
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
def invnum(n,a):
    bit=Bit(n)
    res=0
    for j in range(n):
        res+=j-bit.sum(a[j])
        bit.add(a[j],1)
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
flag=0
M=-1
if N%2==0:
    M=N//2
else:
    M=N//2+1
ans=(N*(N-1))//2
for seq in itertools.combinations(range(N),M):
    X=[]
    Y=[]
    era=[0 for i in range(N)]
    for i in seq:
        if i%2==0:
            X.append((A[i],i))
        else:
            X.append((B[i],i))
        era[i]=1
    for i in range(N):
        if era[i]==0:
            if i%2==0:
                Y.append((B[i],i))
            else:
                Y.append((A[i],i))
    X.sort()
    Y.sort()
    L=[]
    if N%2==1:
        for i in range(M-1):
            L.append(X[i])
            L.append(Y[i])
        L.append(X[-1])
    else:
        for i in range(M):
            L.append(X[i])
            L.append(Y[i])
    #print(L)
    flag2=1
    for i in range(N-1):
        if L[i][0]>L[i+1][0]:
            flag2=0
            break
    if flag2==1:
        flag=1
        S=[L[i][1] for i in range(N)]
        tmp=0
        for i in range(N):
            for j in range(i+1,N):
                if S[i]>S[j]:
                    tmp+=1
        ans=min(tmp,ans)
if flag==1:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 52316