akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
    int N,t,c,r=0;
    cin >> N;
    map<int,int> a;

    rep(i,N) {
        cin >> t;
        if(a.count(t))
            a.at(t)++;
        else
            a[t] = 1;
    }

    rep(i,1e5) {
        c = 0;
        if(a.count(i))
            c += a.at(i);
        if(a.count(i+1))
            c += a.at(i+1);
        if(a.count(i+2))
            c += a.at(i+2);
        r = max(r,c);
    }

    cout << r << endl;
}

Measured memory_bytes: 3200
def knapsack(n,W,v,w):
    dp=[[0 for i in range(W+1)]for j in range(n+1)]
    for i in range(n+1):
        for j in range(W+1):
            if(i==0 or j==0):
                dp[i][j]=0
            elif(v[i-1]<=j):
                dp[i][j] = max(w[i-1] + dp[i-1][j-v[i-1]],dp[i-1][j]) #2 cases in max bracket if (i-1)th element will count or will not count.
            else:
                dp[i][j]=dp[i-1][j]
    # print(dp)
    return dp[n][W] 



n,W=map(int,input().split())
v=[]
w=[]
for i in range(n):
    a,b=map(int,input().split())
    v.append(a)
    w.append(b)
print(knapsack(n,W,v,w))

    # l.append(list(map(int,input().split()))) 

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

using namespace std ;

#define rg register
#define dbg(v) cerr << #v << " " << v ;
typedef long long ll ;

int main() {
    int c, n ;
    cin >> c >> n ;
    vector<int> a(n) ;
    for(int i = 0 ; i < n ; i++) cin >> a[i] ;
    sort(a.rbegin(), a.rend()) ;
    for(int i = 0 ; i < n ; i++){
        c -= a[i] ;
    }
    if(c <= 0){
        cout << "Yes\n" ;
    } else cout << "No\n" ;
}

/*
 Empty set of troubles.
*/


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

using namespace std;
#define ll long long int

int main()
{
   ll t;
   t = 1;	
  // cin t;
   while(t--){
    string s, t;
    cin >> s >> t;
    int len = s.length();
    int len1 = t.length();
    bool check = true;
    if(len1 != len + 1)
    check=false;
    for(int i =0 ;i < len; i ++)
    {
        if(i < len1 && s[i] != t[i])
        check = false;
    }         
    if(check)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
   }
}


Measured memory_bytes: 3584
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

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

using namespace std;
string s;

int main(){
  cin >> s;
  int a,b;
  REP(i,s.size()){
    if (s[i]=='A') {
      a=i;
      break;
    }
  }
  for(int i=s.size()-1;i>=0;i--){
    if (s[i]=='Z'){ b=i;
    break;
  }
  }
  cout << b-a+1 << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define PI acos(-1)
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int t[4*N];

void build(pii a[], int v, int tl, int tr) {
	if (tl == tr) {
		t[v] = a[tl].se;
	} else {
		int tm = (tl + tr) / 2;
		build(a, v*2, tl, tm);
		build(a, v*2+1, tm+1, tr);
		t[v] = 0;
	}
}

void update(int v, int tl, int tr, int l, int r, int add) {
	if (l > r)
		return;
	if (l == tl && r == tr) {
		t[v] += add;
	} else {
		int tm = (tl + tr) / 2;
		update(v*2, tl, tm, l, min(r, tm), add);
		update(v*2+1, tm+1, tr, max(l, tm+1), r, add);
	}
}

int get(int v, int tl, int tr, int pos) {
	if (tl == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	if (pos <= tm)
		return t[v] + get(v*2, tl, tm, pos);
	else
		return t[v] + get(v*2+1, tm+1, tr, pos);
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	#ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	int n, d, a;
	cin >> n >> d >> a;
	pii x[n];
	for(int i = 0; i < n; i++) {
		cin >> x[i].fi >> x[i].se;
	}
	sort(x, x + n);
	build(x, 1, 0, n - 1);
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int cur = get(1, 0, n - 1, i);
		if(cur <= 0) {
			continue;
		}
		int req = (cur + a - 1) / a;
		ans += req;
		int pos = upper_bound(x, x + n, make_pair(x[i].fi + 2 * d, inf)) - x;
		pos--;
		update(1, 0, n - 1, i, pos, -req * a);
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 9472
INF = float('inf')
N,M = map(int,input().split())
A = []
B = []
C = []
for i in range(M):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    A.append(a)
    B.append(b)
    C.append(c)

dp = [{} for _ in range(M+1)]
for m in range(M):
    for i in range(2**N):
        if i == 0:
            dp[m][i] = 0
        else:
            dp[m][i] = INF

for m in range(M):
    a = A[m]
    b = B[m]
    c = C[m]
    s = 2**N-1
    for i in range(b):
        s -= 2**(c[i]-1)
    for i in range(2**N):
        dp[m+1][i] = min(dp[m][i],dp[m][i&s]+a)

ans = dp[M][2**N-1]
if ans == INF:
    ans = -1
print(ans)

Measured memory_bytes: 281604
// https://atcoder.jp/contests/abc128/tasks/abc128_b

import java.util.Scanner;
import java.util.TreeMap;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Arrays;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        TreeMap<String,TreeMap<Integer,Integer>> map = new TreeMap<>();
        for (int i=1;i<N+1;i++){
            String S = sc.next();
            int P = sc.nextInt();
            TreeMap<Integer,Integer> pi;
            if (map.containsKey(S)){
                pi = map.get(S);
            } else {
                pi = new TreeMap<>();
            }
            pi.put(P,i);
            map.put(S,pi);
        }
        for (String s:map.keySet()){
            Object[] key = map.get(s).keySet().toArray();
            Arrays.sort(key,Collections.reverseOrder());
            for (Object i:key){
                System.out.println(map.get(s).get(i));
            }
        }
    }
}

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

int main() {
	string s;
	while (cin >> s) {
		int cnt1 = 0, cnt2 = 0;
		if (s.size() <= 2) {
			cout << "0\n0\n" << endl; return 0;
		}
		rep(i, s.size() - 2) {
			if (s[i + 1] == 'O'&&s[i + 2] == 'I') {
				if (s[i] == 'J')cnt1++;
				if (s[i] == 'I')cnt2++;
			}
		}
		cout << cnt1 << endl << cnt2 << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
using System;
 class Colon
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split();
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int h = int.Parse(input[2]);
            int m = int.Parse(input[3]);

            double angH = (h * 30) + (m * 0.5);
            double angM = m * 6.0;
            double ang = Math.Abs(angH - angM);
            if (ang > 180) ang = 360 - ang;

            double rad = ang * Math.PI / 180;

            double diff = Math.Sqrt((a * a) + (b * b) - ((2 * a * b) * (Math.Cos(rad))));
            Console.WriteLine(diff);
        }
    }

Measured memory_bytes: 27912
<?php
//$K = (int)trim(fgets(STDIN));
$T = trim(fgets(STDIN));
//list($H1,$M1,$H2,$M2,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$s = trim(fgets(STDIN));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$len = strlen($T);
$S = "";
for($i=0;$i<$len;$i++) {
  if ($T[$i]=='?') {
    $S[$i]='D';
  }
  else {
    $S[$i]=$T[$i];
  }
}
printf("%s\n",$S);


Measured memory_bytes: 16604
void main()
{
    long[] nm = readln.split.to!(long[]);
    nm.sort!"a < b";
    long n = nm[0], m = nm[1];

    if (n == 1)
    {
        if (m == 1) 1.writeln;
        else writeln(m - 2);
    }
    else
    {
        writeln((n - 2) * (m - 2));
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

int main(){
    char c;
    cin >> c;
    cout << (char)(int)(c+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main(void){
    string A;
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    bool flag = true;
    cin  >> A;
    for(int i=0;i<alpha.size();i++){
        for(int j = 0;j<A.size();j++){
            if(alpha[i] == A[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << alpha[i] << endl;
            return 0;
        }else{
            flag = true;
        }
    }
    cout << "None" << endl;

}


Measured memory_bytes: 512
N=int(input().strip())
# 約数の列挙
def list_divisor(N):
    lw=1
    up=N
    divsl=[lw]
    divsu=[up]
    while lw<up:
        lw+=1
        up=N//lw
        if N%lw==0:
            if lw<up:
                divsl.append(lw)
                divsu.append(up)
            elif lw==up:
                divsl.append(lw)
    return divsl+divsu[::-1]
lst=list_divisor(N)
mn=float('inf')
for a in lst:
    b=N//a
    ans=max(len(str(a)),len(str(b)))
    if mn > ans:
        mn=ans
    if b<=a:
        break
print(mn)

Measured memory_bytes: 3064
from collections import Counter
s = input()
n = len(s)
dp = [0]*(n+1)
mod = 2019
for i in range(n-1,-1,-1):
    dp[i] = (dp[i+1]+int(s[i])*pow(10,n-i-1,mod))%mod
c = Counter(dp)
ans = 0
for i in c.values():
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 70556
use proconio::*;

fn main() {
    input! {
        c: [[i64; 3]; 3],
    };

    let mut ans = true;
    let mut a = [0; 3];
    let mut b = [0; 3];
    for i in 0..3 {
        b[i] = c[0][i];
    }
    for i in 0..3 {
        a[i] = c[i][0] - b[0];
    }

    'outer: for i in 0..3 {
        for j in 0..3 {
            if a[i] + b[j] != c[i][j] {
                ans = false;
                break 'outer;
            }
        }
    }

    println!("{}", if ans { "Yes" } else { "No" });
}


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

typedef long long int ll;

int main() {
    int n, m;
    const ll MOD = 1e9+7;
    cin >> n >> m;
    vector<int> v(n+1);
    for (int i = 1; i <= n; i++) cin >> v[i];
    v.push_back(1<<26);
    sort(v.begin(), v.end());
    auto sum = v;
    for (int i = 0; i < n; i++)
        sum[i] += sum[i-1];

    ll ans = 0;
    for (int i = 1; i <= n+1; i++) {
        if (sum[i-1] > m) break;

        vector<ll> dp(m+1);
        vector<int> used(m+1);
        dp[sum[i-1]] = 1LL;

        for (int j = i + 1; j <= n; j++) {
            for (int k = m; k - v[j] >= sum[i-1]; k--) {
                if (dp[k - v[j]]) {
                    dp[k] += dp[k - v[j]];
                    dp[k] %= MOD;
                    used[k - v[j]] = true;
                }
            }
        }

        for (int j = 1; j <= m; j++) {
            if (!used[j] && j + v[i] > m) {
                ans += dp[j];
                ans %= MOD;
            }
        }
    }

    cout << max(ans,1LL) << endl;

    return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;



int32_t main()
{
    fast

   int test=1;
    //cin>>test;
  
   

  while(test--)
  {
    
   int n;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];

    int max_so_far=a[0],ans=0;
    FOR(i,1,n-1)
    {
        if(a[i]<max_so_far)
        {
            ans+=max_so_far-a[i];
            //max_so_far
        }
        else max_so_far=a[i];
    }

    cout<<ans;

// while ending
   }
  

return 0;
}

Measured memory_bytes: 5212
# input
n = int(input())

mod = pow(10, 9) + 7
c = []
dp = [0] * (n + 1)
stone_history = dict()
for i in range(n):
    stone = int(input())
    if len(c) == 0:
        dp[i + 1] = 1
    else:
        if stone in stone_history and c[-1] != stone:
            dp[i + 1] = dp[i] + stone_history[stone]
        else:
            dp[i + 1] = dp[i]

    stone_history[stone] = dp[i + 1]
    c.append(stone)

print(dp[-1] % mod)


Measured memory_bytes: 760564
from sys import stdin


def main():
    h, w = map(int, input().split())
    a = [next_str() for _ in range(h)]
    ans = ["#" * w if i == 0 or i == h + 1 else a[i - 1] for i in range(h + 2)]
    print("\n".join(map(lambda x: "#{}#".format(x), ans)))


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
int N, M; ll A, B, C, ans;
map<ll, ll, greater<ll>> m;
int main() {
  scanf("%d %d", &N, &M);
  for(int i = 0; i < N; ++i) {
    scanf("%ld", &A);
    if(m.count(A) > 0) ++m.at(A);
    else m.insert({A, 1LL});
  }
  for(int i = 0; i < M; ++i) {
    scanf("%ld %ld", &B, &C);
    if(m.count(C) > 0) m.at(C) += B;
    else m.insert({C, B});    
  }
  ll n = N;
  for(auto i = m.begin(); n > 0; ++i) {
    ans += i->first * min(n, i->second);
    n -= i->second;
  }
  printf("%ld\n", ans);
}

Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;

#define int long long

signed main() {
    int n; cin >> n;
    vector<int> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];
    int m; cin >> m;
    vector<int> p(m), x(m);
    for(int i = 0; i < m; i++) cin >> p[i] >> x[i];

    for(int i = 0; i < m; i++) {
        int idx = p[i] - 1;
        int ans = 0;
        for(int j = 0; j < n; j++) {
            if(j != idx) ans += t[j];
            else ans += x[i];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
(princ (if (funcall (lambda (target)
                      (let ((result t))
                        (dotimes (x target)
                          (let ((tmp (read)))
                            (when (evenp tmp)
                              (unless (or (= (mod tmp 3) 0) (= (mod tmp 5) 0))
                                (setq result nil)))))
                        result)) (read))
           "APPROVED"
           "DENIED"))


Measured memory_bytes: 12392
from itertools import accumulate
from collections import Counter

I = lambda s:map(int, s)

p = int(input().split()[1])
s = input()
if 10 % p == 0:
  r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
  a = accumulate(x * pow(10, i, p) for i, x in enumerate(I(reversed(s)), 1))
  c = Counter(x % p for x in a) 
  c[0] += 1
  r = sum(i * (i - 1) // 2 for i in c.values())
print(r)


Measured memory_bytes: 4464
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#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;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N;
	cin >> N;
	ll A, B, C;
	cin >> A >> B >> C;
	vector<char> ans(N);
	vector<string> S(N);
	rep(i, N) {
		cin >> S[i];
	}
	rep(i, N) {
		if (S[i] == "AB") {
			if (A > B) {
				ans[i] = 'B';
				A--;
				B++;
			}
			else if (A < B) {
				ans[i] = 'A';
				A++;
				B--;
			}
			else {
				if (A + B == 0) {
					cout << "No" << endl;
					return 0;
				}
				if (A + B == 2) {
					ans[i] = 'A';
					if (i != N - 1 && S[i + 1] == "BC") {
						ans[i] = 'B';
					}
					if (ans[i] == 'A') {
						A++;
						B--;
					}
					else {
						A--;
						B++;
					}
				}
				else {
					ans[i] = 'A';
					A++;
					B--;
				}
			}
		}
		if (S[i] == "AC") {
			if (A > C) {
				ans[i] = 'C';
				A--;
				C++;
			}
			else if (A < C) {
				ans[i] = 'A';
				A++;
				C--;
			}
			else {
				if (A + C == 0) {
					cout << "No" << endl;
					return 0;
				}
				if (A + C == 2) {
					ans[i] = 'A';
					if (i != N - 1 && S[i + 1] == "BC")
						ans[i] = 'C';
					if (ans[i] == 'A') {
						A++;
						C--;
					}
					else {
						A--;
						C++;
					}
				}
				else {
					ans[i] = 'A';
					A++;
					C--;
				}
			}
		}
		if (S[i] == "BC") {
			if (C > B) {
				ans[i] = 'B';
				C--;
				B++;
			}
			else if (C < B) {
				ans[i] = 'C';
				C++;
				B--;
			}
			else {
				if (C + B == 0) {
					cout << "No" << endl;
					return 0;
				}
				if (C + B == 2) {
					ans[i] = 'C';
					if (i != N - 1 && S[i + 1] == "AB")
						ans[i] = 'B';
					if (ans[i] == 'B') {
						C--;
						B++;
					}
					else {
						C++;
						B--;
					}
				}
				else {
					ans[i] = 'C';
					C++;
					B--;
				}
			}
		}
	}


	cout << "Yes" << endl;
	rep(i, N)
		cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define rep(i,n,k) for(long long int i=k; i<n; ++i)
#define drep(i,n,k) for(long long int i=n-1; i>=k; --i)
using namespace std;

int main(){
  long long int n, k;
  cin >> n >> k;
  long long int ans = 0;
  rep(i,n,0){
    int l;
    cin >> l;
    if(l >= k) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()

#define naman                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

const ll INF=1e18;
const double PI=4*atan(1);
//ll dp[100005];
ll arr[100005];

void solve(){
   ll n;
   cin >> n;
   ll a[n],b[n];
   loop(i,0,n) cin >> a[i] >> b[i];

   sort(a,a+n);
   sort(b,b+n);

   if(n%2!=0){
     cout << b[n/2]-a[n/2]+1 << endl;
   }
   else{
        ll p=a[n/2-1]+a[n/2];
        ll q=b[n/2-1]+b[n/2];

        cout << q-p+1 << endl;
   }

}

int32_t main(){
    naman
    ll i = 0,j = 0;

#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    //cout << fixed << setprecision(10);

    ll t;
    t=1;
    //cin >> t;
    ll cno=0;
    while (t--){
        solve();

    }

}

Measured memory_bytes: 6720
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int mypow(int a,int b){
	if(b==0) return 1;
	if(b%2) return mypow(a,b-1)*a%mod;
	int z=mypow(a,b/2);
	return z*z%mod;
}
map<int,int> ma;
signed main(){
	int n,m;
	cin>>n;
	f(i,n){
		int a;
		cin>>a;
		ma[a]++;
	}
	cin>>m;
	f(i,m){
		int a;
		cin>>a;
		if(!ma[a]){
			puts("NO");
			return 0;
		}
		ma[a]--;
	}
	puts("YES");
    return 0;
}


Measured memory_bytes: 12800
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
	S = input()

	for i, x in enumerate(S):
 		if i%2==0 and x=='L':
 			print("No")
 			exit()
 		if i%2==1 and x=='R':
 			print("No")
 			exit()
	else:
 		print("Yes")

if __name__ == '__main__':
    main()


Measured memory_bytes: 5392
from collections import Counter

n=int(input())
v=list(map(int,input().split()))

e=Counter(v[::2]).most_common() + [(0,0)]
o=Counter(v[1::2]).most_common() + [(0,0)]


if e[0][0]!=o[0][0]:
    print(n-e[0][1]-o[0][1])
else:
    print(min(n-e[0][1]-o[1][1],n-e[1][1]-o[0][1]))    


Measured memory_bytes: 20572
#include<bits/stdc++.h>
#define int long long
#define double long double
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define msi map<string,int>
#define set set<int>
#define u_set unordered_set<int>
#define pb push_back
#define endl "\n"
#define ll long long int
#define vll vector<long long int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define umap unordered_map 
#define mod 1000000007
#define fori(a,n) for(int i=a;i<n;i++)
#define forj(a,n) for(int j=a;j<n;j++)
#define MAX 300303
#define V vector
using namespace std;
signed main()
{
    io
    int n;
    cin >> n;
    V<double> p(n);
    fori(0,n)cin >> p[i];
    V<V<double>> dp(n+5,V<double>(n+5,0.0));
    dp[0][0] = 1-p[0];
    dp[0][1] = p[0];
    fori(1,n){
        forj(0,i+2){
            if(j>0)
                dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
            else dp[i][j] = dp[i-1][j]*(1-p[i]);
        }
    }
    double ans = 0 ;
    forj(n/2+1,n+1){
            ans += dp[n-1][j];
    }
    cout << setprecision(10) << ans << '\n';
    
}

Measured memory_bytes: 141568
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=1,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(a,b,s);
  bool test = (s[a] == '-');
  REP(i,s.size()){
  	if(s[i] == '-' && i != a) test = false;
  }
  Yes(test);
}

Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static int gcd(int x, int y){
    	if(x<y) return gcd(y,x);
    	if(y==0) return x;
    	return gcd(y,x%y);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] x = new int[N];
        for(int n=0;n<N;n++) x[n]=sc.nextInt();
        
        int D = Math.abs(X-x[0]);
        for(int n=1;n<N;n++){
        	D = gcd(D,Math.abs(X-x[n]));
        }
        System.out.println(D);
    }
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    for(int i = 0; i < n; i++){
        auto iter_1 = lower_bound(a.begin(), a.end(), b[i]);
        ll index_1 = iter_1 - a.begin();
        auto iter_2 = upper_bound(c.begin(), c.end(), b[i]);
        //ll index_2 = c.end() - iter_2;
        ll index_2 = iter_2-c.begin();
        index_2 = n-index_2;
        ans += index_1*index_2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;
constexpr ll MOD = ll(1e9) + 7;

int main(void) {
	int n, m;
	cin >> n >> m;
	
	if( n == m ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double N,T,A;
  double H[1100];
  double min;
  cin >> N >> T >> A;
  REP(i,N) {
    cin >> H[i];
    H[i]=abs((T-H[i]*0.006)-A);
    if(i==0) min=H[i];
    else if(min>H[i]) min=H[i];
  }
  REP(i,N){
    if(min==H[i]){
      cout << i+1 << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define N 1000001
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define forin for(auto &i : A) cin >> i;
#define forout for(auto i : A) cout<< i<<" ";
const int MAX = 26; 


void solving() {
	string s, sub;
	cin >> s >> sub;
	int p = INT_MAX;
	for(int i = 0; i <= s.length() - sub.length(); i++){
		int k = 0;
		for(int j = 0; j < sub.length(); j++)
			if(s[i+j] != sub[j]) k++;
		if(p > k)
			p = k;
	}
	cout<<p<<endl;
}

int main() {
    clock_t clk_start = clock();
    fast;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

  	ll test = 1;
    //cin >> test;
    ll p = 1;
    while(test--) {
    	solving();
	}

    cerr<<"Execution Time: "<<fixed<<double(clock() - clk_start)/double(CLOCKS_PER_SEC)<<setprecision(6)<<" sec\n"; 
}


Measured memory_bytes: 3792
//https://atcoder.jp/contests/abc094/submissions/8948179
//参考にさせて頂いたコード

#include <bits/stdc++.h>

using namespace std;

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


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()


int main(){
    int N,pre=0;
    cin>>N;
    vector<int> A(N);
    ll sum=0;
    rep(i,N){
        cin>>A[i];
        sum+=abs(pre-A[i]);
        pre=A[i];
    }
    sum+=abs(pre);
    pre=0;
    rep(i,N){
        ll ANS;
        if(i==N-1){
            ANS=sum-abs(pre-A[i])-abs(A[i]);
            ANS+=abs(pre);
        }
        else{
            ANS=sum-abs(pre-A[i])-abs(A[i]-A[i+1]);
            ANS+=abs(pre-A[i+1]);
            pre=A[i];
        }
        cout<<ANS<<endl;
    }
    return 0;
}

//a=97,z=122

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n, t[800007], tag[800007], inf, dp[200007], sum[200007];
pair<int, int>p[200007], in[200007];
map<int, int>s;
int read()
{
	int num = 0;
	char c = getchar();
	while (c < '0' || c>'9')c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num;
}
int cmp(pair<int, int>a, pair<int, int>b)
{
	if (a.second == b.second)return a.first < b.first;
	else return a.second < b.second;
}
int down(int w)
{
	if (tag[w] == inf)return 0;
	t[2 * w] = min(t[2 * w], tag[w]);
	t[2 * w + 1] = min(t[2 * w + 1], tag[w]);
	tag[2 * w] = min(tag[2 * w], tag[w]);
	tag[2 * w + 1] = min(tag[2 * w + 1], tag[w]);
	tag[w] = inf;
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] = min(t[w], v);
		tag[w] = min(tag[w], v);
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int x)
{
	if (l == r)return t[w];
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)return ask(2 * w, l, mid, x);
	else return ask(2 * w + 1, mid + 1, r, x);
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++)
	{
		p[i].first = read();
		p[i].second = read();
		s[p[i].first] = 0;
	}
	int cnt = 0;
	for (map<int, int>::iterator i = s.begin(); i != s.end(); i++)
		i->second = ++cnt;
	for (int i = 1; i <= n; i++)
		p[i].first = s[p[i].first];
	sort(p + 1, p + n + 1, cmp);
	memset(t, 0x3f, sizeof t);
	memset(tag, 0x3f, sizeof tag);
	inf = t[0];
	for (int i = 1; i <= n; i++)
	{
		change(1, 1, n, 1, p[i].first, i);
		in[i].first = ask(1, 1, n, p[i].first);
	}
	memset(t, 0x3f, sizeof t);
	memset(tag, 0x3f, sizeof tag);
	for (int i = n; i >= 1; i--)
	{
		change(1, 1, n, p[i].first, cnt, -i);
		in[i].second = -ask(1, 1, n, p[i].first);
	}
	sort(in + 1, in + n + 1, cmp);
	dp[0] = sum[0] = 1;
	for (int i = 1, j = 0; i <= n; i++)
	{
		while (in[j].second + 1 < in[i].first)j++;
		dp[i] = (sum[i - 1] - (j == 0 ? 0 : sum[j - 1]) + mod) % mod;
		sum[i] = (sum[i - 1] + dp[i]) % mod;
	}
	int res = 0;
	for (int i = n; i >= 1 && in[i].second == n; i--)
		res = (res + dp[i]) % mod;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 20608
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<vector<ll>> a(n, vector<ll>(n));
	REP(i, n) REP(j, n) cin >> a[i][j];
	vector<ll> cost((1ll << n), 0);
	REP(bit, (1ll << n)) {
		bitset<16> bi(bit);
		vector<ll> v;
		REP(i, n) if(bi[i]) v.pb(i);
		REP(i, v.size()) FOR(j, i + 1, v.size()) cost[bit] += a[v[i]][v[j]];
	}
	vector<ll> dp((1ll << n), 0);
	FOR(bit, 1, (1ll << n)) {
		dp[bit] = cost[bit];
		for(ll i = bit; i > 0; i = (i - 1) & bit) {
			dp[bit] = max(dp[bit], dp[i] + cost[bit ^ i]);
		}
	}
	cout << dp[(1ll << n) - 1] << endl;
	return 0;
}

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


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

int c[10][1005];
const static int INF = 1001001001;


int main(void){
    int h, w, k;
    int ans = INF;
    std::cin >> h >> w >> k;
    std::vector<std::string> s(h);
    for(int i = 0; i < h; i++){
	std::cin >> s[i];
    }
    std::vector<int> id(h);
    for(int i = 0; i < (1 << (h-1)); i++){
	int g = 0;
	for(int j = 0; j < h; j++){
	    id[j] = g;
	    if(i >> j & 1){
		g++;
	    }
	}
	g++;
	std::vector<int> tmp(g);
	for(int x = 0; x < h; x++){
	    for(int y = 0; y < w; y++){
		c[id[x]][y] = 0;
	    }
	}
	for(int x = 0; x < h; x++){
	    for(int y = 0; y < w; y++){
		c[id[x]][y] += s[x][y] - '0';
	    }
	}
	auto judge = [&](int y){
	    for(int x = 0; x < g; x++){
		tmp[x] += c[x][y];
		if(tmp[x] > k) return false;
	    }
	    return true;
	};

	int num = g - 1;
	for(int y = 0; y < w; y++){
	    bool ok = judge(y);
	    if(!ok){
	        num++;
	        for(int t = 0; t < g; t++){
		   tmp[t] = 0;
	        }
	        ok = judge(y);
	        if(!ok){
		   num = INF;
	    	   break;
	        }
	    }
	}
	ans = std::min(ans, num);
    }
    std::cout << ans << std::endl;
    return 0;
}



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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long S, long long W) {
  if(W>=S){ cout << "unsafe" << endl; }
  else { cout << "safe" << endl;}
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long S;
  std::cin >> S;
  long long W;
  std::cin >> W;
  solve(S, W);
  return 0;
}


Measured memory_bytes: 3604
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    ll n,T;cin>>n>>T;
    ll prev=0;
    ll ans=0;
    rep(i,n){
        ll t;cin>>t;
        ans-=max((ll)0,t-prev-T);
        prev=t;
    }
    cout<<(ans+prev+T)<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;
vector<bool> used;
vector<double> xcoord;
vector<double> ycoord;
int n;


int main()
{

    cin >> n;
    for (int q = 0; q < n; q++)
    {
        double a,b;
        cin >> a >> b;
        xcoord.push_back(a);
        ycoord.push_back(b);
        used.push_back(false);
    }
    double total = 0;
    for (int q = 0; q < n; q++)
    {
        for (int w = 0; w < n; w++)
        {
            if (q!=w)
            {
                total+=sqrt((xcoord[q]-xcoord[w])*(xcoord[q]-xcoord[w])+(ycoord[q]-ycoord[w])*(ycoord[q]-ycoord[w]));
            }
        }
    }
    cout.precision(17);
    cout << total / n;
    return 0;
}


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

using namespace std;

int main()
{
    long long n,m,x,i,j,k,y,z=0;
    string s;
    string ss;
    cin>>s>>ss;
    for(i=0;i<s.size();i++)
    {
        if(s[i]==ss[i])
        {
            z++;
        }
    }
    cout<<z;
}



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

using namespace std;

int main() {

    string s;
    cin >> s;
    
    int l = 0;
    int n = (int)s.size();
    
    for(int s1 = 0; s1 < n; ++s1) {
        for(int e1 = s1; e1 < n; ++e1) {
        
            int i = s1;
            for(; i <= e1; ++i) {
                if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') continue;
                break;
            }
            l = max(l, i-s1);
        }
    }
    
    cout << l << endl;
    return 0;
    
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let n = io.read::<usize>();
    let mut rn = 0;
    while rn * rn <= n {
        rn += 1;
    }
    rn -= 1;

    let sm = |x: usize| -> i64 { ((x * (x + 1)) / 2) as i64 };
    assert_eq!(sm(4), 10);

    let mut ans = 0i64;
    for i in 1..rn + 1 {
        ans += sm(n / i) * i as i64;
    }
    for i in 1..rn + 1 {
        if i != n / i {
            ans += sm(i) * (sm(n / i) - sm(n / (i + 1)));
        }
    }
    io.writeln(ans);
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


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

int main(){
  string w;
  cin >> w;
  sort(w.begin(),w.end());
  if(w.size()%2){
    cout << "No" << endl;
  }else{
    bool b = 1;
    for(int i=0;i<w.size();i+=2){
      if(w.at(i)!=w.at(i+1)){
        cout << "No" << endl;
        b = 0;
        break;
      }
    }
    if(b){
      cout << "Yes" << endl;
    }
  }
}

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

#define ll long long
#define fi first
#define se second
#define mp make_pair

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;



int main(){
	
	fastio();
	int x;cin>>x;
	if(x==0)cout<<1<<endl;
	else cout<<0<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int T, n;
int t[N];

int main()
{
    scanf("%d%d", &n, &T);
    int last = 0;
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        scanf("%d", &t[i]);
    }
    for(int i = 1; i < n; i++) {
        if(t[i] > last + T) {
            ans += T;
        }else {
            ans += t[i] - last;
        }
        last = t[i];
    }
    ans += T;
    printf("%lld\n", ans);
    return 0;
}


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

#define F first
#define S second

using namespace std;

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

const int N = 200010, M = 110;

int n, m;
double a[N];

int main()
{
	scanf("%d%d", &n, &m);
	
	double t = 0.0, res = 0.0;
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%lf", &a[i]);
		t += (1.0 + a[i]) / 2.0;
		
		if (i >= m)
		{
			if (i > m) t -= (1.0 + a[i - m]) / 2.0;
			res = max(res, t);
		}
	}
	
	printf("%.12f\n", res);
	return 0;
}

Measured memory_bytes: 1920
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define mod 1000000007
#define maxn 100010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buff[20],len; len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buff[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buff[--len]+'0');
}
inline void writeln(ll x)
{
	write(x); putchar('\n');
}
inline void writesp(ll x)
{
	write(x); putchar(' ');
}
int a[maxn];
ll sum[maxn],sum0[maxn],sum1[maxn];
int n,q;
int find(int x)
{
	int l=1,r=n+1;
	while(l<r){
		int mid=(l+r)>>1;
		if(x>a[mid])l=mid+1;
		else r=mid;
	}
	return l;
}
ll work(int x)
{
//	printf("%d ***************\n",x);
	if(x>=a[n]){
		if(n&1)return sum1[n];
		else return sum0[n];
	}
	int l=1,r=n;
	while(l<r){
		int mid=(l+r+1)>>1,pos=find(x*2-a[mid-1]);
		if(mid-pos>n-mid+1)r=mid-1;
		else l=mid;
	}
	int pos=l-(n-l+1);
//	writeln(l);
	return (sum[n]-sum[l-1])+((pos&1)?sum0[pos-1]:sum1[pos-1]);
}
int main()
{
	n=read(); q=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	std::sort(a+1,a+n+1);
	sum[0]=sum0[0]=sum1[0]=0;
	for(int i=1;i<=n;i++){
		sum[i]=sum[i-1]+a[i];
		sum0[i]=sum0[i-1]+((i&1)?0:a[i]);
		sum1[i]=sum1[i-1]+((i&1)?a[i]:0);
	}
	for(int i=1;i<=q;i++){
		int x=read();
		writeln(work(x));
	}
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
// #include <atcoder/all>

using boost::multiprecision::cpp_int;
using namespace std;
// using namespace atcoder;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string acl = "ACL";
  int k;
  cin >> k;
  rep(i, k) cout << acl;
  cout << endl;
}


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

int main(){
  int N;
  cin >> N;
  ll arr[100005];
  for (int i=0;i<N;i++){
    cin >> arr[i];
  }
  int a=0;
  for(int i=0;i<N;i++){
    if(arr[i]==0){
      a++;
    }
  }
  if(a>0){
    cout << "0" <<endl;
    return 0;
  }
  ll x = 1;
  for(int i=0;i<N;i++){
    if(arr[i]<=1000000000000000000/x){
      x*=arr[i];
    }else{
      cout << "-1" << endl;
      return 0;
    }
  }

  cout << x << endl;

  return 0;

}


Measured memory_bytes: 4364