akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
using namespace std;

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

	// 各要素Ai - 1, Ai, Ai + 1の3パターン
	int all_case = pow(3, n);

	int all_odd = 1;
	for (int i = 0; i < n; ++i) {
		int a; scanf("%d", &a);

		if ((a & 1) == 0) all_odd *= 2;
	}

	printf("%d\n", all_case - all_odd);

	return 0;
}

Measured memory_bytes: 128
#include <set>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    string S; int n;
    
    set<string> T;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> S;
        
        if(i % 20 == 0 || i % 20 == 1 || i % 20 == 2)
        {
            printf("1\n");
        }
        else if(i % 20 == 4)
        {
            printf("72\n");
        }
        else if(i % 20 == 5)
        {
            printf("420\n");
        }
        else
        {
            T.clear();
            
            for(int j = 1; j < S.size(); j++)
            {
                string A = S.substr(0, j);
                string B = S.substr(j, S.size() - j);
                
                string C = A; reverse(C.begin(), C.end());
                string D = B; reverse(D.begin(), D.end());
                
                T.insert(A + B);
                T.insert(B + A);
                T.insert(A + D);
                T.insert(D + A);
                T.insert(C + B);
                T.insert(B + C);
                T.insert(C + D);
                T.insert(D + C);
            }
            
            printf("%d\n", T.size());
        }
    }
    
    return 0;
}

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

int main()
{


 int a,b;
 cin>>a>>b;

 int mn=min(b*10,(a*100)/8)-1;
 int mx=max(b*10,(a*100)/8)+1;

 for(int index=mn;index<=mx;index++)
 {
     if(index/10==b&&(index*8)/100==a)
     {
         cout<<index<<endl;
         return 0;
     }
 }
cout<<-1<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==1||a==3||a==5||a==7||a==8||a==10||a==12){
		a=0;
	}
	else if(a==4||a==6||a==9||a==11){
		a=1;
	}
		else if(a==2){
			a=2;
		}
	if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)	{
		b=0;
	}
	else if(b==4||b==6||b==9||b==11){
		b=1;
	}
	else if(b==2){
			b=2;
	}
	if(a==b){
		printf("Yes");
	}
	else{printf("No");}
	return 0;
}


Measured memory_bytes: 128
N = int(input())
a =[int(input()) for i in range(N)]

count = 0
num = 0

for x in range(N):
  if a[num] == 2:
    count += 1
    print(count)
    break
  elif a[num] != 2:
    count += 1
    num = a[num] - 1
    if count == N:
      print(-1)
    else:
      continue

Measured memory_bytes: 7084
num=int(input().rstrip())
cases=[]
for i in range(num):
    cases.append(input().rstrip())
target=['AC','WA','TLE','RE']
result=[0,0,0,0]
for j in range(len(target)):
    for i in range(len(cases)):
        if cases[i]==target[j]:
            result[j]=result[j]+1
for i in range(len(target)):
    print(target[i]+' x '+str(result[i]))


Measured memory_bytes: 16072
#include <bits/stdc++.h>
 
using namespace std;
typedef pair<int, int> pii;

int n;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<pii> V;
    for (int i = 1; i <= n; i++) {
        int x, l;
        cin >> x >> l;
        V.emplace_back(x + l, x - l);
    }
    sort(V.begin(), V.end());
    int ans = 0, last = -2e9;
    for (auto i : V) {
        if (last <= i.second) {
            last = i.first;
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 1400
#include <iostream>
using namespace std;
 
    
    
int main(){
     
     int H,A,x=0;
     cin>>H>>A;

     for(int i=0;H>0;i++)
     {
        H=H-A;
        x=x+1;
     }

    cout<<x<<endl;
 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>


using namespace std;

int main()
{
    int N;

    cin >> N;
    string buff;
    for (int n = 0; n < N; ++n) { cin >> buff;}

    vector<int> c(N);   // R = 0, W = 1 の配列
    const char* cbuff = buff.c_str();
    for (int n = 0; n < N; ++n) { c[n] = (cbuff[n] == 'R') ? 0 : 1;}

    int count = 0;
    int start_min_w = 0;
    int start_max_r = N-1;
    for (int n = 0; n < N; ++n)
    {
        // 最小の 1 のインデックス
        int min_w = -1;
        for (int i = start_min_w; i < N; ++i)
        {
            if (c[i] == 1)
            {
                min_w = i;
                break;
            }
        }

        if (min_w == -1) { break;}    // ないときは終了
        start_min_w = min_w + 1;

        // 最大の 0 のインデックス
        int max_r = N;
        for (int i = start_max_r; i >= 0; --i)
        {
            if (c[i] == 0)
            {
                max_r = i;
                break;
            }
        }

        if (max_r == N) { break; }    // ないときは終了
        start_max_r = max_r - 1;


        if (min_w > max_r)
        {
            break;
        }
        else     // 交換
        {
            c[max_r] = 1;
            c[min_w] = 0;
            ++count;
        }
    }

    cout << count << endl;


    return 0;
}


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

int main() {
	int N; cin >> N;
	vector<int> L(N*2);
	for(int i = 0; i < L.size(); i++)
		cin >> L[i];
	sort(L.begin(), L.end());

	int res = 0;
	for(int i =0; i < L.size(); i += 2)
		res += L[i];
	cout << res << endl;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll n;
vector<ll> a;

ll count(ll sum) {
    ll cnt = 0;
    for (ll i = 1; i < n; ++i) {
        if (sum > 0) {
            sum += a[i];
            if (sum >= 0) {
                cnt += abs(sum) + 1;
                sum = -1;
            }
        } else {
            sum += a[i];
            if (sum <= 0) {
                cnt += abs(sum) + 1;
                sum = 1;
            }
        }
    }

    return cnt;
}

int main() {

    cin >> n;
    ll ans = LINF;

    a.resize(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }

    if (a[0] == 0) {
        ans = min(ans, count(1) + 1);
        ans = min(ans, count(-1) + 1);
    } else {
        ans = min(ans, count(a[0]));

        if (a[0] > 0) {
            ans = min(ans, count(-1) + abs(a[0]) + 1);
        } else {
            ans = min(ans, count(1) + abs(a[0]) + 1);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4028
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
int main(){
    int n;cin>>n;
    int A[MAX];
    rep(i,n)cin>>A[i];
    int ans=A[0];
    for(int i=0;i<n;i++){
        ans=GCD(ans,A[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	vector<ll> a;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	if(n<=k){
		cout << 0;
		return 0;
	}
	ll sum=0;
	for(ll i=0;i<n-k;i++){
		sum+=a[i];
	}
	cout <<sum;
	// your code goes here
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);

//番号ズレ注意！！
int main() {
    int N, M;
    cin >> N >> M;
    int ans[N + 1];
    REP_1(i, N) {
        ans[i] = 0;
    }
    REP(i, M) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        ans[tmp1] += 1;
        ans[tmp2] += 1;
    }
    REP_1(i, N) {
        print(ans[i]);
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    L, R, d = map(int, input().split())
    ans = 0
    for i in range(L,R+1):
        if i % d == 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9460
#include <stdio.h>
int power(int,int);
int main(void){
    int D, N;
    scanf("%d %d", &D, &N);
    if(N==100) N++;
    printf("%d\n", power(100, D) * N);
    return 0;
}
int power(int a, int b){
    int i, w=1;
    for(i=0; i<b; i++) w *= a;
    return w;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
c = 0
is_count = True

while 1:
    a = list(map(lambda x: x/2, a))

    for i in a:
        if not i.is_integer():
            is_count = False

    if is_count:
        c += 1
    else:
        break

print(c)

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

# cnt = 0
# for i in range(N):
#     if A[i] % 2 == 1:
#         cnt += 1

# 内包表記の後ろに条件式で抽出できる
cnt = len([i for i in A if i % 2 == 1])
if cnt % 2 == 0:
    print('YES')
else:
    print('NO')


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

int stuff[100005];
int n, k;

bool allocation(int p){
    int sum=0;
    int i=0;
    int truck=1;
    while(i<n){
        if(p<stuff[i]){
            return false;
        }
        sum+=stuff[i];
        if(sum>p){
            truck++;
            sum=0;
            if(truck>k)
                return false;
        }
        else{
            i++;
        }
    }
    
    return true;
}

int main() {
    ios_base::sync_with_stdio(0);
    
    cin >> n >> k;
    
    for(int i=0; i<n; i++){
        cin >> stuff[i];
    }
    
    int low=0, high=1000000006;
    int mid=0;
    while(low+1<high){
        mid = (low+high)/2;
        if(allocation(mid)){
            high=mid;
        }
        else{
            low=mid;
        }
    }
    
    cout << high << endl;
    return 0;
}

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

using namespace std;

#define endl "\n"
#define int long long 
#define test int qt;cin>>qt;while (qt--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)



int32_t main()
{
    IOS;
    int a,b,c;cin>>a>>b>>c;
    int k;cin>>k;
    while(b<=a){
        b*=2;k--;
    }
    while(c<=b) {
        c*=2;k--;
    }
    if(k<0)cout<<"No";
    else cout<<"Yes";
    return 0;
} 

Measured memory_bytes: 3648
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;
 
#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

main(){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    n *= 2;
    int l[n];
    scn(n, l);
    sort(l, l + n);
 
    int res = 0;
    rep(i, n / 2){
      res += l[i * 2];
    }
 
    pri(res);
 
/*/
 
//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, d;
	cin >> n >> d;
	vi ds(n);
	trav(x, ds) cin >> x;

	vi pos(n+1, d);
	rep(i,0,n){
		pos[i+1] = ds[i]>=2*pos[i] ? pos[i] : abs(pos[i] - ds[i]);
	}

	vi suf(n+1, 1);
	rrep(i,0,n)
		suf[i] = suf[i+1] + (ds[i]>=2*suf[i+1] ? 0 : ds[i]);

	int q;
	cin >> q;
	rep(_,0,q){
		int x;
		cin >> x;
		if(pos[x-1] >= suf[x]) puts("YES");
		else puts("NO");
	}
}

Measured memory_bytes: 7808
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int[] a = new int[n];
                int[] b = new int[n];
                int[] c = new int[n];
                long bwa = 0;
                long awa = 0;
                long lost = 0;
                int yono = 0;
                for(int i = 0 ; i < n ; i++){
                        a[i] = sc.nextInt();
                        awa += a[i];
                }
                for(int i = 0 ; i < n ; i++){
                        b[i] = sc.nextInt();
                        bwa += b[i];
                        c[i] = a[i] - b[i];
                        if(c[i] < 0){
                                lost -= c[i];
                                yono++;
                        }
                }
                sc.close();
                if(bwa > awa){
                        System.out.println(-1);
                }else{
                        int cha = 0;
                        Arrays.sort(c);
                        while(lost > 0){
                                cha++;
                                lost -= c[n - cha];
                        }
                        System.out.println(cha + yono);
                }
        }
}
//これを制限時間内に解けていれば勝てたのに…

Measured memory_bytes: 61560
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define ll      long long

int g[202][202];

static const int INF = 0x3f3f3f3f;

void solve() {
        int n, m, r;
        cin >> n >> m >> r;
        vector<int> city(r);
        for (int i = 0; i < r; i ++) { 
                cin >> city[i];
                city[i] --;
        }
        for (int i = 0; i < 202; i ++) {
                for (int j = 0; j < 202; j ++) {
                        g[i][j] = INF;
                }
        }
        for (int i = 0; i < m; i ++) {
                int a, b, c;
                cin >> a >> b >> c;
                a --, b --;
                g[a][b] = c;
                g[b][a] = c;
        }
        for (int i = 0; i < 202; i ++) g[i][i] = 0;
        for (int k = 0; k < n; k ++) {
                for (int i = 0; i < n; i ++) {
                        for (int j = 0; j < n; j ++) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
                }
        }
        sort(all(city));
        int ans = INF;
        do {
                int sum = 0;
                for (int i = 0; i < r - 1; i ++) {
                        sum += g[city[i]][city[i + 1]];
                }
                ans = min(ans, sum);
        } while (next_permutation(all(city)));
        cout << ans << endl;
        return;
}

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

        //int T;
        //freopen("a.in", "r", stdin);
        //cin >> T;
        //while (T --) solve();
        
        solve();
        return 0;
}



Measured memory_bytes: 384
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto d = RDR.ARR;

	d.sort();
	auto diff = d[$/2] - d[$/2-1];

	writeln(diff);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 4444
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

print(max(0, min(B, D) - max(A, C)))

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  cin >> a;
  int count = 0;
  for (int i=0; i < 3; i++){
    if (a.at(i) == '1'){
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
n = int(input())
MOD = 10 ** 9 + 7

a = list(map(int, input().split()))

if n % 2 == 1:
    l = (n + 1) * (n - 1)
else:
    l = n ** 2

if sum(a) == l // 2:
    print(2 ** (n//2) % MOD)
else:
    print(0)



Measured memory_bytes: 13880
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        int ans = 0;
        int tmp = 0;
        if(b!=1) {
        	for(int i = 1;true;i++) {
        		if(i != 1) {
        		tmp--;
        		}
        		tmp += a;
        		if(tmp >= b) {
        		ans = i;
        		break;
        		}

        	}
        }
        System.out.println(ans);
    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 1e5 + 1;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg 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 << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

struct node {
	int x; LL c;
} a[N];

int main() {
	reg n = read(), S = read();
	fo(i, 1, n) a[i].x = read(), a[i].c = read();
	reg t = -1, l = 1, r = n; LL ans = 0;
	while(a[l].x < S && a[r].x > S) {
		if(a[l].c < a[r].c) a[r].c += a[l].c, ans += t == 0 ? 0 : a[r].x - a[l].x, t = 0, l++;
		else a[l].c += a[r].c, ans += t == 1 ? 0 : a[r].x - a[l].x, t = 1, r--;
	} if(a[l].x > S) ans += a[r].x - S;
	else ans += S - a[l].x;
	pr2(ans);
	return 0;
}



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

void fail(){
	cout << "Impossible" << '\n';
	exit(0);
}

mt19937 mt(48);

vector<int> inv(vector<int> x){
	reverse(x.begin(), x.end());
	for(int& a : x) a = -a;
	return x;
}

vector<int> make(vector<int> val){
	if(val.size() == 1){
		int f = mt() & 4;
		f -= 2;
		if(f == 0) f++;
		vector<int> x;
		if(f < 0){
			for(int r = 0; r < -f; r++) x.push_back(-val.front());
		} else {
			for(int r = 0; r < f; r++) x.push_back(val.front());			
		}
		return x;
	}
	vector<int> nval[2];
	vector<int> nx[2];
	for(int i = 0; i < (int)val.size(); i++){
		nval[i & 1].push_back(val[i]);
	}
	nx[0] = make(nval[0]);
	nx[1] = make(nval[1]);
	vector<int> x;
	for(int r : nx[0]) x.push_back(r);
	for(int r : nx[1]) x.push_back(r);
	for(int r : inv(nx[0])) x.push_back(r);
	for(int r : inv(nx[1])) x.push_back(r);
	return x;
}

void pr(vector<int> x){
	vector<pair<int,int> > path;
	path.push_back({0, 0});
	for(int f : x){
		int c = 0;
		int val = abs(f) - 1;
		while(c < val){
			c++;
			path.push_back({c, 0});
		}
		if(f > 0){
			path.push_back({c, 1});
			path.push_back({c+1, 1});
			path.push_back({c+1, 0});
			path.push_back({c, 0});
		} else {
			path.push_back({c+1, 0});
			path.push_back({c+1, 1});
			path.push_back({c, 1});
			path.push_back({c, 0});
		}
		while(c > 0){
			c--;
			path.push_back({c, 0});
		}
	}
	cout << "Possible" << '\n';
	cout << (int)path.size() - 1 << '\n';
	for(pair<int,int> a : path){
		cout << a.first << ' ' << a.second << '\n';
	}
}

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int N = (1 << n);
	string s(N, '0');
	cin >> s;
	// for(int j = 0; j < N; j++){
	// 	s[j] = "01"[(__builtin_popcount(j | (j >> 1)) <= 3)];
	// }

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if((i & j) == i){
				if(s[i] < s[j]){
					fail();
				}
			}
		}
	}
	vector<vector<int> > q;
	for(int i = 0; i < N; i++){
		if(s[i] == '1') continue;
		vector<int> val;
		bool fail = false;
		for(int j = 0; j < n; j++){
			if((i >> j) & 1){
				val.push_back((j+1));
				if(s[i ^ (1 << j)] == '0') fail = true;
			}
		}
		if(fail) continue;
		shuffle(val.begin(), val.end(), mt);
		q.push_back(val);
	}
	while(true){
		vector<int> ans;
		shuffle(q.begin(), q.end(), mt);
		for(vector<int> val : q){
			vector<int> z = make(val);
			for(int v : z) ans.push_back(v);
		}
		bool works = true;
		for(int j = 0; j < N; j++){
			vector<int> stk = {0};
			for(int f : ans){
				if((j >> (abs(f) - 1)) & 1){
					if(stk.back() == -f){
						stk.pop_back();
					} else {
						stk.push_back(f);
					}
				}
			}
			int wins = (stk.size() == 1);
			if(wins != s[j] - '0'){
				cerr << j << ' ' << wins << ' ' << (s[j] - '0') << '\n';
				works = false;
			}
		}
		if(!works) continue;
		cerr << ans.size() << '\n';
		for(int x : ans){
			cerr << x << ' ';
		}
		cerr << '\n';
		pr(ans);
		exit(0);
	}
}

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

int main() {
    int N, a, b, B, sumA=0, sumB=0, Min=1000000;
    cin >> N;
    for (int A=1; A<N; A++){
     		B=N-A;
      		a=A, b=B;
            sumA=0, sumB=0;
            while (true){
              		sumA += a%10;
                    a = (a-a%10)/10;
                    if (a==0) break;
            }
            while (true){
              		sumB += b%10;
                    b = (b-b%10)/10;
              		if (b==0) break;
            }
            if ((Min>sumA+sumB)||A==1){
              		Min = sumA+sumB;
            }
    }
    cout << Min << endl;
              		
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
#define INF (1<<28)
#define MAX 105
struct edge{int to,cost;};
struct state{
  int pos,cost;
  bool operator < (const state &p)const{
    return cost > p.cost;
  }
};

vector<edge> G[MAX];
int n,m,p;

void init(){
  for(int i=0;i<MAX;i++){
    G[i].clear();
  }
}

long long d[MAX][MAX];
double cnt[MAX][MAX];
void dijkstra(int si){
  for(int i=0;i<MAX;i++)d[si][i]=INF,cnt[si][i]=0;
  priority_queue<state> Q;
  d[si][si]=0;
  cnt[si][si]=1;
  Q.push((state){si,0});
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>d[si][s.pos])continue;
    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(d[si][e.to]<s.cost+e.cost)continue;
      else if(d[si][e.to]==s.cost+e.cost){
	cnt[si][e.to]+=cnt[si][s.pos];
      }else{
	cnt[si][e.to]=cnt[si][s.pos];
	d[si][e.to]=s.cost+e.cost;
	Q.push((state){e.to,d[si][e.to]});
      }
    }
  }
}

int main(){
  while(1){
    cin>>n>>m>>p;
    if(n==0&&m==0&&p==0)break;
    init();
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      G[a].push_back((edge){b,c});
      G[b].push_back((edge){a,c});
    }
    for(int i=0;i<n;i++)
      dijkstra(i);

    for(int i=0;i<p;i++){
      int a;
      scanf("%d",&a);
      if(d[0][a]+d[a][n-1]!=d[0][n-1]){
	cout<<"0.0"<<endl;
      }else{
	double x=cnt[0][a],x2=cnt[a][n-1],y=cnt[0][n-1];
	printf("%.8f\n",x/y*x2);
      }


    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1600
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(n,x) for(ll i=0;i<n;i++) cin>>x[i];


int main()
{
	ll h;
	cin >> h;
	ll i = 0;
	while (h != 1)
	{
		h /= 2;
		i += 1;
	}
	ll ans = pow(2, i+1) - 1;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4112
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr ll LONGINF = 1050000000000000000;

struct all_init { all_init() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(15); }; }ALL_INIT;

#define CIN(vector_array_etc,n) for(int loop=0;loop<n;loop++){cin>>vector_array_etc[loop];};
#define COUT(vector_array_etc,n) for(int LOOP=0;LOOP<n;LOOP++){cout<<vector_array_etc[LOOP]<<(LOOP == n-1 ?'\n':' ');};
#define VC(Type_name) vector<Type_name>//1次元ならあまり意味ないかも
#define VCVC(Type_name) vector<vector<Type_name>>//2次元配列定義怠過ぎ問題
#define SORT(vector_etc) sort(vector_etc.begin(),vector_etc.end());

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }//aに最大値が入る
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }//aに最小値が入る
template<class T>void swap(T &a, const T &b) { T tmp = a; a = b; b = a; return; }//aとbを入れ替える

template<typename T>
istream& operator >> (istream& is, vector<T>& Vec) { for (T& x : Vec) { is >> x; }return is; }

template<typename V, typename H>
void resize(vector<V>& vec, const H head) { vec.resize(head); }

template<typename V, typename H, typename ... T>
void resize(vector<V>& vec, const H& head, const T ... tail) { vec.resize(head); for (auto& v : vec) { resize(v, tail...); } }

int dx[] = { 0,1,-1, 0,1,-1, 1,-1 };    //i<4:4way i<8:8way
int dy[] = { 1,0, 0,-1,1,-1,-1, 1 };

class UnionFind {
private:
	std::vector<int> parent;
	std::vector<int> height;
	std::vector<int> m_size;

public:
	UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	void init(int size_) {
		parent.resize(size_);
		height.resize(size_, 0);
		m_size.resize(size_, 1);
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	int find(int x) {
		if (parent[x] == x) return x;
		return parent[x] = find(parent[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		int t = size(x) + size(y);
		m_size[x] = m_size[y] = t;
		if (height[x] < height[y]) parent[x] = y;
		else parent[y] = x;
		if (height[x] == height[y]) ++height[x];
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		if (parent[x] == x) return m_size[x];
		return size(parent[x] = find(parent[x]));
	}
};

int main() {
	int n, m; cin >> n >> m;
	vector<int> check(n + 1, 0);
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		chmax(check[b], a);
	}
	int ans = 0;
	int before_cut_point = 1;
	for (int i = 1; i <= n; i++) {
		if (before_cut_point <= check[i]) {
			ans++;
			before_cut_point = i;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

const uint64_t LIMIT = 1'000'000'000'000'000'000;

int main() {
  uint32_t N = 0;
  std::cin >> N;
  std::vector<uint64_t> A(N, 0);
  bool zero = 0;
  for (auto &&a : A) {
    std::cin >> a;
    zero |= (a == 0);
  }
  if (zero) {
    std::cout << 0 << std::endl;
  } else {
    uint64_t prod = 1;
    for (uint32_t i = 0; i < N; i++) {
      if (LIMIT / prod < A[i]) {
        std::cout << -1 << std::endl;
        prod = 0;
        break;
      }
      prod *= A[i];
    }
    if (prod) std::cout << prod << std::endl;
  }

  return 0;
}

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

#define ll long long
#define ld long double

using namespace std;
int main(){
	int N,M;
	cin>>N>>M;
	vector<long long> v;
	for(int i=0;i<N;i++){
		long long input;
		cin>>input;
		v.push_back(input);
	}
	make_heap(v.begin(),v.end());
	for(int i=0;i<M;i++){
		long long a=v.front();
		pop_heap(v.begin(),v.end());
		v.pop_back();
		a=a/2;
		v.push_back(a);
		push_heap(v.begin(),v.end());
	}
	long long ans=0;
	for(int i=0;i<N;i++){
		ans+=v[i];
	}
	cout<<ans;
}

Measured memory_bytes: 1400
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

#include <cmath>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;
ll N, A, B;
ll h[100100];

int enough(ll T) {
  ll t = 0;
  REP(i, N) {
    if (h[i] - B * T > 0) {
      t += ceil((double)(h[i] - B * T) / (A - B));      
    }
  }
  return t <= T;
}

int main() {
  cin >> N >> A >> B;

  REP(i, N) {
    cin >> h[i];
  }

  ll mx = 1500000000;
  ll left = 0;
  ll right = 1500000000 - 1;
  while (left < right) {
    ll mid = (right + left) / 2;
    if (enough(mid)) {
      right = mid;
    } else {
      left = mid + 1;
    }
  }

  assert(right == left);

  cout << left << endl;

  debug(enough(2));
  debug(enough(3));
  debug(enough(4));
  debug(enough(5));

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string t;
  cin >> t;

  for (int i = 0; i < t.size(); i++) {
    if (t[i] == '?') t[i] = 'D';
  }

  cout << t << endl;
}

Measured memory_bytes: 3752
import math
import itertools
import statistics
#import numpy as np
#import collections
A, B, C = list(map(int, input().split()))
k = int(input())
for i in range(k):
    if A >= B and A >= C:
        A *= 2
    elif B > A and B > C:
        B *= 2
    else:
        C *= 2


print(A+B+C)


Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,cnt;
    cin >> n;
    int a[n],ans = 100 * 100 * n;
    rep(i, n)cin >> a[i];
    nfor(i, -100, 101){
        cnt = 0;
        rep(j, n){
            cnt += (a[j] - i) * (a[j] - i);
        }
        if (cnt <= ans) {
            ans = cnt;
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
  int N, M; cin >> N >> M;
  int i, j;
  vector<int> s(M), c(M);
  rep (i, M) scanf("%d%d", &s[i], &c[i]), --s[i];
    rep (i, 1000) {
      string t = to_string(i);
      if (t.size() == N) {
        bool flag = true;
        rep (j, M) {
          if (t[s[j]] - '0' != c[j]) {
            flag = false;
            break;
          }
        }
        if (flag) {
          printf("%d\n", i);
          return 0;
        }
      }
    }
    puts("-1");
  return 0;
}


Measured memory_bytes: 256
import sys
N = int(sys.stdin.readline())
ss = []
for i in range(N):
    ss.append(sys.stdin.readline().rstrip())

incount = 0
has_ba = 0
has_b = 0
has_a = 0
for s in ss:
    incount += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        has_ba += 1
    elif s[0] == 'B':
        has_b += 1
    elif s[-1] == 'A':
        has_a += 1

res = incount
if has_a:
    res += has_ba
elif has_ba:
    has_a += 1
    has_ba -= 1
    res += has_ba
res += min(has_a, has_b)




# if has_ba:
#     res += has_ba - 1
#     has_ba = 1
# if has_b or has_a:
#     npair = min(has_b, has_a)
#     res += npair
#     has_b -= npair
#     has_a -= npair
# if has_ba and (has_b or has_a):
#     res += 1

print(res)


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

int main() {
  string s;
  cin>>s;
  char minc='a';
  for(int i=0;i<s.size();i++){
    if(minc=='{'){
      cout<<"None"<<endl;
      return 0;
    }
    if(minc==s.at(i)){
      minc++;
      i=0;
    }
  }
  cout<<minc<<endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

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

using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;

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

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

int main()
{
  string s, t;
  cin >> s >> t;
  if(s == t.substr(0, s.size())) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 500050;
 
char s[MAXN];
int ans, l, r, n, a[MAXN];
 
inline bool chk(int x)
{
	int len = n, sum = 0;
	for( int i = 1 ; i <= n ; i++ ) a[ i ] = ( s[ i ] - '0' ) * 9;
	a[ 1 ] += 9 * x;
	for( int i = 1 ; i <= len ; i++ )
		if( a[ i ] > 9 )
		{
			if( i == len ) a[ ++len ] = 0;
			a[ i + 1 ] += a[ i ] / 10;
			a[ i ] %= 10;
		}
	for( int i = 1 ; i <= len ; i++ ) sum += a[ i ];
	return sum <= 9 * x;
}
 
int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%s", s + 1 );
	l = 1, r = n = strlen( s + 1 );
	reverse( s + 1, s + n + 1 );
	while( l <= r )
	{
		int mid = l + r >> 1;
		if( chk( mid ) ) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2688
s = list(input())
count = 0
if len(s)%2 == 0:
  for i in range(int(len(s)/2)):
    if s[i] != s[len(s)-i-1]:
      count += 1
else:
  for i in range(int((len(s)-1)/2)):
    if s[i] != s[len(s)-i-1]:
      count += 1
print(count)

Measured memory_bytes: 3060
import collections
n=int(input())
s=list(str(input()))
l=[]

c=collections.Counter(s)
#print(len(c.values()))

for i in range(1,n):
    x=s[:i]
    y=s[i:]
    xc=collections.Counter(x)
    yc=collections.Counter(y)
    l.append(len(xc.values())+len(yc.values())-len(c.values()))
    
print(max(l))


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

using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1000000000;
using Graph = vector<vector<int>>;
// typedef pair<int, int> pair;

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  int min = p[0];
  int count = 0;
  for (int i = 1; i < n; i++) {
    if (min > p[i]) {
      min = p[i];
    } else {
      count++;
    }
  }
  cout << n - count << endl;
}


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

int main(){
	long long n,x,d;
	cin>>n>>x;
	long long pos[n],tmp=-1;
	for(int i=0;i<n;i++){
		cin>>pos[i];
		//tmp = max(tmp,pos[i]);
	}
	long long a,b,r;
	a=abs(pos[0]-x);
    b=abs(pos[1]-x);
  if(a<b){
 	   tmp = a;
 	   a = b;
       b = tmp;
 	 }
	r = a % b;
  	while(r!=0){
			a = b;
			b = r;
			r = a % b;
		}
	for(int i=2; i<n; i++){
		a=abs(pos[i]-x);
      	//b = tmp;
      if(a<b){
 	   tmp = a;
 	   a = b;
       b = tmp;
 	 }
     	r = a % b;
		while(r!=0){
			a = b;
			b = r;
			r = a % b;
		}
        //tmp = b;
	}
  	if(n == 1)b = abs(pos[0] - x); 
  	cout<<b<<endl;
}

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

using namespace std;

 vector<bool> arr;

void Eratosthenes(int N){
    arr.resize(N+1);
	for(int i = 0; i <= N; i++){
		arr[i] = 1;
	}
    arr[0] = 0; arr[1] = 0;
	for(int i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}

}

int main(){
 int Q; cin >> Q;
 Eratosthenes(1000010);
  int sum[1000010]; sum[0] = 0; sum[1] = 0;
  for(int i = 2; i < 1000010; i++){
    if(arr[i] && arr[(i+1)/2]){sum[i] = sum[i-1] + 1;}
    else{ sum[i] = sum[i-1];}}
  //sum[x] はx以下の条件を満たす整数の総数
  for(int i = 0; i < Q; i++){
    int l,r; cin >> l >> r;
       cout << sum[r] - sum[l-1] << endl;}
  return 0;}


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

int main() {
    int64_t W, H, x, y;
    cin >> W >> H >> x >> y;
    bool ways = 0;
    
    if (W % 2 == 0 && H % 2 == 0) {
        if (x == W / 2 && y == H / 2) {
            ways = 1;
        }
    }
    if (W % 2 != 0 && H % 2 != 0) {
        cout << W * H / 2 << ".5" << " " << ways << endl;
    }
    else {
        cout << W * H / 2 << " " << ways << endl;
    }
}

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

int main(){
  long X;
  cin >> X;
  vector<long> prime;
  prime.push_back(2);
  bool find=true;
  if(X>2){
    long counter=3;
    while(find){
      bool flag=true;
      for(long i=0; i<prime.size(); i++){
        if(counter%prime[i]==0){
          flag=false;
          break;
        }
      }
      if(flag){
        prime.push_back(counter);
        if(counter>=X){
          break;
        }
      }
      counter+=2;
    }
    long x = prime[prime.size()-1];
    cout << x << endl;
  }
  if(X==2)cout << X << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif

ll power(ll x, ll y) {
  ll res=1;
  while(y>0) {
    if(y&1){
      res=(res*x)%MOD;
    }
    y=y>>1;
    x=(x*x)%MOD;
  }
  return res;
}
int main(){
  fastIO();
  ll n;
  cin>>n;
  ll ans=(power(10,n)+power(8,n))%MOD-(2*power(9,n))%MOD;
  cout<<((ans%MOD)+MOD)%MOD<<endl;
  return 0;
}


Measured memory_bytes: 3612
a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len and i==a_len-1:
        huku.append(a[i])
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")

Measured memory_bytes: 9048