akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(3e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;
int dp[N];
int t[4*N];
int a[N];

void update(int v,int l,int r,int x,int y){
	if(l == r){
		t[v] = y;
		return;
	}
	int m = (l+r)>>1ll;
	if(x <= m)
		update(v*2,l,m,x,y);
	else 
		update(v*2+1,m+1,r,x,y);
	t[v] = max(t[v*2],t[v*2+1]);

}
int query(int v,int l,int r,int st,int en){
	if(l > en || r < st) return 0;
	if(l >= st && r <= en){
		return t[v];
	}
	int m =(l+r)>>1ll;
	return max(query(v*2,l,m,st,en),query(v*2+1,m+1,r,st,en));
}


void solve(){
	int n,k;
	cin >> n >> k;
	for(int i =1;i<=n;i++){
		cin >> a[i];
		a[i]++;
	}	
	dp[a[1]] = 1;
	update(1,1,300000,a[1],1);
	
	for(int i =2;i<=n;i++){
		// abs(a[i] - x) <= k
		// 1. a[i] - x <= k    -> a[i] - k <= x
		// 2. x - a[i] <= k -> x <= k+a[i]
		dp[a[i]] = max(dp[a[i]],1ll);
		// if(i == 2){
		// 	cout << "TEST: " << query(1,1,300000,a[i]-k,300000) << " "<< a[i]-k<< endl;
		// }
		dp[a[i]] = max(dp[a[i]],query(1,1,300000,max(1ll,a[i]-k),min(a[i]+k,300000ll)) + 1);
		
		// if((k + a[i]) <= 300000)
		// 	dp[a[i]] = max(dp[a[i]],query(1,1,300000,1,k+a[i]) + 1);
		update(1,1,300000,a[i],dp[a[i]]);
		// cout << dp[a[i]] << " ";
	}
	// cout << endl;


	// for(int i = 1;i<=n;i++){
	// 	cout << dp[a[i]] << " ";
	// }
	// cout << endl;

	cout << t[1] << endl;

}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

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

typedef long long int lli;
typedef long long ll;
typedef long double ld;



int main(){
    int t=1;
    //cin>>t;
    while(t--){
        int s;
        cin>>s;
        vector<int> a(1000001);
        a.at(s)++;
        for(int i=2;i<=1000000;i++){
            int n;
            if(s%2==0){
                n=s/2;
            }
            else{
                n=(3*s)+1;
            }
            if(a.at(n)==1){
                cout<<i;
                return 0;
            }
            else{
                a.at(n)++;
                s=n;
            }
        }
        cout<<1000000;
    }
    return 0;
}

Measured memory_bytes: 7184
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,0,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
 
signed main(){
    int N;cin>>N;
    cout<<N*(N-1)/2<<endl;
}

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 14.12.2019 10:31:14       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  int s = 3 * c;
  cout << a << " " << b << " " << s - a - b << '\n';
  cout << s - a - (a + b - c) << " " << c << " " << s - (s - a - b) - (s - a - c) << '\n';
  cout << a + b - c << " " << s - b - c << " " << s - a - c << '\n';
  return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
	int x, y;
	cin >> x >> y;
	if (y % 2 != 0||x*4<y||x*2>y) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	return 0;
}//どうして・・・(´･_･`)


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,x=0;string S;cin>>N>>S;
  for(int i=0;i<N-2;i++)if(S.at(i)=='A'&&S.at(i+1)=='B'&&S.at(i+2)=='C')x++;
  cout<<x<<endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

MOD = 998244353

N = int(readline())
X = read().rstrip().decode('utf-8')

def F(d):
    """
    ・dは奇数
    ・d個のブロックに分けられるものの個数
    """
    L = N//d
    arr = [int(X[i:i+L],2) for i in range(0,N,L)]
    cnt = arr[0] # 最初の桁が下回るもの
    x = arr[0] # 最初の桁がちょうどx。満たすか確認する。
    flip_x = ((1<<L)-1)^x
    bl = True
    for i,y in enumerate(arr):
        if i&1:
            if y > flip_x:
                break
            elif y == flip_x:
                continue
            else:
                bl = False
                break
        if y > x:
            break
        elif y == x:
            continue
        else:
            bl = False
            break
    return cnt + bl

# 奇数の約数を取得
div = set(x for x in range(1,1000) if N%x == 0)
div |= set(N//x for x in div)
div = sorted(d for d in div if d&1)

cnt = [F(d) for d in div]

# 包除を雑にやる
D = len(div)
for n in range(D-1,-1,-1):
    for m,d in enumerate(div[:n]):
        if div[n]%d == 0:
            cnt[m] -= cnt[n]

answer = sum((N//x)*y for x,y in zip(div,cnt))*2
answer %= MOD
print(answer)

Measured memory_bytes: 6212
#include<bits/stdc++.h>
using namespace std;
int main()
{
      string s,t,u;
      int a,b;
      cin>>s>>t;
      cin>>a>>b;
      cin>>u;
      if(s.compare(u)==0)
        a=a-1;
      else
        b=b-1;
     cout<<a<<" "<<b<<endl;
      return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))
already_town_check =[False]*(N+1)
already_town_check[1] = True
already_town = [1]
now_town=1
check=False
my_append = already_town.append
for i in range(K):
    check_town=A[now_town-1]
    if(already_town_check[check_town]):
        cicle_start_value=check_town
        check=True
        break
    already_town_check[check_town]=True
    my_append(check_town)
    now_town = check_town

if(check==False):
    print(now_town)
else:
    cicle_start=already_town.index(cicle_start_value)
    roop_town=already_town[cicle_start:]
    print(roop_town[(K-cicle_start)%((i+1)-cicle_start)])


Measured memory_bytes: 32360
#include <iostream>

using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;

    int sum_l = 0, sum_r = 0;
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;

        if (a < x) {
            sum_l++;
        } else {
            sum_r++;
        }
    }

    cout << (sum_l < sum_r ? sum_l : sum_r) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int x[n][n];
  int tmp;
  
  REP(i,n) REP(j,n) x[i][j] = -1;
  REP(i,n){
    cin >> a[i];
    REP(j,a[i]){
      cin >> tmp;
      cin >> x[i][tmp-1];
    }
  }
  
  int z[n];
  int nsq = 1;
  REP(i,n) nsq *= 2;
  int ans = 0;
  REP(k,nsq){
    bool flag = true;
    int sum = 0;
    tmp = k;
    REP(i,n){
      z[i] = tmp % 2;
      if(tmp%2 == 1) sum++;
      tmp = tmp / 2;
    }
    REP(i,n){
      if(!flag) break;
      if(z[i] == 1){
        REP(j,n){
          if(x[i][j] != -1 && x[i][j] != z[j]){
            flag = false;
            break;
          }
        }
      }
    }
    if(flag && ans < sum) ans = sum;
  }

  cout << ans;
  return 0;
}

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

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

func main() {
	defer stdout.Flush()
	N := readInt()
	K := readInt()
	a := make([]int64, N)
	for i := range a {
		a[i] = readInt64()
	}
	b := make([]int64, N)
	var j int
	for j = 1; j < K; j++ {
		b[0] += a[j] - a[j-1]
	}
	for i := 0; j < N; j++ {
		b[i+1] = b[i] + (a[j] - a[j-1]) - (a[i+1] - a[i])
		i++
	}
	var min int64 = math.MaxInt64
	for i := 0; i < N-K+1; i++ {
		v1 := absInt64(a[i]) + b[i]
		v2 := absInt64(a[i+K-1]) + b[i]
		min = minInt64(min, v1)
		min = minInt64(min, v2)
	}
	println(min)
}

// -----------------------------------------------------------------------------
func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 3456
from collections import defaultdict

N = int(input())
d = defaultdict(int)

for _ in range(N):
    s = input()
    k = sorted(s)
    d[''.join(k)] += 1

ans = 0    

for k, v in d.items():
    if v > 1:
        ans += v * (v - 1) // 2

print(ans)

Measured memory_bytes: 18144
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x = int(input())
count = 0
for a in range(a_500+1):
    for b in range(b_100+1):
        c_num = int((x-a*500-b*100)/50)
        if c_num in range(c_50+1):
            count += 1
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    REP(i, M) cin >> A[i];
    REP(i, M) N -= A[i];
    N = (N < 0) ? -1 : N;
    cout << N << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    int left = 0, right = (int)s.size()-1;
    int ans = 0;
    while (left < right) {
        if (s[left] == s[right]) {
            left++;
            right--;
            continue;
        }

        if (s[left] == 'x') {
            left++;
            ans++;
            continue;
        } else if (s[right] == 'x') {
            right--;
            ans++;
            continue;
        }

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

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int a,b,c,n;
    cin >> a >> b >> c >> n;
    vector<int> nums;
    REP(k,n+1) nums.push_back(k*c);
    int ans=0;
    for(int i=0;i<=n;i++){
        for(int j=0; j<=n; j++){
            int res = n-(i*a+j*b);
            if(binary_search(ALL(nums), res)){
            // cout << i<< " "<<j << endl;
                ans++;
            //  cout << "res:"<<res << endl;
            // cout << "ans:"<<ans << endl;    
            }

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

Measured memory_bytes: 888
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static String[] mySplit(String str){return str.split("");}
        public static void main(String[] args){
          long N = getLong();
          long M = getLong();
  if(N == 2 || M == 2){
     myout(0);
  }else if(N == 1 || M == 1){
     if(N == M){
        myout(1);
     }else if(N == 1){
     	myout(M - 2);
     }else{
        myout(N - 2);
     }
  }else{
    myout((N-2)*(M-2));
  }
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

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

int main()
{
    ll a,b,c,d,ansa,ansb;
    cin >> a >> b >> c >> d;
    ansa=a*b;
    ansb=c*d;
    cout << max(ansa,ansb) << endl;

    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>

int main(void){
  int a, b;
  scanf("%d %d", &a, &b);
  if(a >= 13){
  	printf("%d", b);
  }else if(a >= 6){
  	printf("%d", b / 2);
  }else{
  	printf("0");
  }
	return 0;  
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    ll a,b;
    cin >> a >> b;
    ll A=0,B=0,C=0;
    for(ll i=0;i<n;i++){
        ll p;
        cin >> p;
        if(p<=a) A++;
        else if(p<=b) B++;
        else C++;
    }
    ll ans=min(min(A,B),C);
    cout << ans << endl;
}


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first

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

struct p{
    int x,y;
    p(int a,int b){
        x = a;
        y = b;
    }
};

vector<pii> dirc = {{1,0},{0,-1},{-1,0},{0,1}};

typedef pair<int,p> pip;

int main(){
    bool flag=false;
    ll ans=0,bl=0;

    int h,w;
    cin >>h>>w;
    vector<string> g(h);
    vector<vector<bool>> vis(h,vector<bool>(w,false));
    vector<vector<int>> dist(h,vector<int>(w,INF));

    for (int i=0; i<h; i++){
        cin>>g[i];
        for(int j = 0; j < w;j++){
            if(g[i][j]=='#')bl++;
        }
    }

    priority_queue<pii,vector<pii>,greater<pii>> q;
    q.push({0,0});
    dist[0][0]=0;
    
    while (!q.empty()){
        pii cur = q.top();
        q.pop();

        int x = (cur.se)%w;
        int y = (cur.se)/w;

        if(dist[y][x] < cur.fi)continue;

        for (pii d:dirc){
            int nx = x + d.fi;
            int ny = y + d.se;

            if(w > nx && nx >= 0 && h > ny && ny >= 0 && g[ny][nx]=='.'){
                if(dist[ny][nx] > dist[y][x]+1){
                    dist[ny][nx] = dist[y][x]+1;
                    q.push({dist[ny][nx], ny*w + nx });
                }
            }
        }
    }
    ans = (w*h)- dist[h-1][w-1] -bl-1;

    /*
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            if(dist[i][j]==INF)cout<<" INF";
            else printf("%4d",dist[i][j]);
        }
        puts("");
    }
    */
    

    //cout <<fixed<<setprecision(16)<< << endl;
    if(dist[h-1][w-1] == INF)cout << -1 << endl;
    else cout << ans << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val p = (0 until n).map { sc.next().toInt() }
    println(problem115b(n, p))
}

fun problem115b(n: Int, p: List<Int>): Int {
    return p.sorted().mapIndexed { i, pi -> if (i == n - 1) pi / 2 else pi }.sum()
}

Measured memory_bytes: 36040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] hts = new long[n];
		for (int i = 0; i < n; i++) hts[i] = sc.nextLong();
		solve(hts, n);
	}

	private static void solve(long[] hts, int n) {
		// TODO Auto-generated method stub
		long rht = 0, lm = hts[0];
		for (int i = 1; i < n; i++) {
			lm = Math.max(lm, hts[i]);
			if (hts[i] < lm) {
				rht += lm - hts[i];
			}
		}
		System.out.println(rht);
	}

}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define fr(x,v) for(auto&x :v)
#define pr(a,b) cout << a << " " << b << endl
#define pr1(a,b,c) cout << a << " " << b << " "<< c << endl

typedef long long int ll;
typedef vector<ll> vi;

struct input{
	ll a;
};

const ll M=1e9+7;
const ll N=1e5;
template< class T > T gcd(const T a, const T b) { return (b ? gcd<T>(b, a%b) : a); }

int main()
{
	
	fastio;
	
	ll n,m,i,j,k,temp,x,y,z,t,p;
	cin >> n;
	ll a,b;
	ll s1=0,s2=0,mn=1e16;
	for(i=1;i<=n-1;i++)
	{
		a=i, b=(n-i);
		s1=0,s2=0;
		while(a>0)
		{
			s1+=a%10;
			a/=10;
		}
		while(b>0)
		{
			s1+=b%10;
			b/=10;
		}
		if(s1+s2 < mn)
			mn=s1+s2;
	}
	cout << mn << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,x,happy=0;
  scanf("%d",&x);
  while(x>=500){
    x-=500;
    happy+=1000;
  }
  while(x>=5){
    x-=5;
    happy+=5;
  }
  printf("%d\n",happy);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int L,R,n;
    int i,cnt=0;
    scanf("%d %d %d",&L,&R,&n);
    for(i = L;i<=R;i++){
        if(i%n==0) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 1724
# -*- coding: utf-8 -*-

A,B,C,X,Y = map(int, input().split())

ans = 10000 * 10**5
for z in range(10**5+1):
    x = max(X-z, 0)
    y = max(Y-z, 0)
    yen = A*x + B*y + 2*C*z
    if ans > yen:
        ans = yen

print(ans)


Measured memory_bytes: 9108
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (unfoldr)

main :: IO ()
main = do
  (n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    next :: Maybe Digits -> Maybe ([Int], Maybe Digits)
    next = fmap next'
      where
        next' :: Digits -> ([Int], Maybe Digits)
        next' = (,) <$> (0 :) . map snd . reverse <*> succDs
  mapM_ (putStrLn . map toLEL) . unfoldr next . Just . zeroes $ n

type Digits = [(Int, Int)]

extend :: Digits -> Digits
extend [] = (1, 0) : []
extend ds@((m, k) : _) = (max m (succ k), 0) : ds

zeroes :: Int -> Digits
zeroes 1 = []
zeroes l  = extend . zeroes . pred $ l

succDs :: Digits -> Maybe Digits
succDs [] = Nothing
succDs ((m, k) : ds) | k < m = Just ((m, succ k) : ds)
succDs (_ : ds) = extend <$> succDs ds

showDs :: Digits -> String
showDs = map toLEL . (0 :) . map snd . reverse

toLEL :: Int -> Char
toLEL = toEnum . (fromEnum 'a' +)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 2172
#include <algorithm>
#include <iostream>
 
using namespace std;
 
int main(){
 
    int DataSetNum = 0;
    int HouseNum = 0;
    int GeneNum = 0;
    int* HousePos;
    int* CableLength;
    int AllCableLength = 0;
 
    cin >> DataSetNum;
    for (int datanum = 0; datanum < DataSetNum; ++datanum){

        cin >> HouseNum;
        cin >> GeneNum;
        HousePos = new int[HouseNum];
        for (int i = 0; i < HouseNum; ++i){
            cin >> HousePos[i];
        }
        if (HouseNum <= GeneNum){
            cout << 0 << endl;
            continue;
        }
        CableLength = new int[HouseNum - 1];
        for (int i = 0; i < HouseNum - 1; ++i){
            CableLength[i] = HousePos[i + 1] - HousePos[i];
        }
        AllCableLength = HousePos[HouseNum - 1] - HousePos[0];

        sort(&CableLength[0], &CableLength[0]+HouseNum-1);
        for (int i = 0; i < GeneNum - 1; ++i){
            AllCableLength -= CableLength[HouseNum - i - 2];
            CableLength[HouseNum - i - 2] = 0;
        }

        cout << AllCableLength << endl;
 
        delete[] CableLength;
        delete[] HousePos;
    }
 
    return 0;
}

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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    ll x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> A(x),B(y),C(z);

    for(auto &i: A)
        cin >> i;
    for(auto &i: B)
        cin >> i;
    for(auto &i: C)
        cin >> i;

    sort(A.rbegin(),A.rend());
    sort(B.rbegin(),B.rend());
    sort(C.rbegin(),C.rend());

    vector<ll> res;

    FOR(i,0,x){
        FOR(j,0,y){
            FOR(l,0,z){
                if((i+1)*(j+1)*(l+1)<=k)
                    res.pb(A[i]+B[j]+C[l]);
                else
                    break;
            }
        }
    }

    sort(res.rbegin(),res.rend());

    FOR(i,0,k)
        cout << res[i] << endl;

    return 0;
}


Measured memory_bytes: 1404
import fractions 

n,X=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=abs(x[i]-X)

ans=10**10
if n==1:
    print(x[0])
    exit()
for g in range(1,n):
    ans=min(ans,fractions.gcd(x[g-1],x[g]))
print(ans)

Measured memory_bytes: 16240
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

long long prime[1000100];
long long isPrime[1000100];

long long sieve(long long n){
  long long p = 0;
  for(long long i = 0; i <= n; i++){
    isPrime[i] = 1LL;
  }
  isPrime[0] = 0;
  isPrime[1] = 0;
  for(long long i = 2LL; i <= n; i++){
    if(isPrime[i] == 1LL){
      prime[p] = i;
      p++;
      for(long long j = 2LL * i; j <= n; j += i){
        isPrime[j] = 0;
      }
    }
  }
  return p;
}

int main() {
  sieve(1000050);
  ll a,b;
  cin>>a>>b;
  set<ll> sea,seb;
  sea.insert(1);
  seb.insert(1);
  rep(i,2,1000030){
    if(isPrime[i]==1){
      while(a%i==0){
        sea.insert(i);
        a/=i;
      }
    }
  }
  rep(i,2,1000030){
    if(isPrime[i]==1){
      while(b%i==0){
        seb.insert(i);
        b/=i;
      }
    }
  }
  sea.insert(a);
  seb.insert(b);
  vector<ll> v1(all(sea));
  vector<ll> v2(all(seb));
  ll ans = 0;
  rep(i,0,v1.sz){
    rep(j,0,v2.sz){
      if(v1[i]==v2[j])ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

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

    long long a, ans;
    cin>>a;
    ans = a + a*a + a*a*a;
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3688
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <numeric>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <cstdlib>

using namespace std;

typedef long long LL;
typedef pair<int, int>PII;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), rend()
#define PB pushback
#define SORT(c) sort((c).begin(),(c).end())

const LL INF = 1LL << 60;

//priority_queue<int> p;




//scanf("%d",&N);

//printf("%d", ans);

//cout <<  << endl;
int i, j, k, tmp, ans, cnt, N, M, T, K;
bool flag = true;


int main(void) {
	scanf("%d", &N);
	FOR(i, 1, N + 1) {
		if ((i & 1 )== 1) {
			cnt++;
		}
	}

	printf("%lf", (double)cnt/N);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
//#include <string.h>
//#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main() {
	int a, b, c,E, F;
	int K;
	cin >> a >> b >> c;
	cin >> K;
	if (a == b && b == c) {
		for (int i = 0; i < K; i++) {
			a *= 2;
		}	
		cout << a + b + c<< endl;	
	} else {
		int ans = max({a, b, c});
		if (ans == a) {
			E = b;
			F = c;
		} else if (ans == b) {
			E = a;
			F = c;
		} else if (ans == c) {
			E = a;
			F = b;
		}
		for (int j = 0; j < K; j++) {
			ans = ans * 2;
		}
		cout << ans + E + F << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int, int > Pi;
typedef pair< int, Pi > Pii;
 
int H, N;
string C[10][2];
string B[3][10][2];
 
 
char Map[60][2][2];
 
int getPoint(vector< Pi >& where)
{
  fill_n(**Map, 60 * 2 * 2, '.');
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < 2; j++) {
      for(int k = 0; k < 2; k++) {
        Map[i][j][k] = C[i][j][k];
      }
    }
  }
 
  int cnt = 0;
 
  for(int i = 0; i < N; i++) {
 
    for(int h = 50; h >= -1; h--) {
 
      bool hit = true;
      for(int j = 0; j < 2; j++) {
        for(int k = 0; k < 2; k++) {
          for(int l = 0; l < 2; l++) {
            if(B[i][j][k][l] == '.') continue;
            int y = k + where[i].first, x = l + where[i].second;
            int height = h + j;
            if(height - 1 < 0) hit = false;
            else if(Map[height - 1][y][x] == '#') hit = false;
          }
        }
      }
 
 
      if(!hit) { // ????????????
        for(int j = 0; j < 2; j++) {
          for(int k = 0; k < 2; k++) {
            for(int l = 0; l < 2; l++) {
              if(B[i][j][k][l] == '.') continue;
              int y = k + where[i].first, x = l + where[i].second; // ??????????????????????????§?¨?
              int height = h + j;
              Map[height][y][x] = '#';
            }
          }
        }
        break;
      }
    }
 
    for(int j = 0; j < 44; j++) {
      bool flag = true;
      for(int k = 0; k < 2; k++) {
        for(int l = 0; l < 2; l++) {
          if(Map[j][k][l] == '.') flag = false;
        }
      }
      if(flag) {
        ++cnt;
        for(int k = j; k < 44; k++) {
          for(int l = 0; l < 2; l++) {
            for(int m = 0; m < 2; m++) {
              Map[k][l][m] = Map[k + 1][l][m];
            }
          } 
        }
        j = -1;
      }
    }
  }
  return(cnt);
}
 
int rec(vector< Pi >& where, int idx)
{
  if(idx == N) {
    return(getPoint(where));
 
  } else {
    int ret = 0;
    for(int i = -1; i < 2; i++) {
      for(int j = -1; j < 2; j++) {
        bool need = true;
        for(int h = 0; h < 2; h++) {
          for(int k = 0; k < 2; k++) {
            for(int l = 0; l < 2; l++) {
              if(B[idx][h][k][l] == '#') {               
                if(i + k < 0 || j + l < 0 || i + k > 1 || j + l > 1) {
                  need = false;
                }
              }
            }
          }
        }
        if(need) {
          where[idx] = make_pair(i, j);
          ret = max(ret, rec(where, idx + 1));
        }
      }
    }
    return(ret);
  }
}
 
 
 
int main()
{
  while(cin >> H >> N, H) {
    for(int i = 0; i < H; i++) {
      for(int j = 0; j < 2; j++) {
        cin >> C[i][j];
      }
    }
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < 2; j++) {
        for(int k = 0; k < 2; k++) {
          cin >> B[i][j][k];
        }
      }
    }
    vector< Pi > a(N);
    cout << rec(a, 0) << endl;
  }
}

Measured memory_bytes: 1204
import sys as sys

lines =  input().split()
n = int(lines[0])
m = int(lines[1])

py = []
od = {}

#lines = sys.stdin.readlines()

for i in range(0,m):


    #l =  lines[i].split()
    l = input().split()
    p = int(l[0])
    y = int(l[1])
    
    if p in od :
        od[p].append([i,y])
    else:
        od[p] = [[i,y]]

a = []
for p in od.keys():
    od[p].sort(key=lambda x:x[1])
    r = 1

    for o in od[p]:
        cs = ""

        tmp = p
        digit = 0
        while tmp > 0 :        
            digit += 1
            tmp = tmp // 10
        
        l = 6-digit
        for j in range(l):
            cs += '0'
        cs += str(p)

        tmp = r 
        digit = 0
        while tmp > 0 :        
            digit += 1
            tmp = tmp // 10

        l = 6-digit
        for j in range(l):
            cs += '0'
        cs += str(r)        

        a.append([o[0],cs])
        r += 1

a.sort(key=lambda x:x[0])
for aa in a:
    print(aa[1])

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin>>n;
  vector<string> vec(n);
  for (int i = 0; i < n; i++) {
    string s; cin>>s;
    sort(s.begin(), s.end());
    vec.at(i) = s;
  }

  sort(vec.begin(), vec.end());

  int64_t sum = 0, cnt=0;
  string pre=vec.at(0);
  for (int i = 1; i < n; i++) {
    if (vec.at(i)!=pre) {
      cnt=0;
    }
    else {
      cnt++;
    }
    sum += cnt;
    pre = vec.at(i);
  }
  
  cout << sum << endl;
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll s;
    cin >> s;

    ll a = 1e9, b = ceil(s, a);
    cout << "0 0 1000000000 1 " << a*b-s << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  long long l,m,n;
  cin>>l>>m>>n;
  long long ans=min(l*m,n);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str;
  if(str == "Sunny"){
  	cout << "Cloudy" << endl;
  }else if(str == "Cloudy"){
  	cout << "Rainy" << endl;
  }else if(str == "Rainy"){
  	cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int sum(int n) {
  return n*(n+1)/2;
}

int main() {
  string s;
  cin >> s;
  int n = s.size()/2;
  for (int i = 1; i <= n; i++) {
    string t = s.substr(0, n-i);
    string u = s.substr(n-i, n-i);
    if (t == u) {
      cout << 2*(n-i) << endl;
      return 0;
    }
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    a[i] = x + y;
    b[i] = x - y;
  }
  ll amax = -INF;
  ll amin = INF;
  ll bmax = -INF;
  ll bmin = INF;
  rep(i, n) {
    amax = max(amax, a[i]);
    bmax = max(bmax, b[i]);
    amin = min(amin, a[i]);
    bmin = min(bmin, b[i]);
  }
  cout << max(amax - amin, bmax - bmin) << endl;
  return 0;
}

Measured memory_bytes: 6308
N, A = map(int, input().split())
X = list(map(int, input().split()))
S = max(N * A, sum(X))
DP = [[[0] * (S+1) for _ in range(N+1)] for _ in range(N+1)]
DP[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(S+1):
            if not DP[i][j][k]: continue
            DP[i+1][j][k] += DP[i][j][k]
            if j != N:
                DP[i+1][j+1][k+X[i]] += DP[i][j][k]
print(sum(DP[N][j][j*A] for j in range(1, N+1) if j * A <= S))

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

int main(){
 	int H, W, i, j;
 	
	while(1) {
 		cin >> H >> W;
		if(H == 0 && W == 0) {
			break;
		}
 		for(i = 0; i < H; i++) {
			for(j = 0; j < W; j++) {
				cout << '#';
			}
 		cout << endl;
 		}
	cout << endl;
	}
 	return 0;
}

Measured memory_bytes: 3088
import sys
from collections import deque
input = sys.stdin.readline

def main():
    n = int(input())
    tree = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    
    not_yet = deque([0])
    already = [False]*n
    already[0] = True
    dist = [0]*n

    while not_yet:
        value = not_yet.popleft()
        for v in tree[value]:
            if already[v]:
                continue
            already[v] = True
            dist[v] = (dist[value] + 1) % 2
            not_yet.append(v)
    
    zero = dist.count(0)
    one = dist.count(1)

    ans = [0]*n
    already = [False]*n
    if zero >= one:
        if one <= n//3:
            ind = 1
            for i in range(n):
                if dist[i] == 1:
                    ans[i] = ind*3
                    already[ind*3-1] = True
                    ind += 1
            ind = 0
            for i in range(n):
                if ans[i] == 0:
                    while already[ind]:
                        ind += 1
                    ans[i] = ind + 1
                    already[ind] = True
    
        else:
            c0, c1, c2 = 0, 0, 1
            z, o = n//3 + bool(n%3), n//3 + bool(n%3==2)
            for i in range(n):
                if dist[i] == 0:
                    if c0 >= z:
                        ans[i] = c2*3
                        c2 += 1
                        continue
                    ans[i] = c0*3 + 1
                    c0 += 1
                else:
                    if c1 >= o:
                        ans[i] = c2*3
                        c2 += 1
                        continue
                    ans[i] = c1*3 + 2
                    c1 += 1
    else:
        if zero <= n//3:
            ind = 1
            for i in range(n):
                if dist[i] == 0:
                    ans[i] = ind*3
                    already[ind*3-1] = True
                    ind += 1
            ind = 0
            for i in range(n):
                if ans[i] == 0:
                    while already[ind]:
                        ind += 1
                    ans[i] = ind + 1
                    already[ind] = True
    
        else:
            c0, c1, c2 = 0, 0, 1
            z, o = n//3 + bool(n%3), n//3 + bool(n%3==2)
            for i in range(n):
                if dist[i] == 1:
                    if c0 >= z:
                        ans[i] = c2*3
                        c2 += 1
                        continue
                    ans[i] = c0*3 + 1
                    c0 += 1
                else:
                    if c1 >= o:
                        ans[i] = c2*3
                        c2 += 1
                        continue
                    ans[i] = c1*3 + 2
                    c1 += 1

    print(*ans)

            


    
if __name__ == "__main__":
    main()



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

using namespace std;

int main(){
        int n,l;
        cin>>n>>l;
        vector<string> z(n);
        for(int i=0;i<n;i++)
        cin>>z[i];
        sort(z.begin(),z.end());
        for(int i=0;i<n;i++)
        cout<<z[i];
        cout<<endl;
}

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

int main(void){
  
  int i,len,cnt=0;
  char str[100];
  
  scanf("%s",str);
  
  len = strlen(str);
  
  for(i=0;i<len/2;i++){
    if(str[i]!=str[len-1-i])
      cnt++;
  }
  printf("%d",cnt);
  
  return 0;
  
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

o = input()
e = input()
n = len(o) + len(e)
for i in range(n):
  if i % 2 == 0:print(o[i//2],end = "")
  else:print(e[i//2],end = "")
print()

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

int main(){
  int n;
  cin >> n;
  
  vector <vector <int>> a(2, vector <int>(n));
  for (int i = 0; i < 2; i++){
    for (int j = 0; j < n; j++){
      cin >> a.at(i).at(j);
    }
  }
  
  int ans = 0;
  for (int go_down = 0; go_down < n; go_down++){
    int candies = 0;
    for (int i = 0; i <= go_down; i++){
      candies += a.at(0).at(i);
    }
    for (int i = go_down; i < n; i++){
      candies += a.at(1).at(i);
    }
    if (candies > ans) ans = candies;
  }
  cout << ans <<endl;
}

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

int main() {
  int N,K,A,Z;
  cin>>N>>K>>A;
  Z=A;
  for(int i=1;i<N;i++){
    int b;
    cin>>b;
    A=gcd(A,b);
    Z=max(Z,b);
  }
  if(K<=Z&&K%A==0){
    cout<<"POSSIBLE"<<endl;
  }
  else{
    cout<<"IMPOSSIBLE"<<endl;
  }

}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <functional>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

#define pii pair<int,int>

int main() {
  int a,b;
  vector<pii> v;
  while(true) {
    scanf("%d,%d\n",&a,&b);
    if (a==0&&b==0) break;
    v.push_back(pii(b,a));
  }
  sort(ALL(v),greater<pii>());
  int c = v[0].first;
  int p = 1;
  map<int,int> x;
  FOR(i,v) {
    if ((*i).first<c) {
      p++;
      c = (*i).first;
    }
    //   printf("%d,%d, %d\n",(*i).first, (*i).second, p);
    x[(*i).second] = p;
  }
  int n;
  while(cin>>n)
    cout << x[n] << endl;

}

Measured memory_bytes: 0
#include"bits/stdc++.h"
//#include"atcoder.h"
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
const ll inf = ll(1e18) + 1;
const ll mod = 1000000007;

int main() {
	int n;
	cin >> n;
	int count = 0;

	for (int i = 0; i < n;i++) {
		int a, b;
		cin >> a >> b;

		if (a!=b) {
			count = 0;
		}
		else {
			count++;
		}

		if (count == 3) {
			cout <<"Yes" << endl;
			return 0;
		}

	}

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


Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<vector>
using namespace std;
vector<int> quota[21];
bool flg[21]={0};
int ans[20];
int m,n;
bool fend;
void check(int x){
    //for(int i=1;i<=m;i++)cout<<"flg["<<i<<"] = "<<flg[i]<<endl;
    if(x == m){
        fend = true;
        return;
    }
    for(int i=1;i<=m;i++){
        if(!flg[i]){
            bool a=true;

            for(int j=0;j<quota[i].size();j++){
                if(!flg[quota[i][j]])a=false;
                //cout<<"x = "<<x<<",i = "<<i<<",j = "<<j<<endl;
            }
            if(a){
                flg[i] = true;
                ans[x] = i;
                //cout<<"---"<<i<<endl;
                check(x+1);
                flg[i] = false;
            }
            if(fend)return;
        }
    }
}
int main(void){
    while(cin>>m>>n){
        int x,y;
        fend = 0;
        for(int i=0;i<20;i++)ans[i] = 0;
        for(int i=0;i<21;i++)quota[i].clear();
        for(int i=0;i<n;i++){
            cin>>x>>y;
            quota[y].push_back(x);
        }
/*
        for(int i=1;i<=m;i++){
            for(int j=0;j<quota[i].size();j++){
                cout<<i<<"-"<<quota[i][j]<<" ";
            }
            cout<<endl;
        }*/
        check(0);

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


    }
    return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

class Main {
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a + b >= 10) {
        	System.out.println("error");
        } else {
        	System.out.println(a + b);
        }
    
    
}
}

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

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

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

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {

    int N;
    cin >> N;
    string s;
    cin >> s;
    set<int> r, g, b;
    REP(i, N){
        if (s[i] == 'R') r.insert(i);
        if (s[i] == 'G') g.insert(i);
        if (s[i] == 'B') b.insert(i);
    }
    ll ans = 0;
    for(auto i : r) for(auto j: g){
        ll l = b.size();
        if ((i + j) % 2 == 0 && b.find((i+j)/2) != b.end()) l--;
        if (b.find(2*i-j) != b.end()) l--;
        if (b.find(2*j-i) != b.end()) l--;
        ans += l;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3304
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int k=scan.nextInt();
    int[] arr=new int[n];
    for(int i=0;i<n;i++)
      arr[i]=scan.nextInt();
    Arrays.sort(arr);
    int sum=0;
    for(int i=0;i<k;i++)
      sum+=arr[i];
    System.out.println(sum);
  }
}

Measured memory_bytes: 38612