akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define n 500000
#define mem(arr) memset(arr, 0, sizeof(arr))
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
void solve();
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int times = 1;
//	cin >> times;
	for(int i=0; i<times; i++)
	{
		solve();
		cout << '\n';
	}
	return 0;
}

int a, b, c, d, e, f, g, h;
int arr[n + 50], arr1[n + 50], arr2[n + 50];

//type here

void solve()
{
	cin >> a >> b >> c;
	for(int i=0; i<b; i++)
		cout << c << ' ';
	for(int i=b; i<a; i++)
	{
		if(c == 1e9) cout << 1;
		else		 cout << 1000000000;
		cout << ' ';
	}
}

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



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

    int n;
    cin >> n;
    vector< vector<int> > v(n, vector<int>(3));
    rep(i, n) {
        cin >> v[i][1] >> v[i][2];
        v[i][0] = v[i][1] + v[i][2];
    }
    sort(all(v));
    reverse(all(v));
    int ans = 0;
    rep(i, n) {
        if(i % 2 == 0) ans += v[i][1];
        else ans -= v[i][2];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,k;cin>>n>>k;
    vector <int> v(n);
    for(int &x : v) cin>>x;
    sort(v.begin(),v.end());
    int sum=0;
    for(int i=0;i<k;i++) sum+=v[i];
    cout<<sum<<endl;
    return 0;
}

/*




*/


Measured memory_bytes: 3620
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  sort(a,a+N);

  int ind;
  int dist = 1000000007;
  for(int i=0;i<N;i++){
    int tmp;
    tmp = min(abs(a[N-1]/2-a[i]), abs((a[N-1]+1)/2-a[i]));
    if(tmp < dist){
      dist = tmp;
      ind = i;
    }
  }

  cout << a[N-1] << " " << a[ind] << endl;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	map<int, int> mp;
	rep(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	int mx = 0;
	for (auto x : mp) {
		int np = 0;
		int nm = 0;
		if (mp.count(x.first+1)) np = mp[x.first+1];
		if (mp.count(x.first-1)) nm = mp[x.first-1];
		int cnt = x.second + np + nm;
		mx = max(mx, cnt);
	}
	cout << mx << endl;
}

Measured memory_bytes: 3200
#include <algorithm>
#include <bits/stdc++.h>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define INF 1LL << 40;
#define MOD 1000000007;
#define ll long long
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define prique priority_queue
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <class T> inline void chmax(T &a, T b) { a < b ? a = b : a; };
template <class T> inline void chmin(T &a, T b) { a > b ? a = b : a; };
int dp[200500];
bool compare(P a, P b) { return a.first < b.first; }
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, k + 1) dp[i] = -1;
    rep(i, a[0]) dp[i] = 0;
    rep(i, k) {
        rep(j, n) { chmax(dp[i + a[j]], dp[i] ^ 1); }
    }
    cout << (dp[k] ? "First" : "Second") << endl;
    return 0;
}


Measured memory_bytes: 1024
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define umap unordered_map
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion


pls give {
    AC;
    ll r, d, x, g;
    cin >> r >> d >> x;
    for (int i=0; i<10; i++) {
        g = r*x-d;
        cout << g << nl;
        x = g;
    }
}

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

using namespace std;

int main()
{
    long long int n, temp;
    cin >> n;
    long long int res = n * (n + 1) / 2;
    temp = n / 3;
    res -= 3 * temp * (temp + 1) / 2;
    temp = n / 5;
    res -= 5 * temp * (temp + 1) / 2;
    temp = n / 15;
    res += 15 * temp * (temp + 1) / 2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3644
n = int(input())
a = list(map(int, input().split(' ')))
if a.count(0) > 0:
	print("0")
else:
	lim = int(1e18)
	mult = 1
	for v in a:
		if mult > lim:
			break
		else:
			mult *= v
	if mult > lim:
		print("-1")
	else:
		print(mult)

Measured memory_bytes: 21652
using System;
using System.Linq;

struct point {
  public int x, y;
  public int Dist(int ax, int ay) {
    return Math.Abs(x - ax) + Math.Abs(y - ay);
  }
}

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int n = arr[0];
    int m = arr[1];
    var a = new point[n];
    var c = new point[m];
    for (int i = 0; i < n; i++) {
      arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
      a[i].x = arr[0];
      a[i].y = arr[1];
    }
    for (int i = 0; i < m; i++) {
      arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
      c[i].x = arr[0];
      c[i].y = arr[1];
    }
    for (int i = 0; i < n; i++) {
      int ans = 0;
      int min = int.MaxValue;
      for (int j = 0; j < m; j++) {
        int t = c[j].Dist(a[i].x, a[i].y);
        if (t < min) {
          min = t;
          ans = j + 1;
        }
      }
      Console.WriteLine(ans);
    }
  }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

ll n,u,v;
ll ban;
vector<ll> E[101010];
VI ok(101010,0);
VI d(101010,0);
VI dd(101010,0);
VI pre(101010,0);


void dfs(ll cu, ll pa = -1) {
    for(ll to:E[cu]) {
        if (to != pa) {
        d[to]=d[cu]+1;
        dfs(to, cu);
        pre[to]=cu;
      }
    }
}

void dfs2(ll cu, ll pa){
    for(ll to:E[cu]) {
      if(to != pa&&to!=v) {
        ok[cu]=1;
        dfs2(to, cu);
        dd[cu]=max(dd[to]+1,dd[cu]);
      }
    }
}

int main(){
  ll i,j;
  cin>>n>>u>>v;
  u--;
  v--;
  for(i=0;i<n-1;i++){
    ll a,b;
    cin>>a>>b;
    a--; b--;
    E[a].pb(b);
    E[b].pb(a);
  }
  dfs(v,-1);
  ll p=u;
  for(i=0;i<(d[u]-1)/2;i++){
    p=pre[p];
  } 
  ban=pre[p];
  dfs2(p,ban);
  ll ans=d[u]+dd[p]*2;
  cout<<ans/2<<endl;
  for(i=0;i<5;i++){
    //cout<<d[i]<<endl;
  }
  

  return 0;
}

Measured memory_bytes: 14208
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
typedef long long ll;
const int INF=1e9;
const int maxn=3e2+10;
const double eps=1e-9;
int a[maxn][maxn],p[maxn],cnt[maxn];
inline int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	int i,j,k,m,n,s;
	n=read();m=read();
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			a[i][j]=read();
	for(i=1;i<=n;i++)p[i]=1;
	int ans=INF,maxans;
	for(i=1;i<=m;i++){
		memset(cnt,0,sizeof(cnt));
		int flag=0;
		for(j=1;j<=n;j++){
			while(a[j][p[j]]==0 && p[j]<n)p[j]++;
			if(p[j]==n && a[j][p[j]]==0){
				flag=1;
				break;
			}
			cnt[a[j][p[j]]]++;
			if(flag)break;
		}
		for(j=1;j<=n;j++)
			if(p[j]>n){
				flag=1;
				break;
			}
		if(flag)break;
		maxans=0;
		for(j=1;j<=m;j++)
			if(cnt[j]>maxans){
				maxans=cnt[j];
				k=j;
			}
		if(ans>maxans)ans=maxans;
		for(j=1;j<=n;j++)
			for(s=1;s<=m;s++)
				if(a[j][s]==k)
					a[j][s]=0;
		for(j=1;j<=n;j++){
			if(a[j][p[j]]==0){
				p[j]++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n,k=map(int,input().split())
h=list(map(int,input().split()))
for hi in h:
    if hi>=k:
        ans+=1
print(ans)

Measured memory_bytes: 12308
a,b = map(int,input().split())
x = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if x.index(a)>x.index(b):
    print("Alice")
elif x.index(a)==x.index(b):
    print("Draw")
else:
    print("Bob")

Measured memory_bytes: 3060
n = int(input())
s = input()
if n % 2 != 0:
    print("No")
    quit()

first = ""
second = ""
for i in range(n // 2):
    first += s[i]
    second += s[i+(n//2)]
if first == second:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
"use strict"
function main(arg) {
    var tmp = arg.trim().split("\n")[0].split(" ").map(Number)
    var N = tmp[0]
    var K = tmp[1]
    var counter = 0
    for (let i = K; i <= N + 1; i++) {
        var min = 0
        var max = 0
        min = sumStep(i - 1)
        max = sumStep(N) - sumStep(N -i)
        counter += (max-min) + 1
        counter %= 1000000007
    }
    console.log(counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function sumStep(n) {
    return (n * (n + 1))/2
}

Measured memory_bytes: 33116
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	x := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range x {
		x[i] = nextInt(sc)
	}
	dist := make([]int, N-K+1)
	for i := 0; i+K-1 < N; i++ {
		dist[i] = abs(x[i] - x[i+K-1])
	}
	ans := int(1e9)
	for i := 0; i < len(dist); i++ {
		// 区間の左端 l -> x[l]
		// 区間の右端 r -> x[l+K-1]
		d := -1
		l, r := x[i], x[i+K-1]
		if r < 0 { // l < r < 0
			d = abs(l)
		} else if l > 0 { // 0 < l < r
			d = abs(r)
		} else { // l <= 0 <= r
			// 0からスタートして右端まで行ってから左端まで行く距離をd1
			// 0からスタートして左端まで行ってから右端まで行く距離をd2
			// d1とd2の小さい方
			d = min(abs(l)*2+r, abs(l)+r*2)
		}
		ans = min(ans, d)
	}
	fmt.Println(ans)
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


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

using namespace std;

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

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

    long c = h.at(0);
    int mov = 0;
    priority_queue<int> count;
    for (int i = 1; i < n; i++) {
        if (c >= h.at(i)) {
            mov++;
        } else {
            count.push(mov);
            mov = 0;
        }
        c = h.at(i);
    }
    count.push(mov);
    cout << count.top() << endl;
    return 0;
}

Measured memory_bytes: 1660
S=list(input())
S.reverse()
N=len(S)
R=[0]*N
R10=[0]*N
m=2019
K=0

R10[0]=1
R[0]=int(S[0])%m
for i in range(1,N):
    R10[i]=(R10[i-1]*10)%m
    R[i]=(R[i-1]+int(S[i])*R10[i])%m
d={}
for i in range(2019):
    d[i]=0

for i in range(N):
    d[R[i]]+=1
ans=0
for i in range(2019):
    if i == 0:
        ans += d[i]
        ans +=d[i]*(d[i]-1)//2
    else:
        ans +=d[i]*(d[i]-1)//2
print(ans)



Measured memory_bytes: 80920
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a, b;
  cin >> a >> b;
  if (a > b)
  {
    for (int i = 0; i < a; i++)
    {
      cout << b;
    }
  }
  else
  {
    for (int i = 0; i < b; i++)
    {
      cout << a;
    }
  }
  cout << endl;
}


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

using namespace std;

using ll = long long;

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,K;
    string S;
    cin>>N>>K>>S;

    vector<int> v{};
    v.push_back(0);
    for(int i=1;i<N;i++){
        if(S[i-1]!=S[i]){
            v.push_back(i);
        }
    }
    v.push_back(N);
    int ans=0;
    rep(i,v.size()){
        int x=i+2*K+1;
        if(S[v[i]]=='0') x--;
        x=min((int)v.size()-1,x);
        ans=max(ans,v[x]-v[i]);

    }
    ans=min(ans,N);
    cout << ans << endl;
    
    

    



}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if(a == b && a == c) cout << 1 << endl;
  else if(a != b && b != c && c != a) cout << 3 << endl;
  else cout << 2 << endl;
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  int g = a[0];
  for (int i = 1; i < n; i++) {
    g = __gcd(g, a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] >= k && (a[i] - k) % g == 0) {
      cout << "POSSIBLE" << '\n';
      return;
    }
  }
  cout << "IMPOSSIBLE" << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3868
A=int(input())
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=[]
for i in range(A):
   l3.append(sum(l1[:i+1]))
ans=0
for i in range(A):
   ans = max(ans,l3[i]+sum(l2[i:]))
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

class Pair {
	public:
		int i;
		int v;
	public:
		Pair(){}
};

bool operator>(const Pair& a, const Pair& b) {
	return a.v > b.v;
}

int main() {
	uint N;
	cin >> N;
	
	vector<Pair> P(N);
	for (uint i=0; i<N; i++) {
		cin >> P[i].v;
		P[i].i = i;
	}
	
	sort(P.begin(), P.end(), greater<Pair>());
	set<int> sd_l;
	set<int, greater<int>> sd_h;
	
	ull ans = 0;
	sd_l.insert(P[0].i);
	sd_h.insert(P[0].i);
	
	for (uint l=1; l<N; l++) {
		int V = P[l].v;
		int I = P[l].i;
		int nl1, nl2, nr1, nr2;
		
		auto l1 = sd_h.upper_bound(I);
		auto l2 = l1;
		if (l1 == sd_h.end()) {
		    nl1 = I + 1;
		    nl2 = 0;
		    //cout << "nf-l1 ";
		} else if (++l2 == sd_h.end()) {
		    nl1 = I - *l1;
		    nl2 = *l1 + 1;
		    //cout << "nf-l2 ";
		} else {
		    nl1 = I - *l1;
		    nl2 = *l1 - *l2;
		    //cout << "bf-l12 ";
		}
		
		auto r1 = sd_l.upper_bound(I);
		auto r2 = r1;
		if (r1 == sd_l.end()) {
		    nr1 = N - I;
		    nr2 = 0;
		    //cout << "nf-r1 ";
		} else if (++r2 == sd_l.end()) {
		    nr1 = *r1 - I;
		    nr2 = N - *r1;
		    //cout << "nf-r2 ";
		} else {
		    nr1 = *r1 - I;
		    nr2 = *r2 - *r1;
		    //cout << "bf-r12 ";
		}
		
		ull C = nr1 * nl2 + nr2 * nl1;
		//cout << "v" << V << " " << "i" << I << " " << nl2 << " " << nl1 << " " << nr1 << " " << nr2 << " " << "c" << C << endl;
		
		ans = ans + C * V;
		
		sd_h.insert(I);
		sd_l.insert(I);
	}
	
	cout << ans;

	return 0;
}

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

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

int main(){
    int N;
    cin >> N;
    long long sum = 0;
    int minA=INT_MAX,A;
    int count=0;
    rep(i,N){
        cin >> A;
        if(A < 0)count++;
        minA = min(minA,abs(A));
        sum += abs(A);
    }
    if(minA == 0) cout << sum << endl;
    else if(count%2) cout << sum - minA * 2 << endl;
    else cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a+b >=c )
	{
		cout << "Yes" << "\n";
	}
	else
	{
		cout << "No" << "\n";
	}
}

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

/* {{{ */
#define PI(N) ((M_PI * (N)) / 180) //角度をラジアンに変換する
#define CL(N) (cout << (N) << endl)
#define DCT(N) (cout << "debug " << (N) << endl)
#define REP(i, N) for (int i = 0; i < (N); i++)
/* }}} */

int main()
{
    int n, m = 0, x = 0;
    string s;

    cin >> n >> s;

    REP(i, s.size()){
        if (s[i] == 'I') x++;
        else if (s[i] == 'D') x--;
        m = max(m, x);
    }

    CL(m);

    return (0);
}


Measured memory_bytes: 256
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-06-25 18:17:53
 * @LastEditTime: 2020-06-25 18:21:35
 * @FilePath: \VSC\C++\Public\Red Scarf.cpp
 */ 
#include<bits/stdc++.h>
using namespace std;

int n,a[200005];
signed main(){
    scanf("%d",&n);
    register int i;
    for(i=1;i<=n;++i) scanf("%d",&a[i]);

    int ans=a[1];
    for(i=2;i<=n;++i) ans^=a[i];
    for(i=1;i<=n;++i) printf("%d ",ans^a[i]);

    return 0;
}

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

using namespace std;


int main() {
    string O, E;
    cin >> O >> E;

    string ans = "";
    for (int i = 0; i < O.size() + E.size(); ++i) {
        int idx = i / 2;
        if (i % 2 == 0) {
            ans += O[idx];
        } else {
            ans += E[idx];
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using Int = int64_t;
int main() {
    Int N, C, K;
    cin >> N >> C >> K;
    vector<Int> T(N);
    for (auto& i : T) cin >> i;
    sort(T.begin(), T.end());
    int bus = 1;
    for (int i = 0, head = 0, c = 1; i < N; i++) {
        if (T[i] > T[head] + K || c >= C) {
            bus++;
            head = i;
            c = 1;
        }
        else c++;
    }
    if (C == 1) cout << N << endl;
    else cout << bus << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		int x  = s.nextInt();
	    int x2 = s.nextInt();
	    System.out.print(x * x2 + " ");
		System.out.println(x + x +  x2 + x2);
	}
	public static void main(String[] args) {
		
		new Main().run();
	}
}

Measured memory_bytes: 25872
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

//Global Variable
int n; // the size of target array
int q; // the number of querys
int* D;// the minimum value array.

int i; // the variable for for loop. just lazy.
//End of Global Variable



// Function prototype Area
void __get_init_value(void);
int __min(int a, int b);
void initRMQ( int n_);
void update(int k, int a);
int findMin(int a, int b);
int query(int a , int b, int k, int l, int r);
// End of Funtion prototype Area


int main(int argc, char* argv[]){

	__get_init_value();
	//printf("init n = %d\n",n);
	initRMQ(n);
	//printf("after initRMQ n = %d\n",n);


	int com;
	int a;
	int b;
	int ans;
	while(q>0){
		scanf("%d %d %d",&com, &a, &b);
		if(com){
			ans = findMin(a,b);
			printf("%d\n",ans);
		}else{
			update(a,b);
		}	
		q--;
	}

	return 0;
}

int __min(int a, int b){
	if(a > b){
	return b;
	}else{
	return a;
	}
}

void __get_init_value(void){

	scanf("%d %d", &n, &q);
	return;
}//end of get init value;

void initRMQ(int n_){
	// n_ is used to preserved original n;
	// after this function, n is not the total item number anymore.

	n = 1;
	while(n < n_){
		n *= 2;
	}
	
	D = malloc(sizeof(int)* (2*n-1));
	if(D == NULL){
		printf("Init Array Failed, no memory or size is wrong\n");
		return;
	}

	for(i = 0; i< 2*n-1 ; i++){
		D[i] = INT_MAX;
	}
	return;
}// end of initRMQ;


void update(int k , int a){
	k += n - 1;
	D[k] = a;
	while (k > 0){
		k = (k-1)/2;
		D[k] = __min(D[k*2+1], D[k*2+2]);
	}
}// end of update;

int findMin(int a, int b){
	//printf("findMin n = %d\n",n);

	return query( a, b+1, 0, 0, n);
}// end of findMin;

int query(int a, int b, int k , int l , int r){
	//printf("qurey a=%d b=%d k=%d l=%d r=%d\n",a,b,k,l,r);
	if(r <= a || b <= l){
		return INT_MAX;
	}
	if(a <= l && r <= b){
		return D[k];
	}
	//printf("(L+R)/2 = %d\n",(l+r)/2);
	//printf("vl, l=%d\n",l);
	int vl = query(a, b, k*2+1, l , (l+r)/2);
	//printf("vr, r=%d\n",r);
	int vr = query(a, b, k*2+2, (l+r)/2, r);
	return __min(vl, vr);
}



Measured memory_bytes: 2876
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 n, m, v, p;
    cin >> n >> m >> v >> p;
    akari<i64> as(n);
    for (int i = 0; i < n; i++)
    {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    int ng = -1, ok = n - 1;
    while (ok > ng + 1)
    {
        int i = (ok + ng) / 2;
        i64 b = as[i] + m;
        auto bs = as;
        bs.erase(bs.begin() + i);
        i64 plus = m * v - m;
        int pena = p - 1;
        for (int k = n - 2; k >= 0; k--)
        {
            if (bs[k] > b)
            {
                pena--;
                plus -= m;
                bs[k] += m;
                continue;
            }
            if (pena == 0)
            {
                plus -= min(m, b - bs[k]);
                bs[k] += min(m, b - bs[k]);
            }
            else
            {
                plus -= m;
                pena--;
            }
        }
        (pena == 0 && plus <= 0 ? ok : ng) = i;
    }
    cout << n - ok << endl;
}

int main()
{
    solve();
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int t[n], sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    sum += t[i];
  }
  int m;
  cin >> m;
  int p, x, ans[m];
  for (int i = 0; i < m; i++) {
    cin >> p >> x;
    ans[i] = sum - t[p-1] + x;
  }
  for (int i = 0; i < m; i++)
    cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n;
    cin >> n;
    int x = 1;
    while (2*x <= n) x *= 2;
    cout << x << endl;

    return 0;
}

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

#define sz 100005
#define nl printf("\n");
#define ll long long int

char f,g;
bool flag;
pair < int ,int > pi;
map < int , int > mp;
vector < int > v,va,vb;
int arr[sz],brr[sz],crr[sz];



int main(){

    double a,b,c,d,temp=INT_MAX,ans=INT_MAX,temp2;
    int n,m, i,j,k, x=0,y=0,z=0,idx;

    cin>>n>>a>>b;
    for(i=1; i<=n; i++){
        cin>>c;

        temp=a-c*0.006;
        temp2=(temp-b);
        if(temp2<0)
            temp2*=-1.0;
        //cout<<temp2<<endl;

        if(temp2<ans){
            ans=temp2;
            idx=i;
        }
    }
    cout<<idx<<endl;



    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;

int main(){
    cin>>N;

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

    cout<<"No"<<endl;
}

Measured memory_bytes: 256
use io::*;
use std::cmp::min;

fn main() {

    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let s: Vec<u32> = sc.next_vec(n);
    println!("{}",
        (0..n)
        .map(|i| s[i].trailing_zeros())
        .min()
        .unwrap()
    );
    /*
    let mut ans: usize = 0;
    let mut flag: bool = false;
    loop {
        for i in 0..n {
            if s[i] % 2 == 0 { s[i] /= 2; }
            else {
                println!("{}", ans);
                flag = true;
                break;
            }

        }
        ans += 1;
        if flag { break; }
    }
    */

}

pub mod io {

    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

Measured memory_bytes: 4352
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

int main() {
    int n = read();
    if (__builtin_popcount(n) == 1) {
        return puts("No"), 0;
    }

    vector<pair<int, int> > ans;
    ans.emplace_back(1, 2);
    ans.emplace_back(2, 3);
    ans.emplace_back(1, 3 + n);
    ans.emplace_back(3 + n, 2 + n);
    ans.emplace_back(2 + n, 1 + n);

    for (int i = 4; i <= n - ((n & 1) ^ 1); ++i) {
        if (i & 1) {
            ans.emplace_back(1, i + n);
            ans.emplace_back(i - 1, i);
        } else {
            ans.emplace_back(1, i);
            ans.emplace_back(i + n + 1, i + n);
        }
    }

    if (!(n & 1)) {
        for (int a = 2; a < n; ++a) {
            int b = n ^ 1 ^ a;
            if (1 < b && b < n) {
                ans.emplace_back(a & 1 ? a + n : a, n);
                ans.emplace_back(b & 1 ? b + n : b, n << 1);
                break;
            }
        }
    }

    puts("Yes");
    for (auto &pr : ans) {
        printf("%d %d\n", pr.first, pr.second);
    }
    return 0;
}


Measured memory_bytes: 3952
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 200000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int a[maxn+5];

int main()
{
    int n; scanf("%d",&n);
    int s=0;
    rep(i,1,n) scanf("%d",&a[i]);
    rep(i,1,n) s^=a[i];
    rep(i,1,n) printf("%d%c",s^a[i]," \n"[i==n]);
    return 0;
}

Measured memory_bytes: 4596
#include<iostream>
using namespace std;
long N,K;
main()
{
    cin>>N>>K;
    long L=1,R=K+1;
    while(R-L>1)
    {
        long M=L+R>>1;
        long S=0,T=M;
        for(long i=0;i<N&&T>0;i++)
        {
            S+=T;
            T>>=1;
        }
        if(S<=K)L=M;
        else R=M;
    }
    cout<<L<<endl;
}


Measured memory_bytes: 3112
# coding: utf-8
# Your code here!
 
import fractions
 
n, m = map(int, input().split(" "))
numbers = list(set(map(int, input().split(" "))))
 
for i in range(len(numbers)):
    if i == 0:
        gcd = numbers[i]
        lcm = numbers[i]
    else:
        gcd = fractions.gcd(gcd, numbers[i])
        lcm = (lcm * numbers[i]) // fractions.gcd(lcm, numbers[i])
 
if (lcm//gcd) % 2 == 0:
    print(0)
else:
    init_num = lcm // 2
    print((m - init_num) // lcm + 1)

Measured memory_bytes: 13292
using System;
using System.Linq;

namespace abc112_d
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int max = x[1] / x[0];
			int ret = 1;
			for (int i = 1; i * i <= x[1]; i++)
			{
				if (x[1] % i == 0)
				{
					if (i <= max) ret = Math.Max(ret, i);
					if ((x[1] / i) <= max) ret = Math.Max(ret, x[1] / i);
				}
			}
			Console.WriteLine(ret);
		}
	}
}

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

int main()
{
    int n, k, x, y;
    long long int sum = 0;
    cin >> n >> k >> x >> y;

    if(n>k)
        sum = x*k + y*(n-k);
    else
        sum = x*n;

    cout << sum;

    return 0;
}


Measured memory_bytes: 3624
H, W = map(int,input().split( ))

ans = H * W
for i in range(H):
	l_1 = [(i+1) * W, (H - i - 1) * (W//2), (H - i - 1) * (W-(W//2))]
	l_2 = [(i+1) * W, ((H - i - 1)//2) * W, (H-i-1 -((H - i - 1)//2)) * W]
	ans = min(ans, max(l_1) - min(l_1), max(l_2) - min(l_2))


H, W = W, H
for i in range(H):
	l_1 = [(i+1) * W, (H - i - 1) * (W//2), (H - i - 1) * (W-(W//2))]
	l_2 = [(i+1) * W, ((H - i - 1)//2) * W, (H-i-1 -((H - i - 1)//2)) * W]
	ans = min(ans, max(l_1) - min(l_1), max(l_2) - min(l_2))



print(ans)



Measured memory_bytes: 3188
import collections

N = int( input() )
A = list( map( int, input().split() ) )

# collections.Counter(a): (aの要素, 出現回数) と組になった Counter オブジェクトを返す
# most_common(): Counter オブジェクトをタプルにして返す
c = collections.Counter(A)
c = c.most_common()
c = sorted( c, reverse=True )  # 要素の大きい順に並び替える

ans = 0
for i,j in c:
    if j >= 4 and ans == 0:
        ans = i*i
        break
    elif j >= 2 and ans == 0:
        ans = i
    elif j >= 2:
        ans *= i
        break

print( ans )

Measured memory_bytes: 21540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 10
ld x[N], y[N];
int p[N];

int main(){
	int n; scanf("%d", &n);
	REP(i, n) scanf("%Lf%Lf", x+i, y+i);
	REP(i, n) p[i] = i;
	ld sm = 0; int cnt = 0;
	do {
		REP(i, n-1){
			sm += sqrt(pow(x[p[i]]-x[p[i+1]], 2) + pow(y[p[i]]-y[p[i+1]], 2));
		}
		cnt++;
	} while(next_permutation(p, p+n));
	printf("%.30Lf\n", sm / cnt);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

int calc(int a, int b, int x) {
    return ((a * x) / b) - (a * (x / b));
}

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

    int a, b, n;
    cin >> a >> b >> n;
    cout << calc(a, b, min(n, b - 1)) << '\n';

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {

	int a[3];

	cin >> a[0] >> a[1] >> a[2];

	sort(a, a + 3);

	cout << a[0] + a[1] << "\n";

	return 0;
}

Measured memory_bytes: 256
// by syu
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

var in = NewScanner(os.Stdin, 0)

func main() {
	s := in.String()
	switch {
	case check(s, "k", "eyence"):
		fallthrough
	case check(s, "ke", "yence"):
		fallthrough
	case check(s, "key", "ence"):
		fallthrough
	case check(s, "keye", "nce"):
		fallthrough
	case check(s, "keyen", "ce"):
		fallthrough
	case check(s, "keyenc", "e"):
		fallthrough
	case check(s, "keyence", ""):
		Rln("YES")
	default:
		Rln("NO")
	}
}
func check(a, x, y string) bool {
	if strings.HasPrefix(a, x) && strings.HasSuffix(a, y) {
		return true
	}
	if strings.HasPrefix(a, "keyence") || strings.HasSuffix(a, "keyence") {
		return true
	}
	return false
}

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}
func (s *Scanner) String() string {
	s.Scan()
	return s.Text()
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for start < len(data) && isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func Rln(s ...interface{}) {
	fmt.Println(s...)
	os.Exit(0)
}

type ByteSlice []byte
type IntSlice []byte


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

int main(){
    bool A[4][14];
    char suite;
    int rank, i, j, n;
    for(i = 0; i < 4; i++){
        for(j = 1; j < 14; j++){
            A[i][j] = true;
        }
    }
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> suite >> rank;
        switch(suite){
            case 83:
                A[0][rank] = false; break;
            case 72:
                A[1][rank] = false; break;
            case 67:
                A[2][rank] = false; break;
            case 68:
                A[3][rank] = false; break;
        }
    }
    for(j = 1; j < 14; j++){ if(A[0][j]) cout << "S " << j << endl; }
    for(j = 1; j < 14; j++){ if(A[1][j]) cout << "H " << j << endl; }
    for(j = 1; j < 14; j++){ if(A[2][j]) cout << "C " << j << endl; }
    for(j = 1; j < 14; j++){ if(A[3][j]) cout << "D " << j << endl; }

    return 0;
}
// S, H, C, Dはそれぞれ83, 72, 67, 68です。


Measured memory_bytes: 3024
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N, M := nextInt(), nextInt()
	if N >= M {
		fmt.Println(0)
	} else {
		Xn := make([]int, M)
		for i := range Xn {
			Xn[i] = nextInt()
		}
		sort.Ints(Xn)
		Xd := make([]int, M-1)
		for i := 0; i < M-1; i++ {
			Xd[i] = Xn[i+1] - Xn[i]
		}
		width := Xn[len(Xn)-1] - Xn[0]
		sort.Ints(Xd)
		for i := 0; i < N-1; i++ {
			width -= Xd[len(Xd)-1-i]
		}
		fmt.Println(width)
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(void)
{
    int S, h, m, s;
    scanf("%d\n" ,&S);

    h = S/3600 ;
    m = S%3600/60 ;
    s = S%60 ;

    printf("%d:%d:%d\n" ,h, m, s);

    return 0;
}


Measured memory_bytes: 2132
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF (1e9)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

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

    // 素数である
    return true;
}


int N;
long long H;
int main()
{
	cin>>N>>H;
	ll a[N],b[N];

	vector<pair<ll,int> > c;
	REP(i,0,N){
		cin>>a[i]>>b[i];
		c.push_back(make_pair(a[i],0));
		c.push_back(make_pair(b[i],1));
	}

	sort(c.begin(),c.end());


	int ans=0;
	for(int i=2*N-1;i>=0;i--){
		auto p=c[i];
		if(p.second==1){
			H-=p.first;
			ans++;
			if(H<=0){
				break;
			}

		}else{
			if(H%p.first==0){
				ans+=H/p.first;
				break;
			}else{
				ans+=H/p.first+1;
				break;
			}
		}
		
	}

	cout<<ans<<endl;

	

	
	
	
	

	return 0;
}

Measured memory_bytes: 7152
#include<iostream>
using namespace std;
long long a,b;
int main()
{
	cin>>a>>b;
	if(a>0&&b>0)
	{
		cout<<"Positive";
	}
	if(a<=0&&b>=0)
	{
		cout<<"Zero";
	}
	if(a<0&&b<0)
	{
		a=b-a;
		if(a%2==0)
		{
			cout<<"Negative";
		}
		else
		{
			cout<<"Positive";
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++){
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 1e5 + 10;//;
ll dp[N][3];
vector < int > g[N] ;
int n;
ll dfs(int node, int black, int par)
{
    ll &r = dp[node][black];
    if(r != -1) return r;
    r = 0;
    ll ans = 1;
        for(auto v : g[node])
        {
            ll tot = 0;
            if(v == par) continue;
            for(int i = 0; i <= 1; i++)
            {
                if(i and black)
                    continue;
                ll tmp = dfs(v,i,node);
                tot = (tot + tmp) % MOD;
            }


            ans = (ans * tot ) % MOD;
            //cum = (cum + tmp) % MOD;
        }
        //r = ( r + ans ) % MOD;

    r = ans ;
    return r;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n ;
    memset(dp,-1,sizeof dp);

    for(int i = 1; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    cout << ( dfs(1,0,-1) + dfs(1,1,-1) ) % MOD << endl;
    return 0;
}




Measured memory_bytes: 16384
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

const double INFTY = 10000000;

int main() {
    int n;
    double r;
    int rint;
    int x1,x2;
    double h;
    double ans;
    for(;;){
        cin >> r >> n;
        rint = (int)r;
        if(rint==0)break;
        vector<double> height(2*rint,0);
        for(int j=0; j<n ; j++){
            cin >> x1 >> x2 >> h;
            for(int i=max(0,x1+rint); i<min(x2+rint,2*rint); i++){
                height[i] = max(height[i],h);
            }
        }
        ans = INFTY;
        for(int i=0; i<rint; i++){
            ans = min(ans, height[i] + r - sqrt(r*r - (i+1-r)*(i+1-r)));
        }
        for(int i=rint; i<2*rint; i++){
            ans = min(ans, height[i] + r -  sqrt(r*r - (i - r)*(i - r)));
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3264
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

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

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int N;
    cin >> N;
    N %= 10;
    if (N == 3) {
        cout << "bon" << endl;
    } else if (N <= 1 || N == 6 || N == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
n=int(input())
a=list(map(int,input().split()))
dp=[[9999999999999999999999999999999999999 for i in range(n)] for j in range(n)]
pre=[0]*n
pre[0]=a[0]
dp[0][0]=0
for i in range(1,n):
    pre[i]=a[i]+pre[i-1]
    dp[i-1][i]=a[i-1]+a[i]
    dp[i][i]=0
for i in range(3,n+1):
    for j in range(n-i+1):
        k=j+i-1
        for l in range(j,k):
            t1,t2=0,0
            if l>=j:
                t1=dp[j][l]
            if l+1<=k:
                t2=dp[l+1][k]
            # print(pre[l],pre[j],a[j],a[l],pre[l]-(pre[j]-a[j])-a[l],t1,t2)
            # if count==2:
            #     print(t1,t2)
            # print(t1,t2,pre[k]-pre[j]+a[j])
            dp[j][k]=min(dp[j][k],t1+t2+pre[k]-pre[j]+a[j])
# print(dp)
print(dp[0][n-1])

Measured memory_bytes: 44508