akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

signed main(void)
{
    ll x, a;
    cin >> x >> a;
    if (x < a) 
        mes(0);
    if(x >= a)
        mes(10);
    
    
}

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

int main(){
    string s,t;
    cin >> s >> t;
    int res = 0;
    rep(i,3){
        if(s[i] == t[i]) res++;
    }
    cout << res << endl;
}

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

long long a, b, k;

int main() {
	cin >> a >> b >> k;
	if (k > a) {
		k -= a;
		if (k > b)
			cout << 0 << ' ' << 0;
		else
			cout << 0 << ' ' << b - k;
	}
	else
		cout << a - k << ' ' << b;
		
}

Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iterator>
#include<cstring>
#include<cstdio>
using namespace std;
int o[111111],r[111111],cr;
long long d[111111],x[111111];
bool viz[111111];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%lld",&x[i]);
	for(int i=1;i<=n;++i)
		d[i]=x[i+1]-x[i];
	int m;
	long long k;
	scanf("%d%lld",&m,&k);
	for(int i=1;i<=n;++i)o[i]=i;
	for(int i=1;i<=m;++i)
	{
		int a;
		scanf("%d",&a);
		swap(o[a],o[a-1]);
	}
	for(int i=1;i<=n;++i)
		if(!viz[i])
		{
			cr=0;
			int j=i;
			do viz[r[cr++]=j]=1;while((j=o[j])!=i);
			for(j=0;j<cr;++j)
				o[r[j]]=r[(j+k)%cr];
		}
	for(int i=1;i<=n;++i)
		x[i]=d[o[i]];
	for(int i=n;i;--i)
		x[i]=x[i+1]-x[i];
	for(int i=1;i<=n;++i)
		printf("%lld.0\n",x[i]);
	return 0;
}

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

int main(){
  int N,p,A=0,cnt;
  cin >> N;
  for(int i=1;i<=N;i++){
    cnt=0;
    if(i%2!=0){
      for(int j=1;j<=i;j=j+2){
        if(i%j==0) cnt++;
      }
      if(cnt==8) A++;
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
S = input()
S = S.replace('BC', 'D')
length = len(S)

ans = 0
count_a = 0
for i in range(length):
  c = S[i]

  if c == 'A':
    count_a += 1
  elif c == 'D':
    ans += count_a
  else:
    count_a = 0

print(ans)


Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<int,int>;
using  v = vector<ll>;

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

   auto x = vector<int>(n,0);
   for (int i = 0; i < n; i++)
   {
      cin >> x[i];
   }
   
   ll sum =0;
   for (int i = 0; i < n; i++)
   {
      sum += min(2*x[i],2*(k-x[i]));
   }
   cout << sum;

   return 0;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 100005;
const ld pi = 3.141592653;
const ll MOD = 1000000007;

using namespace std;

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

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1, cac=0, cwa=0, ctle=0, cre=0;
        cin>>T;
        while(T--)
        {
                string s;
                cin>>s;
                if(s[0]=='A') cac++;
                else if(s[0]=='W') cwa++;
                else if(s[0]=='T') ctle++;
                else cre++; 
        }
        cout<<"AC x "<<cac<<"\n";
        cout<<"WA x "<<cwa<<"\n";
        cout<<"TLE x "<<ctle<<"\n";
        cout<<"RE x "<<cre<<"\n";
        return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}


int main() {
    ll a, v, b, w, t; cin >> a >> v >> b >> w >> t;
    if (v <= w) cout << "NO" << endl;
    else {
        ll k = abs(a - b);
        if (t * (v-w) >= k) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

Measured memory_bytes: 3640
N = int(input())
D = []
for i in range(N):
    a,b = map(int,input().split())
    D.append([a,b])
for i in range(N-2):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1]:
            if D[i+2][0] == D[i+2][1]:
                print('Yes')
                exit()
print('No')

Measured memory_bytes: 62312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll N, ans = 0;
  string S;
  cin >> N >> S;
  
  for (int i = 0; i < 1000; i++) {
    string num = "";
    if (i < 100) num += '0';
    if (i < 10) num += '0';
    num += to_string(i);
    bool third = false, second = false, first = false;
    for (int j = 0; j < S.size(); j++) {
      if (!third) {
        if (S.at(j) == num.at(0)) {
          third = true;
        }
        continue;
      }
      else if (third && !second) {
        if (S.at(j) == num.at(1)) {
          second = true;
        }
        continue;
      }
      else if (third && second && !first) {
        if (S.at(j) == num.at(2)) {
          ans++;
          break;
        }
      }
    }
  }

  cout << ans << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0 ; i < n ; i++) {
            x[i] = sc.nextInt();
        }
        int ans = 10000000;
        for (int i = 0 ; i <= 100 ; i++) {
            int sum = 0;
            for (int j = 0 ; j < n ; j++) {
                sum += (x[j] - i) * (x[j] - i);
            }
            ans = Math.min(ans, sum);
        }
        System.out.println(ans);
    }

}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, Q;
	vector<llong> a;
	vector<P> xy;

	cin >> N;
	a.resize(N);
	for(int i = 0; i < N; i++)
		cin >> a[i];
	cin >> Q;
	xy.resize(Q);
	for(int i = 0; i < Q; i++)
		cin >> xy[i].first >> xy[i].second;

	vector<llong> ok = a;
	vector<bool> same(N, false);
	llong many = 0;
	sort(BE(ok));
	for(int i = 0; i < N; i++)
		if(a[i] == ok[i])
			same[i] = true, many++;

	if(many == N){
		cout << 0 << endl;
	}else{
		llong ans = -1;
		for(int i = 1; i <= Q; i++){
			int l = xy[i-1].first-1, r = xy[i-1].second-1;
			swap(a[l], a[r]);
			if(a[l] == ok[l] && same[l] == false)
				same[l] = true, many++;
			else if(a[l] != ok[l] && same[l] == true)
				same[l] = false, many--;

			if(a[r] == ok[r] && same[r] == false)
				same[r] = true, many++;
			else if(a[r] != ok[r] && same[r] == true)
				same[r] = false, many--;

			if(many == N){
				ans = i;
				break;
			}
		}

		cout << ans << endl;
	}


	return 0;
}


Measured memory_bytes: 12372
s = input()
f = lambda x: '+' if x>0 else '-'
for i in range(-1, 3, 2):
    for j in range(-1, 3, 2):
        for k in range(-1, 3, 2):
            if int(s[0])+i*int(s[1])+j*int(s[2])+k*int(s[3])==7:
                print(s[0]+f(i)+s[1]+f(j)+s[2]+f(k)+s[3]+'=7')
                break
        else:
            continue
        break
    else:
        continue
    break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V) \
  for (auto v : (V)) cout << v << " "
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  print(count(ALL(S), '+') - count(ALL(S), '-'));
  return 0;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> vec(N); 
	
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	sort(vec.begin(), vec.end());
	
	if(vec.at(N-1) < 0)
		cout << vec.at(N-1) - vec.at(0) * -1 << endl;
	else
		cout << vec.at(N-1) - vec.at(0) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import decimal

decimal.getcontext().prec = 9

(W, H, x, y) = map(decimal.Decimal, input().split(' '))

half = (W * H) / 2

has_multi = 0
if x == W / 2 and y == H / 2:
  has_multi = 1

print("{} {}".format(half, has_multi))


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

#define pll pair<long long,long long>
#define mp make_pair
using namespace std;
int par[100010],ran[100010];
pll x[100010],y[100010];
vector<pair<long long,pll>> edge;
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		ran[i] = i;
	}
}

int find(long long x){
	if(par[x]==x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(long long x, long long y){
	x = find(x);
	y = find(y);
	if(x==y) return;
	if(ran[x]<ran[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(ran[x]==ran[y]) ran[x]++;
	}
}

bool same(long long x, long long y){
	return find(x)==find(y);
}

int main(){
	int i,n;
	long long ans=0,cnt=0;
	cin >> n;
	for(i=0;i<n;i++){
		long long a,b;
		cin >> a >> b;
		x[i] = mp(a,i);
		y[i] = mp(b,i);
	}
	init(n);
	sort(x,x+n);
	sort(y,y+n);
	for(i=0;i<n-1;i++){
		edge.push_back(mp(x[i+1].first-x[i].first,mp(x[i+1].second,x[i].second)));
		edge.push_back(mp(y[i+1].first-y[i].first,mp(y[i+1].second,y[i].second)));
	}
	sort(edge.begin(),edge.end());
	i = 0;
	while(cnt<n-1){
		if(!same(edge[i].second.first,edge[i].second.second)){
			unite(edge[i].second.first,edge[i].second.second);
			ans += edge[i].first;
			cnt++;
		}
		i++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 12400
#include <iostream>

using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if(a != b && a != c){
        cout << a << endl;
    }else if(b != a && b != c){
        cout << b << endl;
    }else {
        cout << c << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cerr << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cerr << e << " "; } cerr << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




// ***************************************

int main() {

    int N, K;
    cin >> N >> K;

    vector<int> A(N);
    for (auto& a : A) {
        cin >> a;
    }

    vector<int> dp(K + 1, -1);

    FOR(i, 1, K + 1) {
        bool flag = false;
        REP(j, N) {
            if (i - A.at(j) < 0) continue;
            if (dp.at(i - A.at(j)) == -1) {
                flag = true;
                dp.at(i) = j;
            }
        }
        if (!flag) dp.at(i) = -1;
    }

    if (dp.at(K) != -1) cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009


int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll n,k,q;
	cin>>n>>k>>q;
	VL ans(n,k-q),cr(n,0);
	fr(i,0,q)
	{
		ll x;
		rl(x);
		x--;
		ans[x]++;
	}
	// fr(i,0,n)
	// {
	// 	fr(j,0,n)
	// 	{
	// 		if(i!=j)
	// 		{
	// 			ans[j]-=cr[i];
	// 		}
	// 	}
	// }
	fr(i,0,n)
	{
		if(ans[i]>0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}

}

Measured memory_bytes: 2176
package main

import (
	"fmt"
	"math"
	"math/big"
)

func main() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		arr[i] = tmp
	}
	l, r := make([]int, n), make([]int, n)
	l[0], r[n - 1] = arr[0], arr[n - 1]
	for i := 1; i < n; i++ {
		l[i], r[n - i - 1] = gcd(l[i - 1], arr[i]), gcd(r[n - i], arr[n - i - 1])
	}
	max := math.MinInt32
	for i := 0; i < n; i++ {
		var ll, rr int
		if i - 1 >= 0 {
			ll = l[i - 1]
		}
		if i + 1 <= n - 1 {
			rr = r[i + 1]
		}
		var tmp int
		if ll == 0 {
			tmp = rr
		} else if rr == 0 {
			tmp = ll
		} else {
			tmp = gcd(ll, rr)
		}
		if max < tmp {
			max = tmp
		}
	}
	fmt.Println(max)
}


func gcd(m, n int) int {
	x := new(big.Int)
	y := new(big.Int)
	z := new(big.Int)
	a := new(big.Int).SetUint64(uint64(m))
	b := new(big.Int).SetUint64(uint64(n))
	return int(z.GCD(x, y, a, b).Uint64())
}

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

int main()
{
	string O,E;
	cin >> O >> E;
	
	for (int i=0; i < O.size()-1; i++) {
		cout << O[i] << E[i];
	}
	if (O.size() == E.size())cout << O[O.size() - 1] << E[E.size() - 1];
	else cout << O[O.size() - 1];
    
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
#define ll long long

int main(){
  ll N, M;
  cin >> N >> M;

  map<ll, ll> X;
  X[0]=1;

  ll A, S = 0, ans = 0;
  for(ll i=0; i<N; ++i)	{
    cin >> A;
    S = (S+A)%M;
    auto itr = X.find(S);
    if(itr!=X.end()) ans += X[S]++;
    else X[S]=1;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4224
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  static Scanner sc = new Scanner(System.in);
  static long n;
  static long m;


  public static void main(String[] args) {
    n = sc.nextLong();
    m = sc.nextLong();
    long answer = solve(n, m);
    System.out.println(answer);
  }

  private static long solve(long n, long m) {
    long answer = 0;
    if (n < 2 || m < 2) {
      answer = getAnswer(n, m);
    } else {
      answer += (n - 2) * (m - 2);
    }
    return answer;
  }

  private static int getAnswer(long n, long m) {
    int answer = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        int count = 9;
        if (i == 0) {
          count -= 3;
        }
        if (j == 0) {
          count -= 3;
        }
        if (i + 1 == n) {
          count -= 3;
        }
        if (j + 1 == m) {
          count -= 3;
        }
        if (i + 1 == n && j == 0) {
          count++;
        }
        if (i == 0 && j == 0) {
          count++;
        }
        if (j + 1 == m && i == 0) {
          count++;
        }
        if (i + 1 == n && j + 1 == m) {
          count++;
        }

        if (count % 2 == 1) {
          answer++;
        }
      }
    }
    return answer;
  }


}


Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int d,t,s;
  cin>>d>>t>>s;
  double a;
  a=(double)d/s;
  if(a<=t)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  return 0;
}


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

int main()
{
    int $=1;
    //cin>>$;
    while($--)
    {
        long long n;
        cin>>n;
        long long a=0;
        a=(n+1)*n/2;
        for(int i=3;i<=n;i++)
        {
            if(i%3==0) a-=i;
            else if(i%5==0) a-=i;
        }
        cout<<a<<endl;
    }
}


/*
8888888888888888888888888888
    Md. Masud Mazumder
    University of Chittagong
    Department of CSE
8888888888888888888888888888
*/


Measured memory_bytes: 3636
// Created by new_sm
//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
	int n;
	cin>>n;
	while(n--)
	{
		int x;
		cin>>x;
		if(x&1)
			continue;
		else
		{
			if(x%3==0||x%5==0)
				continue;
			else
			{
				cout<<"DENIED";
				return ;
			}
		}
	}
cout<<"APPROVED";
}

int main()
{
//code

fastio	
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = ReadInt();
            if (X == 3 || X == 5 || X == 7) Console.WriteLine("YES");
            else Console.WriteLine("NO");

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

#ifdef LOCAL
#define i64 "%lld"
#else
#define i64 "%I64d"
#endif

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int N = 55;
const int OFF = N*N;

int x[N]; 
ll dp[N][2*OFF];

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

    int n,a; cin >> n >> a;
    forn(i,n) { cin >> x[i]; x[i] -= a; }

    dp[0][0+OFF] = 1;
    forn(i,n) {
        forn(sum,2*OFF) if (dp[i][sum]) {
            dp[i+1][sum] += dp[i][sum];
            dp[i+1][sum+x[i]] += dp[i][sum];
        }
    }
    cout << dp[n][OFF]-1 << endl;

    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[4];cin>>a[0]>>a[1]>>a[2]>>a[3];sort(a,a+4);
  cout<<((a[0]==a[1]&&a[2]==a[3])?"yes":"no")<<endl;
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, ans;
	cin >> n;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(i == 0)
			ans = x;
		else
			ans = __gcd(ans, x);
	}
	cout << ans;
}

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

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

int main() {
  long long n, p = 1e9 + 7;
  cin >> n;
  long long ans = (modPow(10, n, p) + modPow(8, n, p) - 2*modPow(9, n, p)) % p; 
  if(ans < 0){
    cout << ans + p << endl;
  }else{
    cout << ans;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

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

  int d = a - b;
  if (d % 2 == 0) {
    cout << "Alice" << endl;
  } else {
    cout << "Borys" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <cmath>
#include <bitset>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  ll N;
  ll A[200010];
  cin >> N;
  rep(i,N){
    cin >> A[i];
  }
  ll ans = 0;
  ll m = 1000000007;
  ll t[200010];
  
  t[0] = A[N-1];
  rep(i, N-2){
    t[i+1] = t[i] + A[N-2-i];
    t[i+1] %= m;
  }
  
  rep(i,N-1){
      ans += A[i]*t[N-i-2];
      ans %= m;
  }

  cout << ans << endl;

  
}

Measured memory_bytes: 6704
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <cstring>
#define MAX 15
#define INF 1e9

using namespace std;

double dp[1 << MAX][MAX];
double dist[MAX][MAX];
int N;

double rec(int S,int v){
  if(dp[S][v] >= 0) return dp[S][v];
  if(S == (1 << N)-1 && v == 0) return dp[S][v] = 0;

  double res = INF;
  for(int i = 0 ; i < N ; i++){
    if(!(S >> i & 1)){ 
      res = min(res,rec(S | 1 << i, i) + dist[v][i]);
    }
  }
  return dp[S][v] = res;
}

int main(){
  string in;
  
  while(getline(cin,in)){
    vector<double> v;
    stringstream s(in);
    int num,box_length;

    s >> box_length;

    while(s >> num){
      v.push_back(num);
    }

    N = (int)v.size();
    memset(dp,-1,sizeof(dp));

    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j < N ; j++){
	if(i == j) dist[i][j] = 0;
	else dist[i][j] = sqrt(pow(v[i]+v[j],2.0)-pow(v[i]-v[j],2.0));
      }
    }      

    dist[N][N] = 0;

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

    N++;

    if(rec(0,0) <= box_length) cout << "OK" << endl;
    else cout << "NA" << endl;
  }

  return 0;
}

Measured memory_bytes: 5080
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
//#define MOD 998244353
#define MAX 100000

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

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

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

	ll N;
	cin >> N;

	vl H(N);

	rep(i, N) {
		cin >> H[i];
	}

	ll count = 0;

	rep(i, N - 1) {
		if (H[i] - H[i+1] >= 2) {
			cout << "No" << endl;
			return 0;
		}
		else if (H[i] - H[i + 1] == 1) {
			count++;
		}
		else if (count == 1 && (H[i] < H[i + 1])) {
			count = 0;
		}

		if (count == 2) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;




	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define hii cout << "hii" << endl
#define int long long
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int N = 5e5 + 5;
const int MAX = 250000 + 5;
const int M = 1e6 + 5;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;

int arr[N];

void solve()
{
	int d, t, s;
	cin >> d >> t >> s;
	if(d <= t * s)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

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

Measured memory_bytes: 3648
import sys
from collections import OrderedDict
n = int(input())
v = list(map(int, input().split()))
if len(list(set(v))) == 1:
    print(n // 2)
    sys.exit()
e = {}
for i in v[::2]:
    if i in e:
        e[i] += 1
    else:
        e[i] = 1
o = {}
for i in v[1::2]:
    if i in o:
        o[i] += 1
    else:
        o[i] = 1
e = OrderedDict(sorted(e.items(), key = lambda x:-x[1]))
o = OrderedDict(sorted(o.items(), key = lambda x:-x[1]))
ans = 0
if not list(e.keys())[0] == list(o.keys())[0]:
    ans += (n // 2 - max(list(e.values())))
    ans += (n // 2 - max(list(o.values())))
else:
    ans1 = 0
    ans2 = 0
    if not len(list(set(list(o.keys())))) == 1:
        ans1 += (n // 2 - list(e.values())[0])
        ans1 += (n // 2 - list(o.values())[1])
    else:
        ans1 = 10 ** 10
    if not len(list(set(list(e.keys())))) == 1:
        ans2 += (n // 2 - list(o.values())[0])
        ans2 += (n // 2 - list(e.values())[1])
    else:
        ans2 = 10 ** 10
    ans = min(ans1, ans2)
print(ans)


Measured memory_bytes: 49116
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;            
          
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;

const ll   N     =  1e7+5;
const ll   mod   =  998244353;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll test=1, n, a[N], b[N], s = 0, k, m;
bool prime[N], primesquare[N]; 

void SieveOfEratosthenes(){
    for (int i = 2; i < N; i++) 
        prime[i] = true; 
    for (ll i = 0; i < N; i++) 
        primesquare[i] = false;  
    prime[1] = false;
    for (ll p = 2; p * p < N; p++){ 
        if (prime[p] == true) {
            for (ll i = p * 2; i < N; i += p) 
                prime[i] = false; 
        } 
    } 
  
    int j = 0; 
    for (ll p = 2; p < N; p++){ 
        if (prime[p]) { 
            a[j] = p;
            if(p*p < N) primesquare[p*p] = true; 
            j++; 
        } 
    } 
} 

ll countDivisors(int n){  
    if (n == 1) 
        return 1; 
    ll ans = 1; 
    for (int i = 0;; i++) { 
        if (a[i] * a[i] * a[i] > n) 
            break; 
        int cnt = 1;
        while (n % a[i] == 0){ 
            n = n / a[i];
            cnt = cnt + 1;
        } 
        ans = ans * cnt; 
    } 
    if (prime[n]) 
        ans = ans * 2; 
    else if (primesquare[n]) 
        ans = ans * 3; 
    else if (n != 1) 
        ans = ans * 4; 
  
    return ans; // Total divisors 
} 

void solve(){
	SieveOfEratosthenes();
	ll ans = 0;
	cin>>n;
	for(int i = 1; i <= n; i++){
		ans += i*countDivisors(i);
	}
	deb1(ans)
}

int main(){
    fastio;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 28368
def median(q):
    l=len(q)
    q=sorted(q,reverse=True)
    if l%2==0:
        return (q[int(l/2)]+q[int(l/2)-1])/2
    else:
        return q[int((l+1)/2-1)]

n=int(input())

a=[]
b=[]

for i in range(n):
   x,y=map(int,input().split())
   a.append(x)
   b.append(y)
   
med_a=median(a)
med_b=median(b)

if n%2==0:
    print(int(2*(med_b-med_a)+1))
    
else:
    print((med_b-med_a)+1)

Measured memory_bytes: 27208
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	int ans = 6;
	cin >> N >> M;
	ans -= N;
	ans -= M;
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int N; cin >> N;
    vi data(N);
    F0R(i, N) cin >> data[i];

    sort(all(data));
    int start = data[N-1];
    vi odds, evens;
    odds.pb(data[0]);
    FOR(i, 1, N-1) {
    	if (data[i] < 0) {
    		odds.pb(data[i]);
    	} else {
    		evens.pb(data[i]);
    	}
    }

    vpi answer;
    F0R(i, sz(evens)) {
    	answer.pb(mp(odds[0], evens[i]));
    	odds[0] -= evens[i];
    }
    F0R(i, sz(odds)) {
    	answer.pb(mp(start, odds[i]));
    	start -= odds[i];
    }

    cout << start << endl;
    F0R(i, sz(answer)) {
    	cout << answer[i].f << " " << answer[i].s << endl;
    }
    
    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3828
//package atcoder;
 
import java.util.*;
//import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long A = sc.nextLong();
		Long B = sc.nextLong();
		Long K = sc.nextLong();
		if(A>=K) {
			System.out.println((A-K)+" "+B);
		}else if(A<K&&K<A+B) {
			System.out.println(0+" "+(B-(K-A)));
		}else {
			System.out.println(0+" "+0);
		}
		
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;

using ci = const int;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair <int,int>;
using pcc = pair <char,char>;
using pll = pair <ll,ll>;
using pss = pair <string,string>;
using vi = vector <int>;
using vb = vector <bool>;
using vpii = vector <pii>;
using vll = vector <ll>;
using vii = vi::iterator;

#define INF (0x3f3f3f3f)
#define MOD 1000000007
#define mt make_tuple
#define all(c) c.begin(), c.end()
#define ms(name,val) memset(name, val, sizeof (name))
#define np nullptr
// inline functions



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

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    if (c == 1LL || d == 1LL || (c > b && d > b))
    {
        cout << 0 << '\n';
        return 0;
    }

    ll occ_c = (b/c)-(a-1)/c;
    ll occ_d = (b/d)-(a-1)/d;
    ll lcm = c/__gcd(c,d)*d;
    ll occ_lcm = (b/lcm)-(a-1)/lcm;

    cout << (b-a+1)-occ_c-occ_d+occ_lcm << '\n';



























































    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

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

int main()
{
  int A, B; cin >> A >> B;
  cout << max(0, A - 2*B) << endl;
  return 0;
}


Measured memory_bytes: 256
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var N = o.getValue(0);
    var ds = o.getArray(1);

    var result = 0;
    for(var i = 0; N > i; i++) {
        for(var j = i + 1; N > j; j++) {
            result += ds[i] * ds[j];
        }
    }

    return result;
}

Measured memory_bytes: 7372
let is_month n = 0 < n && n <= 12;;

let () = Scanf.scanf "%2d%2d" (fun s t -> 
  (if (is_month s) && (is_month t) then "AMBIGUOUS"
  else if (is_month s) && (not (is_month t)) then "MMYY"
  else if (not (is_month s)) && (is_month t) then "YYMM"
  else "NA") |> print_string
);;

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
	char s[5];
	int n=1,p=0;
	cin >> s;
	for (int i = 0; i<3; i++)
	{
		n = 1;
		for (int j = i + 1; j<4; j++)
			if (s[i] == s[j])n++;
		if (n == 2)p++;
	}
	if (p!=2)cout << "No";
	else cout << "Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl "\n"
#define F first
#define S second	
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define LCM(a,b) (a*b)/__gcd(a,b)
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define sz(x) (ll)x.size()
#define ld long double
#define pcnt(x) __builtin_popcountll(x)
const long long I1=1e9;
const long long I2=1e18;
const int32_t M1=1e9+7;
const int32_t M2=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}

void solve()
{
  //code begins from here//
  ll n,d;
  cin>>n>>d;
  ll ans=0;
  lop(i,n)
  {
    ll x,y;
    cin>>x>>y;
    ld p=sqrt(pow(x,2)+pow(y,2));
    if(p<=d) ans++;
  }
  cout<<ans<<endl;
  }

signed main()
{
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef MODULO
        initialize();
    #endif
    #ifdef SIEVE
        sieve();
    #endif
    int testcase=1;
   // cin>>testcase;
    while(testcase--) solve();
    return 0;
}


Measured memory_bytes: 3696
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

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

	int one, two, three;

	for (int i = n; i < 1000; i++){
		one = i % 10;
		two = (i/10) % 10;
		three = i / 100;

		if (one == two and two == three){
			cout << i << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int N;
    int A[200000];

    cin >> N;

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

    long count[200001] = {0};
    
    //count
    for(int i=0;i<N;i++){
        count[A[i]]++;
    }

    //nicou
    long total=0;
    for(int i=1;i<=N;i++){
        total += (count[i] * (long)(count[i]-1)) / (long)2;
    }

    //output
    for(int i=0;i<N;i++){
        cout << total - count[A[i]] + (long)1 << endl;
    }  
    
}

Measured memory_bytes: 4864
import java.util.*;
public class Main {
	//0925 start
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int w = sc.nextInt();
			int d = sc.nextInt();
			if((w|d) == 0) break;
			int [] data = new int[w];
			int sum = 0;
			for(int i = 0 ; i < w; i++){
				data[i] = sc.nextInt();
				sum += data[i];
			}
			boolean [] used = new boolean[w];
			for(int i = 0 ; i < d; i++){
				int h = sc.nextInt();
				boolean flg = false;
				for(int j = 0 ; j < w; j++){
					if(h == data[j] && used[j] == false){
						used[j] = true;
						flg = true;
						break;
					}
				}
				if(! flg){
					sum += h;
				}
			}
			System.out.println(sum);
		}
	}

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

Measured memory_bytes: 12000