akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int l,k;
    vector<vector<LL>> dp;
    Problem(LL l,LL k):l(l),k(k),dp (l+1,vector<LL>(2)){};

    void solve(){
        dp[0][0]=1;
        for(int i=1; i<=l; ++i){
            dp[i][0]=dp[i-1][1];
            dp[i][1]=dp[i-1][0];
            if(i>=k)dp[i][1]+=dp[i-k][0];
        }
        LL ans =0;
        for(int i=1; i<=l; ++i){
            ans+=dp[i][1];
        }
        cout << ans <<"\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long l=0,k;
    cin >> l >> k;

    Problem p(l,k);
    p.solve();
    return 0;
}

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

const int maxn = 2e5 + 3;

int n, q, a, b;
vector <int> graph[maxn];
int ar[maxn], ans[maxn];

void dfs(int i, int ansPar, int par){
    ans[i] = ansPar + ar[i];
    for (int u : graph[i])
        if (u != par)
            dfs(u, ans[i], i);
}

int main() {
    cin >> n >> q;
    for (int i = 1; i < n; i++) {
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        cin >> a >> b;
        ar[a] += b;
    }
    dfs(1, 0, 0);
    for(int i = 1; i < n + 1; i++)
        cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 24064
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <map>

#define ll long long int
#define MAX_W 20
#define MAX_H 20

using namespace std;

char field[MAX_W][MAX_H];
bool reach[MAX_W][MAX_H];
int h, w;
int cou = 0;


void search(int x, int y)
{
	if (x < 0 || w <= x || y < 0 || h <= y || field[x][y] == '#') {
		return;
	}

	if (reach[x][y] == true) {
		return;
	}

	reach[x][y] = true;


	cou++;



	search(x - 1, y);
	search(x + 1, y);
	search(x, y + 1);
	search(x, y - 1);

}

int main(void)
{
	vector <string> s;
	vector <int> ans;
	int i, j;

	int dx, dy; //start

	string temp;


	while (1) {
		cin >> w >> h;
		if (w == 0 && h == 0) {
			break;
		}

		for (i = 0; i < h; i++) {
			cin >> temp;
			s.push_back(temp);
		}

		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				field[j][i] = s[i][j];
				if (s[i][j] == '@') {
					dx = j;
					dy = i;
				}
			}
		}




		search(dx, dy);

		ans.push_back(cou);
		cou = 0;

		s.clear();

		for (i = 0; i < MAX_W; i++) {
			
			for (j = 0; j < MAX_H; j++) {


				field[i][j] = '#';
				reach[i][j] = false;
			}
		}


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

	return (0);
}

Measured memory_bytes: 3028
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    ll N, A[100000], B[100000], as = 0, bs = 0;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        as += A[i];
    }
    REP(i, N) {
        cin >> B[i];
        bs += B[i];
    }
    if (as < bs) {
        cout << -1 << endl;
        return 0;
    }

    ll diff[100000];
    REP(i, N) diff[i] = A[i] - B[i];
    sort(diff, diff + N);

    ll l = 0, r = N - 1, ans = 0;
    bool f = false;
    while (diff[l] < 0 && l < r) {
        if (abs(diff[l]) > abs(diff[r])) {
            diff[l] += diff[r--];
            ans++;
            f = true;
        }
        else if (abs(diff[l]) == abs(diff[r])) {
            l++; r--;
            ans += 2;
            f = false;
        }
        else {
            diff[r] += diff[l++];
            ans++;
            f = true;
        }
    }

    if (f) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#define NOT_FOUND 0


int linearSearch(int data[], int num1, int key);

int main(void)
{
    int i, num1, num2, key, data[10000 + 1], count = 0;

    scanf("%d", &num1);
    for (i = 0; i < num1; i++) {
        scanf("%d", &data[i]);
    }

    scanf("%d", &num2);
    for (i = 0; i < num2; i++) {
        scanf("%d", &key);
        if (linearSearch(data, num1, key) != NOT_FOUND) count++;
    }

    printf("%d\n", count);

    return 0;
}

int linearSearch(int data[], int num1, int key)
{
    int i = 0;

    data[num1] = key;

    while (data[i] != key) {
        i++;
    }
    if (i == num1) return NOT_FOUND;

    return 1;
}



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


int main()
{
    string S;
    cin >> S;


    int N = S.size();
    vector<int> switching(N, false), ans(N, 0);
    for(int i = 0; i < N-1; ++i){
        if(S[i] == 'R' and S[i+1] == 'L') switching[i] = +1;
        if(S[i] == 'L' and S[i+1] == 'R') switching[i] = -1;
    }
    int prev_pos = 0;
    for(int i = 0; i < N; ++i){
        if(switching[i] == 1){
            if(prev_pos == 0) 
            {
                ans[i] += (i-prev_pos)/2 + 1;
                ans[i+1] += (i-prev_pos+1)/2;
            }else{
                ans[i+1] += (i-prev_pos)/2;
                ans[i] += (i-prev_pos-1)/2 + 1;
            }
        }
        if(switching[i] == -1) prev_pos = i;
        //for(int i = 0; i < N; ++i) cout << ans[i] << " ";
        //cout << endl;
    }
    prev_pos = N-1;
    for(int i = N-1; i >= 0; --i){
        if(switching[i] == 1){
            ans[i+1] += (prev_pos-i-1)/2 + 1;
            ans[i] += (prev_pos-i)/2;
        }
        if(switching[i] == -1) prev_pos = i;
    }

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

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

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int i=0,n=s1.size(),m=s2.size(),j;
    int t[n+1][m+1];
    for(i=0;i<n+1;i++)
    {
        for(j=0;j<m+1;j++)
        {
            
             if((i==0||j==0))
            t[i][j]=0;
            else
            {
                if(s1[i-1]==s2[j-1])
                {
                    t[i][j]=1+t[i-1][j-1];
                }
                else
                t[i][j]=max(t[i-1][j],t[i][j-1]);
            }
    
        }
    }
    i=n,j=m;
    string s="";
    while(i>0&&j>0)
    {
        if(s1[i-1]==s2[j-1])
        {
         s=s+s1[i-1];
         i--;
         j--;
        }
        else
        {
            if(t[i][j-1]>t[i-1][j])
            {
                j--;
            }
            else
            i--;
        }
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
    
}

Measured memory_bytes: 38872
C = [[int(i) for i in input().split()] for j in range(3)]

b21, b32 = C[0][1] - C[0][0], C[0][2] - C[0][1]
a21, a32 = C[1][0] - C[0][0], C[2][0] - C[1][0]
for i in range(1, 3):
    if b21 != C[i][1] - C[i][0] or b32 != C[i][2] - C[i][1] or \
        a21 != C[1][i] - C[0][i] or a32 != C[2][i] - C[1][i]:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string S = in<string>();
    int red  =0;
    REP(i,S.size())if(S[i] == '0')red++;
    int N = S.size();
    cout << 2*min(N-red,red) << "\n";
}

Measured memory_bytes: 512
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  ll T1, T2;
  cin >> T1 >> T2;
  ll A1, A2;
  cin >> A1 >> A2;
  ll B1, B2;
  cin >> B1 >> B2;

  if(A1 * T1 + A2 * T2 == B1 * T1 + B2 * T2){
    cout << "infinity" << endl;
    return 0;
  }

  // A1が小さい(遅い)方を高橋君にする。
  if(A1 > B1){
    swap(A1, B1);
    swap(A2, B2);
  }

  ll T = T1 + T2;
  ll FA = A1 * T1;
  ll FB = B1 * T1;
  ll A = A1 * T1 + A2 * T2;
  ll B = B1 * T1 + B2 * T2;

  // 高橋君の逆転の可能性がないと0
  if(A < B){
    cout << 0 << endl;
    return 0;
  }

  ll N = (FB - FA) / (A - B);

  ll ans = 2 * N;
  if((FB - FA) % (A - B) != 0){
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int find_divisors(int n)
{
	int count = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (n%i==0) count++;
	}
	return count;
}

int main()
{
	int n;

	cin >> n;
	int count = 0;

	for (int i = 1; i <= n; ++i)
	{
		if (i%2 == 1)
		{
			if (find_divisors(i) == 8) count++;
		}
	}

	cout << count;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define second sec
#define first fir
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	bool f = 1;
	rep(i, n - 1) {
		if(a[i] == a[i + 1]) f = 0;
	}
	YORN(f);
	return 0;
}

Measured memory_bytes: 1792
#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() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll cd = c * d / __gcd(c, d);
    ll del = 0;
    del += b / c - (a - 1) / c;
    del += b / d - (a - 1) / d;
    del -= b / cd - (a - 1) / cd;
    cout << b - a + 1 - del << endl;
}

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

int main() {
    int N; cin >> N;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            if (4 * i + 7 * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

#define Bye return 0
#define ll long long
const ll MAX = 1e2;

void solve(){
    string a, b; cin>>a>>b;

    char str[MAX];
    for (int i=0, j=0; i<max(a.size(), b.size()); i++, j+=2){
        if(i<a.size()) cout<<a[i];
        if(i<b.size()) cout<<b[i];
    }
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 3596
a = [list(input()) for i in range(2)]
for i in range(len(a[0])):
  for j in range(len(a[1])):
    if i+j< len(a[0]):
        if a[0][i+j] != a[1][j]:
          break
    else:
        if a[0][i+j-len(a[0])] != a[1][j]:
          break
    if j == len(a[1]) - 1:
      print('Yes')
      exit()
print('No')


Measured memory_bytes: 5572
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int main(void){
    int n; cin>>n; if(n==1) {cout<<1<<endl; return 0;}
    vector <pair<int,int>> data(n);
    for(int i=0;i<n;i++){
        int a,b; cin>>a>>b;
        data[i] = make_pair(a,b);
    }
    vector <pair<int,int>> data2;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j) continue;
            int x1 = data[i].F, x2 = data[j].F, y1 = data[i].S, y2 = data[j].S;
            data2.push_back(make_pair(x2-x1, y2-y1));
        }
    }
    int NumofMode = 0;
    int x=0;
    sort(data2.begin(),data2.end());
    for(int i=0;i<data2.size();i++){
        if(data2[max(0, i-1)] == data2[i]){
            x++;
        }else{
            NumofMode = max(NumofMode, x);
            x=1;
        }
        if(i==data2.size()-1){
            NumofMode = max(NumofMode, x);
        }
    }
    cout<<n-NumofMode<<endl;
}


Measured memory_bytes: 256
# LCS: Longest common subsequence
# dp[i][j]: Sのi-1番目まで, Tのj-1番目まででの最長共通文字列
# dp[0][0] = 0 長さ0の文字列
# dp[0][1] = 0 長さ1の文字列と長さ0の文字列
# dp[1][0] = 0 長さ0の文字列と長さ1の文字列
# dp[i][j] = max(dp[i-1][j], dp[i][j-1]) (S[i] != T[j])
# dp[i][j] = max(
#                dp[i-1][j-1]+1  (共通文字列を利用する),
#                dp[i-1][j]        (共通文字列を利用しない),
#                dp[i][j-1]        (共通文字列を利用しない),
#            )


dp = [[0 for _ in range(3001)] for _ in range(3001)]


def main():
    S = input()
    T = input()

    result = solve(S, T)
    print(result)


def solve(S, T):
    for i in range(1, len(S) + 1):
        for j in range(1, len(T) + 1):
            if S[i - 1] != T[j - 1]:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1], dp[i-1][j-1])
            else:
                dp[i][j] = max(dp[i - 1][j - 1] + 1, dp[i - 1][j], dp[i][j - 1])
    result = ""
    i = len(S)
    j = len(T)
    while dp[i][j] != 0:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            result += S[i-1]
            i -= 1
            j -= 1
    return "".join(reversed(result))


if __name__ == "__main__":
    main()


Measured memory_bytes: 153088
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define ALL(co) co.begin(), co.end()

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef vector<int> Array;
typedef vector<int> LArray;

const int INF = 1 << 29;
const LL LINF = 1LL << 60;

int itiv;
inline int getInt() { return (cin >> itiv, itiv); }
void readAll(Array& vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; }
inline bool between(int first, int last, int n) { return first <= n && n <= last; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }

int d, n;
int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
int dr[] = { 0, -1, 0, 1 }, dc[] = { -1, 0, 1, 0 };

int dp[201][201];
int main(void)
{
	while(cin >> d >> n && n)
	{
		Array t(d), c(n);
		vector<P> tem(n);
		readAll(t, d);
		for (int i = 0; i < n; i++)
			cin >> tem[i].first >> tem[i].second >> c[i];
		memset(dp, 0, sizeof(dp));
		int ans = 0;
		for (int i = 1; i < d; i++)
		{
			for (int j = 0; j < n; j++)//今日着る
			{
				if(!between(tem[j].first, tem[j].second, t[i])) continue;
				for (int k = 0; k < n; k++)//昨日着た
				{
					if(!between(tem[k].first, tem[k].second, t[i-1])) continue;
					dp[i][j] = max(dp[i][j], dp[i - 1][k] + abs(c[j] - c[k]));
					ans = max(ans, dp[i][j]);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1360
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

int main(){
    ll n; cin >> n;
    ll res = n - 1;
    for(ll i = 1; i <= (ll)sqrt(n); i++){
        if(n % i == 0){
            if(i-1 + n/i-1 < res) res = i-1 + n/i-1;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
import math

n = int(input())
p0 = (0,0)
p1 = (100,0)

def koch(depth, p0, p1):

	if depth == 0:
		return

	sx = (2*p0[0] + 1*p1[0]) / 3
	sy = (2*p0[1] + 1*p1[1]) / 3
	s = (sx,sy)
	tx = (1*p0[0] + 2*p1[0]) / 3
	ty = (1*p0[1] + 2*p1[1]) / 3
	t = (tx,ty)

	theta = math.radians(60)
	ux = (tx - sx)*math.cos(theta) - (ty - sy)*math.sin(theta) + sx
	uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
	u = (ux, uy)

	#各辺でkoch関数を適用することにより、頂点を出力。出力したい部分に噛ませる。
	koch(depth-1,p0,s)
	print(*s)
	koch(depth-1,s,u)
	print(*u)
	koch(depth-1,u,t)
	print(*t)
	koch(depth-1,t,p1)
	

print(*p0)
koch(n,p0,p1)
print(*p1)


Measured memory_bytes: 5792
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

def main():
    N, M = LI()
    S = SL()

    ans = []
    tmp = 0
    checkpoint = -1

    for e in S[:-1][::-1]:
        tmp += 1
        if e == "0":
            if tmp >= M:
                ans.append(tmp)
                tmp = 0
                checkpoint = -1
            else:
                checkpoint = tmp
        else:
            if tmp >= M:
                if checkpoint == -1: break
                ans.append(checkpoint)
                tmp -= checkpoint
                checkpoint = -1
    else:
        if tmp > 0:
            ans.append(tmp)
        print(*ans[::-1])
        return
    print(-1)



if __name__ == '__main__':
    main()

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

int main(){
    int n;
    cin>>n;
    int x[100];
    double sum;
    rep(i,n){
        cin>>x[i];
        sum+=x[i];
    }
    int p=round(sum/n);
    int ans=0;
    rep(i,n){
        int diff=p-x[i];
        ans+=pow(diff,2);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3700
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int a, b;
    char line[256];

    if (!fgets(line, sizeof(line), stdin)) {
        fprintf(stderr, "error input val\n");
        return -1;
    }
    if (sscanf(line, "%d %d", &a, &b) != 2) {
        fprintf(stderr, "error input format\n");
        return -1;
    }

    if (a == b) {
        printf("a == b\n");
        return 0;
    } else {
        printf("%s\n", (a < b) ? "a < b" : "a > b");
    }


    return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;
const int MAX_N = 2e5;

int main(){
  int a, b, c, d, e;
  string s, t;
  cin >> a;
  cout << a + a*a + a*a*a <<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <map>

using namespace std;

bool kirai[10];

bool ok(int n){
	while(n){
		if(kirai[n%10]){
			return false;
		}
		n/=10;
	}
	return true;
}

int main(){
	int n,k;
	cin >> n >> k;
	
	int t;
	for(int i=0; i<k; i++){
		cin >> t;
		kirai[t] = true;
	}

	for(int i=n; ; i++){
		if(ok(i)){
			cout << i << endl;
			break;
		}
	}

	return 0;
}

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

#define TOUMAX 4
#define KAIMAX 3
#define ROOMMAX 10

int main(void)
{
	int m,f,r;
	int sum;

	while (1) {
		cin >> m;
		cin >> f;
		cin >> r;

		sum = m+f+r;

		if (sum == -3) {
			break;
		}
		else if ((m != -1) && (f != -1)) {
			sum -= r;

			if (sum >= 80) {
				cout << "A" << endl;
			}
			else if ((sum >= 65) && (sum < 80)) {
				cout << "B" << endl;
			}
			else if ((sum >= 50) && (sum < 65)) {
				cout << "C" << endl;
			}
			else if ((sum >= 30) && (sum < 50)) {
				if (r>= 50) {
					cout << "C" << endl;
				}
				else {
					cout << "D" << endl;
				}
			}
			else {
				cout << "F" << endl;
			}
		}
		else {
			cout << "F" << endl;
		}
	}

	return 0;
}



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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

ll x, y, ans = 3e9;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> x >> y;
	if (abs(x) <= abs(y))
		ans = (x < 0) + (y < 0) + (ll)abs(y) - (ll)abs(x);
	if (-(ll)abs(x) <= -(ll)abs(y))
		ans = min(ans, (x > 0) + (y > 0) + -(ll)abs(y) + (ll)abs(x));
	ans = min(ans, (x > 0) + (y < 0) + abs(y) + abs(x));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
 
//const long long INF = 1LL << 55;
 
#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define MAX_N 300030

int n,m,q;
int grid[600][600];
int grid_cumulative[600][600];
void precalc(){
   for(int i = 1;i < 550;i++){
      for(int j = 1;j < 550;j++){
         grid_cumulative[i][j]
            = grid_cumulative[i][j-1] + grid_cumulative[i-1][j] - grid_cumulative[i-1][j-1] + grid[i-1][j-1];
      }
   }
   // rep(i,10){
      // rep(j,10)cout << grid[i][j] << " ";
      // cout << endl;
   // }
}
void query(int p,int q){
   int ans = 0;
   ans += grid_cumulative[q+1][q+1];
   ans -= (grid_cumulative[p][q+1] + grid_cumulative[q+1][p]);
   ans += grid_cumulative[p][p];
   cout << ans << endl;
}
int main(void){
   ioboost;
   cin >> n >> m >> q;
   rep(i,m){
      int l,r;cin >> l >> r;
      grid[--l][--r]++;
   }
   precalc();
   rep(i,q){
      int p,q;cin >> p >> q;
      query(--p,--q);
   }
}


Measured memory_bytes: 3456
#include <stdio.h> 
int main(void){

int i, j, k, n, m,l,f[128][128], s[128][128];
long a[128][128] = {{0}};
 
scanf("%d %d %d",&n,&m,&l);
 
for(i = 1; i <= n; i++){
for(j = 1; j <= m; j++){
scanf("%d",&f[i][j]);
}
}
 
for(i = 1; i <= m; i++){
for(j = 1; j <= l; j++){
scanf("%d",&s[i][j]);
}
}
 
for(i =1; i <= n; i++){
for(j = 1; j <= l; j++){
for(k =1; k <= m; k++){
a[i][j] += f[i][k] * s[k][j];
}
}
}
 
for(i = 1; i <= n; i++){
for(j = 1; j <= l; j++){
printf("%ld",a[i][j]);
if(j != l)
printf(" ");
}
printf("\n");
}
 
return 0;
}



Measured memory_bytes: 2112
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		BitSet[] ind = new BitSet[26];
		for (int i = 0; i < 26; i++)
			ind[i] = new BitSet();
		for (int i = 0; i < s.length(); i++)
			ind[s.charAt(i) - 'a'].set(i);
		for (int i = 0; i < t.length(); i++) {
			if (ind[t.charAt(i) - 'a'].isEmpty()) {
				System.out.println(-1);
				return;
			}
		}
		int k = 0, j = 0;
		long ans = 0;
		while (k < t.length()) {
			j = ind[t.charAt(k) - 'a'].nextSetBit(j);
			if (j < 0) {
				ans++;
				j = 0;
			} else {
				k++;
				j++;
			}
		}
		System.out.println(ans * s.length() + j);
	}
}

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


void chmin(long long &a, int b){
    if(a>b)
        a = b;
    return;
}

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

    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h.at(i);

    long long DP[n + 10];
    for (int i = 0; i < n+10;i++)
        DP[i] = 1234567890;

    DP[0] = 0;
    DP[1] = abs(h.at(0) - h.at(1));

    for (int i = 2; i < n;i++){
        
        chmin(DP[i], DP[i-2]+abs(h.at(i) - h.at(i-2)));
        chmin(DP[i], DP[i-1]+abs(h.at(i) - h.at(i - 1)));
    }
    cout << DP[n - 1] << endl;

    return 0;
}

Measured memory_bytes: 1408
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
         #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {n:i64}
    let mut cnt = 0;
    for i in 1..n+1 {
        if i.to_string().len() % 2 == 1 {
            cnt += 1
        }
    }
    p!(cnt);
}


Measured memory_bytes: 4352
it = [input() for i in range(2)]
n = int(it[0])
a_list = list(map(int, it[1].split()))

def main():
    print(multi_mapdev(a_list, 0))

def findodd(l):
    filtered = list(filter(lambda e:e%2 == 1, l))
    ##print(len(filtered))
    return (len(filtered) > 0)

def mapdev(l):
    return list(map(int, list(map(lambda e:e/2, l))))

def multi_mapdev(l, cnt):
    if findodd(l):
        return cnt
    else:
        return multi_mapdev(mapdev(l), cnt + 1)

main()


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

using namespace std;

int a[111];
int n;
int dp[100010];

int f(int k) {
    if (dp[k] != -1)    return dp[k];
    bool ans = false;
    for(int i = 0; i < n; ++i) {
        if (k-a[i] >= 0) {
            ans |= !f(k-a[i]);
        }
    }
    dp[k] = ans;
    return ans;
}


int main(void) {

    int k;
    cin>>n>>k;
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    memset(dp, -1, sizeof(dp));
    if (f(k))   cout<<"First";
    else cout<<"Second";

    return 0;
}



Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
inline ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll char_to_ll(char c) { return (int)(c - '0'); }
inline ll string_to_ll(string s) { return atoi(s.c_str()); }
inline bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

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

    while(N > 0){
        if(N % 10 == 7){
            cout << "Yes" << endl;
            return 0;
        }
        N /= 10;
    }

    cout << "No" << endl;

    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}



int main(){
	ll N;
	cin >> N;
	ll luca[100];
	luca[0] = 2;
	luca[1] = 1;
	for(int i=2;i<100;i++){
		luca[i] = luca[i-1] + luca[i-2];
	}
	cout << luca[N] << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
const MOD = 998244353;
list($n, $m, $k) = ints();
init($n - 1);
$ans = 0;
// 隣り合う組のうちi個が同じ色
// = 左端を除いたn-1個のブロックのうちi個が左隣と同じ色（１通り）で、
//   その他のn-1-i個のブロックは左隣と違う色（m-1通り）。
//   左端のブロックは何色でも良い（m通り）
for ($i = 0; $i <= $k; ++$i) {
    $t = modProd($m, nCr2($n - 1, $i), modPow($m - 1, $n - 1 - $i));
    $ans = modAdd($ans, $t);
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}

// 足し算
function modAdd($x, $y)
{
    return ($x + $y) % MOD;
}

function modSum(...$xs)
{
    $res = 0;
    foreach ($xs as $x) $res = modAdd($res, $x);
    return $res;
}

// 引き算
function modSub($x, $y)
{
    return ($x + MOD - $y) % MOD;
}

// 掛け算
function modMul($x, $y)
{
    return ($x * $y) % MOD;
}

function modProd(...$xs)
{
    $res = 1;
    foreach ($xs as $x) $res = modMul($res, $x);
    return $res;
}

// 割り算
function modDiv($x, $y)
{
    return modMul($x, modPow($y, MOD - 2));
}

// 累乗（繰り返し二乗法）
function modPow($n, $x)
{
    if ($x === 0) return 1;
    $res = (modPow($n, $x >> 1) ** 2) % MOD;
    if ($x % 2 === 1) $res = modMul($res, $n);
    return $res;
}

// 階乗
function modFac($n)
{
    if ($n === 0) return 1;
    return modMul($n, modFac($n - 1));
}

// 順列
function nPr($n, $r)
{
    if ($r === 0) return 1;
    return modMul(nPr($n, $r - 1), $n - $r + 1);
}

// 組み合わせ
function nCr($n, $r)
{
    $r = min($r, $n - $r);
    if ($r === 0) return 1;
    return modDiv(nPr($n, $r), modFac($r));
}

// 階乗、逆元を前処理
function init($n)
{
    global $fact, $ifact;
    $fact[0] = 1;
    for ($i = 1; $i <= $n; ++$i) $fact[$i] = modMul($fact[$i - 1], $i);
    $ifact[$n] = modDiv(1, $fact[$n]);
    for ($i = $n; $i >= 1; --$i)
        $ifact[$i - 1] = modMul($ifact[$i], $i);
}

// 順列（前処理）
function nPr2($n, $r)
{
    global $fact, $ifact;
    return modMul($fact[$n], $ifact[$n - $r]);
}

// 組み合わせ（前処理）
function nCr2($n, $r)
{
    global $fact, $ifact;
    return modMul(modMul($fact[$n], $ifact[$r]), $ifact[$n - $r]);
}


Measured memory_bytes: 33956
#include<stdio.h>
#include<string.h>
#define M 1000

int A[M+1][M+1];
int longest(char x[M+1],char y[M+1]){
  int i,j,a,b;
  a = strlen(x);
  b = strlen(y);
  for(i  = 1;i<=a; i++){
    for(j = 1; j <= b; j++){
      if(x[i-1] == y[j-1])A[i][j]=A[i-1][j-1] + 1;
      else if(x[i-1] != y[j-1])A[i][j] = max(A[i-1][j],A[i][j-1]);
    }
  }
  return A[a][b];
}

int max(int a,int b){
  if(a>= b)return a;
  else if(a < b)return b;
}

int main(){
  int i,n;
  char x[M+1],y[M+1];
  scanf("%d", &n);
  for(i = 0;i<n;i++){
    scanf("%s", x);
    scanf("%s",y);
    printf("%d\n", longest(x,y));
  }

  return 0;
}

Measured memory_bytes: 4524
#include <iostream>
#include <vector>
#include <stdio.h>
#include <cmath>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const double PI=3.14159265358979323846;

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

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

    // 素数である
    return true;
}

int main(){
  int x;
  cin >> x;
  while(1298){
    if(IsPrime(x)) break;
    x++;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int a,b,c,d,e,f,g,h,hiro,ken;
   cin>>a>>b>>c>>d>>e>>f>>g>>h;
   
   hiro=a*e+(a/10)*g+b*f+(b/20)*h;
   ken=c*e+(c/10)*g+d*f+(d/20)*h;
   if(hiro>ken){
       cout<<"hiroshi"<<endl;
   }
   else if(hiro<ken){
       cout<<"kenjiro"<<endl;
   }
   else if(hiro==ken){
       cout<<"even"<<endl;
   }
   return 0;
}


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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

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

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    FASTIO;

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];

    for(int i = k; i < n; i++){
        if(a[i-k] < a[i]) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3988
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

struct timer {
  double t = 0.0;
  timer() { restart(); }
  inline void restart() { t = now(); }
  inline double time() { return now() - t; }
  inline double now() {
    unsigned long long l, h;
    __asm__ ("rdtsc" : "=a"(l), "=d"(h));
    return (double)(l | h << 32) * 3.5714285714285715e-10;
  }
};

inline double randouble3() {
    static unsigned long long x = 147028549203948592LL;
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    double ret = x*5.472109e-25;
    if (x&1) ret *= -1;
    return ret;
}

inline double randouble2() {
    static unsigned long long x = 147028549203948592LL;
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    double ret = (x%10000000000000)*(0.00000000000001);
    if (x&1) ret *= -1;
    return ret;
}

inline double randouble1() {
    static unsigned long long x = 1520931673207987412LL;
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    double ret = (x%1000000000)*(0.00000001);
    if (x&1) ret *= -1;
    return ret;
}

double radius (double y, double x, const vector<pair<double, double>> &data) {
    double ret = -1;
    for (const auto &d : data) {
        double dx, dy; tie(dx, dy) = d;
        double dist = sqrt((y-dy)*(y-dy) + (x-dx)*(x-dx));
        chmax(ret, dist);
    }
    return ret;
}
timer t;
int main() {
    int N;
    cin >> N;
    vector<pair<double, double>> data(N);
    for (int i = 0; i < N; i++) {
        cin >> data[i].first >> data[i].second;
    }

    double ans_x = 500, ans_y = 500;
    double ans = 1000000000;
    while (t.time() < 0.001) {
        double nxt_x = ans_x + randouble1();
        double nxt_y = ans_y + randouble1();
        double score = radius(nxt_y, nxt_x, data);
        if (score < ans) { ans_x = nxt_x; ans_y = nxt_y; ans = score;}
    }
    //cout << fixed << setprecision(15) << ans << endl;
    while (t.time() < 1.000) {
        double nxt_x = ans_x + randouble2();
        double nxt_y = ans_y + randouble2();
        double score = radius(nxt_y, nxt_x, data);
        if (score < ans) { ans_x = nxt_x; ans_y = nxt_y; ans = score;}
    }
    
    while (t.time() < 1.950) {
        double nxt_x = ans_x + randouble3();
        double nxt_y = ans_y + randouble3();
        double score = radius(nxt_y, nxt_x, data);
        if (score < ans) { ans_x = nxt_x; ans_y = nxt_y; ans = score;}
    }
    
    cout << fixed << setprecision(15) << ans << endl;
    //cout << randouble3() <<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
X_list = list(map(int, input().split()))
min_strength = sum(list(map(lambda x: (x - max(X_list)) ** 2, X_list)))
for i in range(min(X_list), max(X_list)):
    strength = sum(list(map(lambda x: (x - i) ** 2, X_list)))
    if min_strength > strength:
        min_strength = strength
print(min_strength)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec d(N); cin >> d;
    Sort(d);
    int ans = d[N / 2] - d[N / 2 - 1];
    Out(ans);

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/


int main() {

	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];

	bool can = false;

	vector<int> ans;
	vector<int> num(n, 0);

	// 上からいれる
	for (int i = n - 1; i >= 0; i--) {
		// i+1の倍数の箱に入っているか確かめる
		int cnt = 0;
		if (a[i] == 1) cnt++;
		for (int j = (i + 1); j <= n; j += (i + 1)) {
			if (num[j - 1] == 1) cnt++;
		}
		// 入れる
		if (cnt % 2 == 1) {
			ans.push_back(i + 1);
			num[i] = 1;
		}
	}

	cout << ans.size() << endl;
	if (ans.size() == 0) return 0;
	for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] << " ";
	cout << endl;

	return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

#define MAX_N 2000005
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll perm(ll n, ll r) {
  if(n < 0)       return 0;
  else if(n < r)  return 0;
  else            return (fac[n] * finv[n-r]) % mod;
}
ll comb(ll n, ll r) {
  ll ans = 1;
  ans = perm(n, r);
  ans = (ans * finv[r]) % mod;
  return ans;
}
ll modpow(ll a, ll N) {
  ll ans = 1;
  ll tmp = a;
  while(N > 0) {
    if(N % 2 == 1) (ans *= tmp) %= mod;
    (tmp *= tmp) %= mod;
    N /= 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  make();
  int k; cin >> k;
  string s; cin >> s;
  int n = s.size();
  ll ans = 0;
  for(int i=0; i<=k; i++) {
    ans += comb(k-i+n-1, n-1) * modpow(25, k-i) % mod * modpow(26, i) % mod;
    ans %= mod;
  }
  cout << ans << endk;
  return 0;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    char s[10];
    cin >> s+1;
    if(s[3] == s[4]  &&  s[5] == s[6])cout << "Yes";
    else cout << "No";
    return 0;
}


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

int cnt[50][26];

int main() {
  int n; cin >> n;
  string s,ans="";
  REP(i,n) {
    cin >> s;
    for (char c : s) cnt[i][c-'a']++;
  }

  REP(i,26) {
    int m = 100;
    REP(j,n) m = min(m,cnt[j][i]);
    while(m>0) { ans += 'a'+i; m--; }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
#define       RESET(a, b)        memset(a, b, sizeof(a))
#define       gcd(a, b)          __gcd(a, b)
#define       MX                 200005
bool cmp(long long int x,long long int y)
{
   return x>y;
}
int main(void)
{
   long long int t,n,m,k,x,cnt=0,ans=0;
   vector<long long int> v,v1,v2;
   vector< pair <long long int,long long int> >p,p1,p2;
   set<long long int> st;
   priority_queue<long long int> pq;
   priority_queue< long long int,vector<long long int>,greater<long long int> > lpq;
   priority_queue< pair<long long int,long long int>,vector< pair<long long int,long long int> >,greater< pair <long long int,long long int> > > plpq;
   string s;
      cin>>n;
      cin>>s;
      ll w=0,r=0;
      for(long long int i=0;i<n;i++)
      {
         if(s[i]=='W')
            w++;
         else
            r++;
      }
      for(long long int i=0;i<r;i++)
      {
         if(s[i]=='W')
            ans++;
      }
      //ans=min(ans,cnt);
      cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 3740
#include <iostream>

using namespace std;

int main()
{
    string s;
    int ans = 0;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '+') ++ans;
        if (s[i] == '-') --ans;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<ll,ll>;

int main()
{
   string s;cin >>s;
   ll l=0,r=s.size()-1;
   ll ans=0;
   while(1){
    if(l>=r)break;
    if(s[l]==s[r]){
            l++;r--;
    }
    else if(s[l]=='x'){
        ans++;
        l++;
    }
    else if(s[r]=='x'){
        ans++;
        r--;
    }
    else{
        ans=-1;
        break;
    }
   }
   cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512