akhauriyash/Code-Regression huggingface dataset:
from heapq import heappush, heappop

q = int(input())

# PQ1に小さい方→PQ1で欲しいのは最大値→負の値でpush
# PQ2に大きい方→PQ2で欲しいのは最小値→そのままpush
# sizeが同じ時はPQ1に入れるようにしておけば常にクエリで取り出すのはPQ1
PQ1 = []
pqsize1 = 0
PQ2 = []
pqsize2 = 0
seppen = 0
a_sum_small = 0
a_sum_big = 0
b_sum = 0
for _ in range(q):
    a = input()
    if a[0] == "1":
        p, q, r = map(int, a.split())
        b_sum += r
        if pqsize1 == 0:  # 初回用
            heappush(PQ1, -q)
            pqsize1 += 1
            a_sum_small += q
        elif pqsize2 == 0:  # 2回め用
            temp = heappop(PQ1)
            temp *= -1
            a_sum_small = 0
            num_list = [temp, q]
            num_list.sort()
            heappush(PQ1, -num_list[0])
            a_sum_small += num_list[0]
            heappush(PQ2, num_list[1])
            a_sum_big += num_list[1]
            pqsize2 += 1
        else:  # それ以後
            # smaller, biggerとqの大小で3パターン
            smaller = heappop(PQ1)
            smaller *= -1
            a_sum_small -= smaller
            bigger = heappop(PQ2)
            a_sum_big -= bigger
            num_list = [smaller, bigger, q]
            num_list.sort()
            x, y, z = num_list
            if pqsize2 < pqsize1:
                heappush(PQ1, -x)
                heappush(PQ2, y)
                heappush(PQ2, z)
                pqsize2 += 1
                a_sum_small += x
                a_sum_big += y + z
            else:
                heappush(PQ1, -x)
                heappush(PQ1, -y)
                heappush(PQ2, z)
                pqsize1 += 1
                a_sum_small += x + y
                a_sum_big += z
    else:
        res = 0
        res += b_sum
        chuo = heappop(PQ1)
        chuo *= -1
        res += pqsize1 * chuo - a_sum_small
        res += a_sum_big - pqsize2 * chuo
        heappush(PQ1, -chuo)
        print(chuo, res)


Measured memory_bytes: 11124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[114514],b[114514],c[114514];
int main(){
	ll n;
	cin>>n;
	ll ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		c[i]=a[i]+b[i];
		ans-=b[i];
	}
	sort(c,c+n);
	for(int i=n-1;i>=0;i-=2)ans+=c[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5932
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

const int MOD = 1000000007;
const int MAX = 2000100;
long long fac[MAX], finv[MAX], inv[MAX];
void init_comb() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long comb(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init_comb();
  int n, m;
  cin >> n >> m;
  int ans = comb(n, 2)+comb(m, 2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 47104
import sys
input = sys.stdin.readline
def print_ans(A, B, C):
    """Test Case
    >>> print_ans(2, 11, 4)
    4
    >>> print_ans(3, 9, 5)
    3
    >>> print_ans(100, 1, 10)
    0
    """
    print(min(C, B // A))


if __name__ == '__main__':
    A, B, C = map(int, input().rstrip().split())
    print_ans(A, B, C)




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define int long long
#define fill(x, v) memset(x, v, sizeof(x))
#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...);
}
int dp[100005];
int n, m;
vector<int> g[100005];
int solve(int a)
{
    if (dp[a] != -1)
        return dp[a];
    dp[a] = 0;
    for (int i = 0; i < g[a].size(); i++)
    {
        dp[a] = max(dp[a], 1 + solve(g[a][i]));
    }
    return dp[a];
}
int32_t main()
{
    cin >> n >> m;
    for (int i = 0; i <= n + 1; i++)
        dp[i] = -1;
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        g[x].pb(y);
    }
    int ans = INT_MIN;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, solve(i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 8576
def main():
    n = int(input())
    A = list(map(int, input().split()))

    if n  == 0:
        if A[0] == 1:
            return 1
        else:
            return -1
    elif A[0] != 0:
        return -1
    
    bound = [0]*(n+1)
    bound[n] = A[n]
    for i in range(n-1, -1, -1):
        bound[i] = bound[i+1] + A[i]

    B = [0] * (n+1)
    for i in range(n+1):
        if i == 0:
            B[i] = 1
        else:
            above = (B[i-1] - A[i-1]) * 2
            if  (i < n and above <= 0) or above < 0:
                return -1
            B[i] = min(above, bound[i])
    if B[n] < A[n]:
        return -1
    # print('B: ', B)
    return sum(B)

print(main())

Measured memory_bytes: 22140
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class Type>struct is_vector : std::false_type {};
	template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
	template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
		if (v.empty())return out;
		constexpr bool is_vector_v = is_vector<T>::value;
		if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
		else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
		return out;
	}
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
	inline void putn() {}
	template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

	void solve() {
		IOS;
		int n,m;
		cin >> n >> m;
		vector<int> v(n), w(n);
		REP(i, n) {
			cin >> v[i] >> w[i];
		}
		vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
		REP(i, n) {
			REP(j, m+1) {
				dp[i + 1][j] = dp[i][j];
				if (j - w[i] >= 0) {
					chmax(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
				}
			}
		}
		put(dp[n][m]);
	}
} // namespace idaten

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



Measured memory_bytes: 6848
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int n,k,o;
  scanf("%d\n%d", &n, &k);
  o = 1;
  for (size_t i = 0; i < n; i++) {
    if (o * 2 <= o + k) {
      o *= 2;
    } else {
      o += k;
    }
  }
  printf("%d\n", o);
  return 0;
}


Measured memory_bytes: 128
h, w = map(int, input().split())
s = [[j for j in input()] for i in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            tmp = 0
            for k in range(max(0, i-1), min(i+2, h)):
                tmp += s[k][(max(0, j-1)) : min(j+2, w)].count('#')
            s[i][j] = str(tmp)

for s_ in s:
    print(''.join(s_))

Measured memory_bytes: 3188
#include <stdio.h>

int main(void)
{
        int a,b;
        scanf("%d%d",&a,&b);
        if(a==b)printf("Draw\n");
        else if(a==1)printf("Alice\n");
        else if(b==1)printf("Bob\n");
        else{
                if(a>b)printf("Alice\n");
                else printf("Bob\n");
        }
        return 0;
}


Measured memory_bytes: 1624
#include <iostream>
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;

int main()
{
	int n;
	int cnt = 0;
	stack<int> car;
	vector<int> out;

	while (cin >> n, cin.eof() != true){
		if (n == 0){
			out.push_back(1);
			out[cnt] = car.top(); // top pop
			car.pop();
			cnt++;
		}
		else {
			car.push(n);
		}
	}

	for (int i = 0; i < cnt; i++){
		cout << out[i] << endl;
	}

	return (0);
}

Measured memory_bytes: 1220
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int A, B, C;
  cin >> A >> B >> C;

  if ((A == B && A != C) || (B == C && B != A) || (C == A && C != B)) {
    out("Yes");
  } else {
    out("No");
  }
}


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

int N, u, v;
vector <int> edges[100005];
int ans = 0;
int distU[100005], distV[100005];
int longestSub[100005];
int length;

void dfsU(int vertex, int p, int dist){
    distU[vertex] = dist;
    for (int e: edges[vertex]){
        if (e != p) {
            dfsU(e, vertex, dist+1);
        }
    }
}

void dfsV(int vertex, int p, int dist){
    distV[vertex] = dist;
    for (int e: edges[vertex]){
        if (e != p) {
            dfsV(e, vertex, dist+1);
        }
    }
}

void dfsSub(int vertex, int p){
    int longest = 0;
    for (int e: edges[vertex]){
        if (e != p && distU[e] + distV[e] != length){
            dfsSub(e, vertex);
            longest = max(longest, longestSub[e]+1);
        }
    }
    longestSub[vertex] = longest;
}


int main() {
    int a, b;
    cin >> N >> u >> v;
    for (int i=0; i<N-1; i++){
        scanf("%d %d", &a, &b);
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    memset(longestSub, -1, sizeof(longestSub));
    dfsU(u, u, 0);
    dfsV(v, v, 0);
    length = distU[v];
    for (int i=1; i<=N; i++){
        if (distU[i] + distV[i] == length && distU[i] < distV[i]){
            dfsSub(i, i);
            ans = max(ans, distV[i]+longestSub[i]-1);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12032
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
using namespace std;

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

int main () {

	vector < int > a(3);
	REP(i,3) cin >> a[i];

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

	cout << a[2] * 10 + a[1] + a[0] << endl;

	return 0;
}

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

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	int flag = 0;

	string t1 = "";
	string t2 = "keyence";

	REP(i, 8) {
		if (s.size() >= t1.size() && equal(begin(t1), end(t1), begin(s))) {
			if (s.size() >= t2.size() && s.compare(s.size() - t2.size(), t2.size(), t2) == 0) {
				flag = 1;
			}
		}
		if (i != 7) {
			t1 = t1 + t2[0];
			t2.erase(t2.begin());
		}
	}

	if (flag == 1) {
		ANS("YES");
	}
	else {
		ANS("NO");
	}

	return 0;
}


Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += D[i] * D[j]

print(ans)

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

ll a=0,n,t=1,b[1000000],ans=0,c[1000000];
int main(){

    cin>>n;
    ref(i,n+1){
        cin>>a;
        b[i]=a;
        c[i]=t-a;
        if(t>=INF) continue;
        if(t>=a) t=(t-a)*2;
        else{cout<<-1; return 0;}
    }
    a=0;
    for(ll i=n;i>0;i--){
            ans+=b[i];
        if(c[i-1]>=b[i]) {b[i-1]+=b[i];}
        else {b[i-1]+=c[i-1];}
        //cout<<ans;
    }
    ans+=b[0];
    cout<<ans;
    return 0;

}



Measured memory_bytes: 5160
function main(input) {
  const [l, r, d] = input[0].trim().split(" ").map(i => parseInt(i));
  let cnt=0;
  for(let i=l;i<=r;i++){
    if(i%d===0){
      cnt++;
    }
  }
  console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 29680
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N,K;
 string S;

 cin>>N>>K;
 cin>>S;

 vector<int> Nums;
 int now=1;
 int cnt=0;
 for(int i=0; i<N; i++){
   if(S[i]==(char)('0' + now))cnt++;
   else {
    Nums.push_back(cnt);
    now = 1-now; 
    cnt =1;
   }
 }

 if(cnt != 0) Nums.push_back(cnt);

 //1-0-1-0-1-0-1って感じの配列が欲しい
 //1-0-1-0みたいに0で終わってたら、適当に1つタス
 if(Nums.size() % 2==0)Nums.push_back(0);

 int Add= 2* K+1;
 int ans=0;

 for(int i=0; i<Nums.size(); i+=2)
 {
  int tmp=0;

  int left=i;
  int right=min(i+Add,(int)Nums.size());
  for(int j=left; j<right; j++)
  {
    tmp +=Nums[j];
  }
  ans= max(tmp,ans);
 }

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

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

int main() {
  int n; cin >> n;
  int money = 100000;
  for (int i = 0; i < n; i++) {
    money *= 1.05;
    if (money % 1000 != 0) money = ((money / 1000) + 1) * 1000;
  }
  cout << money << endl;
  return 0;
}


Measured memory_bytes: 3092
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const X = parseInt(arg[0].split(" ")[1]);
    
    let a = [1];
    let p = [1];
    
    for(let i=1; i<N; i++) {
        a.push((a[i-1] * 2) + 3);
        p.push((p[i-1] * 2) + 1);
    }

    const rec = (N, X) => {
        // ベースケース、0枚食べる時以外は必ず１枚
        if(N === 0) {
            return X <= 0 ? 0 : 1;
        // 半分以下の層までしか食べないなら、前のバーガーと同じである
        } else if(X <= 1 + a[N-1]) {
            return rec(N-1, X-1);
        // 半分以上食べる時
        } else {
            return p[N-1] + 1 + rec(N-1, X-2-a[N-1]);
        }
    }
    
    let answer = rec(N, X);
    
    console.log(answer)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include<stdio.h>
int main()
{
    int A,B,Y;
    scanf("%d%d",&A,&B);
    if(A>B){
     Y=A+A;
     Y--;
    printf("%d\n",Y);
    }
    else if(A<B){
         Y=B+B;
     Y--;
        printf("%d\n",Y);

    }else if(A==B){

        printf("%d\n",A+B);

    }
    return 0;
}


Measured memory_bytes: 128
char s[999],t[999];u,p,i;main(z){for(;gets(s);--z&&puts(t+u))for(memset(t,i=0,999),t[u=p=500]=*s;s[i+1];u>p?u=p:0)t[p+=s[i+2]%3-1]=s[i+=3];}

Measured memory_bytes: 524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		String str = sca.next();

		int result = 0;
		for(int i = 0; i < str.length(); i++) {
			if(str.charAt(i) != str.charAt(str.length() - 1 - i)) {
				result++;
			}
		}
		System.out.println(result/2);
	}
}


Measured memory_bytes: 23252
from collections import deque


que = deque()
n = int(input())
push_list = list(map(int, input().split()))
for i in range(len(push_list)):
    if not i % 2:
        que.append(push_list[i])
    else:
        que.appendleft(push_list[i])
        


if  n % 2:
    que.reverse()
    
    
print(*que)

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

#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int n,m;
    string s1,s2;
    cin>>s1>>s2;
    n=s1.size(),m=s2.size();
    int dp[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0||j==0)
                dp[i][j]=0;
            else if(s1[i-1]==s2[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    string ans="";
    /*for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++)
            cout<<dp[i][j]<<' ';
        cout<<'\n';
    }*/
    int i=n,j=m;
    while(i>0&&j>0){
        if(dp[i-1][j]!=dp[i][j]&&dp[i][j-1]!=dp[i][j])
            ans=s1[i-1]+ans,i--,j--;
        else if(dp[i-1][j]==dp[i][j])
            i--;
        else
            j--;
    }
    cout<<ans;
}

Measured memory_bytes: 38800
/*
*    AUTHOR:    mkbaloch
*    CREATED:   26.01.2020 17:40:13
*/

#include<bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i=a; i<=b; i++)
#define repn(i, n) for(int i=0; i<(int)n; i++)
#define all(x) x.begin(), x.end()

using namespace std;

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

  #ifdef DEBUG
    auto start = chrono::high_resolution_clock::now();
  #endif

  //-------Start-------//
  
  int h, a;
  cin >> h >> a;
  int ans = ceil(h/(float)a);
  cout << ans << endl;

  //-------End---------//

  #ifdef DEBUG
    auto end = chrono::high_resolution_clock::now();
    auto dur = chrono::duration_cast<chrono::microseconds>(end - start);
    cout << "Execution time: " << setprecision(6) << ((long double)dur.count() / 1e6) << " seconds" << endl; 
  #endif

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  ll a,b,k;cin >> a >> b >> k;
  if(a>k){
    cout << a-k << " " << b << endl;
  }
  else{
    ll rem = k-a;
    cout << 0 << " " << max(0LL, b-rem) << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long a,b,c,d=0,e,z=0,v;
    scanf("%lld%lld",&a,&b);


    scanf("%lld",&e);
    if(e>b)
    {
       z+=e-b;
    e=b;
    }


    for(c=0; c<a-1; c++)
    {
        scanf("%lld",&d);
        v=e+d;
        if(v>b)
        {
            z+=v-b;
            e=d-v+b;
        }
        else
        {
            e=d;
        }

    }

    printf("%lld\n",z);
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()


int main(){
  ll H,W,M;
  cin >> H >> W >> M;
  vec h(H,0),w(W,0);
  map<P,ll> X;
  rep(i,M){
    ll x,y;
    cin >> x >> y;
    X[P(x-1,y-1)]=1;
    h.at(x-1)++;
    w.at(y-1)++;
  }
  priority_queue<P> A,B;
  rep(i,H){
    A.push(P(h.at(i),i));
  }
  rep(i,W){
    B.push(P(w.at(i),i));
  }
  ll m=A.top().first+B.top().first,a=A.top().first,b=B.top().first;
  vecp C(M),D(M);
  ll k=0;
  while(!A.empty()&&a==A.top().first){
    C.at(k)=A.top();
    A.pop();
    k++;
  }
  ll l=0;
  while(!B.empty()&&b==B.top().first){
    D.at(l)=B.top();
    B.pop();
    l++;
  }
  rep(i,k){
    rep(j,l){
      if(!X.count(P(C.at(i).second,D.at(j).second))){
        cout << m << endl;
        return 0;
      }
    }
  }
  cout << m-1 << endl;
}

Measured memory_bytes: 47212
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <utility>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;

#define LL   long long
#define ld   long double
#define pii  pair<int,int>
#define pLL  pair<LL,LL>
#define vint vector<int>
#define vLL  vector<LL>

#define SZ(x) ((int)(x).size())
#define ALL(x)  (x).begin() , (x).end()
#define F first
#define S second
#define MP make_pair
#define PB push_back

#define Si(x) scanf("%d",&(x));
#define Sii(x,y) scanf("%d %d",&(x),&(y));
#define Siii(x,y,z) scanf("%d %d %d",&(x),&(y),&(z));
#define SL(x) scanf("%lld",&(x));
#define SLL(x,y) scanf("%lld %lld",&(x),&(y));
#define SLLL(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z));

#define Pi(x) printf("%d\n",(x));
#define Pii(x,y) printf("%d %d\n",(x),(y));
#define Piii(x,y,z) printf("%d %d %d\n",(x),(y),(z));
#define Piiii(x,y,z,w) printf("%d %d %d %d\n",(x),(y),(z),(w));
#define Piiiii(a,b,c,d,e) printf("%d %d %d %d %d\n",(a),(b),(c),(d),(e));
#define Piiiiii(a,b,c,d,e,f) printf("%d %d %d %d %d %d\n",(a),(b),(c),(d),(e),(f));
#define PL(x) printf("%lld\n",(x)*1LL);
#define PLL(x,y) printf("%lld %lld\n",(x)*1LL,(y)*1LL);
#define PLLL(x,y,z) printf("%lld %lld %lld\n",(x)*1LL,(y)*1LL,(z)*1LL);
#define PLLLL(x,y,z,w) printf("%lld %lld %lld %lld\n",(x)*1LL,(y)*1LL,(z)*1LL,(w)*1LL);

#define Pi1(x) printf("%d",  (x));
#define PiL(x) printf("%lld",(x));
#define Pspace putchar(' ');

#define MEM0(x) memset( (x), 0, sizeof( (x) ) )
#define MEM1(x) memset( (x),-1, sizeof( (x) ) )
#define REP1(i,n)  for (int i = 1; (n) >= i ; ++i)
#define REP0(i,n)  for (int i = 0; (n) >  i ; ++i)
#define REP(L,R,k) for (int i = (L); (R) >= i; i+= (k) )

int myRnd(int L,int R) {
    return abs(( (rand()<<15)|rand() ) ) % (R-L+1) + L;
}

const int N = 1e5 + 6;
const int INF = 1e9 + 7;

LL pre[N];

int main () {
    srand(time(NULL));
    int n,x;
    Si(n);
    vint a,b,c;
    REP1(i,n) {
        Si(x);
        a.PB(x);
    }
    REP1(i,n) {
        Si(x);
        b.PB(x);
    }
    REP1(i,n) {
        Si(x);
        c.PB(x);
    }
    a.PB(-INF); a.PB(INF);
    b.PB(-INF); b.PB(INF);
    c.PB(-INF); c.PB(INF);
    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));
    REP1(i,n) {
        int tmp=b[i];
        int now=lower_bound(ALL(a),tmp)-a.begin();
        pre[i] = pre[i-1] + (now-1);
    }
    LL ans=0;
    REP1(i,n) {
        int tmp=c[i];
        int pos=lower_bound(ALL(b),tmp)-b.begin();
        ans += pre[pos-1];
    }
    PL(ans);
}



Measured memory_bytes: 2296
# include <bits/stdc++.h>
//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>
//# include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace __gnu_pbds;
//namespace vl = boost::multiprecision;
 
// Did you miss me ?
 
# define gc          getchar
# define LL          long long
# define VLL         vl::cpp_int
# define pb          push_back
# define mp          make_pair
# define vi          vector<int>
# define vll         vector<LL>
# define pii         pair<int,int>
# define all(v)      v.begin(),v.end()
 
const int MOD = 1000000007;
const int MAXN = 1e6 + 5;
const int INF = 1e9;
const double PI = 3.14159265359;
 
template<class T> void in(T &x) { register T c=gc();x=0;T neg=0;for(;((c<48||c>57)&&c!='-');c=gc());if(c=='-'){neg=1;c=gc();}for(;c>47&&c<58;c=gc()){x=(x<<1)+(x<<3)+c-48;}if(neg)x=-x;}
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
LL power(LL a,LL b,LL m){ if(b==0) return 1; if(b==1) return a%m; LL t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
LL lcm(LL a, LL b) { LL ret = a*b; ret /= __gcd(a,b); return ret;}
LL nC2(LL n) {LL ret = n*(n-1)/2; return ret;}
 
vector<int> primes;
void sieve(int n)
{
	bool isPrime[n + 1];
	memset(isPrime, true, sizeof(isPrime));
	isPrime[0] = isPrime[1] = false;
	for(int i = 2; i * i <= n; i++) {
		if (isPrime[i]) {
			for (int j = 2 * i; j <= n; j += i)
			 	isPrime[j] = false;
		}
	}
	for (int i = 2; i <= n; i++)
		if (isPrime[i])
			primes.push_back(i);
}


int main()
{
	int t;
	//in(t);
	t = 1;
	while (t--) {
		int a,b;
		cin>>a>>b;
		if(a==b)
		{
			cout<<"Draw\n";
			return 0;
		}
		if(a==1 || b==1)
		{
			if(a==1)
				cout<<"Alice\n";
			else
				cout<<"Bob\n";
			return 0;

		}
		if(a>b)
			cout<<"Alice\n";
		else if(b>a)
			cout<<"Bob\n";
		
	}
    return 0;
}
 

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

int main(){
	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;


	if( x-r >= 0 && y-r >= 0 && W >= x+r && H >= y+r){
		cout << "Yes\n";

	}else{
		cout << "No\n";
	}
	
	return 0;

}

Measured memory_bytes: 1124
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int T[50000];
int S[50000];

int main() {
  string hoge[] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
  map<string, int> mp;
  REP(i,12) mp[hoge[i]] = i;
  int NUM;
  cin>>NUM;
  while(NUM--) {
    int n,m; cin >> n >> m;
    REP(i,n) {
      string s;cin >> s;
      T[i] = mp[s];
    }
    REP(i,m) {
      string s;cin>>s;
      S[i] = mp[s];
    }
    queue<pii> Q;
    Q.push(pii(-1,-1));
    bool ok = 0;
    while(!Q.empty()) {
      pii p = Q.front(); Q.pop();
      int a = p.first, b = p.second;

      int rest = n-a;
      if ((m-b)*2 < n-a) continue;
      if (a==n) {
        if (b==m) {
          ok = 1;
          break;
        }
        continue;
      }
      if (a+1<=n) {
        if (a+1==n || T[a+1]==S[b+1]) {
          Q.push(pii(a+1,b+1));
        }
      }
      if (a+2<=n) {
        if (a+2==n || (T[a+2]+1)%12==S[b+1]) {
          Q.push(pii(a+2,b+1));
        }
      }
      if (a) {
        if ((T[a-1]+11)%12==S[b+1]) {
          Q.push(pii(a-1,b+1));
        }
      }
    }
    cout << (ok?"Yes":"No") << endl;
  }

}

Measured memory_bytes: 1512
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    print(700+100*s.count('o'))
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int n;
  cin >> n;
  vector<pii> pi;
  int a, b;
  rep(i, n){
    cin >> a >> b;
    pi.emplace_back(b, a);
  }
  sort(all(pi));
  lol time = 0;
  rep(i, n){
    time += pi[i].se;
    if(time > pi[i].fi){
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int n, y;
	cin >> n >> y;

    for (int a = 0; a <= n; a++) {
        for (int b = 0; b <= n - a; b++) {
            int c = n - (a + b);

            if(10000*a + 5000*b + 1000*c == y) {
                printf("%d %d %d\n", a, b, c);
                return 0;
            }

        }
    }

    printf("-1 -1 -1\n");
	return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC026A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            int d;

            if (a >= b && a >= c)
                Console.WriteLine(b+c);
            else if (b>=a && b>= c)
                Console.WriteLine(a+c);
            else
                Console.WriteLine(a+b);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int n;
    string s,t,ans;
    cin>>n;
    cin>>s>>t;
    rep(i,n)
    {
        ans+=s[i];
        ans+=t[i];
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef std::pair<int, int> int_pair;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << abs(a - c) * abs(b - d) << endl;

}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

func main() {
	var sum int
	i := scanIntNums()
	i2 := scanIntNums()

	H := i[0]
	for _, num := range i2 {
		sum += num
	}

	if sum >= H {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func scanIntNums() (nums []int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	nums = make([]int, len(numString))
	var err error

	for i := 0; i < len(nums); i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}

Measured memory_bytes: 4864
from collections import Counter

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

V = list(map(int, input().split()))

V.sort(reverse=True)

c = Counter(V)
max_average = sum(V[:A]) / A
c_max = Counter(V[:A])

def nCr(n,r):
  if n < 0 or r < 0 or n < r: return 0
  if n - r < r: r = n - r
  if r == 0: return 1
  if r == 1: return n
  
  # 分子のn*(n-1)*...がr個分続くやつ
  numerator = [n-r+k+1 for k in range(r)]
  # 分母：r!=r*(r-1)*...*3*2の要素
  denominator = [k+1 for k in range(r)]
  
  # 分母の要素で割れる部分を割っていく部分
  for p in range(2, r+1):
    # 分母は1,2,3,...rのようになっており、1は意味がないのでスキップした形か
    pivot = denominator[p-1]
    if pivot > 1:
      # 分子のX番目と分母のX-offset番目が共通の約数を持つということだと思う。piv分ずれているのだから、pivの倍数というところか
      offset = (n-r) % p
      for k in range(p-1, r, p):
        # 約分できる要素について割る
        numerator[k - offset]  /= pivot
        denominator[k] /= pivot
        
  ret = 1
  for k in range(r):
    if numerator[k] > 1: ret *= int(numerator[k])
      
  return ret

# A個選んだ時の最大平均値が、全て同じ価値で構成されている時
# この場合は、全体の個数の取り方が、A〜min(B, V_maxの個数)と、複数ある
if len(c_max) == 1:
    # A個選ぶ、A+1個選ぶ、...、min(B, c[V[0]])個選ぶ　の和が答え
    ans = 0
    n = c[V[0]]
    for r in range(A, min(B, n)+1):
        ans += nCr(n,r)


# 最大平均値が複数の価値から作られる場合、価値が大きい順から全て使われる価値がいくつかと、中途半端に使われる価値が一つになる
# なので、中途半端に選ばれるものの選び方を数え上げる
# この時、全体の個数はA個固定（さらに何かを追加すると平均が減少するため）
else:
    
    # 最大平均値を構成する、最小の価値を探す
    tmp = list(c_max.keys())
    tmp.sort()
    # 最小の値
    min_num = tmp[0]
    # 最小以外の数字で何個選んでいるか
    cnt = 0
    for i in tmp[1:]:
        cnt += c_max[i]
    remaining = A - cnt

    ans = nCr(c[min_num], remaining)

print(max_average)
print(ans)

Measured memory_bytes: 3444
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>

using namespace std;

template<class T> void gc(T &x)
{
    int s, k, m = 0;
    x = 0;

    k = getchar_unlocked();

    if (k == '-') s = 1;
    else if ('0' <= k && k <= '9')  x = k - '0';

    while (true)
    {
        k = getchar_unlocked();

        if (k < '0' || k > '9') break;
        x = x * 10 + k - '0';
    }

    if (m) x = -x;
}

// void del(int *A) と同じ
template<class T> void del(T A[])
{
    delete[] A;
}

int main()
{
    const char *YES = "YES";
    const char *NO = "NO";

    long long int N;
    gc(N);

    if (N == 1)
    {
        printf("%s\n", YES);
        return 0;
    }

    long long int a;
    long long int sum = 0LL;

    long long int *A = new long long int[ N ]();

    for (int i = 0; i < N; i++)
    {
        gc(a);
        A[i] = a;
        sum += a;
    }

    long long int val = N * (N + 1) / 2;
    if (sum % val != 0LL)
    {
        printf("%s\n", NO);
        del(A);
        return 0;
    }

    long long int times = sum / ((N * (N + 1)) / 2);

    long long int div;

    for (int i = 0; i < N; i++)
    {
        long long int div = A[(i + 1) % N] - A[i] - times;

        if (div > 0LL || div % N != 0LL)
        {
            printf("%s\n", NO);
            del(A);
            return 0;
        }
    }

    printf("%s\n", YES);
    del(A);
    return 0;
}


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

#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;;

typedef long long ll;
typedef long double ld;

const int maxN = 1e6 + 10, maxE = 2e5 + 10;
const int  oo = 1e9;

vector <pii> yal[maxN], adj[maxN];
vector <int> comp, a2[maxN], cand;
bool mark[maxN];
int cnt, dis[maxN];

void DFS(int v)
{
	mark[v] = true;
	comp.pb(v);
	for (auto u : a2[v])
		if(!mark[u])
			DFS(u);
	return ;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m; cin >> n >> m;
	cnt = n;
	for (int i=0; i<m; i++)
	{
		int u, v, c; cin >> u >> v >> c;
		--u; --v; 
		yal[c].pb({u, v});
	}

	for (int c=0; c<maxN; c++)
	{
		if(yal[c].size() == 0) continue ;
		for (auto X : yal[c])
			a2[X.F].pb(X.S), a2[X.S].pb(X.F), cand.pb(X.F);
		
		for (auto v : cand)
		{
			if(mark[v]) continue ;
			comp.clear();
			DFS(v);
			for (auto u : comp)
			{
				adj[u].pb({cnt, 0});
				adj[cnt].pb({u, 1});
			}
			cnt ++;
		}

		cand.clear();
		for (auto X : yal[c])
			a2[X.F].clear(), a2[X.S].clear(), mark[X.F] = mark[X.S] = 0;
	}

	set <pii> st;
	st.insert({0, 0});
	for (int i=1; i<cnt; i++) dis[i] = oo;
	
	while(st.size())
	{
		int v = st.begin()->S;
		st.erase(st.begin());
		for (auto u : adj[v])
		{
			if(dis[u.F] > dis[v] + u.S)
			{
				st.erase({dis[u.F], u.F});
				dis[u.F] = dis[v] + u.S;
				st.insert({dis[u.F], u.F});
			}
		}
	}

	if(dis[n - 1] == oo) return cout << -1 << endl, 0;
	else cout << dis[n - 1] << endl;

}


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

#define MOD 1000000007
#define debug(x) cout << (#x) << " is " << (x) << endl
typedef long long int ll;
#define int ll
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;
typedef vector < ll > vll;

#define pi 3.1415926536
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int a, b; cin >> a >> b;
    int ans = ceil((b - 1.0)/(a - 1));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<time.h> 
#define loop(i,c,n) for(long long i=c;i<n;i++) 
#define iter(v) for(auto x : v)  // to iterate over entire vector/sets/map
using namespace std; 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii; 
typedef set<int> si; 
int max(int a,int b){if(a>b)return a;
return b;} 
//optimised school method
bool isPrime(ll a){ 
if(a<=1)return false ;
if(a<=3)return true ;
if(a%2==0 || a%3==0)return false;
for(ll i=5;i*i<=a;i=i+6){//Instead of checking till n, we can check till √n because a larger factor of n 
//must be a multiple of smaller factor that has been already checked.
if(a%i==0 || a%(i+2)==0)return false;}return true;}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);  
	cout.tie(0);
	//  to read input from local files  
	 #ifndef ONLINE_JUDGE 
	clock_t clocktime; 
	clocktime= clock(); 
	 freopen("input.txt", "r",stdin);
	 freopen("output.txt", "w",stdout);
	#endif
	// to read entire line with spaces 
	// string s;
	// getline(cin,s);
	
	// when amount of data is unknown
	// while(cin>>x){} 
	int x,y ; 
	cin>>x>>y;
	int t  =  -(2*x-y)/2; 
	
	 if((t>=0 )&& (x-t>=0)  &&(2*t == -2*x+y))cout<<"Yes";
	 else cout<<"No"; 
	
	#ifndef ONLINE_JUDGE
	clocktime = clock()-clocktime; 
	double runtime  = (((double)clocktime)/CLOCKS_PER_SEC); 
	cout<<"\n--------\nTimeUsed -- "<<runtime<<"s"; 
	#endif
	return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(b-a == c-b) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		

	}

}


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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int n, k;
    cin >> n >> k;
    cout << (int)(log(n) / log(k)) + 1 << endl;

    return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring> 
#include <algorithm>
using namespace std;
int dp[101][10001] = { 0 };
int main() {
	int N,W;
	int v[101] = {0};
	int w[101] = {0};
	scanf("%d%d", &N,&W);
	for (int i = 1;i <= N; ++i) scanf("%d%d", &v[i], &w[i]);
	for (int i = 1;i <= N;++i) {
		for (int q = 1;q <= W;++q) {//q ?????????????????????????????§??????
				if (q - w[i] >= 0) {
					dp[i][q] = max(dp[i - 1][q], dp[i][q - w[i]] + v[i]);
				}
				else {
					dp[i][q] = dp[i - 1][q];
				}
			}
	}
	printf("%d\n", dp[N][W]);
	return 0;
}


Measured memory_bytes: 4936
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s; int k;
    cin>>s;
    cin>>k;
    set<string> sets;
    int r=s.length();
    int run = min(r,k);
    for(int len=1;len<=run;len++){
        for(int i=0;i< s.length()-len+1;i++){
            string t=s.substr(i,len);
            sets.insert(t);
        }
    }
    int count=0;
    for(auto it= sets.begin();it!=sets.end();it++){
        count++;
        if(count==k){
        cout<<*it;
        }
    }
    return 0;
}

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

long long n, a, b, c, m = 1, t = 2, w1 = 1, w2, v;
const long long M = 1000000007;

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

	for (int i = 0; (1ull << i) <= n; i++) {
		if((1ull << i) & n)
			m = m * t % M;

		t = t * t % M;
	}

	m -= 1;

	c = max(a, b);

	for (int i = 1; i <= c; i++) {
		w2 = w1 * i % M;

		t = w2;
		v = 1;
		w1 = w2;

		if (i == a || i == b) {
			for (int j = 0; (1ull << j) < M - 1; j++) {
				if ((1ull << j) & (M - 2))
					v = v * t % M;

				t = t * t % M;
			}

			t = 1;
			for (long long k = n; k > n - i; k--)
				t = t * k % M;

			m = (M + m - (t * v % M)) % M;
		}
	}

	cout << m << endl;

	return 0;
}

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

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int N, M;
   cin >> N >> M;
   vector<vector<int>> A(N, vector<int>(M));
   for (int i = 0; i < N; ++i) {
      for (int j = 0; j < M; ++j) {
         cin >> A[i][j];
         --A[i][j];
      }
   }
   int ans = N;
   vector<bool> ban(M);
   for (int iter = 0; iter < M; ++iter) {
      vector<int> cnt(M);
      for (int i = 0; i < N; ++i) {
         for (int j = 0; j < M; ++j) {
            if (!ban[A[i][j]]) {
               ++cnt[A[i][j]];
               break;
            }
         }
      }
      int z = max_element(cnt.begin(), cnt.end()) - cnt.begin();
      ans = min(ans, cnt[z]);
      ban[z] = true;
   }
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  ll a,b,c,k;
  scanf("%lld%lld%lld%lld", &a,&b,&c,&k);
  
  if(k%2==0) cout << (a-b) << endl;
  else cout << b-a << endl;


}



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

using namespace std;

const int N = 2e5 + 8;
int n , a[N] , l = -1 , r , mid , v , q;
pair<int, int> k , z;
set<pair<int , int> > s;

bool is_val(int x)
{
	s.clear();
	s.insert({0 , 0});
	for(int i = 1 ; i < n ; i++)
	{
		k = *s.rbegin();
		if(a[i] > a[i - 1])
		{
			if(k.second != 0)
				s.insert({a[i - 1] + 1 , 0});
		}
		else
		{
			while(s.size() && s.rbegin()-> first > a[i])
				s.erase(*s.rbegin());
			v = s.rbegin()-> second , q = s.rbegin()-> first;
			if(v != x)
			{
				if(s.rbegin()->first == a[i])
					s.erase(*s.rbegin());
				if(s.empty() || (s.size() && s.rbegin()->second != v + 1))
					s.insert({a[i] , v + 1});
			}
			else
			{
				if(q == 0)
					return 0;
				s.erase(*s.rbegin());
				z = *s.rbegin();
				if(z.first + 1 == q)
					s.erase(*s.rbegin());
				if(s.empty() || (s.size() && s.rbegin()->second != z.second + 1))
					s.insert({q - 1 , z.second + 1});
				s.insert({q , 0});
			}
		}
	}
	return 1;
}

int main()
{
	cin >> n;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> a[i];
		a[i]--;
	}
	r = n;
	while(r - l > 1)
	{
		mid = (l + r) / 2;
		if(is_val(mid))
			r = mid;
		else
			l = mid;
	}
	cout << r + 1;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,m,a,cnt,i;
	scanf("%d %d",&n,&m);
	cnt=0;
	for(i=0;i<m;i++)	{
		scanf("%d",&a);
		if(a>m)	cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}


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

int main(){
int n;
  cin >> n;
int j;  
int a[100000];
  for(int i=0;i<n;i++) cin >> a[i];
sort(a,a+n);
  int res=0,f;
  while(j<n){
   int cc=a[j];
    f=0;
    while(j<n && a[j]==cc){
      j++;
      f++;     
      }
    res+=f%2;
  
  }
  cout << res << endl;


}


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

  string s,t;
  cin >>s >>t;
  
  bool ans=0;
  int a=-1;
  for(int i=0; i<(s.size()-t.size()+1); i++){
    ans=1;
  	for(int j=0; j<t.size(); j++){
    	if(s[i+j]!=t[j] && s[i+j]!='?') {ans=0; break;}
    }
    if(ans) a=i;
  }

  if(a==-1) cout << "UNRESTORABLE" << endl;
  else{
  	for(int i=a; i<a+t.size(); i++){
    	s[i]=t[i-a];
    }
    for(int i=0; i<s.size(); i++) if(s[i]=='?') s[i]='a';
    cout << s << endl;
  }
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans[ohara],a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>x;
    rep(i,n)cin>>a[i];
    ans[1]=0;
    rrep(i,1,n+1){
        ans[i]=ans[i-1]+a[i-1];
    }
    rep(i,n+1){
        if(ans[i]<=x)cnt++;
    }
    Cout(cnt);
    return 0;
}

Measured memory_bytes: 2304