akhauriyash/Code-Regression huggingface dataset:
# AOJ 0005 GCD and LCM
# Python3 2018.6.9 bal4u
 
def lcm(a, b):
    return a // gcd(a, b) * b
 
def gcd(a, b):
    while b != 0:
        r = a % b
        a = b
        b = r
    return a
 
while True:
    try:
        a = list(map(int, input().split()))
        print(gcd(a[0], a[1]), lcm(a[0], a[1]))
    except EOFError:
        break


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

int main() {
    int r, D, x;
    cin >> r >> D >> x;
    for (int i = 0; i < 10; ++i) {
        x = r * x - D;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	ll a,b,w;
	cin >> w >> a >> b;
	ll min = (a<b?a:b);
	ll max = (a<b?b:a);
	if(min+w<=max)
		cout << max-min-w << endl;
	else
		cout << 0 << endl;
}

Measured memory_bytes: 3576
#include "bits/stdc++.h"

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"
#define MOD 1000000000+7
#define forit(v) for(auto it = v.begin(); it != v.end(); ++it)

using namespace std;

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

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  // flag = true;

  int a, b; cin >> a >> b;
  string s; cin >> s;

  int hyphen = 0;
  for (auto it = s.begin(); it != s.end(); ++it) {
    if (*it == '-') hyphen++;
  }

  if (hyphen == 1 && s[a] == '-') flag = true;

  // cout << num << endl;
  cout << (flag ? YES : NO) << endl;
  
  return 0;
}


Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <bits/stdc++.h>

#define ll long long

int main(){
    int N;
    cin >> N;
    vector<int> o;
    for ( int i = 0; i < N; i ++ ){
        int v;
        cin >> v;
        o.push_back( v );
    }
    sort( o.begin(), o.end() );
    double ans = o[0] + o[1];
    ans /= 2;
    for ( int i = 2; i < N; i ++ ){
        ans += o[i];
        ans /= 2;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=998244353;
int main()
{
	ll n;
	scl(n);
	ll cou=(n+1)*n/2;
	rep(i,1,n){
		if(i%3==0||i%5==0)cou-=i;
	}pf("%lld\n",cou);
}


Measured memory_bytes: 3816
from time import time
from random import randrange
from bisect import bisect_left
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]
start = time()
d = int(input())
c = list(map(int, input().split()))
C = sum(c)
s = [list(map(int, input().split())) for _ in range(d)]
#t = [int(input()) for _ in range(d)]
t = []
day = [[0] for _ in range(26)]
order = []

def score(t):
	res = 0
	minus = 0
	last = [0 for _ in range(26)]
	for i, x in enumerate(t):
		minus += C - c[x-1] * (i - last[x-1] + 1)
		res -= minus
		res += s[i][x-1]
		last[x-1] = i+1
		#print(res)
	return res

def tri(n):
	return n * (n-1) // 2

def change(i, to):
	diff = 0
	fr = t[i]-1
	#print(day[fr])
	#print(day[to])
	if fr == to:
		return None
	fr_ind = bisect_left(day[fr], i+1)
	diff += (tri(day[fr][fr_ind] - day[fr][fr_ind-1]) + tri(day[fr][fr_ind+1] - day[fr][fr_ind])) * c[fr]
	diff -= (tri(day[fr][fr_ind+1] - day[fr][fr_ind-1])) * c[fr]
	diff -= s[i][fr]
	
	to_ind = bisect_left(day[to], i+1)
	diff += (tri(day[to][to_ind] - day[to][to_ind-1])) * c[to]
	diff -= (tri(day[to][to_ind] - (i+1)) + tri(i+1 - day[to][to_ind-1])) * c[to]
	diff += s[i][to]

	if diff > -1000:
		day[fr].pop(fr_ind)
		after = day[to][:to_ind] + [i+1] + day[to][to_ind:]
		day[to] = after
		t[i] = to+1
		#print("↓")
		#print(day[fr])
		#print(day[to])
		return diff
	else:
		return None

#score(t)
res = 0
minus = 0
last = [0 for _ in range(26)]
for i in range(d):
	minus += C
	li = sorted(list(range(26)), key=lambda x: - c[x] * (i - last[x] + 1) - s[i][x])
	order.append(li)
	M_ind = li[0]
	minus -= c[M_ind] * (i - last[M_ind] + 1)
	last[M_ind] = i+1
	res -= minus - s[i][M_ind]
	t.append(M_ind+1)
	day[M_ind].append(i+1)

for i in range(26):
	day[i].append(d+1)


#print(*t, sep="\n")
#print(score(t))
#print("↓")

priority = [0 for _ in range(d)]
while time() - start < 1.8:
	i = randrange(d)
	pr = randrange(max(0, priority[i]-4), min(26, priority[i]+6))
	diff = change(i, order[i][pr])
	if diff is not None:
		res += diff
		priority[i] = pr

print(*t, sep="\n")
#print(score(t))

Measured memory_bytes: 98444
#include <iostream>

using namespace std;

uint64_t a[100'000];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    uint64_t cnt = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (a[i] % 2 == 1 && a[i + 1] != 0)
        {
            a[i]--;
            a[i + 1]--;
            cnt++;
        }
    }

    for (int i = 0; i < n; i++)
    {
        cnt += a[i] / 2;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;
#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    array<int, 26> hist_min;
    hist_min.fill(INT_MAX);
    loop(i, N){
        string Si;
        cin >> Si;
        array<int, 26> hist({{0}});
        for (auto& c : Si) ++hist[c - 'a'];
        loop(j, 26) hist_min[j] = min(hist[j], hist_min[j]);
    }
    loop(i, 26) loop(j, hist_min[i]) putchar('a' + i);
    puts("");
}


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




int main(){
    long long int t;
    cin>>t;
    int cnt;
    while(t){
        cnt=t%10;
        t=t/10;
        if(cnt==7){cout<<"Yes";
        return 0;}
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3592
// abc145_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int r;
  cin>>r;
  cout<<r*r<<endl;
  return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : template.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m, k;
	cin >> n >> m >> k;

	vector<unsigned long long int> a(n + 1, 0);
	vector<unsigned long long int> b(m + 1, 0);

	REP(i, 1,  n) {
		ll x; cin >> x;
		a[i] = a[i - 1] + x;

	}
	REP(i, 1,  m) {
		ll x; cin >> x;
		b[i] = b[i - 1] + x;
	}

	int i = n;
	while (i > 0 && a[i] > k) {
		i--;
	}
	int ans = i;
	int j = 0;
	bool gone = false;
	while (i >= 0 && j <= m ) {
		if (a[i] + b[j] > k) {
			i--;
		} else {
			ans = max(ans, i + j);
			j++;

		}
	}
	if (i >= 0 && j <= m && a[i] + b[j] <= k) ans = max(ans, i + j);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6328
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

int main() {
  int N;
  cin >> N;
  int sum = 0;
  int max = 0;
  rep(i, N) {
    int a;
    cin >> a;
    sum += a;
    if (max < a) {
      max = a;
    }
  }
  cout << sum - max / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int cnt[13];
int ans;
bool used[24];

void dfs(int d, int m){
    //cout << d << ' ' << m << endl;
    if(cnt[d] >= 3){
        ans = 0;
    }else if(cnt[d] == 2){
        int tmp = m;
        for(int i = 0; i < 24; i++){
            if(used[i]) {
                tmp = min(tmp, min(24-2*d, 2*d));
                tmp = min(tmp, min(abs(d-i), 24-abs(d-i)));
                tmp = min(tmp, min(abs(d-(24-i)), 24-abs(d-(24-i))));
            }
        }
        if(d == 12){
            ans = 0;
        }else{
            used[d] = true;
            used[24-d] = true;
            dfs(d+1, tmp);
            used[d] = false;
            used[24-d] = false;
        }
    }else if(cnt[d] == 1){
        int tmp = m;
        for(int i = 0; i < 24; i++){
            if(used[i]) {
                tmp = min(tmp, min(abs(d-i), 24-abs(d-i)));
            }
        }
        if(d == 12){
            ans = max(ans, tmp);
        }else{
            used[d] = true;
            dfs(d+1, tmp);
            used[d] = false;
        }
        tmp = m;
        for(int i = 0; i < 24; i++){
            if(used[i]) {
                tmp = min(tmp, min(abs(24-d-i), 24-abs(24-d-i)));                
            }
        }
        if(d == 12){
            ans = max(ans, tmp);
        }else{
            used[24-d] = true;
            dfs(d+1, tmp);
            used[24-d] = false;
        }
    }else{
        if(d == 12){
            ans = max(ans, m);
        }else{
            dfs(d+1, m);
        }
    }
}

int main(){
    int N;
    int D[50];
    cin >> N;
    
    for(int i = 0; i < N; i++){
        int D;
        cin >> D;
        cnt[D]++;
    }
    if(cnt[0] != 0){
        cout << 0 << endl;
        return 0;
    }
    used[0] = true;
    dfs(1, 12);
    cout << ans << endl;
}

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

const int N = 100 * 1000 + 10;
int64_t a[N], x;

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

    cin >> n >> x;

    int64_t ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans = __gcd(ans, abs(x - a[i]));
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int n;
string s;

int main() {

	cin >> n >> s;
	int ans = 0;
	for (char i = '0'; i <= '9'; i ++) {
		for (char j = '0'; j <= '9'; j ++) {
			for (char k = '0'; k <= '9'; k ++) {
				string tmp = "";
				tmp += i;
				tmp += j;
				tmp += k;
				int pos = 0;
				for (int z = 0; z < s.size(); z ++) {
					if (s[z] == tmp[pos]) {
						pos ++;
					}
				}
				if (pos == 3) ans ++;
			}
		}
	}
	cout << ans << '\n';
	return 0;
}

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

int dist[1005][1005];
queue<pair<int,int> > q;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
int R, C;

bool inside(int r, int c){
  return 1<=r && r<=R && 1<=c && c<=C;
}

int bfs(){
  int ans = 0;
  while(!q.empty()){
    auto pos = q.front();
    q.pop();
    int row = pos.first;
    int col = pos.second;
    ans = max(ans, dist[row][col]);

    for(int d=0; d<4; d++){
      int nxr = row+dx[d];
      int nxc = col+dy[d];
      if(!inside(nxr, nxc)) continue;
      if(dist[nxr][nxc] != -1) continue;
      dist[nxr][nxc] = dist[row][col] + 1;
      q.push(make_pair(nxr, nxc));
    }
  }
  return ans;
}

int main() {
  cin >> R >> C;
  memset(dist, -1, sizeof(dist));
  for(int i=1; i<=R; i++){
    for(int j=1; j<=C; j++){
      char input;
      cin >> input;
      if(input == '#'){
        dist[i][j] = 0;
        q.push(make_pair(i,j));
      }
    }
  }

  cout << bfs() << endl;
}

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

#define LL long long
#define DD long double

#define M 1000000007
#define INF 1e18

void setIO(string s = "") { 
  cin.sync_with_stdio(0); cin.tie(0);
  if (s.size()) s += ".in", freopen(s.c_str(), "r", stdin);
}

int tt = 1;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> f (n+1);
  for (int i = 0; i < n; i++) {
    cin >> f[i+1];
    f[i+1] += f[i];
  }

  int ans = 0;
  for (int i = k; i <= n; i++) {
    ans = max(ans, f[i] - f[i-k]);
  }

  cout << fixed << setprecision(9) << (double) (ans+k) / 2.0 << endl;
}

int main() {
  setIO();
  while (tt--) {
    solve();
  }
  return 0;
}

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

int main()
{
    vector<char> data(4);

    for (int i = 0; i < 4; i++)
    {
        cin >> data.at(i);
    }

        if (data.at(0) == data.at(1))
        {
            cout << "Bad" << endl;
        }
        else if (data.at(1) == data.at(2))
        {
            cout << "Bad" << endl;
        }
        else if (data.at(2) == data.at(3))
        {
            cout << "Bad" << endl;
        }
        else
        {
            cout << "Good" << endl;
        }

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;

    int mcd = m / n;

    for(int i = mcd; i > 0; i--){
        if((m - n * i) % i == 0){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define fi first
#define se second
#define mp make_pair
using namespace std;

const int N = 105;

int n;
vector<pair<int, int>> ve, ans;

int main()
{
    scanf("%d", &n);
    if (n % 2 == 1)
        ve.push_back(mp(n--, 0));
    for (int i = 1; i <= n / 2; i++)
        ve.push_back(mp(i, n + 1 - i));
    for (int i = 0; i < ve.size(); i++)
        for (int j = i + 1; j < ve.size(); j++)
        {
            ans.push_back(mp(ve[i].fi, ve[j].fi));
            ans.push_back(mp(ve[i].fi, ve[j].se));
            if (ve[i].se > 0)
            {
                ans.push_back(mp(ve[i].se, ve[j].fi));
                ans.push_back(mp(ve[i].se, ve[j].se));
            }
        }
    printf("%d\n", ans.size());
    for (pair<int, int> u : ans)
        printf("%d %d\n", u.fi, u.se);
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 ans[101];
  if (n & 1) {
    ans[n] = 0;
    for (i32 i = 1; i < n - i; ++i) {
      ans[i] = ans[n - i] = i;
    }
  } else {
    for (i32 i = 1; i < n + 1 - i; ++i) {
      ans[i] = ans[n + 1 - i] = i;
    }
  }
  i32 cnt = 0;
  for (i32 i = 1; i <= n; ++i) {
    for (i32 j = i + 1; j <= n; ++j) {
      if (ans[i] != ans[j]) {
	cnt++;
      }
    }
  }
  printf("%" PRIi32 "\n", cnt);
  for (i32 i = 1; i <= n; ++i) {
    for (i32 j = i + 1; j <= n; ++j) {
      if (ans[i] != ans[j]) {
	printf("%" PRIi32 " %" PRIi32 "\n", i, j);
      }
    }
  }
}

int main (void) {
  run ();
  return 0;
}


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

using namespace std;

#define MAXN 100000

vector < int > g[MAXN + 1];
bool viz[MAXN + 1];

int dfs(int x) {
    int ans = 0;
    viz[x] = 1;
    for (auto &y : g[x])
        if (viz[y] == 0)
            ans ^= 1 + dfs(y);
    return ans;
}

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

    for (n--; n; n--) {
        int x, y;
        cin >> x >> y;

        g[x].push_back(y);
        g[y].push_back(x);
    }

    cout << ( dfs( 1 ) ? "Alice" : "Bob" );

    return 0;
}


Measured memory_bytes: 8960
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int N, M, K;
int X, Y, Z;
int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> v1;
vector<double> v2;


set<int> s1;
map<string, int> m1;
map<string, int> m2;


int main(){
  
  
    // input data
    string ss ;

    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> ss;
        m1[ss] += 1;
//       std::cout << m1[ss] << ss << "\n";

    }

    cin >> M;

    for (int i = 0; i < M; i++) {
        cin >> ss;
        m1[ss] -= 1;

//        std::cout << m1[ss] << ss  << "\n";

//        m1.insert(make_pair(ss, -1));
    }

    con = 0;

    map<string, int> :: iterator ite;


    for(ite = m1.begin(); ite != m1.end(); ++ite){
        //ite = ;

        int a0 = ite->second;

        if (con < a0) {
            con = a0;
        }

      //  std::cout << ite->first << " " << ite->second << "\n";


    }


 
    
    std::cout << con << "\n";

        return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

#define ARRAY_INIT 0
#define DIV_INIT 0
#define LOOP_INIT 0
#define G_MAX 12

int main( void )
{
	unsigned long ulW_Dtc_cnt;
	int *aulW_Dtestcase;
	unsigned long ulW_Cloop_cnt;
	unsigned long ulW_Cloop_sub_cnt;
	unsigned long ulW_Csort_cnt = DIV_INIT;
	unsigned long ulW_Dm;
	unsigned long aulW_DG[ G_MAX ];
	unsigned long ulW_Dv;
	signed long ulW_Dk;

	scanf( "%d", &ulW_Dtc_cnt );
	aulW_Dtestcase = ( int * ) malloc ( sizeof ( int ) * ulW_Dtc_cnt );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dtc_cnt; ulW_Cloop_cnt++ ){
		scanf( "%d", &aulW_Dtestcase[ ulW_Cloop_cnt ] );
	}

	ulW_Dm = 1;
	aulW_DG[ 0 ] = 1;
	while( 3 * aulW_DG[ ulW_Dm - 1 ] + 1 < ulW_Dtc_cnt ){
		aulW_DG[ ulW_Dm ] = 3 * aulW_DG[ ulW_Dm - 1 ] + 1;
		ulW_Dm++;
	}

	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm / 2; ulW_Cloop_cnt++ ){
		ulW_Dv = aulW_DG[ ulW_Cloop_cnt ];
		aulW_DG[ ulW_Cloop_cnt ] = aulW_DG[ ulW_Dm - 1 - ulW_Cloop_cnt ];
		aulW_DG[ ulW_Dm - 1 - ulW_Cloop_cnt ] = ulW_Dv;
	}

	printf( "%d\n", ulW_Dm );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm; ulW_Cloop_cnt++ ){
		if( ulW_Cloop_cnt == ulW_Dm - 1 ){
			printf( "%d\n", aulW_DG[ ulW_Cloop_cnt ] );
		}
		else{
			printf( "%d ", aulW_DG[ ulW_Cloop_cnt ] );
		}
	}

	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dm; ulW_Cloop_cnt++){
		for( ulW_Cloop_sub_cnt = aulW_DG[ ulW_Cloop_cnt ]; ulW_Cloop_sub_cnt < ulW_Dtc_cnt; ulW_Cloop_sub_cnt++ ){
			ulW_Dv = aulW_Dtestcase[ ulW_Cloop_sub_cnt ];
			ulW_Dk = ulW_Cloop_sub_cnt - aulW_DG[ ulW_Cloop_cnt ];
			while( ( ulW_Dk >= 0 ) && ( aulW_Dtestcase[ ulW_Dk ] > ulW_Dv ) ){
				aulW_Dtestcase[ ulW_Dk + aulW_DG[ ulW_Cloop_cnt ] ] = aulW_Dtestcase[ ulW_Dk ];
				ulW_Dk -= aulW_DG[ ulW_Cloop_cnt ];
				ulW_Csort_cnt++;
			}
			aulW_Dtestcase[ ulW_Dk + aulW_DG[ ulW_Cloop_cnt ] ] = ulW_Dv;
		}
	}

	printf( "%d\n", ulW_Csort_cnt );
	for( ulW_Cloop_cnt = LOOP_INIT; ulW_Cloop_cnt < ulW_Dtc_cnt; ulW_Cloop_cnt++ ){
		printf( "%d\n", aulW_Dtestcase[ ulW_Cloop_cnt ] );
	}

	return 0;
}

Measured memory_bytes: 4508
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int ans = 0;
    ans += (n < k ? n : k) * x;
    ans += (n > k ? n - k : 0) * y;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
const int N = 200003, mod = 998244353;
template<typename T>
void read(T &x){
	int ch = getchar(); x = 0; bool f = false;
	for(;ch < '0' || ch > '9';ch = getchar()) f |= ch == '-';
	for(;ch >= '0' && ch <= '9';ch = getchar()) x = x * 10 + ch - '0';
	if(f) x = -x;
}
void qmo(int &x){x += (x >> 31) & mod;}
int ksm(int a, int b){
	int res = 1;
	for(;b;b >>= 1, a = (LL) a * a % mod) if(b & 1) res = (LL) res * a % mod;
	return res;
}
template<typename T>
inline bool chmax(T &a, const T &b){if(a < b) return a = b, 1; return 0;}
template<typename T>
inline bool chmin(T &a, const T &b){if(a > b) return a = b, 1; return 0;}
int n, p, stk[N], top;
LL a[N], b[N], aa[N], bb[N], c[N];
LD ans;
int main(){
	read(n);
	for(Rint i = 0;i < n;++ i){read(aa[i]); if(aa[p] < aa[i]) p = i;}
	for(Rint i = 0;i < n;++ i) read(bb[i]);
	for(Rint i = p;i < n;++ i){a[i-p] = aa[i]; b[i-p] = bb[i];}
	for(Rint i = 0;i <= p;++ i){a[i+n-p] = aa[i]; b[i+n-p] = bb[i];}
	for(Rint i = 1;i < n;++ i) c[i+1] = 2 * (c[i] - b[i]) - c[i-1];
	stk[0] = 0; stk[1] = 1; top = 1;
	for(Rint i = 2;i <= n;++ i){
		a[i] += c[i];
		while(top){
			LL x1 = stk[top] - stk[top-1], x2 = i - stk[top-1], y1 = a[stk[top]] - a[stk[top-1]], y2 = a[i] - a[stk[top-1]];
			if(x1 * y2 - x2 * y1 >= 0) -- top; else break;
		}
		stk[++ top] = i;
	}
	for(Rint i = 0;i < top;++ i) ans += (LD) (a[stk[i]] + a[stk[i+1]]) * (stk[i+1] - stk[i] + 1) / 2 - a[stk[i]];
	for(Rint i = 2;i <= n;++ i) ans -= c[i];
	printf("%.10Lf\n", ans / n);
}

Measured memory_bytes: 12108
A,B,C,D = map(int, input().split())
while A > 0 and C > 0:
  if C > B:
    C -= B
    if A > D:
      A -= D
    else:
      A -= D
      break
  else:
    C -= B
    break
if A > 0:
  print('Yes')
elif C > 0:
  print('No')
  

Measured memory_bytes: 61640
#include<bits/stdc++.h>
using namespace std;
int n,x,sum;
bitset<2000007>f;
signed main()
{
	scanf("%d",&n);
	f[0]=1;
	for(register int i=1;i<=n;++i)
	scanf("%d",&x),f|=f<<x,sum+=x;
	for(register int i=(sum+1)>>1;i<=sum;++i)
	if(f[i]) 
	if(printf("%d",i))
	break;
	return 0;
}

Measured memory_bytes: 1152
use std::io;
use std::cmp::Ordering;

fn main() {
  let stdin = io::stdin();
  let mut buf = String::new();
  stdin.read_line(&mut buf).unwrap();
  let mut iter = buf.trim()
    .split_whitespace()
    .map(|x| x.parse::<i32>().unwrap());
  let a = iter.next().unwrap();
  let b = iter.next().unwrap();
  let c = iter.next().unwrap();

  let answer = if a < b && b < c { "Yes" } else { "No" };

  println!("{}", answer);
}


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

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> vec(n);
  for(int64_t i=0; i<n; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end(),greater<int64_t>());
  int64_t ans = 0;
  int64_t a,b,c;
  for(int64_t i=0; i<n-2; i++){
    for(int64_t j=i+1; j<n-1; j++){
      for(int64_t k=j+1; k<n; k++){
        a = vec.at(i);
        b = vec.at(j);
        c = vec.at(k);
        if(a>=b+c){if(j+1==k)goto NEXT;else break;}
       
        if((c<a+b)&&(b<a+c))ans++;
      }
    }
  NEXT:
    {}
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
//#define P pair<int,int>

signed main(){
    string S;
    cin >> S;
    int dp[114514][4]={};
    dp[0][0]=1;
    REP(i,S.size()){
        REP(j,4){
            if(S[i]!='?'){
                dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
            }else{
                dp[i+1][j]=((3*dp[i][j])%MOD+dp[i+1][j])%MOD;
            }
        }
        if(S[i]=='A'||S[i]=='?'){
            dp[i+1][1]=(dp[i+1][1]+dp[i][0])%MOD;
        }
        if(S[i]=='B'||S[i]=='?'){
            dp[i+1][2]=(dp[i+1][2]+dp[i][1])%MOD;
        }
        if(S[i]=='C'||S[i]=='?'){
            dp[i+1][3]=(dp[i+1][3]+dp[i][2])%MOD;
        }
    }
    REP(i,4){
        REP(j,S.size()+1){
            cerr << dp[j][i] << " ";
        }cerr << endl;
    }
    cout << dp[S.size()][3] << endl;
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t;
    cin>>t;
    int ar[t];
    for(int i=0;i<t;++i) cin>>ar[i];
   	sort(ar,ar+t);
   	cout<<ar[t-1]-ar[0];
   return 0;
}

Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int>a(N);
    long long sum=0;
    for(int i=1;i<=N;i++){
        if(i%3!=0&&i%5!=0)sum+=i;
    }
cout<<sum;

return 0;
}

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

int gcd(int x, int y){
    int r = x % y;
    if (r == 0) {
        return y;
    }
    else{
        return gcd(y, r);
    }
}

int main(){
    int x, y;
    cin >> x >> y;
    int ans = gcd(x, y);
    cout << ans << endl;
    return 0;
}


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

using ll = long long;

int X, Y, A, B, C;
vector<int> p(100001);
vector<int> q(100001);
vector<int> r(100001);

void solve(){
    sort(p.begin() + 1, p.begin() + A + 1, greater<int>());
    sort(q.begin() + 1, q.begin() + B + 1, greater<int>());
    priority_queue<int, vector<int>, less<int>> pq;
    for(int i = 1; i <= X; ++i){
        pq.push(p[i]);
    }
    for(int i = 1; i <= Y; ++i){
        pq.push(q[i]);
    }
    for(int i = 1; i <= C; ++i){
        pq.push(r[i]);
    }
    ll ans = 0;
    int i = X + Y;
    while(!pq.empty() && i > 0){
        ans += pq.top();
        pq.pop();
        i--;
    }
    cout << ans;
}
int main(){
    cin >> X >> Y >> A >> B >> C;
    for(int i = 1; i <= A; ++i){    
        cin >> p[i];
    }
    for(int i = 1; i <= B; ++i){   
        cin >> q[i];
    }
    for(int i = 1; i <= C; ++i){
        cin >> r[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>

/*  選択ソート(0オリジン) */
int selectionSort(int A[], int N) {
    int i, j, t, sw =0, minj;
    for(i=0;i<N-1;i++) {
        minj = i;
        for(j=i;j<N;j++) {
            if(A[j]<A[minj]) minj = j;
        }
        t=A[i]; A[i]=A[minj]; A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main(void) {
    int A[100], N, i, sw;

    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = selectionSort(A,N);

    for(i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);

    return 0;
}


Measured memory_bytes: 2100
dict = {}
n = gets.to_i
answers = []
1.upto(n).each {
  op, x = gets.chomp.split
  case op
    when "insert" then dict[x] = 0
    when "find" then answers << (dict.has_key?(x) ? "yes" : "no")
  end
}

puts answers.join("\n")

Measured memory_bytes: 71532
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from itertools import accumulate as acc
def gcd(a,b):
    while b: a, b = b, a%b
    return a
def main():
    n = II()
    aa = MII()
    b = list(acc([0]+aa, gcd))
    c = list(acc([0]+aa[::-1], gcd))
    print(max(gcd(s,t) for s, t in zip(b, c[::-1][1:])))


if __name__ == '__main__':
    main()


Measured memory_bytes: 14528
#include <iostream>
#define MAX 100000;
using namespace std;

typedef struct process {
    char name[100];
    int cost;
} P;

P Q[100000];
int head, tail, n;

void enqueue(P x)
{
    Q[tail] = x;
    tail = (tail + 1) % 100000;
}

P dequeue()
{
    P a = Q[head];
    head = (head + 1) % 100000;

    return a;
}

int min(int a, int b) {
    return a < b ? a : b;
}

int main() {
    int time = 0;
    int c;
    int i, q;
    P u;
    cin >> n >> q;

    for ( i = 0; i < n; ++i ) {
        cin >> Q[i].name >> Q[i].cost;
    }
    head = 0; tail = n;

    while ( head != tail ) {  // Queueが空でない時
        u = dequeue();
        c = min(q,u.cost);
        u.cost -= c;
        time += c;
        if ( u.cost > 0 ) enqueue(u);
        else cout << u.name <<  ' ' << time << endl;
    }
    return 0;
}


Measured memory_bytes: 13244
#include <bits/stdc++.h>
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N, A, B;
    string s;
    scan(N, A, B, s);

    int a = 0, b = 0;

    rep(i, N) {
        if (s[i] == 'a' && a + b < A + B) {
            print("Yes");
            a++;
        } else if (s[i] == 'b' && a + b < A + B && b < B) {
            print("Yes");
            b++;
        } else {
            print("No");
        }
    }

    return 0;
}

Measured memory_bytes: 848
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    n = n % 10;
    if(n==3)cout << "bon" << endl;
    else if(n==0 || n==1 || n==6 || n==8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3472
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        float a[] = new float[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextFloat();
        }
        float tmp = 0;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(a[i] > a[j]){
                    tmp = a[i];
                    a[i] = a[j];
                    a[j] = tmp;
                }
            }
        }
        float r = (a[0] + a[1]) / 2;
        for(int i = 2; i < n; i++){
            r = (r + a[i]) / 2;
        }
        System.out.println(r);
    }
}

Measured memory_bytes: 24276
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

#N = int(input())
N, K = map(int, input().split())
A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]
#S = input()
#S = [input() for _ in range(N)]

max_a = max(A)

ok = max_a
ng = 0

while ok - ng != 1:
    mid = (ok + ng) // 2
    cnt = 0
    for a in A:
        cnt += a // mid
        if a % mid == 0:
            cnt -= 1
    if cnt <= K:
        ok = mid
    else:
        ng = mid

print(ok)

Measured memory_bytes: 92800
#include <cstdio>

#define min(a, b) ((a) < (b) ? (a) : (b))

int main()
{
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  printf("%d\n", min(a, b) + min(c, d));
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bla
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            List<long> a = new List<long>();
            for (int i = 0; i < n; i++)
            {
                a.Add(int.Parse(s[i]));
            }

            int l = 0;
            int r = 0;

            long xor = 0;
            long sum = 0;
            long count = 0;

            while (r < a.Count)
            {
                xor ^= a[r];
                sum += a[r];
                if(sum == xor)
                {
                    count += r - l + 1;
                    
                }
                else
                {
                    while(sum != xor)
                    {
                        xor ^= a[l];
                        sum -= a[l];
                        l++;
                    }
                    count += r - l + 1;
                }
                r++;
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 36060
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
const lint mod=1e9+7;
map<lint,lint>d;
inline lint read(){
    char c;lint x=0,f=1;
    c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return f*x;
}
inline void write(lint x){
    if(x<0)putchar('-'),x=-x;
    lint y=10,len=1;
    while(y<=x)y*=10,len++;
    while(len--)y/=10,putchar(x/y+48),x%=y;
}
inline lint solve(lint x){
    return d[x]!=0?d[x]:d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
inline void work(){
    d[0]=1;d[1]=2; 
    lint n=read(); 
    lint ans=solve(n);
    write(ans);
}
signed main(){
	work();
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int x = fs.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = fs.nextInt();
        }
        int diff;
        long res = 0;
        for(int i=0;i<n-1;i++){
            if(a[i] + a[i+1]>x){
                diff = a[i]+a[i+1]-x;
                a[i+1]-=Math.min(diff,a[i+1]);
                res+=diff;
            }
        }
        System.out.println(res);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }

}


Measured memory_bytes: 22288
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0; }
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path; vl A, T;
//***********//
int main() {
	char C;
	cin >> C;
	char A = C + 1;
	cout << A;
}

Measured memory_bytes: 764
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
D = list(map(int,input().split()))

D.sort()

abc_max = D[N//2-1]
arc_min = D[N//2]

print(max(0,arc_min - abc_max))

Measured memory_bytes: 14016
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
ll nC2(ll n){
	return n*(n-1)/2;
}
	
int main(){
	ll n;
	cin>>n;
	ll a[n],b[n+1];
	in(a,n);
	memcpy(b,a,n*sizeof(ll));
	sort(b,b+n);
	ll sum=0;
	ll count=0;
	b[n]=200001;
	rep(i,n){
		if(b[i]==b[i+1])count++;
		else{
			count++;
			sum+=nC2(count);
			count=0;
		}
	}
	rep(i,n){
		count=upper_bound(b,b+1+n,a[i])-lower_bound(b,b+1+n,a[i]);
		cout<<sum+nC2(count-1)-nC2(count)<<"\n";
	}
	return 0;
}

Measured memory_bytes: 6692
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] list = new int[26];
    while (sc.hasNext()) {
      char[] cList = sc.nextLine().toLowerCase().toCharArray();
      for (char c : cList) {
        int num = c;
        if (num >= 'a' && num <= 'z') {
          list[num - 'a'] += 1;
        }
      }
    }
    for (int i = 0; i < list.length; i++) {
      System.out.printf("%c : %d\n", i + 'a', list[i]);
    }
  }
}


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

int main() {
    ll a,b,n;
    std::cin >> a>>b>>n;
    
    n = min(n,b-1);
    
    std::cout << a*n/b-a*(n/b) << std::endl;
}


Measured memory_bytes: 3588
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
/*int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}*/
/*bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second > secondElof.second;
}*/


/*long nCr(int n, int r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
       return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}*/
int main(){
    int n;
    cin >> n;
    if(n%2==1){
        cout << n/2+1 << endl;
    }else cout << n/2 << endl;
}


Measured memory_bytes: 256