akhauriyash/Code-Regression huggingface dataset:
from math import ceil
N,A,B = map(int,input().split())
H = [int(input()) for _ in range(N)]

def attack(n):
    s = 0
    for h in H:
        h -= B*n
        if h > 0:
            s += ceil(h/(A-B))
    return s <= n

l = 0
r = 0
for h in H:
    r = max(ceil(h/B),r)

for _ in range(30):
    mid = (l+r)//2
    if attack(mid):
        r = mid
    else:
        l = mid

print(r)

Measured memory_bytes: 7068
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
        int n;
        int num[100]={0};
        int tmp;
        int i,j,k;
        k=0;
        cin>>n;
        for(i=0;i<n;i++){
                cin>>num[i];
        }
        for(k=0;k<n;k++){
                cout<<num[k];
                if(k<n-1){
                        cout<<" ";
                }
        }
        cout<<endl;
        for(i=1;i<n;i++){
                tmp=num[i];
                j=i-1;
                while((j>=0)&&(tmp<num[j])){
                        num[j+1]=num[j];
                        j--;
                }
                        num[j+1]=tmp;
                        for(k=0;k<n;k++){
                                cout<<num[k];
                                if(k<n-1){
                                        cout<<" ";
                                }
                        }
                        cout<<endl;
        }

        return 0;
}

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

int main()
{
    string s;
    cin >> s;
    if (s.at(0) == s.at(1) && s.at(2) == s.at(3) && s.at(0) != s.at(2))
    {
        cout << "Yes" << endl;
    }
    else if (s.at(0) == s.at(2) && s.at(1) == s.at(3) && s.at(0) != s.at(1))
    {
        cout << "Yes" << endl;
    }
    else if (s.at(0) == s.at(3) && s.at(1) == s.at(2) && s.at(0) != s.at(1))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int n;
	cin >> n;
	double s = 0;

	rep(_,n) {
		double a;
		cin >> a;
		s += 1. / a;
	}

	printf("%.6f\n", 1 / s);



	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n), bs(n);
    cin >> as >> bs;
    int ans = 0;
    for(int i = 28; i >= 0; i--){
        for(auto& a : as){ a &= (2 << i) - 1; }
        for(auto& b : bs){ b &= (2 << i) - 1; }
        sort(bs.begin(), bs.end());
        int num = 0;
        for(auto& a : as){
            auto xx = lower_bound(bs.begin(), bs.end(), (1 << i) - a);
            auto yy = lower_bound(xx, bs.end(), (2 << i) - a);
            auto zz = lower_bound(yy, bs.end(), (3 << i) - a);
            int x = xx - bs.begin();
            int y = yy - bs.begin();
            int z = zz - bs.begin();
            // int x = lower_bound(bs.begin(), bs.end(), (1 << i) - a) - bs.begin();
            // int y = lower_bound(bs.begin(), bs.end(), (2 << i) - a) - bs.begin();
            // int z = lower_bound(bs.begin(), bs.end(), (3 << i) - a) - bs.begin();
            num += y - x + n - z;
        }
        ans |= num & 1 ? 1 << i : 0;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1792
<?php
define("inf", 10**15);
list($n, $m) = array_map("intval", explode(" ", trim(fgets(STDIN))));
for($i = 2; $i <= $n; $i++){
  $map[$i][] = [$i-1, 0];
}
for($i = 0; $i < $m; $i++){
  list($from, $to, $d) = array_map("intval", explode(" ", trim(fgets(STDIN))));
  $map[$from][] = [$to, $d];
}
$D[1] = 0;
for($i = 2; $i <= $n; $i++){
  $D[$i] = inf;
}
$pq = new SplPriorityQueue();
$pq->insert(1, 0);
while($pq->count()){
  $f = $pq->extract();
  if(!isset($map[$f]))continue;
  foreach($map[$f] as $to){
    $new = $D[$f] + $to[1];
    if($D[$to[0]] > $new){
      $D[$to[0]] = $new;
      $pq->insert($to[0], -$new);
    }
  }
}
printf("%d", $D[$n] == inf ? -1 : $D[$n]);


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
    ll K;
    cin >> K;
    ll ans = 0;
    for (int a = 1; a <= K; a++) {
        for (int b = 1; b <= K; b++) {
            for (int c = 1; c <= K; c++) {
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    int N; cin >> N;
    vi data(N); F0R(i, N) cin >> data[i];
    int ans = 0;
    FOR(i, 1, N-1) {
        if (((data[i-1] < data[i]) && (data[i] < data[i+1])) || (data[i-1] > data[i] && data[i] > data[i+1])) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

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

int n;
long long a[100005];
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i)
    std::cin>>a[i];
  
  long long ans1=0;
  long long sum=0;
  for(int i=0;i<n;++i){
    sum+=a[i];
    if(i%2==0){
      if(sum>=0){
        ans1+=sum+1;
        sum=-1;
      }
    }
    else
      if(sum<=0){
        ans1+=1-sum;
        sum=1;
      }
  }
  
  long long ans2=0;
  sum=0;
  for(int i=0;i<n;++i){
    sum+=a[i];
    if(i%2==0){
      if(sum<=0){
        ans2+=1-sum;
        sum=1;
      }
    }
    else
      if(sum>=0){
        ans2+=sum+1;
        sum=-1;
      }
  }
  
  std::cout<<std::min(ans1,ans2)<<std::endl;
  
  return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int x,n;cin>>x>>n;
    map<int,int>p;
    rep(i,n){
        int y;cin>>y;
        p[y]++;
    }
    int z=0;
    while(true){
        if(p[x-z]==0){
            cout<<x-z<<endl;
            return 0;
        }
        else if(p[x+z]==0){
            cout<<x+z<<endl;
            return 0;
        }
        z++;
    }
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
   int a,b,c,d,e,f,g,h;
   cin >>a >> b >> c >> d;
   cin >>e >>f>>g>>h;
   
   if ((a+b+c+d)>(e+f+g+h)) cout << a+b+c+d <<endl;
   else if ((a+b+c+d)<(e+f+g+h)) cout << e+f+g+h <<endl;
   else cout << a+b+c+d <<endl;
   
   
}


Measured memory_bytes: 3048
// Aizu Vol-5 0556: Tile
// 2017.8.31 bal4u@uu

#include <stdio.h>

int main()
{
	int n, k, x, y;

	scanf("%d%d", &n, &k);
	while (k--) {
		scanf("%d%d", &x, &y);
		x--, y--;
		if (x > (n-1)/2) x = n-1-x;
		if (y > (n-1)/2) y = n-1-y;
		if (x > y) x = y;
		printf("%d\n", x % 3 + 1); 
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    int N, T, A;
    int H[1010];
    float temp;
    float diff = 0;
    float diff_min = 1000;
    int st = -1;
    
    cin >> N >> T >> A;
    for (int i = 0; i < N; ++i)
    {
        cin >> H[i];
    }
    
    for (int i = 0; i < N; ++i)
    {
        temp = T - H[i] * 0.006;
        diff = A - temp;
        diff = abs(diff);
        
        
        if (diff_min > diff)
        {
            diff_min = diff;
            st = i;
        }
    }
    st += 1;
    cout << st << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(s) for s in input().split()]

used = [False] * (N + 1)
dist = []
dist.append(1)
for i in range(N):
    v = dist[-1]
    if used[v]:
        break
    used[v] = True
    dist.append(A[v - 1])

g = dist[-1]
s = dist.index(g)

if K <= s:
    print(dist[K])
else:
    k = K - s
    index = k % (len(dist) - s - 1)
    print(dist[s + index])


Measured memory_bytes: 32336
#include <iostream>
#include <stdio.h>
using namespace std;

int BubbleSort(int A[],int N){
	int rs = 0;
	bool flag = true;
	for(int i = 0; flag; i++){
		flag = false;
		for (int j= N-1; j>=i+1; j--){
			if(A[j] < A[j-1]){
				swap(A[j],A[j-1]);
				flag = true;
				rs++;
			}
		}
	}
	return rs;
}

int main(){
	int A[100],N,rs;
	scanf("%d",&N);
	for(int i = 0; i<N;i++){
		scanf("%d", &A[i]);
	}
	rs = BubbleSort(A,N);
	for(int i = 0; i<N;i++){
		if(i) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",rs);
	return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //pikachu, I choose you
    
    int n;
    cin >> n;
    string s;
    cin >> s;
    int dp[26];
    for(int i = 0;i<26;i++)
    dp[i] = 0;
    long long sol = 1ll;
    for(int i = 0;i<n;i++)
    {
        dp[s[i] - 'a']++;
    }
    for(int i= 0;i<26;i++)
    {
        sol*= (dp[i]+1)%MOD;
        sol%=MOD;
    }
    sol = (sol%MOD - 1 + MOD)%MOD;
    cout << fixed << sol ;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


int main(){
  int n,maxNum = 0;
  cin >> n;
  int a[n];
  rep(i,n){
    cin >> a[i];
    maxNum = max(maxNum,a[i]);
  }
  int midDiff = 0;
  int midNum;
  rep(i,n){
    if(maxNum/2 < a[i] && midDiff <= maxNum - a[i]){
      midDiff = maxNum - a[i];
      midNum = a[i];
    }
    if(maxNum/2 >= a[i] && midDiff <= a[i]){
      midDiff = a[i];
      midNum = a[i];
    }
  }
  cout << maxNum << ' ' << midNum << endl;
  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;

class MainClass
{
   
    public static void Main(string[] args)
    {
        var N = LnInt();
        var As = LnInts();
        var shains = new int[N];
        for (int i = 0; i < As.Length;i++){
            shains[As[i]-1]++;
        }
        foreach(var i in shains){
            Console.WriteLine(i);
        }
    }

   
    public static int[] LnInts()
    {
        var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        var ins = new int[vs.Length];
        for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]);
        return ins;
    }

    public static int LnInt()
    {
        var vs = Console.ReadLine().Trim();
        return int.Parse(vs);
    }

    public static string[] LnStrs()
    {
        var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        return vs;
    }
    public static string LnStr()
    {
        var vs = Console.ReadLine().Trim();
        return vs;
    }
}

Measured memory_bytes: 39160
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

int main() {
	ll x, y;
	cin >> x >> y;
	if (y % 2 == 0 && x * 2 <= y && y <= x * 4) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 3624
N = int(input())
A = [0] * N
B = list(map(int,input().split()))

for i in range(N):
  if i == 0:
    A[i] = B[i]
  elif i == N-1:
    A[i] = B[N-2]
  else:
    A[i] = min(B[i-1],B[i])
print(sum(A))

Measured memory_bytes: 3064
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int n;
vector<ll> pr;
mt19937 rnd(123);
ll a[1200][1200];
using lll = __int128_t;


lll lcm(lll a, lll b) {
	return a * b / __gcd(a, b);
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	n = 500;
	for (int i = 2; i < 8000; ++i) {
		int fl = 0;
		for (int j = 2; j * j <= i; ++j)
			if (i % j == 0) {
				fl = 1;
				break;
			}
		if (!fl)
			pr.push_back(i);
	}
	vector<int> xx, yy;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j) {
			if (i % 2 == j % 2) {
				xx.push_back((i + j) / 2);
				yy.push_back((i - j) / 2);
			}
		}
	sort(xx.begin(), xx.end());
	xx.resize(unique(ALL(xx)) - xx.begin());
	sort(yy.begin(), yy.end());
	yy.resize(unique(ALL(yy)) - yy.begin());
	pr.resize(xx.size() + yy.size());
	vector<ll> tmp;
	int l = 0;
	int r = pr.size() - 1;
	while (l <= r) {
		tmp.push_back(pr[l]);
		++l;
		if (l <= r) {
			tmp.push_back(pr[r]);
			--r;
		}
	}
	pr = tmp;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (i % 2 == j % 2) {
				int x = (i + j) / 2 - xx[0];
				int y = (i - j) / 2 - yy[0];
				a[i][j] = pr[x] * pr[xx.size() + y];
				assert(a[i][j] <= ll(1e15));
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (i % 2 != j % 2) {
				a[i][j] = 1;
				for (int g = 0; g < 4; ++g) {
					int nx = i + dx[g];
					int ny = j + dy[g];
					if (nx < 0 || ny < 0 || nx >= n || ny >= n)
						continue;
					a[i][j] = lcm(a[i][j], a[nx][ny]);
				}
				a[i][j] += 1;
				assert(a[i][j] <= ll(1e15));
			}
		}
	}
	cin >> n;
	set<ll> ss;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j)
			cout << a[i][j] << " ", ss.insert(a[i][j]);
		cout << "\n";
	}
	assert(ss.size() == n * n);
	return 0;
}




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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int N;
int b[1000];

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

	cin >> N;

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

	vector<int> ans;
	int idx = 0;
	int cnt = 0;

	for (int i = 0;i < N;i++){
		idx = 0; cnt = 1;
		int last = -1;
		for (;idx < N;idx++){
			if(b[idx] == cnt) last = idx;
			if(b[idx] != -1) cnt++;
		}
		if(last == -1){
		 	cout << -1 << endl;
		 	return 0;
		}
		ans.push_back(b[last]);
		b[last] = -1;
	}

	reverse(ans.begin(), ans.end());
	for (int i = 0;i < N;i++){
		cout << ans[i] << endl;
	}

	return 0;

}


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

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

    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    string b;
    int a,c;
    cin >> a >> b >> c;
    if(b == "+"){
        cout << a + c << endl;
    } else {
        cout << a - c << endl;
    }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc139_a solver = new abc139_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc139_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String[] S = in.next().split("");
            String[] T = in.next().split("");
            int hit = 0;
            for (int i = 0; i < S.length; i++) {
                if (S[i].compareTo(T[i]) == 0) {
                    hit++;
                }
            }
            out.println(hit);
        }

    }
}



Measured memory_bytes: 25300
#include "bits/stdc++.h"
using namespace std;
#define ASC(vec) vec.begin(), vec.end()			// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
const long long INF = 1LL << 60;
typedef long long ll;

int Euclidean(int a, int b)
{
	if (a % b == 0)
	{
		return b;
	}
	else
	{
		Euclidean(b, a % b);
	}
}

int main()
{
	int N, X; cin >> N >> X;
	int i;

	vector<int> diff(N);
	vector<int> x(N);
	rep(i, N) {
		cin >> x[i];
		diff[i] = abs(X - x[i]);
	}

	if (N == 1) cout << diff[0] << endl;
	else if (N == 2) cout << Euclidean(diff[0], diff[1]) << endl;
	else
	{
		sort(DESC(diff));

		int ans = Euclidean(diff[0], diff[1]);

		for (i = 2; i < N; i++)
		{
			ans = Euclidean(ans, diff[i]);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1024
S = input()

answer = ''
number_of_consecutive_times = 0
maxium_number_of_consecutive_times = 0
for char in S:
    is_included = char in ['A', 'C', 'G', 'T']

    if is_included:
        number_of_consecutive_times += 1
    else:
        maxium_number_of_consecutive_times = max(
            number_of_consecutive_times,
            maxium_number_of_consecutive_times,)
        number_of_consecutive_times = 0
maxium_number_of_consecutive_times = max(
            number_of_consecutive_times,
            maxium_number_of_consecutive_times,)

print(maxium_number_of_consecutive_times)


Measured memory_bytes: 2940
//Kyokai no Kanata //
#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
  const char* comma=strchr(names+1,',');
  cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...)
#endif
float  inf=std::numeric_limits<double>::infinity();
LL INF=std::numeric_limits<LL>::max();
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
int FN[26];
int main()
{
    string s;cin>>s;
    for(auto x:s)
      FN[x-'a'] = 1;
    for(int i=0;i<26;i++)
      if(!FN[i]) return 0*printf("%c\n",i+'a');
    puts("None");
    return 0;
}

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

int main() {
    long long x, k, d, p;
    cin >> x >> k >> d;

    x = abs(x);
    if (x/d >= k) cout << x-k*d << endl;
    else { 
        k = k - (x/d);
        if(k%2 == 0) cout << x%d << endl;
        else cout << abs(x%d-d) << endl;
    }
}


Measured memory_bytes: 3624
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=998244353;
const int M=100005;
inline ll bigmod(ll B,ll P){ll R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline ll ad(ll x,ll y){ll ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll sub(ll x,ll y){ll ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll gun(ll x,ll y){ll ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
int k,zero=0,one=0,cur=0;
string s;
vector< vector< vector<int> > >dp;
int cnt[306];
int solve(int pos,int has,int op)
{
    if(op>k)return 0;
    if(pos==cur)return 1;
    int &ret=dp[pos][has][op];
    if(ret!=(-1))return ret;
    ret=0;
    for(int i=0;i<=cnt[pos];i++)
    {
        ret=ad(ret,solve(pos+1,has+i,op+i));
    }
    for(int i=1;i<=has;i++)
    {
         ret=ad(ret,solve(pos+1,has-i,op));
    }
    return ret;
}
 main()

{
    fast
    cin>>s>>k;
    for(auto ch:s)
    {
        if(ch=='0')zero++;
        else one++;
    }
    dp.resize(zero+3);
    for(auto &x:dp)
    {
        x.resize(one+2);
        for(auto &y:x)
        {
            y.resize(one+2,-1);
        }
    }
    while(s.size())
    {
        if(s.back()=='0')cur++;
        else cnt[cur]++;
        s.pop_back();
    }
    cout<<solve(0,0,0)<<endl;
    return 0;

}





































Measured memory_bytes: 35816
#include <stdio.h>



int main() {
	int a, b, k;
	scanf("%d%d%d", &a, &b, &k);
	int i;
	for (i = 0; i < k; i++) {
		if (i % 2 == 0) {//高橋君
			if (a % 2 == 1) {
				a--;
			}
				b += (a / 2);
				a /= 2;
		} else {//青木君
			if (b % 2 == 1) {
				b--;
			}
				a += (b / 2);
				b /= 2;
		}
	}
	printf("%d %d", a, b);

	return 0;
}

Measured memory_bytes: 128
a=int(input())
b=[str(input()) for i in range(a)]
c=int(input())
d=[str(input()) for i in range(c)]

bset=list(set(b))
e=[]
for i in bset:
  e.append(b.count(i)-d.count(i))

f=max(e)
print(max(0,f))

Measured memory_bytes: 3064
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var output = "";
  for(var i = 0; i < input[0].length; i++){
    output += input[0].slice(i,i+1) + input[1].slice(i,i+1);
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayList<Integer> b = new ArrayList<Integer>(N);
		for(int i = 0; i < N; i++) {
			b.add(sc.nextInt());
		}
		ArrayList<Integer> ans = new ArrayList<Integer>();
		boolean isExist = true;
		while(!b.isEmpty()) {
			int rm_ind = -1;
			for(int i = 0; i < b.size(); i++) {
				if(b.get(i) == i + 1) {
					rm_ind = i;
				}
			}
			if(rm_ind == -1) {
				isExist = false;
				break;
			}
			b.remove(rm_ind);
			ans.add(rm_ind + 1);
		}
		if(isExist) {
			Collections.reverse(ans);
			for(int a : ans) {
				System.out.println(a);
			}
		}
		else {
			System.out.println(-1);
		}
	}
}


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

vector<pair<int,long long > >graph[100005];

long long d1[100005];
long long d2[100005];
long long dp1[100005];
long long dp2[100005];
void dijkstra(int st, long long d[], long long w[])
{
	multiset<pair<long long, int> >q;
	q.insert({0,st});
	w[st] = 1;
	d[st] = 0;
	while(q.size())
	{
		long long c = q.begin()->first;
		long long at = q.begin()->second;
		
		q.erase(q.begin());
		if(c > d[at])
			continue;
		for(int i = 0; i < graph[at].size(); i++)
		{
			int v = graph[at][i].first;
			long long c = graph[at][i].second;
			if(d[v] > d[at] + c)
			{
				d[v] = d[at] + c;
				w[v] = w[at];	
				q.insert({d[v],v});
			}
			else if(d[v] == d[at] + c)
			{
				w[v] = (w[v] + w[at]) % mod;	
			}
		}
	}
}
int main()
{
	memset(d1,0x3f3f3f3f,sizeof(d1));
	memset(d2,0x3f3f3f3f,sizeof(d2));
	int n,m;
	int s,t;
	scanf("%d %d",&n,&m);
	scanf("%d %d", &s,&t);
	for(int i = 0 ; i < m ; i++)
	{
		int u,v;
		long long c;
		scanf("%d %d %lld",&u,&v,&c);
		graph[u].push_back({v,c});
		graph[v].push_back({u,c});
	}
	dijkstra(s,d1,dp1);
	dijkstra(t,d2,dp2);
	long long mdis = d1[t];
	long long ans1 = (dp1[t] * dp2[s]) % mod;
	long long ans = 0;
	for(int i = 1; i <= n ; i++)
	{
		if(d1[i] == d2[i] && (d1[i] + d2[i] == mdis))
		{
			ans = (ans + ((dp1[i]*dp2[i]%mod) * (dp1[i]*dp2[i] %mod))%mod) %mod;
		}
		for(int j = 0; j < graph[i].size(); j++)
		{
			int v = graph[i][j].first;
			long long c = graph[i][j].second;
			if(2LL*d1[i] < mdis && 2LL*d2[v] < mdis && (d1[i] + d2[v] + c == mdis) )
			{
				ans = (ans + ((dp1[i]*dp2[v]%mod) * (dp1[i]*dp2[v] %mod))%mod) %mod;
			}
		}
	}
	ans = (ans1 - ans + mod) % mod;
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 21232
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
      mut  a:[i64;n],
    }
    let mut b = vec![];
    for (i, &x) in a.iter().enumerate() {
        b.push((x, i));
    }
    b.sort();
    b.reverse();
    let mxi = b[0].1;

    for i in 0..n {
        if i == mxi {
            println!("{}", b[1].0);
        } else {
            println!("{}", b[0].0);
        }
    }
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli c[9];
    lli total = 0;
    REP(i, 0, 9) {
        cin >> c[i];
        total += c[i];
    }
    if (total % 3 != 0) {
        cout << "No" << endl;
        return 0;
    }

    if (((c[0] + c[4] + c[8])*3 != total) ||
        ((c[2] + c[4] + c[6])*3 != total)) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}


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

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

    for(int i=0;i<n;++i){
        cout << b[i] <<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int X, Y, A, B, C;
long long int p[100005], q[100005], r[100005];
vector<long long int > V, W, Z, T;

int main(void) {

	cin >> X >> Y >> A >> B >> C;
	for (int i = 1; i <= A; i++) {
		cin >> p[i]; V.push_back(p[i]);
	}

	for (int i = 1; i <= B; i++) {
		cin >> q[i]; W.push_back(q[i]);
	}

	for (int i = 1; i<= C; i++) {
		cin >> r[i]; Z.push_back(r[i]);
	}

	sort(V.rbegin(), V.rend());
	sort(W.rbegin(), W.rend());
	sort(Z.rbegin(), Z.rend());


	long long int ans = 0;

	for (int i = 0; i < X; i++) {
		T.push_back(V[i]);
	}

	for (int i = 0; i < Y; i++) {
		T.push_back(W[i]);
	}

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

	int q = 0;

	for (int i = 0; i < X + Y; i++) {
		if (T[i] < Z[q]) { T[i] = Z[q]; q++; }
	}

	
	for (int i = 0; i < X + Y; i++) {
		ans += T[i];
	}


	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 7156
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 3e5+2;


void solve()
{
    int n;
    scn(n);

    vi a(n);

    rep(i, 0, n)
    scn(a[i]);

    int cnt = 0;

    rep(i, 0, n) {
        rep(j, i + 1, n) {
            if(a[j] == a[i]) continue;
            rep(k, j + 1, n) {
                if(a[j] == a[k] or a[i] == a[k]) continue;
                bool ok = 1;
                if(a[i] + a[j] <= a[k]) ok = 0;
                if(a[j] + a[k] <= a[i]) ok = 0;
                if(a[i] + a[k] <= a[j]) ok = 0;
                cnt += ok;
            }
        }
    }

    prin(cnt);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <cmath>
#include <algorithm>

#define SIZE 100
void nuru(int, int, int);

using namespace std;
int rec[SIZE][SIZE] = {{}};
int W, H, N;

int main(int argc, char const *argv[])
{
    int x, y, a;
    cin >> W >> H >> N;
    for(int i=0; i<N; i++){
        cin >> x >> y >> a;
        nuru(x, y, a);
    }
    int area = 0;
    for(int i=0; i<W; i++){
        for(int j=0; j<H; j++){
            if(!rec[i][j]){
                area++;
            }
        }
    }
    cout << area;
    return 0;
}

void nuru(int x, int y, int a){
    switch(a){
        case 1:
            for(int i=1; i<= x; i++){
                for(int j=1; j <= H; j++){
                    rec[i-1][j-1] = 1;
                }
            }
            break;
        case 2:
            for(int i=x+1; i<= W; i++){
                for(int j=1; j <= H; j++){
                    rec[i-1][j-1] = 1;
                }
            }
            break;
        case 3:
            for(int i=1; i<= W; i++){
                for(int j=1; j <= y; j++){
                    rec[i-1][j-1] = 1;
                }
            }
            break;
        case 4:
            for(int i=1; i<= W; i++){
                for(int j=y+1; j <= H; j++){
                    rec[i-1][j-1] = 1;
                }
            }
            break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define fi first
#define sc second
typedef pair<int,int> P;
typedef long long ll;
int a[5005],c[5005],b[5005];
int n;
int ans[5005];
//b[0]...b[zan-1] ... available
void make(int zan,int need){
//cout << zan << " " << need << endl;
	if(zan == 0) { assert(need == 0); return; }
	vector<int>vec; vec.resize(zan-1,0);
	int id = 0;
	for(int i=n-zan+1;i<n;i++) vec[id++] = a[i];
	sort(vec.begin(),vec.end());
	int base = upper_bound(b,b+zan,a[n-zan])-b;
	if(base != zan && need){
		//remove base
		int goal = need-1;
		int id = zan-1;
		bool bad = 0;
		for(int i=goal-1;i>=0;i--){
			if(id == base) id--;
			if(id < 0 || vec[i] >= b[id--]) {bad=1;break;}
		}
		//cout << zan << " " << bad << " " << a[n-zan] << " " << b[base] << endl;
		if(!bad){
			//ok
			int lb = base, ub = zan; 
			while(ub-lb > 1){
				int mid = (lb+ub)/2;
				int goal = need-1; bool bad2 = 0;
				int id = zan-1;
				for(int i=goal-1;i>=0;i--){
					if(id == mid) id--;
					if(id < 0 || vec[i] >= b[id--]) {bad2=1;break;}
				}
				if(bad2) ub = mid; else lb = mid;
			}
			//cout << b[lb] << endl;
			ans[n-zan] = b[lb];
			swap(b[lb],b[zan-1]);
			sort(b,b+zan-1);
			make(zan-1,need-1);
			return;
		}
	}
	//cout << base << endl;
	{
	//cout << zan << " " << need << endl;
			//ng
			int lb = 0, ub = base; 
			while(ub-lb > 1){
				int mid = (lb+ub)/2;
				int goal = need;
				int id = zan-1;bool bad2 = 0;
				for(int i=goal-1;i>=0;i--){
					if(id == mid) id--;
					//cout << i << " " << vec[i] << " " << id << " " << b[id] << endl;
					if(id < 0 || vec[i] >= b[id--]) {bad2=1;break;}
				}
				if(bad2) ub = mid; else lb = mid;
			}
			assert(lb >= 0);
			//cout << lb << "s" << endl;
			//cout << n-zan << " d " << b[lb] << endl;
			ans[n-zan] = b[lb];
			swap(b[lb],b[zan-1]);
			sort(b,b+zan-1);
			make(zan-1,need);
			return;
	}
}
int main(){
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) c[i] = a[i];
	rep(i,n) cin >> b[i];
	sort(b,b+n);
	sort(c,c+n);
	int anss;
	for(int cnt=0;cnt<=n;cnt++){
		bool ok = 1;
		for(int i=0;i<cnt;i++){
			if(c[i] >= b[n+i-cnt]){ ok = 0; break;}
		}
		if(ok) anss = cnt;
	}
	//cout << anss << endl;
	make(n,anss);
	rep(i,n) cout << ans[i] << (i==n-1?'\n':' ');
	int cnt = 0;
	rep(i,n) cnt += (ans[i] > a[i]);
	assert(cnt == anss);
	return 0;
}



Measured memory_bytes: 52528
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#pragma endregion

signed main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> x(m);
    rep(i, m) cin >> x.at(i);

    if(m == 1 || n >= m) {
        cout << 0 << endl;
        return 0;
    }
    sort(all(x));

    vector<ll> v(m - 1);
    rep(i, m - 1) v[i] = abs(x[i] - x[i + 1]);

    sort(all(v));
    reverse(all(v));
    rep(i, n - 1) v[i] = 0;
    ll sum = 0;
    rep(i, m - 1) sum += v[i];
    cout << sum << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int x, y; cin >> x >> y;
    print(x + y/2);
}


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

int main(){
    
    int a,b,c;
    
    cin >> a >> b >> c;
    
    if (a < b && b < c) {
        
        cout <<"Yes" << endl;
    
    } else {
        cout <<"No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
  string O, E;
  cin >> O >> E;
  string ans="";
  rep(i,E.size()){
    ans.push_back(O[i]);
    ans.push_back(E[i]);
  }
  if(O.size()-E.size()) ans.push_back(O[O.size()-1]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
A, B, C, D = map(int, input().split())

if C < A:
    if D < A:
        ans = 0
    elif A <= D < B:
        ans = D - A
    else:
        ans = B - A
elif A <= C < B:
    if D < B:
        ans = D - C
    else:
        ans = B - C
else:
    ans = 0

print(ans)

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }

template <long long MOD> class modint {
  long long x;
  long long norm(long long v) {
    v %= MOD;
    return (v+MOD)%MOD;
  }
public:
  modint(long long v = 0) : x(norm(v)) {
  }

  modint operator+(modint other) {
    return norm(x+other.x);
  }

  modint& operator+=(modint other) {
    x = (*this + other).x;
    return *this;
  }

  modint operator-(modint other) {
    return norm(x-other.x);
  }

  modint& operator-=(modint other) {
    x = (*this - other).x;
    return *this;
  }

  modint operator*(modint other) {
    return norm(x*other.x);
  }

  modint operator*=(modint other) {
    x = (*this - other).x;
    return *this;
  }

  /*
    modint operator/(modint other) {
    return x*mod_pow(other.x, MOD-2)%MOD;
    }

    moding operator/=(modint other) {
    x = (*this / other).x;
    return *this;
    }
  */

  modint operator^(long long b) {
    if (b == 0) return 1;
    modint ret = *this ^ (b/2);
    ret = ret * ret;
    if (b % 2 == 1) ret = *this * ret;
    return ret;
  }

  long long value() {
    return x;
  }

  friend istream& operator>>(istream& in, modint& a) {
    long long x; in >> x;
    a = modint(x);
    return in;
  }

  friend ostream& operator<<(ostream& out, modint a) {
    out << a.x;
    return out;
  }
};

const ll MOD = 1000000007;
typedef modint<MOD> mint;
ll l,r;
bool vis[61][2][2][2];
mint dp[61][2][2][2];

mint rec(int pos, bool f1, bool f2, bool f3) {
  if (pos < 0) return 1;

  bool &b = vis[pos][f1][f2][f3];
  mint &v = dp[pos][f1][f2][f3];
  if (b) return v;
  b = true;

  int br = (r >> pos) & 1;
  int bl = (l >> pos) & 1;

  mint res = 0;
  // 00
  if (f2 || !bl)
    res += rec(pos-1,f1,f2,br?true:f3);
  // 01
  if (f1 && (f2 || !bl) && (f3 || br))
    res += rec(pos-1,f1,f2,f3);
  // 11
  if (f3 || br)
    res += rec(pos-1,true,!bl?true:f2,f3);

  return v = res;
}

int main()
{
  cin >> l >> r;

  cout << rec(60,false,false,false) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int l;
    string  a;
    cin>>a;
    l=a.size();
    if(l==2){
	    cout<<a<<endl;
    }
    else if(l==3){
		char r;
		r=a.at(0);
		a.at(0)=a.at(2);
		a.at(2)=r;
		cout<<a<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int H,W,h,w;
int main(){
	cin>>H>>W>>h>>w;
	cout<<(H*W-(H*w)-(h*W)+(h*w))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
 int a,b;
 cin >> a >> b;
 if (a==1) a=14;
 if (b==1) b=14;
 if (a>b) cout << "Alice" << endl;
 if (b>a) cout << "Bob" << endl;
 if (b==a) cout << "Draw" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define mem(x,val) memset(x,val,sizeof(x))
#define mk make_pair
#define f(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<=n;i++)
#define all(a) a.begin(),a.end()
#define upp(v,val) upper_bound(v.begin(),v.end(),val)
#define lower(v,val) lower_bound(v.begin(),v.end(),val)
#define test ll t;cin>>t; while(t--)
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define dbg2(x,y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define dbg3(x,y,z) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<endl
#define dbg4(x,y,z,q) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<", "<<#q<<" = "<<q<<endl
#define speed() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define S second
#define F first
#define fm(it,m) for(it=m.begin();it!=m.end();it++)
#define ct_set(n) __builtin_popcount(n) // count no of set bits
#define INF 0x3f3f3f3f
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265
#define precision cout<<setprecision(15)
//vec.erase(std::remove(vec.begin(), vec.end(), val), vec.end());
using namespace std;

bool isPrime(ll n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
 
    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;
 
    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
 
    return true;
}

vector<ll> primes;

bool prime[10005];
void seive()
{
	mem(prime,1);
	prime[0]=0;
	prime[1]=0;
	for(ll i=2;i<=10000;i++)
	{
		if(prime[i]==1)
		{
			for(ll j=i*i;j<=10000;j+=i)
			prime[j]=0;
		}
	}
	
}

ll power(ll a,ll b)
{
	ll ans=1;
	while(b>0)
	{
		if(b%2==1)
		ans=(ans%mod*a%mod)%mod;
		a=(a*a)%mod;
		b=b/2;
	}
	return ans;
}

template <typename T>
std::string NumberToString ( T Number )
{
 std::ostringstream ss;
 ss << Number;
 return ss.str();
}

void solve()
{
	
	ll n;
	cin>>n;
	ll a[n],i,j;
	vector<ll> v;
	vector<ll> :: iterator it;
	map<ll,ll> m;
//	map<ll,ll> :: iterator it;
	f(i,n)
	cin>>a[i];
	sort(a,a+n);
	ll sum=0;
	for(i=0;i<n-1;i++)
	sum+=a[i];
	if(a[n-1]<sum)
	cout<<"Yes";
	else
	cout<<"No";

}

int main()
{
	speed()
	
//	seive();
//	for(int i=2;i<=10000;i++)
//	{
//		if(prime[i])
//		primes.pb(i);
//	}
	
	bool codechef=0;
	ll t=1;
	
	if(codechef)
	cin>>t;
	
	while(t--)
	{
		solve();
	}
	return 0;
}

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

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

	int low = 1, high = 1E9 + 5;
	while(low < high) {
		int mid = (low + high)/2;

		int need = 0;
		for(int i = 0; i < n; i++)
			need += (a[i] + mid - 1) / mid - 1;

		if(need <= k)
			high = mid;
		else
			low = mid + 1;
	}

	cout << low << '\n';
}


Measured memory_bytes: 3964
package main

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

func main() {
	var k, x int
	s := wordScanner(100)
	scanInts(s, &k, &x)

	l := make([]string, 0)
	for i := max(x-k+1, -1000000); i <= min(x+k-1, 1000000); i++ {
		l = append(l, strconv.Itoa(i))
	}

	fmt.Println(strings.Join(l, " "))
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func wordScanner(n int) *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	b := make([]byte, n)
	s.Buffer(b, n)
	return s
}

func scanInts(s *bufio.Scanner, vals ...*int) {
	for i := range vals {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		*vals[i] = n
	}
}


Measured memory_bytes: 640