akhauriyash/Code-Regression huggingface dataset:
/**
*    created: 21.06.2020 23:32:28
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#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++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcount(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    //最後にnで割る
    long double sum = 0;
    cout << fixed << setprecision(20);
    for (int i = 1; i <= n; i++) {
        if (i >= k) {
          sum += 1.00000000000000;
          continue;
        }
        int t = 1;
        int f = i;
        while(f < k) {
            f *= 2;
            t *= 2;
        }
        sum += 1.000000000000000000 / t;
    }
    cout << sum / n << endl;
    return 0;
}

Measured memory_bytes: 3768
#include<stdio.h>
int max(int a, int b, int c);
void swap(int *a, int *b);
int main(void){
    int A,B,C;
    scanf("%d %d %d",&A, &B, &C);
    printf("%d\n",max(A,B,C));
    return 0;
}

int max(int a, int b, int c){
    if(a < b) swap(&a,&b);
    if(a < c) swap(&a,&c);
    if(b < c) swap(&b,&c);
    return (a*10+b+c);
}//a > b > cにする関数
void swap(int *a, int *b){
    int w = *a;
    *a = *b;
    *b = w;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
using uint = unsigned int;

int main() {
	int a, b;
	cin >> a >> b;
	
	int l = min(a, b);
	int h = max(a, b);
	
	for(uint i=0; i<h; i++) {
		cout << l;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = n-1; i >= 0; i-=2) {
        cout << a[i] << " ";
    }
    for(int i = 0; i < n; i+=2) {
        if(n%2 == 1 && i == 0) {
            i--;
            continue;
        }
        cout << a[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4048
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

int main(){
	ll n,m,k;
	cin >> n >> m >> k;
	
	ll ret = 0;
	ll dp[2002] = {};
	rep1(i,k-1)dp[i] = 1;
	rep1(t,400000){
		if(t*k-(t-1)-m > n)break;
		//cout << t << endl;
		/*rep(i,m+1){
			cout << dp[i] << " ";
		}cout << endl;*/
		for(int i = m ; i >= 1 && t*k-(t-1)-i <= n ; i -= k-1){
			ret += dp[i];
			if(ret >= M)ret -= M;
		}
		ll sum = 0;
		rep(i,k){
			if(m-i < 0)break;
			sum += dp[m-i];
		}
		sum %= M;
		//cout << sum << endl;
		rrep(i,m+1){
			sum += M-dp[i];
			dp[i] += sum;
			dp[i] %= M;
			if(i-k >= 0)sum += dp[i-k];
			sum %= M;
		}
	}
	cout << ret << endl;
}


Measured memory_bytes: 256
open System

let N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split(' ') |> Array.map int
let rec canDiv2 = fun v -> if v % 2 = 1 then 0 else (1 + canDiv2(v / 2))

A
|> Array.map canDiv2
|> Array.min
|> printfn "%d"

Measured memory_bytes: 14044
def main():
    A, B, AB, X, Y = list(map(int, input().split()))

    min_price = 10**100

    for n_pizza_ab in range(0, 200001, 2):
        short_pizza_a = max(X - n_pizza_ab // 2, 0)
        short_pizza_b = max(Y - n_pizza_ab // 2, 0)

        price = short_pizza_a * A + short_pizza_b * B + n_pizza_ab * AB

        if price < min_price:
            min_price = price

    print(min_price)

main()


Measured memory_bytes: 3060
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

inline int sign(ll x) {
  if (x > 0) return 1;
  if (x < 0) return -1;
  return 0;
}

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<ll> acc(N + 1);
  for (int i = 0; i < N; i++) {
    acc[i + 1] = acc[i] + A[i];
  }

  map<ll,ll> cnt;
  ll ans = 0;
  for(int i = 0; i < N + 1; i++) {
    ans += cnt[acc[i]];
    cnt[acc[i]]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15872
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var ABQ = ReadLine().Split().Select(int.Parse).ToArray();
        int A = ABQ[0], B = ABQ[1], Q = ABQ[2];
        const long INF = 100000000000;
        var s = new long[A+2];s[A + 1] = INF;s[0] = -INF;
        for (int i = 0; i < A; i++)
        {
            s[i+1] = long.Parse(ReadLine());
        }
        var t = new long[B+2];t[B + 1] = INF;t[0] = -INF;
        for (int i = 0; i < B; i++)
        {
            t[i+1] = long.Parse(ReadLine());
        }
        var x = new long[Q];
        for (int i = 0; i < Q; i++)
        {
            x[i] = long.Parse(ReadLine());
        }

        long ans = long.MaxValue;
        for (int i = 0; i < Q; i++)
        {
            long sum = long.MaxValue;
            var n = BinarySearch(x[i], s);
            long L1 = Abs(x[i] - s[n.lb]);
            long L2 = Abs(x[i] - s[n.ub]);
            if (n.lb!=0)
            {
                var pos = s[n.lb];
                var m = BinarySearch(pos, t);
                sum = Min(sum, L1 + Min(Abs(pos - t[m.lb]), Abs(pos - t[m.ub])));
            }
            if (n.ub!=A+1)
            {
                var pos = s[n.ub];
                var m = BinarySearch(pos, t);
                sum = Min(sum, L2 + Min(Abs(pos - t[m.lb]), Abs(pos - t[m.ub])));
            }

            n = BinarySearch(x[i], t);
            L1 = Abs(x[i] - t[n.lb]);
            L2 = Abs(x[i] - t[n.ub]);
            if (n.lb!=0)
            {
                var pos = t[n.lb];
                var m = BinarySearch(pos, s);
                sum = Min(sum, L1 + Min(Abs(pos - s[m.lb]), Abs(pos - s[m.ub])));
            }
            if (n.ub!=B+1)
            {
                var pos = t[n.ub];
                var m = BinarySearch(pos, s);
                sum = Min(sum, L2 + Min(Abs(pos - s[m.lb]), Abs(pos - s[m.ub])));
            }
            WriteLine(sum);
        }
        
    }
    static (int lb,int ub) BinarySearch(long pos,long[] A)
    {
        int lb = 0, ub = A.Length;
        while (ub - lb > 1)
        {
            var mid = (lb + ub) / 2;
            if (A[mid] - pos < 0) lb = mid;
            else ub = mid;

        }
        return (lb, ub);
    }
}


Measured memory_bytes: 49356
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[200];
    for(int i=0; i<n; i++) cin>>arr[i];
    int count=0,flag=0;
    while(1)
    {
        for(int i=0; i<n; i++)
        {
            if(arr[i]%2==0)
            {
                arr[i]=arr[i]/2;

            }
            else
            {
                flag=1;
                break;
            }
        }
        if(flag==1) break;
        else count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define ALL(a) a.begin, a.end()

using namespace std;

int main(void) {

	string S, T;

	cin >> S >> T;

	int correct = 0;

	if (S[0] == T[0]) correct++;
	if (S[1] == T[1]) correct++;
	if (S[2] == T[2]) correct++;

	cout << correct << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    while(1){
        if(B!=A+1){
            A++;
        }else if(A!=1){
            A--;
        }else{
            cout << "Borys" << endl;
            return 0;
        }
        if(A!=B-1){
            B--;
        }else if(B!=N){
            B++;
        }else{
            cout << "Alice" << endl;
            return 0;
        }
    }
    
    
	return 0;
}

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

const int MAX_N = 1e5+10,  MAX_Q = 1e5+10;
int N, Q;
int C[MAX_N]; //how many AC before i
int L[MAX_Q],R[MAX_Q];
string S;

void solve()
{
    for(int i=0;i<N;++i){
        C[i+1]=C[i];
        if(i&&S[i]=='C'&&S[i-1]=='A') C[i+1]++;
    }
    for(int i=0;i<Q;++i){
        int l=L[i], r=R[i];
        int res = C[r]-C[l-1];
        if(l>1 && S[l-1]=='C' && S[l-2]=='A') res--;
        printf("%d\n", res);
    }
}

int main()
{
    cin >> N >> Q >> S;
    for(int i=0;i<Q;++i) cin >> L[i] >> R[i];
    solve();
    return 0;
}


Measured memory_bytes: 2176
n,*x=$stdin.read.split.map &:to_i;m=10**9+7;d=x.each_cons(2).map{|a,b|b-a};k=0;l=1;puts d.each.with_index(1).inject(0){|s,(d,i)|k=(k*i+l)%m;l=l*i%m;(s*i+d*k)%m}

Measured memory_bytes: 12668
n = int(input())
s = list(input())
num_list = [ord(i)+n for i in s] #ord(A)は65
ans_num = [(i-65)%26 + 65 for i in num_list]
ans_str = [chr(i) for i in ans_num]
ans = "".join(ans_str)
print(ans)

Measured memory_bytes: 3316
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

/** @see http://d.hatena.ne.jp/komiyam/20120402/1333373895 */
public class Main {
	Scanner sc = new Scanner(System.in);

	int INF = 1 << 28;
	double EPS = 1e-12;

	int n, q;
	int[] ps;
	int[] queryType, queryNode;

	void run() {
		for (;;) {
			n = sc.nextInt();
			q = sc.nextInt();
			if ((n | q) == 0) {
				break;
			}
			ps = new int[n];
			for (int i = 1; i < n; i++) {
				ps[i] = sc.nextInt() - 1;
			}
			queryType = new int[q];
			queryNode = new int[q];
			for (int i = 0; i < q; i++) {
				queryType[i] = sc.next().charAt(0) == 'M' ? 0 : 1;
				queryNode[i] = sc.nextInt() - 1;
			}
			solve();
		}
	}

	class Heap {
		Heap l, r;
		int val;

		Heap(int _val) {
			val = _val;
		}

		int top() {
			return val;
		}

		Heap push(int val) {
			return meld(this, new Heap(val));
		}

		Heap pop() {
			return meld(l, r);
		}
	}

	Heap meld(Heap a, Heap b) {
		if (a == null)
			return b;
		if (b == null)
			return a;
		// if (a.val > b.val)
		if (-a.val > -b.val)
			return meld(b, a);
		a.r = meld(a.r, b);
		Heap t = a.l;
		a.l = a.r;
		a.r = t;
		// swap(a.l, a.r);
		return a;
	}

	class V extends ArrayList<V> {
		Heap h;
		int id,state;
		int markedTime;
		ArrayList<Integer> askedTimes = new ArrayList<Integer>();

		V(int _id) {
			id = _id;
		}
	}

	long ans;

	Heap rec(V v) {
		// vが答えになる
		Heap h = null;
		for (int t : v.askedTimes) {
			h = meld(h, new Heap(t));
		}
		for (V u : v) {
			h = meld(h, rec(u));
		}
		for (; h != null && h.top() > v.markedTime; h = h.pop()) {
			ans += v.id;
			// debug("vid",v.id);
		}
		return h;
	}

	void solve() {
		ans = 0;
		V[] vs = new V[n];
		for (int i = 0; i < n; i++) {
			vs[i] = new V(i + 1);
			vs[i].markedTime = INF;
		}
		// root = 1(0)
		for (int i = 1; i < n; i++) {
			// ps[i]
			vs[ps[i]].add(vs[i]);
		}
		vs[0].markedTime = -1;
		for (int i = 0; i < q; i++) {
			int v = queryNode[i], tick = i + 1;
			if (queryType[i] == 0) {
				// mark
				vs[v].markedTime = min(vs[v].markedTime, tick);
			} else {
				// query
				vs[v].askedTimes.add(tick);
			}
		}

		ps = null;
		queryNode = null;
		queryType = null;

		Stack<V> stackV = new Stack<V>();

		stackV.push(vs[0]);

		for (; !stackV.isEmpty();) {
			V v = stackV.pop();
			if (v.state == 0) {
				// 最初
				for (int t : v.askedTimes) {
					v.h = meld(v.h, new Heap(t));
				}
				stackV.push(v);
				v.state=1;
				for (V u : v) {
					stackV.push(u);
				}
			} else {
				// さいき＼(^o^)／
				for (V u : v) {
					v.h = meld(v.h, u.h);
				}
				for (; v.h != null && v.h.top() > v.markedTime; v.h = v.h.pop()) {
					ans += v.id;
				}
			}
		}
		
		System.gc();

		println(ans + "");
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s) {
		System.out.print(s);
	}

	void println(String s) {
		System.out.println(s);
	}

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

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

#define N (int)1e5 
#define pb push_back
#define ll long long
#define all(a) a.begin(),a.end()
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);

ll dizi[N],dp[N],n;


int main(){
	//fri("in.txt");
	//fro("out.txt");
	cin >> n;
	for(int  i = 0; i < n; i++){
		cin >> dizi[i];
	}
	dp[0] = 0;
	dp[1] = abs(dizi[1] - dizi[0]);
	for(int i = 2; i <= n; i++){
		dp[i] = min(dp[i-1] + abs(dizi[i] - dizi[i-1]), dp[i-2] + abs(dizi[i] - dizi[i-2]));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	long long int k,a,b;
	cin >> k >> a >> b;
	
	long long int ans = 0;
	
	if(a+1 < b && k >= a+1){
		long long int n = a+1;
		ans += b;
		long long int c = (k-n) / 2;
		long long int l = (k-n) % 2;
		ans += c*(b-a) + l;
	}else{
		ans = k + 1;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())

for i in reversed(range(y//10000 + 1)):
	res = y - 10000 * i
	for j in reversed(range(res//5000 + 1)):
		k = n - (i + j)
		if 1000 * k + 5000 * j == y - 10000 * i:
			print(str(i) + ' ' + str(j) + ' ' + str(k))
			break
		elif i == 0  and j == 0:
			print('-1 -1 -1')
	else:
		continue
	break

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

int H,W,A[200005],B[200005];
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>H>>W;
	set<pair<int,P>>st;
	set<P>ans;
	rep(i,W){
		st.insert({i,{i,i}});
		ans.insert({0,i});
	}
	rep(i,H){
		cin>>A[i]>>B[i];
		A[i]--;B[i]--;
		auto it=st.lower_bound({A[i],{0,0}});
		int first=inf,last=-inf;
		while(it!=st.end()&&it->first<=B[i]){
			chmin(first,it->second.first);
			chmax(last,it->second.second);
			ans.erase({it->first-it->second.second,it->second.first});
			it=st.erase(it);
		}
		if(B[i]!=W-1&&first!=inf)ans.insert({B[i]+1-last,first});
		if(B[i]!=W-1&&first!=inf)st.insert({B[i]+1,{first,last}});
		if(len(ans))cout<<(ans.begin()->first)+i+1<<"\n";
		else cout<<"-1\n";
	}
}

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

int main(){
   cin >> n >> m;
   ll a = n -2;
   ll b = m -2;
   
   cout << abs(a*b);
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MS(a) memset(a,0,sizeof(a))
#define MP make_pair
#define PB push_back
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//////////////////////////////////////////////////////////////////////////
const int maxn = 2e5+10;

ll n,k,x,s[maxn],tree[maxn*4];
vector<ll> v;

void add(ll x){
    while(x < maxn){
        tree[x] += 1;
        x += x&-x;
    }
}

ll sum(ll x){
    ll res = 0;
    while(x > 0){
        res += tree[x];
        x -= x&-x;
    }
    return res;
}

int main(){
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        x = read();
        x -= k;
        s[i] = s[i-1]+x;
    }
    for(int i=0; i<=n; i++) 
        v.push_back(s[i]);
    sort(v.begin(),v.end());
    v.resize(unique(v.begin(),v.end())-v.begin());
    for(int i=0; i<=n; i++) s[i] = lower_bound(v.begin(),v.end(),s[i])-v.begin()+1;

    ll ans = 0;
    for(int i=0; i<=n; i++){
        ans += sum(s[i]);
        add(s[i]);
    }
    cout << ans << endl;


    return 0;
}

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

const int N = 2e5 + 10;
const int mod = 1e9 + 7;
#define mk make_pair
#define P pair<int,int>
#define ll  long long
__int128 a[N],sum[N];
int main() {
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin >> x;
        a[i] = x;
        sum[i] = sum[i-1] + a[i];
        sum[i] = sum[i] % mod;
    }
    __int128 ans = 0;
    for(int i=1;i<n;i++)
    {
        ans += a[i] * (sum[n] - sum[i]+mod) % mod;
        ans %= mod;
    }
    cout << (ll)ans % mod << "\n";

    return 0;
}


Measured memory_bytes: 9872
import heapq
T=int(input())
for _ in range(T):
    N=int(input())
    lq=[[] for _ in range(N+1)]
    rq=[[] for _ in range(N+1)]
    ans=0
    for _ in range(N):
        K,L,R=map(int,input().split())
        ans+=min(L,R)
        if L>R:
            lq[K].append(L-R)
        else:
            rq[K].append(R-L)
    ls=[]
    for i in range(1,N+1):
        for v in lq[i]:
            heapq.heappush(ls,v)
        while len(ls)>i:
            heapq.heappop(ls)
    ans+=sum(ls)
    rs=[]
    for i in range(N,0,-1):
        for v in rq[i]:
            heapq.heappush(rs,v)
        while len(rs)>N-i:
            heapq.heappop(rs)
    ans+=sum(rs)
    print(ans)

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

vector<int> Zalgo(const vector<long long> &S) {
    int N = (int)S.size();
    vector<int> res(N);
    res[0] = N;
    int i = 1, j = 0;
    while (i < N) {
        while (i+j < N && S[j] == S[i+j]) ++j;
        res[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while (i+k < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}

int N;
vector<long long> a, b;

void solve() {
    vector<long long> ab(N * 3);
    for (int i = 0; i < N*3; ++i) {
        int j = i % N;
        int k = (i + 1) % N;
        if (i < N) ab[i] = b[j] ^ b[k];
        else ab[i] = a[j] ^ a[k];
    }

    auto v = Zalgo(ab);
    for (int k = N; k < N*2; ++k) {
        if (v[k] >= N) cout << k-N << " " << (a[k-N] ^ b[0]) << endl;
    }
}

int main() {
    while (cin >> N) {
        a.resize(N); b.resize(N);
        for (int i = 0; i < N; ++i) cin >> a[i];
        for (int i = 0; i < N; ++i) cin >> b[i];
        solve();
    }
}


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

using namespace std ;
typedef long long ll;
typedef string str;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)
#define CHI 1000000000000000003

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -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;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//xのy乗をpで割った余り

ll pow(ll x,ll y){
    ll res = 1 ;
    if(y>0){
        res = pow(x,y/2) ;
        if(y%2==0){
            res = (res*res) ;
        }
        else{
            res = (((res*res))*x) ;
        }
    }
    return res ;
}


//nCk

ll com(ll n, ll k){
  ll res = 1 ;
  FOR(i,1,k+1){
    res *= n-i+1 ;
    res /= i ;
  }
  return res ;
}
  
 


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, p ;
  cin >> n >> p ;
  ll cnto = 0 ;
  ll cnte = 0 ;
  REP(i,n){
    int a ;
    cin >> a ;
    if(a%2==0){
      cnte++ ;
    }
    else{
      cnto++ ;
    }
  }
  ll ans = 0 ;
  ll sumo = 0 ;
  ll sume = 0 ;
  if(p==0){
    sume = pow(2,cnte) ;
    for(int i=0;i<=cnto;i+=2){
      sumo += com(cnto,i) ;
    }
    ans = sume*sumo ;
  }
  else{
    sume = pow(2,cnte) ;
    for(ll i=1;i<=cnto;i+=2){
      sumo += com(cnto,i) ;
    }
    ans = sume*sumo ;
  }
  cout << ans <<endl ;
    
    
    
  
  
  
  return 0 ;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n;
	cin >> n;
	int temp = 0;
	int temp_n = n;
	while (temp_n != 0) {
		temp += temp_n % 10;
		temp_n /= 10;
	}

	if (n%temp == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	

	system("pause");
	return 0;
}

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

int main(void) {
    int x[3];
    cin >> x[0] >> x[1] >> x[2];

    int a = x[0] * 100 + x[1] * 10 + x[2];

    cout << (a % 4 == 0 ? "YES" : "NO") << endl;

    return 0;
}


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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<ll, ll>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<PII> v(n);
    for(auto &x : v){
        cin >> x.F >> x.S;
    }
    sort(ALL(v), [&](PII p1, PII p2){
        if(p1.F != p2.F){
            return p1.F < p2.F;
        }
        return p1.S > p2.S;
    });
    ll ans = 0;
    for(auto &x : v){
        ll take = min(m, x.S);
        m -= take;
        ans += take * x.F;
        if(m <= 0){
            break;
        }
    } 
    cout << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define fi first
#define se second
#define test ll int t;cin>>t;while(t--)
#define pll pair<long long,long long>
#define icc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a);}
                a=(a*a);
                b>>=1;
        }
    return ans;
}
int main(){
	icc
	int c;
	cin>>c;
	if(c>=30)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<double> p(n);
    cin >> p;
    double maxi = 0;
    double sum = 0;
    rep(i, n) {
        sum += (p.at(i) + 1) / 2;
        if (i < k - 1) continue;

        if (k <= i) {
            sum -= (p.at(i - k) + 1) / 2;
        }
        chmax(maxi, sum);
    }
    printf("%.10lf\n", maxi);
}

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

const double PI = 3.14159265358979323846;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc144_d() {
	ll a, b, x;
	double value1, value2, value3;
	double ans = 0.0F;

	cin >> a >> b >> x;

	// 台形限界
	value1 = 2.0 * x / (a * a * a);
	// 台形値
	value2 = 2.0 * (a * a * b - x) / (a * a * a);
	// 三角形値
	value3 = a * b * b / (2.0 * x);


	if (value2 < value1) {
		ans = atan(value2) * 180 / PI;
	}
	else {
		ans = atan(value3) * 180 / PI;
	}

	cout << fixed << setprecision(10) << ans << "\n";
}

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

	solve_abc144_d();

	return 0;
}


Measured memory_bytes: 256
program monsters_battle_royale
  implicit none
  integer(8)              :: n, i, ans
  integer(8), allocatable :: a(:)
  read(*,*) n
  allocate(a(n))
  read(*,*) a(:)
  ans = a(1)
  do i = 1, n
     ans = gcd(a(i),ans)
  end do
  deallocate(a)
  write(*,'(i0)') ans
  stop
  
contains
  
  recursive function gcd(a0,b0) result(c)
    implicit none
    integer(8), intent(in) :: a0, b0
    integer(8)             :: a, b, c
    a = a0
    b = b0
    if (a .lt. b) call swap(a,b)
    if (mod(a,b) .eq. 0) then
       c = b
    else
       c = gcd(b,a-b*(a/b))
    end if
  end function gcd
  
  subroutine swap(a,b)
    implicit none
    integer(8), intent(inout) :: a, b
    integer(8)                :: c
    c = a
    a = b
    b = c
    return
  end subroutine swap
  
end program monsters_battle_royale

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(snip_i, n) cin >> a.at(snip_i);
  vector<int> l(n), r(n);
  map<int, int> pl, pr;
  rep(i, n){
    pr[i-a.at(i)]++;
    pl[i+a.at(i)]++;
    // cerr << i << " " << i-a.at(i) << " " << i+a.at(i) << endl;
  }
  ll ans = 0;
  for(auto p : pl){
    ans += (ll)p.second * pr[p.first];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 30940
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> pack(3);
    for(int i = 0; i < 3; i++) cin >> pack[i];
    sort(pack.begin(), pack.end());
    if(pack[0] + pack[1] == pack[2]) cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
local mmi, mma = math.min, math.max
local bls, brs = bit.lshift, bit.rshift
local h, w, k = io.read("*n", "*n", "*n", "*l")
local map = {}
for i = 1, h do
  local s = io.read()
  for j = 1, w do
    local ss = s:sub(j, j)
    map[(i - 1) * w + j] = ss == "1"
  end
end
local ans = false
local tot = 2^(h - 1)
for it = 0, tot - 1 do
  local tmpi = it
  local box = {1}
  local pos = 1
  for j = 2, h do
    if it % 2 == 1 then
      pos = pos + 1
    end
    box[j] = pos
    it = brs(it, 1)
  end
  local bsize = pos
  local ret = bsize - 1
  -- print(tmpi, ret)
  local bcnt = {}
  for i = 1, bsize do
    bcnt[i] = 0
  end
  local valid = true
  local start_w = 1
  for j = 1, w do
    for i = 1, h do
      local idx = (i - 1) * w + j
      if map[idx] then
        bcnt[box[i]] = bcnt[box[i]] + 1
      end
    end
    local over = false
    for ib = 1, bsize do
      if k < bcnt[ib] then
        over = true
        break
      end
    end
    if over then
      if start_w == j then
        valid = false
        break
      end
      start_w = j
      ret = ret + 1
      for ib = 1, bsize do
        bcnt[ib] = 0
      end
      for i = 1, h do
        local idx = (i - 1) * w + j
        if map[idx] then
          bcnt[box[i]] = bcnt[box[i]] + 1
        end
      end
    end
  end
  if valid then
    if not ans then ans = ret
    else ans = mmi(ans, ret)
    end
  end
end
print(ans)


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout<<"\n"
#define endl '\n'
#define pb push_back
#define se second
#define fi first
#define int long long 
#define pi pair<int,int>
#define vpi vector<pi>
#define vvpi vector<vpi>
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define For(i,n) for(int i=0;i<n;i++)
#define Forn(i,a,n) for(int i=a;i<n;i++)
#define pie =3.14159265358979323846264338327950;
const int mod= 998244353;

void solve(){
	fio;
	int n,x,t;
	cin>>n>>x>>t;
	cout<< t*((int)ceil((double)n/x))<<endl;
}

int32_t main(){
	fio;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;i++){ 
		//cout<<"Case #"<<i<<":\n";
		solve();
	}
	return 0;
}


Measured memory_bytes: 3728
#ABC122B
S = input()
SC= S.replace('C','A')
SCG = SC.replace('G','A')
SCGT = SCG.replace('T','A')
ans = 0
wk = 0
for i in range(int(len(S))):
    if SCGT[i:i+1] == 'A':
        wk += 1
    else:
        if wk >= ans:
            ans = wk
        wk =0

if wk >= ans:
    ans = wk
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m,t,i,j,k,x=0,y=0,z,q,l,r;
    cin>>n>>m>>z;
    long long an1=(z/n);
    long long an2=(z/m);
    if(n*an1!=z){
        an1++;
    }
    if(an2*m!=z){
        an2++;
    }
    //cout<<an1<<" "<<an2<<endl;
    cout<<min(an1,an2)<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int n;cin>>n;
	string s;cin>>s;
	int ans=0;
	for(int i=1;i<n;i++){
		string s1=s.substr(0,i);
		string s2=s.substr(i,n-i);
		int c[26]={};
		for(int i=0;i<s1.length();i++){
			for(int j=0;j<s2.length();j++){
				if(s1[i]==s2[j]){
					c[s1[i]-'a']=1;
				}
			}
		}
		int co=0;
		for(int i=0;i<26;i++){
			if(c[i])co++;
		}
		ans=max(ans,co);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,a[200005],cnt,f;
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		a[i]-=i;
	}
	sort(a+1,a+n+1);
	if(n%2==1)f=a[(n+1)/2];
	else f=a[n/2];
	for(int i=1;i<=n;++i)
		cnt+=abs(a[i]-f);
	printf("%lld",cnt);
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;

int main()
{
	const string w[] = { "apple", "peach" };
	const string t[] = { "_ALE_", "_PEH_" };
//	cut here before submit 
//	freopen("testcase.applepeach", "r", stdin);
	string str = "";
	int i;

	while (getline (cin, str ) ){
		if (str.empty() ){
			break;
		} // end if
		vector <int> dot;
		vector <int> camma;
		int i;
		str = ' ' + str + ' ';

		while ( str.find ('.') != string::npos ){
			dot.push_back ((int)str.find('.') );
			str.replace (str.find('.'), 1, " " );
		} // end while
		while ( str.find (',') != string::npos ){
			camma.push_back ((int)str.find(',') );
			str.replace (str.find (','), 1, " " );
		} // end while

		while (str.find(w[0]) != string::npos ){
			str = str.replace (str.find(w[0]), w[0].length(),t[0] );
		} // end while

		while (str.find(w[1]) != string::npos ){
			str = str.replace (str.find(w[1]), w[1].length(),t[1] );
		} // end while

		while (str.find(t[0]) != string::npos ){
			str = str.replace (str.find(t[0]), t[0].length(),w[1] );
		} // end while

		while (str.find(t[1]) != string::npos ){
			str = str.replace (str.find(t[1]), t[1].length(),w[0] );
		} // end while

		if (!dot.empty() ){
			for (i = 0; i < dot.size(); ++i){
				str = str.replace (dot[i], 1, "." );
			} // end for
		} // end if
		if (!camma.empty() ){
			for (i = 0; i < camma.size(); ++i){
				str = str.replace (camma[i], 1, "," );
			} // end for
		} // end if

		cout << str.substr(1, str.length() - 2) << endl;	
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

template<typename T>
struct BellmanFord{
    struct edge{
        int u,v;
        T w;
        edge(){}
        edge(int u,int v,T w):u(u),v(v),w(w){}
    };

    const T inf=(numeric_limits<T>::max())/2;//infを設定する
    int n;
    vector< vector<int> > G;
    vector<int> used,reach;
    BellmanFord(int n):n(n),G(n),used(n,0),reach(n,1){}

    vector<edge> es;
    void add_edge(int u,int v,T c){
        es.emplace_back(u,v,c);
        G[u].emplace_back(v);
    }

    vector<T> build(int from,int &neg_loop){
        vector<T> ds(n,inf);
        ds[from]=0;
        for(int j=0;j<n;j++){
            bool update=0;
            for(auto e:es){
                if(!reach[e.u]||!reach[e.v]||ds[e.u]==inf) continue;
                if(ds[e.v]>ds[e.u]+e.w){
                    ds[e.v]=ds[e.u]+e.w;
                    update=1;
                }
            }
            if(!update) break;
            if(j==n-1){
                neg_loop=1;
                return ds;
            }
        }
        neg_loop=0;
        return ds;
    }

    void dfs(int v){
        if(used[v]) return;
        used[v]=1;
        for(int u:G[v]) dfs(u);
    }

    T shortest_path(int from,int to,int &neg_loop){
        for(int i=0;i<n;i++){
            fill(used.begin(),used.end(),0);
            dfs(i);
            reach[i]=used[to];
        }
        return build(from,neg_loop)[to];
    }
};

int n,m;ll p;

void solve(){
    cin >> n >> m >> p;
    BellmanFord<ll> bel(n);
    rep(i,m){
        int u,v;ll c;cin >> u >> v >> c;u--;v--;
        bel.add_edge(u,v,p-c);
    }
    int neg=0;
    ll ans=bel.shortest_path(0,n-1,neg);
    if(neg) cout << -1 << endl;
    else cout << max(0ll,-ans) << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}


Measured memory_bytes: 3944
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
#define N 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i;
    string a,b;
    cin>>n>>a>>b;
    for(i=0;i<n;i++)
        cout<<a[i]<<b[i];
    return 0;
}


Measured memory_bytes: 256
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)


N = int(input().strip())
T,A = list(map(int, input().strip().split(' ')))

H = list(map(int, input().strip().split(' ')))

best_i = 0
best_temp = T-H[0]*0.006

for i in range(1,N):
	if(abs(A-best_temp) > abs(A-(T-H[i]*0.006))):
		best_i = i
		best_temp = T-H[i]*0.006

print(best_i+1)

Measured memory_bytes: 3064
import Control.Monad

import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

toInts :: IO [Int]
toInts = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

fac :: Integer -> Integer
fac 0 = 1
fac n = n * fac (n - 1)

comb :: Int -> Int -> Int
comb a b =
  let a_ = (fromIntegral a)
   in let b_ = (fromIntegral b)
       in fromIntegral $
          mod (div (fac a_) ((fac $ a_ - b_) * (fac b_))) 1000000007

b_p :: Int -> Int -> Int
b_p a b = mod (a * b) 1000000007

solver :: Int -> Int -> Int -> Int
solver n k i =
  if (n - k) + 1 < i
    then 0
    else b_p (comb ((n - k) + 1) i) (comb (k - 1) (i - 1))

main :: IO ()
main = do
  (n:k:[]) <- toInts
  forM_ [1 .. k] (\i -> print $ solver n k i)

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

int main(int argc, const char * argv[]) {
  int time, hours, minuts, seconds;
  cin >> time ;
  hours = time / 3600;
  minuts = (time % 3600) / 60;
  seconds = (time % 3600) % 60;
  
  cout << hours << ":" << minuts << ":" << seconds << endl;
  
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
const  long double eps = 1e-2;
const long double pi = acos(-1.0);
using namespace std;

const int N = 1e5 + 1;
const int LOG = 20;
int n, l;
int x[N];
int up[LOG][N];
void solve(){
        cin >> n;
        for (int i = 1; i <= n; i++) cin >> x[i];
        cin >> l;
        
    
        for (int i = 1; i <= n; i++){
            if (i == n){
                up[0][i] = i;
                continue;
            }
            int p = upper_bound(x + 1, x + n + 1, x[i] + l) - x;
            p--;
            up[0][i] = p;
        }
        
    for (int k = 1; k < LOG; k++){
        for (int i = 1; i <= n; i++)
            up[k][i] = up[k - 1][up[k - 1][i]];
    }  
    int q;
    cin >> q;
    while (q--){
        int a, b;
        cin >> a >> b;
        if (a > b) swap(a, b);
        int ans = 0;
        for (int i = LOG - 1; i >= 0; i--)
            if (up[i][a] < b){
                ans += (1 << i);
                a = up[i][a];
            }
        cout << ans + 1 << endl;
    }
}
int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(3);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int step;
	step = 1;
    for (int i = 1; i <= step; i++){
         solve();
    }
}

Measured memory_bytes: 11760
L = list("abcdefghijklmnopqrstuvwxyz")

def num(X):
    return L.index(X)


N = int(input())
S = list(str(input()))
S = [0] + S
Q = int(input())

query = [0] * Q

for i in range(Q):
    query[i] = list(input().split())

#print(query)

###Binary Indexed Tree

#A1 ... AnのBIT(1-indexed)
ABC_BIT = [[0]*(N+1) for i in range(26)]

#print(ABC_BIT)

#A1 ~ Aiまでの和 O(logN)
def BIT_query(alp,idx):
    res_sum = 0
    xx = idx
    while xx > 0:
        res_sum += ABC_BIT[alp][xx]
        xx -= xx&(-xx)
    return res_sum

#Ai += x O(logN)
def BIT_update(alp,idx,x):
    xx = idx
    while xx <= N:
        #print(xx)
        ABC_BIT[alp][xx] += x
        xx += xx&(-xx)
    return

#print(L,S,Q)

for i in range(1,N+1):
    BIT_update(num(S[i]),i,1)
    #print(ABC_BIT)

for i in range(Q):
    if query[i][0] == "1":
        y = int(query[i][1])
        z = query[i][2]
        BIT_update(num(S[y]),y,-1)
        BIT_update(num(z),y,1)
        S[y] = z
    else:
        y = int(query[i][1])
        z = int(query[i][2])
        count = 0
        for k in range(26):
            if BIT_query(k,z) - BIT_query(k,y-1) >= 1:
                count += 1
        print(count) 


Measured memory_bytes: 185748
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
for i in range(N):
    P[i] -= 1

ans = -10**10
for i in range(N):
    T = []
    Check = [0]*N
    move = i
    count = 1
    while(True):
        if Check[move] != 0:
            break
        Check[move] = count
        T.append(C[P[move]])
        move = P[move]
        count += 1
    s = Check[move] - 1
    result_1 = -10**10
    total = 0
    for j in range(min(s, K)):
        total += T[j]
        result_1 = max(result_1, total)
    result_2 = -10**10
    total = 0
    for j in range(min(len(T), K)):
        total += T[j]
        result_2 = max(result_2, total)
    if K >= len(T):
        result_3 = 0
        result_3 += sum(T[:s])
        result_3 += sum(T[s:])*((K - len(T[:s])) // len(T[s:]))
        result_4 = result_3
        total = result_3
        for j in range((K - len(T[:s])) % len(T[s:])):
            total += T[j]
            result_3 = max(result_3, total)
        total = result_4
        for j in T[s:][::-1]:
            total -= j
            result_4 = max(result_4, total)
    if K >= len(T):
        if result_4 != 0:
            ans = max([result_1, result_2, result_3, result_4, ans])
        else:
            ans = max([result_1, result_2, result_3, ans])
    else:
        ans = max([result_1, result_2, ans])
print(ans)

Measured memory_bytes: 93852
import sys

dice = [int(i) for i in sys.stdin.readline().split()]
command = sys.stdin.readline().strip()
for c in command:
    if c == "N":
        dice = (dice[1], dice[5], dice[2], dice[3], dice[0], dice[4])
    elif c == "S":
        dice = (dice[4], dice[0], dice[2], dice[3], dice[5], dice[1])
    elif c == "W":
        dice = (dice[2], dice[1], dice[5], dice[0], dice[4], dice[3])
    elif c == "E":
        dice = (dice[3], dice[1], dice[0], dice[5], dice[4], dice[2])
print(dice[0])

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

int main() {
string a;
int i,j,n,m,t,k; 
cin>>a;
for(i=0;i<a.size();i++)
{
	if(a[i]!='R'||a[i+1]!='L')cout<<"0 ";
	else {
		int aa=0,bb=0;
	int tep=i;
	while(a[tep]=='R'){
		if(abs(tep-i)%2==0)aa++;
		else bb++;
		tep--;
	}
	tep=i+1;
	while(a[tep]=='L'){
		if(abs(tep-i-1)%2==0)bb++;
		else aa++;
		tep++;
	}
	cout<<aa<<" "<<bb<<" ";
	i++;
	}
}


}



 

Measured memory_bytes: 640
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
      
      if(n*a>=b){System.out.print(b);}
      else{System.out.print(a*n);}
      
 
      
	}
}

Measured memory_bytes: 23380
from operator import itemgetter
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=itemgetter(2))
x, y, h = xyh[-1][0], xyh[-1][1], xyh[-1][2]

for px in range(101):
    for py in range(101):
        ph = h + abs(px - x) + abs(py - y) #適当な情報一つとpx,pyでpyを決め打ち
        ok = True
        for x, y, h in xyh:
            if h > 0 and ph - h != abs(px - x) + abs(py - y): #その情報において式が成り立たない
                ok = False
            if h == 0 and ph > abs(px - x) + abs(py - y):     
                ok = False

        if ok:
            print(str(px) + " " + str(py) + " " + str(ph))
                
            

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

int main(){
   int n;
   cin >> n;
   int l[n];
   int d=0;
   int m=0;
   for(int i=0; i<n; i++){
       cin >> l[i];
       m += l[i];
       d = max(d,l[i]);
   }
   if(m-d>d) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		int roopCountUp = 0;
		int roopCountDown = 0;
		Set<Integer> numberSet = new TreeSet<>();
		for (int i = A ; i <= B; i++) {

			numberSet.add(i);

			roopCountUp++;
			if (roopCountUp >= K) {
				break;
			}
		}
		for (int j = B; j >= A; j--) {

			numberSet.add(j);

			roopCountDown++;
			if (roopCountDown >= K) {
				break;
			}
		}
		for (Integer number : numberSet) {
			System.out.println(number);
		}


	}
}


Measured memory_bytes: 23508