akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	stack<int> S1;
	stack<pair<int, int> > S2;
	int i;
	char ch;
	for (i = 0; cin >> ch; i++) {
		if (ch == '\\') {
			S1.push(i);
			S2.push(make_pair(i, 0));
		}else if (ch == '/') {
			if (S1.size() == 0) {
				continue;
			}

			int last = S1.top(); S1.pop();
			int sum = i-last;
			while (S2.top().first != last) {
				sum += S2.top().second;
				S2.pop();
			}
			S2.top().second += sum;
		}
	}

	int areaSum = 0;
	stack<int> reverse;
	while (S2.size() > 0) {
		int s = S2.top().second;
		if (s > 0) {
			reverse.push(s);
			areaSum += s;
		}
		S2.pop();
	}
	cout << areaSum << endl;

	cout << reverse.size();

	while (reverse.size() > 0) {
		cout << " ";
		cout << reverse.top();
		reverse.pop();
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 3140
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int num = sc.nextInt();
			for(int i = 1; i <= num ; i++ ) {
				if(i%3 == 0) {
					System.out.print(" " + i);
				}
				else for(int j = i; 0<j ; j /= 10) {
					if(j%10 == 3) {
						System.out.print(" " + i);
						break;
					}
				}
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 28552
using System;

class Program {
    static void Main( string[] args )
    {
        int n = int.Parse( Console.ReadLine() );
        string[] s = Console.ReadLine().Split();

        long min = long.MaxValue;
        long max = long.MinValue;
        long sum = 0;

        for ( int i = 0; i < n; ++i ) {
            long a = long.Parse( s[ i ] );

            if ( a < min ) {
                min = a;
            }

            if ( a > max ) {
                max = a;
            }

            sum += a;
        }

        Console.WriteLine( "{0} {1} {2}", min, max, sum );
    }
}

Measured memory_bytes: 9932
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  while (1) {
    cnt += n;
    ans++;
    if (cnt % 360 == 0) break;
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;


int main(void){
	string now;
	cin >> now;
	int num = 0;
	for(int e=0;e<now.size();e+=2) if(now[e]=='h') num++;
	for(int e=1;e<now.size();e+=2) if(now[e]=='i') num++;
	if((num%2)==0&&num==(int)now.size()) printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
xy = tuple(map(int, input().split()))
pM = sum(xy)
pm = sum(xy)
mM = xy[0] - xy[1]
mm = xy[0] - xy[1]
for _ in range(n - 1):
    xy = tuple(map(int, input().split()))
    s = sum(xy)
    d = xy[0] - xy[1]
    if s > pM:
        pM = s
    elif s < pm:
        pm = s
    if d > mM:
        mM = d
    elif d < mm:
        mm = d
print(max(abs(pM - pm), abs(mM - mm)))

Measured memory_bytes: 68996
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:usize,
    mut b:[isize;a],
    }
    for i in 0..a-1 {
        b[i+1]+=b[i];
    }
    let mut z:isize=100000;
    for i in 0..a {
        if z>(b[a-1]-b[i]*2).abs() {z=(b[a-1]-b[i]*2).abs();}
    }
    println!("{}",z)
}

Measured memory_bytes: 2176
import copy

def bubble(C,N):
    for i in range(N):
        for j in range(N-1,i,-1):
            if int(C[j][1])<int(C[j-1][1]):
                C[j],C[j-1]=C[j-1],C[j]

def selection(A,N):
    count = 0
    for i in range(0,N):
        minj = i
        for j in range(i,N):
            if int(A[j][1]) < int(A[minj][1]):
                minj = j
        if i != minj:
            A[i],A[minj]=A[minj],A[i]
            count += 1
    return count 

n = int(input())
c = input().split()
c2 = copy.copy(c)

bubble(c,n)
selection(c2,n)
print(" ".join(c))
print("Stable")
print(" ".join(c2))
if c==c2:
    print("Stable")
else:
    print("Not stable")


Measured memory_bytes: 6344
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const int MOD = 1e9 + 7;



signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

    int k, x;
    cin >> k >> x;
    k--;
    int mn = max(-1000000ll, x - k);
    int mx = min(1000000ll, x + k);
    for (int i = mn; i <= mx; i++)
        cout << i << " ";
    return 0;
}

Measured memory_bytes: 256
import itertools
def main():
    N  = int(input())
    A = list(map(int, input().split())) 
    combilist = itertools.combinations(A,2)
    sum = 0
    for item in combilist:
        sum += item[0]*item[1]

    print(sum)



if __name__ == '__main__':
    main()

Measured memory_bytes: 9124
#include<iostream>
using namespace std;
int main(){
  int n,m;
  int i,j,k;
  int mat[100][100]={{}};
  int ve[100]={};
  cin >> n >> m;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >> mat[i][j];
    }
  }
  for(j=0;j<m;j++) cin >> ve[j];
  for(i=0;i<n;i++){
    int x=0;
    for(j=0;j<m;j++) x+=mat[i][j]*ve[j];
    cout << x << endl;		       
  }
  
  return 0;
}



Measured memory_bytes: 3132
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
if N >= M:
    print(0)
else:
    X.sort()
    gap = []
    for i in range(1,M):
        gap.append(X[i]-X[i-1])
    print(sum(sorted(gap)[0:M-N]))

Measured memory_bytes: 57512
d,n = map(int,input().split())
res=0
if(d == 0):
    if n ==100:
        n=101
        for i in range(0,n+1):
            res = i
        print(res)
    else:
        for i in range(0,n+1):
            res = i
        print(res)
elif(d == 1):
    if n == 100:
        n=101
        for i in range(0,n+1):
            res = i*100
        print(res)
    else:
        for i in range(0,n+1):
            res = i*100
        print(res)
elif(d == 2):
    if n==100:
        n=101
        for i in range(0,n+1):
            res = i*10000
        print(res)
    else:
        for i in range(0,n+1):
            res = i*10000
        print(res)

Measured memory_bytes: 3064
import collections

n = int(input())
a = tuple(map(int, input().split()))

m = collections.Counter(a)

# n: odd  ->  0, 2, ..., n-1
# n: even ->  1, 3, ..., n-1

if n % 2 == 0:
    mm = {2*i+1: 2 for i in range(0, n//2)}
else:
    mm = {2*i: 2 for i in range(0, n//2 + 1)}
    mm[0] = 1


for i in m:
    if i not in mm or m[i] != mm[i]:
        print(0)
        exit()

for i in mm:
    if i not in m or mm[i] != mm[i]:
        print(0)
        exit()

r = 10**9 + 7
ans = 1
for _ in range(n//2):
    ans = (ans * 2) % r

print(ans)

Measured memory_bytes: 18276
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*
*/

ll a,b,ans=0;

void init(){
	cin>>a>>b;
}

int main(void){
	init();
	cout<<(3*a+b)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

vector<int> v[15];

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

    int ans = 0;
    rep(a, 10){
        rep(b, 10){
            rep(c, 10){
                bool f1 = 0, f2 = 0, f3 = 0;
                int i = 0;
                while(i < n){
                    if (!f1) if(s[i]-'0'==a){
                        f1 = 1;
                        i++;
                    }
                    if (f1&&!f2) if(s[i]-'0'==b){
                        f2 = 1;
                        i++;
                    }
                    if (f1&&f2&&!f3) if(s[i]-'0'==c){
                        f3 = 1;
                        i++;
                    }
                    i++;
                }
                if (f1&&f2&&f3) ans++;
            }
        }
    }

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


Measured memory_bytes: 3612
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int main(){
    char a;
    cin >> a;
    if(a-'A'<=26){
        cout<<'A'<<endl;
    }else{
        cout<<'a'<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n; cin >>n;
  char c[n]; int cnt=0,ans=0;
  for(int i=0; i<n; i++){
    cin >>c[i];
    if(c[i]=='R') cnt++;
  }
  for(int i=0; i<cnt; i++) if(c[i]=='W') ans++;
  cout <<ans;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define debug(x) cerr << #x << " " << x << endl;
#define debug_p(x) cerr << #x << " [" << x.fi << " " << x.se << "]"<<endl;
#define debug_v(x) {cerr << #x << " "; for (auto ioi : x) cerr << ioi << " "; cerr << endl;}
#define debug_vp(x) {cerr << #x << " "; for (auto ioi : x) cerr << '[' << ioi.fi << " " << ioi.se << ']'; cerr << endl;}
#define debug_v_v(x) {cerr << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cerr << ioi2 << " "; cerr << '\n';} cerr << "*/" << #x << endl;}
#define gen_clock(x) ll x = clock(); cerr << "Clock " << #x << " created" << endl;
#define check_clock(x) cerr << "Time spent in " << #x << ": " << (double)(clock() - x)/CLOCKS_PER_SEC << endl; x = clock();
#define reset_clock(x) x = clock()

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

int n,m,q;
ll ans;
struct qu
{
	int a,b,c,d;
};

void dfs(vi seq, vector<qu> & quad)
{
	if(S(seq)==n)
	{
		//debug_v(seq)
		ll sum=0;
		for(auto u:quad)
		if(seq[u.b-1]-seq[u.a-1]==u.c)
		sum+=u.d;
		ans=max(ans,sum);
		return;
	}
	vi temp=seq;
	int st;
	if(seq.empty()) st=1;
	else st=seq.back();
	for(int i=st;i<=m;i++)
	{
		temp.pb(i);
		dfs(temp,quad);
		temp.pop_back();
	}
}

void solve()
{
	cin>>n>>m>>q;
	vector<qu> quad(q);
	int i;
	ans=0;
	for(i=0;i<q;i++)
	cin>>quad[i].a>>quad[i].b>>quad[i].c>>quad[i].d;
	dfs({},quad);
	cout<<ans;
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3608
p=int(input())
x=[int(x) for x in input().split()]
mi=min(x)
ma=max(x)
op=list()
for i in range(mi,ma+1):
	temp=0
	for j in x:
		temp=temp+(i-j)**2
	op.append(temp)  
print(min(op))    

Measured memory_bytes: 3060
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include <tuple>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

bool matatabi(int x1, int y1, int x2, int y2, int m, tuple<int, int, int, int> p[]){
  rep(i, m){
    if(get<0>(p[i]) == x1 && get<1>(p[i]) == y1 && get<2>(p[i]) == x2 && get<3>(p[i]) == y2) return false;
    if(get<0>(p[i]) == x2 && get<1>(p[i]) == y2 && get<2>(p[i]) == x1 && get<3>(p[i]) == y1) return false;
  }

  return true;
}

int main(){
  int n;
  int gx, gy;
  int m;
  tuple<int, int, int, int> p[1000];
  int x1, y1, x2, y2;
  int a[20][20];
  cin >> n;
  rep(k, n){
    cin >> gx >> gy;
    cin >> m;

    rep(i, m){
      cin >> x1 >> y1 >> x2 >> y2;
      p[i] = make_tuple(x1, y1, x2, y2);
    }


    rep(i, gx+1){

      rep(j, gy+1){
        if(i == 0){
          if(j == 0){
            a[0][0] = 1;
          } else{
            if(matatabi(0, j-1, 0, j, m, p) && a[0][j-1] != 0){
              a[0][j] = 1;
            }else{
              a[0][j] = 0;
            }
          }
        } else if (j == 0){
          if(i == 0){
            a[0][0] = 1;
          } else{
            if(matatabi(i-1, 0, i, 0, m, p) && a[i-1][0] != 0){
              a[i][0] = 1;
            } else{
              a[i][0] = 0;
            }

          }
        } else{
          if(matatabi(i-1, j, i, j, m, p) && a[i-1][j] != 0 && matatabi(i, j-1, i, j, m, p) && a[i][j-1] != 0){
            a[i][j] = a[i-1][j] + a[i][j-1];
          } else if (matatabi(i-1, j, i, j, m, p) && a[i-1][j] != 0){
            a[i][j] = a[i-1][j];
          } else if (matatabi(i, j-1, i, j, m, p) && a[i][j-1] != 0){
            a[i][j] = a[i][j-1];
          } else{
            a[i][j] = 0;
          }
        }


      }

    }
    
    // if(k == 2){
    //   rep(i, gx+1){
    //     rep(j, gy+1){
    //       cout << a[i][j] << " " << i << " " << j<< endl;
    //     }
    //   }
    // }

    if (a[gx][gy] != 0){
      cout << a[gx][gy] << endl;
    }else {
      cout << "Miserable Hokusai!"<< endl;
    }



  }




}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}


Int check(Int n){
  Int sum = 0;
  Int num = 1;
  while(1){
    sum = sum + num;
    num = num + 1;
    if(sum == n) return 1;
    if(sum > n) return 0;
  }
}

vector<vector<Int>> solve(Int n){
  vector<vector<Int>> ans;
  ans.push_back({1});
  ans.push_back({1});
  if(n == 1) return ans;
  Int num = 2;
  
  while(1){
    Int h = ans.size();
    ans.push_back({});
    for(Int i=0;i<h;i++) ans[i].push_back(num), ans.back().push_back(num), num++;
    if(num >= n) break;
  }
  return ans;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);


  Int n;
  cin>>n;
  if(check(n) == 0) {
    cout<<"No"<<endl;
  }
  else{
    auto ans = solve(n);
    cout<<"Yes"<<endl;
    cout<<ans.size()<<endl;
    for(Int i=0;i<(Int)ans.size();i++) cout<<ans[i].size()<<" "<<ans[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long N, K;
  cin >> N >> K;
  if (2 * K - 1 > N) {
    cout << -1 << '\n';
    return 0;
  }
  long long a[N], b[N], c[N];
  int M = (N + 1) / 2;
  debug(M);
  int x = M - 1, y = N - 1;
  auto next_x = [&]() { x = (x + M - 1) % M; };
  auto next_y = [&]() { y = (y - M + N - M - 1) % (N - M) + M; };
  for (int i = K; i < K + 3 * N; i++) {
    if (i < K + N) {
      if (i < K + M) {
        a[x] = i;
        next_x();
      } else {
        a[y] = i;
        next_y();
      }
    } else if (i < K + 2 * N) {
      if (i < K + N + N - M) {
        b[y] = i;
        next_y();
      } else {
        b[x] = i;
        next_x();
      }
    } else {
      if ((i - (K + 2 * N)) & 1) {
        c[y] = i;
        next_y();
      } else {
        c[x] = i;
        next_x();
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << a[i] << " " << b[i] << " " << c[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 5908
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;
typedef long long ll;

int N;
ll dp[100002][2];
string S;

ll MOD = 1000000007;

int main() {
	cin >> S;
	N = S.size();
	dp[0][1] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 2; j++) {
			dp[i][j] %= MOD;
			if (j == 0) {
				dp[i + 1][0] += 3ll * dp[i][j];
			}
			else {
				if (S[i] == '0') {
					dp[i + 1][1] += dp[i][j];
				}
				else if (S[i] == '1') {
					dp[i + 1][1] += dp[i][j] * 2ll;
					dp[i + 1][0] += dp[i][j];
				}
			}
		}
	}
	cout << (dp[N][0] + dp[N][1]) % MOD << endl;
	return 0;
}

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

using namespace std;

long long n, a, b;

int main() {
	cin >> n >> a >> b;
	if(a < b) swap(a, b);
	if(a - b & 1) {
		long long res = min(a - 1, n - b);
		res = min(res, (a + b - 1) >> 1);
		res = min(res, (n - b + n - a + 1) >> 1);
		cout << res << endl;
	} else {
		cout << (a - b >> 1) << endl;
	}
	return 0;
}

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

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

  for (int i=0; i < (1<<3);i++){
    int ans = S[0] - '0';
    for (int j=0; j<3; j ++) {
      if (i & (1<<j)) {
        ans += (S[3-j] - '0');
      }
      else {
        ans -= (S[3-j] - '0');
      }
    }
    if (ans == 7){
      for (int k; k<3; k++) {
        string op;
        if (i & (1<<2-k)) {
          op = "+";
        }
        else {
          op = "-";
        }

        
        cout << S[k] << op;
      }

      cout << S.back() << "=7" << endl;


      break;
    }
    
  }

  //cout << ans << endl;
}



Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <iomanip>

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() {
    double N, A[100], product = 1, sum = 0;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        product *= A[i];
    }
    REP(i, N) sum += product / A[i];
    cout << setprecision(12) << product / sum << endl;
    return 0;
}

Measured memory_bytes: 384
A = int(input())
k = 1
if A < 105:
  print(0)
elif A == 105 and A == 106:
  print(1)
else:
  for a in range(107,A+3,2):
    count = 0
    for i in range(1,A+3,2):
      if a % i == 0:
        count = count + 1
      elif count == 8 and A+1 <= i:
        k = 1+k
  print(k)   

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

void chmax(int& a, int b) {
  if (a < b) a = b;
}

int main() {
  int N;
  cin >> N;
  int a[N+1];
  for (int i = 0; i < N; i++) cin >> a[i];
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int count = 0;
    while (i < N-1 && a[i] >= a[i+1]) {
      count++;
      i++;
    }

    chmax(ans, count);
  }
    
  cout << ans << endl;


}

Measured memory_bytes: 640
// ------------------------------------
// Date:2018/ 4/21
// Problem:. . ; b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N, X;

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

  cin >> N >> X;
  vector< int > m(N);
  REP(i, N) {
    cin >> m[i];
    X -= m[i];
  }

  sort(ALL(m));

  int ans = N;
  ans += X / m[0];

  cout << ans << endl;

  return 0;
}



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

using namespace std;

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

constexpr int MAXN = 52, MOD = 1000000007;

char S1[MAXN + 2], S2[MAXN + 2];

int pow(int ans, int base, int e) {
	while(e) {
		if(e & 1)
			ans = (ll)ans * base % MOD;
		base = (ll)base * base % MOD;
		e >>= 1;
	}
	return ans;
}


int main() {
	int N;
	cin >> N >> S1 >> S2;
	int e2 = 0, e3 = 1, i = 1, l = 1;
	if(S1[0] != S2[0]) {
		e2++;
		i++;
		l = 0;
	}
	while(i < N) {
		if(S1[i] == S2[i]) {
			e2 += l;
			l = 1;
		} else {
			if(!l)
				e3++;
			else
				e2++;
			l = 0;
			i++;
		}
		i++;
	}
	cout << (pow(pow(1, 3, e3), 2, e2)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

const int INF = 1 << 25;
const int c[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

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

    set<int> a;
    for (int i = 0; i < M; ++i) {
        int b;
        cin >> b;
        a.insert(b);
    }

    int dp[N + 1], rev[N + 1];
    fill(dp, dp + N + 1, -INF);
    dp[0] = -1;
    for (int n = 1; n <= N; ++n) {
        for (int i : a) {
            if (n >= c[i]) {
                int dig = dp[n - c[i]] + 1;
                if (dig >= dp[n]) {
                    dp[n] = dig;
                    rev[n] = i;
                }
            }
        }
    }

    while (N > 0) {
        cout << rev[N];
        N -= c[rev[N]];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
import sys
import os

OK = 'APPROVED'
NG = 'DENIED'


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = list(map(int, sys.stdin.buffer.readline().split()))

    print('Yay!' if A + B <= 16 and A <= 8 and B <= 8 else ':(')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int a, b;
  cin >> a >> b;
  if (a>=13) cout << b << endl;
  else if (a>=6) cout << b/2 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
MOD=int(1e9+7)
n,m=map(int,input().split())
stairs=[True]*(n+10) #0階を含む
a=[]
for i in range(m):
  s=int(input())
  a.append(s)
for j in a:
  stairs[j]=False
dp=[-1]*(n+10)
dp[0]=1
dp[1]=dp[0]*stairs[1]
for k in range(0,n):
  dp[k+2]=(dp[k+1]+dp[k])*stairs[k+2]%MOD

print(dp[n])

Measured memory_bytes: 51032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9+7;
ll add(ll a, ll b)
{
    return (a+b)%MOD;
}
int main()
{
    ll n, x;
    cin >> n >> x;
    vector<ll> s(n);
    for(int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    reverse(s.begin(), s.end());
    vector<vector<ll>> dp(201, vector<ll>(100010));

    dp[0][x] = 1;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 0; j <= 100010; j++)
        {
            dp[i][j] = add(dp[i][j], dp[i-1][j] * (n-i));
            dp[i][j%s[i-1]] = add(dp[i][j%s[i-1]], dp[i-1][j]);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= 100010; i++)
    {
        ans = add(ans, dp[n][i]*i);
    }
    cout << ans << endl;
}


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

int main() {
	int w, h;
	while (1) {
		cin >> h >> w;
		if (w == 0 || h == 0)break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {

				if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0)) {
					cout << ".";
				}
				else if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) {
					cout << "#";
				}

			}
			cout << endl;
		}
          cout<<endl;
	}

}




Measured memory_bytes: 3088
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long sum = 0, cnt = 0;
        int n = Integer.parseInt(sc.next());
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        int before = Integer.parseInt(sc.next());

        for(int i = 0; i < n-1 ; i++) {
            int p = Integer.parseInt(sc.next());
            long w = (p-before)*a;
            if(w < b) {
                sum += w;
            } else cnt++;
            before = p;
        }
        sum += cnt*b;

        System.out.println(sum);
    }
}


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

using namespace std;

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define FOR(i, n, m) for (int i = (n); i < (m); ++i)

const int MAX = 5010;

int N, K;
vi A;
ll dp[MAX];

bool need(int mid) {
  ll x = A[mid];
  if (x >= K) return true;

  bool res = false;
  FOR (i, 1, MAX) dp[i] = 0;
  dp[0] = 1;
  REP (i, N) if (i != mid) {
    REPR (k, K) {
      if (dp[k]!=0 && k+A[i] < K) {
        dp[k+A[i]] = 1;
        if (k+A[i]+x >= K) res = true;
      }
    }
  }

  return res;
}

int main() {

  cin >> N >> K;
  A = vi(N);
  REP (i, N) cin >> A[i];
  sort(A.begin(), A.end());

  int lo = -1, hi = N;
  while (hi-lo > 1) {
    int mid = (hi+lo)/2;

    if (need(mid)) hi = mid;
    else lo = mid;
  }

  cout << hi << endl;

}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

ll dp[105][5][5][5];

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  ll N;
  scanf("%lld", &N);

  dp[0][0][0][0] = 1;

  // 1:A
  // 2:G
  // 3:C
  // 4:T
  //
  //       ijkl
  // AGC:   123 (j==1 && k==2 && l==3)
  // GAC:   213 (j==2 && k==1 && l==3)
  // ACG:   132 (j==1 && k==3 && l==2)
  // A_GC: 1_23 (i==1 && k==2 && l==3)
  // AG_C: 12_3 (i==1 && j==2 && l==3)
  //
  //

  for (ll n = 0; n < N; n++) {
    for (ll i = 0; i <= 4; i++) {
      for (ll j = 0; j <= 4; j++) {
        for (ll k = 0; k <= 4; k++) {
          for (ll l = 1; l <= 4; l++) {
            // dp[n+1][i][j][k]

            bool skip =
                (j == 1 && k == 2 && l == 3) || (j == 2 && k == 1 && l == 3) ||
                (j == 1 && k == 3 && l == 2) || (i == 1 && k == 2 && l == 3) ||
                (i == 1 && j == 2 && l == 3);
            if (skip) {
              {
                continue;
              }
            }

            ll val = dp[n][i][j][k];
            dp[n + 1][j][k][l] += val;
            dp[n + 1][j][k][l] %= MOD;
          }
        }
      }
    }
  }

  ll ans = 0;
  for (ll i = 0; i <= 4; i++) {
    for (ll j = 0; j <= 4; j++) {
      for (ll k = 0; k <= 4; k++) {
        ll val = dp[N][i][j][k];

        ans = (ans + val) % MOD;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  int nw = 2 * D + 1;
  int answer = (N - 1) / nw + 1;
  cout << answer << endl;
  
  return 0;
}



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

int A, B;

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

    if (A <= 5) {
        printf("0\n");
    } else if (A <= 12) {
        printf("%d\n", B / 2);
    } else {
        printf("%d\n", B);
    }
}

Measured memory_bytes: 256
'''A - Entrance Examination
https://atcoder.jp/contests/abc117/tasks/abc117_a

>>> main(8, 3)
2.6666666667
>>> main(99, 1)
99.0000000000
>>> main(1, 100)
0.0100000000'''


def main(t, x):
    print('{:.10f}'.format(t/x))


if __name__ == "__main__":
    t, x = map(int, input().split(' '))
    main(t, x)


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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void vprint(vector<ll> A){
    ll L = A.size();
    FOR(i, 0, L){
        if(i) cout << ' ';
        cout << A[i];
    }
    cout << endl;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    auto B = A;
    sort(ALL(B));

    ll ma = B.back();
    ll ma_prev = B[N-2];

    if(ma==ma_prev){
        FOR(i, 0, N){
            p(ma);
        }
        
        return 0;
    }

    for(ll a : A){
        if(a==ma){
            p(ma_prev);
        }else{
            p(ma);
        }
    }
    
    return 0;
}

Measured memory_bytes: 4736
a,b=input().split()
a=int(a)
b=int(b)
if b==1:
  print(0)
elif a>=b:
  print(1)
else:
  if (b-a)%(a-1)==0:
    print(int((b-a)/(a-1))+1)
  else:
    print(int((b-a)/(a-1))+2)

Measured memory_bytes: 9192
#include <iostream>
#define llint long long
#define mod 998244353

using namespace std;

llint n;
llint a[305];
llint dp[305][90005][2][2];

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	llint sum = 0;
	for(int i = 1; i <= n; i++) sum += a[i];
	
	
	dp[0][0][0][0] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= sum; j++){
			for(int k = 0; k < 2; k++){
				for(int l = 0; l < 2; l++){
					if(j+a[i+1] <= sum) (dp[i+1][j+a[i+1]][k][l] += dp[i][j][k][l]) %= mod;
					(dp[i+1][j][1][l] += dp[i][j][k][l]) %= mod;
					(dp[i+1][j][k][1] += dp[i][j][k][l]) %= mod;
				}
			}
		}
	}
	
	/*for(int i = 0; i <= n; i++){
		for(int j = 0; j <= sum; j++){
			llint s = 0;
			for(int k = 0; k < 2; k++){
				for(int l = 0; l < 2; l++){
					s += dp[i][j][k][l], s %= mod;
				}
			}
			cout << s << " ";
		}
		cout << endl;
	}*/
	
	llint ans = 0;
	for(int i = 0; i <= sum; i++){
		if(sum-i <= i){
			ans += dp[n][i][1][1], ans %= mod;
		}
	}
	ans *= 3, ans %= mod;
	
	//cout << ans << endl;
	
	llint all = 0, beki3 = 1, beki2 = 1;
	for(int i = 0; i < n; i++) beki2 *= 2, beki2 %= mod;
	for(int i = 0; i < n; i++) beki3 *= 3, beki3 %= mod;
	all = beki3 - beki2*3%mod + 3 + mod, all %= mod;
	
	//cout << all << endl;
	
	ans = (all - ans + mod) % mod;
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int Q, N, C;

int digit(int n, int k = 0)
{
	if (n == 0) { return k; }

	return digit(n / 10, k + 1);
}

int power(int a, int b)
{
	if (b == 0) { return 1; }

	return power(a, b - 1) * a;
}

int main()
{
	cin >> Q;

	for (int i = 0; i < Q; i++)
	{
		cin >> N;

		C = 0;

		while (digit(N) > 1)
		{
			int Next_N = 0;

			for (int j = 1; j < digit(N); j++)
			{
				int l = N / power(10, j);
				int r = N % power(10, j);

				Next_N = max(l * r, Next_N);
			}

			N = Next_N;

			C++;
		}

		cout << C << endl;
	}

	return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#define int long long
using namespace std;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int mypow(int x, int y) {
	if (y == 0)return 1;
	if (y % 2)return mypow(x, y - 1)*x;
	else return mypow(x, y / 2)*mypow(x, y / 2);
}
int Max(int x, int y) {
	if (x > y)return x;
	else return y;
}
int Min(int x, int y) {
	if (x < y)return x;
	else return y;
}
/*ライブラリゾーン！！！！！！！！！！！！！！！*/
int n, m, a, b,ans,o[10],michi[10][10];
signed main(){
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		michi[a][b] = michi[b][a] = 1;
	}
	for (int i = 0; i < n; i++)o[i] = i + 1;
	do {
		for (int i = 1; i < n; i++) {
			if (michi[o[i - 1]][o[i]] == 0)goto bed;
		}
		ans++;
	bed:;
	} while (next_permutation(o + 1, o + n));
	cout << ans << endl;
end:;
	system("PAUSE");
	return 0;
}


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

using ll = long long;
const ll MOD = 998244353;

int main() {
    ll x, y, ans;
    cin >> x >> y;
    if (x < y) {
        if (x * y >= 0) ans = abs(x - y);
        else ans = abs(x + y) + 1;
    } else {
        if (x * y > 0) ans = abs(x - y) + 2;
        else ans = abs(x + y) + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n:usize,
        ab:[(i64,i64);n],
    }
    let mut a: Vec<i64> = ab.iter().map(|(ap, _)| *ap).collect();
    let mut b: Vec<i64> = ab.iter().map(|(_, bp)| *bp).collect();
    a.sort();
    b.sort();
    if n % 2 == 1 {
        println!("{}", b[(n + 1) / 2 - 1] - a[(n + 1) / 2 - 1] + 1)
    } else {
        println!(
            "{}",
            ((b[n / 2 - 1] + b[n / 2]) - (a[n / 2 - 1] + a[n / 2])) + 1
        )
    }
}


Measured memory_bytes: 12936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		double a = sc.nextInt();
		double v = sc.nextInt();
		double b = sc.nextInt();
		double w = sc.nextInt();
		double t = sc.nextInt();



		if(v <= w) {
			System.out.println("NO");
		}else {
			if(Math.abs(a - b) / Math.abs(v - w) <= t) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}


		sc.close();

	}

}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#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;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
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 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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()
{
  int d; cin >> d;
  if(d == 25) cout << "Christmas" << endl;
  else if(d== 24) cout << "Christmas Eve" << endl;
  else if(d == 23) cout << "Christmas Eve Eve" << endl;
  else cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)
#define ci(x) cin>>x;
#define ci2(x,y) cin>>x>>y;
#define co(x) cout<<x<<"\n";
#define co2(x,y) cout<<x<<" "<<y<<"\n";
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;

int main() {
	ll n,k;
	ci2(n,k);
	cout<<min(n%k,abs(n%k-k))<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b,ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m-1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}

int main(){
	llint a, b, c,ans;
	cin >> a >> b >> c;
	if (a + b + 1 >= c)ans = c + b;
	else ans = a + b + 1 + b;
	cout << ans << endl;
	
	
	return 0;
}




  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int _b=(b),i=(a);i<_b;++i)
#define ROF(i, b, a) for(int _a=(a),i=(b);i>_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(), (x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long int ll; typedef pair<int,int> PII;typedef unsigned long long int ull;
typedef vector<int>VI; typedef vector<ll> VL; typedef vector<PII> VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

string s;
string out = "";
int main() {
	IO();
	cin >> s;
	for(auto ch : s) {
		if(ch == 'B' && !out.empty()) {out.pop_back();continue;}
		else if(ch == 'B') continue;
		out += ch;
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256