akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include <iomanip>
#include <string.h>
#include <set>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LL MOD = 1000000007;
const int INF = 1000000007;
const LL LINF = 1LL * INF * INF;
const int MAXN = 1007;
const LD EPS = 1e-7;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("sparse.in", "r", stdin);
	//freopen("sparse.out", "w", stdout);
	int x, y;
	cin >> x >> y;
	if (x % y == 0)
		cout << -1;
	else
		cout << x;
	//cout << endl; system("pause");
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
b_nums = gets.split.map(&:to_i)
b_nums << 10 ** 6
a_nums = []
a_nums << b_nums.first

(1..n - 1).each do |index|
  a_nums << [b_nums[index - 1], b_nums[index]].min
end

puts a_nums.inject(:+)


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var p = ReadInts();
            var ans = 0;
            var max = p[0];
            var min = p[0];

            ans = 0;
            for (int i = 0; i < n; i++)
            {
                //WriteLine("i : " + i);
                //WriteLine("max : " + max);

                var boo = true;
                //WriteLine(p[i] + "<=" + max);
                if (p[i] <= max)
                {
                    if (p[i] <= min)
                    {
                        //WriteLine(1000000);
                    }
                    else
                    {
                        boo = false;
                    }
                }
                else
                {
                    boo = false;
                }

                if (boo)
                {
                    ans++;
                }
                max = Max(max, p[i]);
                min = Min(min, p[i]);
                //WriteLine("----------");
            }
            WriteLine(ans);
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 31068
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

ll imos[200001];
ll sum[200001];

int main() {
  ll n,D,A;
  while(input(n,D,A)) {
    ll ans = 0;
    vector<pii> v;
    REP(i,n) {
      int x,h;
      input(x,h);
      v.emplace_back(x, h);
    }
    REP(i,n+1)sum[i]=imos[i] = 0;
    sort(ALL(v));
    int idx = 0;
    REP(i,n) {
      while (idx<n && v[i].first >= v[idx].first - 2*D) {
        idx++;
      }
      sum[i] = (i?sum[i-1]:0) + imos[i];
      ll vv = max(0LL, v[i].second - sum[i]);
      // cout << vv << " " << sum[i] << endl;
      ll atack_num = (vv+A-1) / A;
      ll atack = atack_num * A;
      imos[i] += atack;
      imos[idx] -= atack;
      sum[i] += atack;
      ans += atack_num;
      //cout << tpl(i,idx,sum[i],atack_num) << endl;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 5104
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize,
        ss:[chars;n]
    }

    let f = |x: i64| x * (x - 1) / 2;
    let mut mp = BTreeMap::new();
    for i in 0..n {
        let mut s = ss[i].clone();
        s.sort();
        *mp.entry(s).or_insert(0) += 1;
    }

    let ans = mp.iter().map(|tup| f(*tup.1)).sum::<i64>();
    println!("{}", ans);
}


Measured memory_bytes: 24956
import numpy as np
from collections import defaultdict
from operator import itemgetter
import sys

input = sys.stdin.readline

MOD = 10 ** 9 + 7


d = defaultdict(list)

N = int(input())
for i in range(N):
    C = int(input())
    d[C].append(i)

pairs = []
for c, indices in d.items():
    for i in range(len(indices) - 1):
        if indices[i+1] - indices[i] > 1:
            pairs.append((indices[i], indices[i+1]))

pairs.sort(key = itemgetter(1))   


dp = np.zeros(N, np.int64)
dp[0] = 1
index = 0
for i in range(1, N):
    dp[i] = dp[i-1]
    while index < len(pairs) and pairs[index][1] == i:
        dp[i] += dp[pairs[index][0]] 
        index += 1
    dp[i] %= MOD

print(dp[-1])
        




Measured memory_bytes: 60980
#include <stdio.h>
int main(){
	int a,b,i;
	double c;
	while(scanf("%d%d",&a,&b)!=EOF){
		c=a+b;
		i=0;
		while(1){
		c=c/10;
		i++;
		if(c<1)break;
		}
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 600
from queue import Queue

H, W = [int(x) for x in input().split()]
realH = H + 2
realW = W + 2
s = ["#" + input() + "#" for x in range(H)]
wall = "#" * (realW)
s.insert(0, wall)
s.append(wall)
dxy = [0, 1, 0, -1, 0]
inf = float("inf")

visited = [[False] * realW for x in range(realH)]
depth = [[inf] * realW for x in range(realH)]
depth[1][1] = 1
q = Queue()
q.put((1,1))

while not q.empty():
    place = q.get()
    if place == (H, W):
        break
    for i in range(4):
        nxt = (place[0] + dxy[i], place[1] + dxy[i+1])
        if s[nxt[0]][nxt[1]] == "." and not visited[nxt[0]][nxt[1]]:
            q.put(nxt)
            depth[nxt[0]][nxt[1]] = depth[place[0]][place[1]] + 1
            visited[nxt[0]][nxt[1]] = True

if depth[H][W] == inf:
    print(-1)
else:
    print(realH * realW - sum(map(lambda x: x.count("#"), s)) - depth[H][W])



Measured memory_bytes: 4336
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>

#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

string s;
int ans = 700;

int main() {
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'o')ans += 100;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// AOJ ALDS1_6_C Quick Sort
// 2018.5.1 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

char buf[20];
void mypr(int n)
{
	int i;
	if (!n) { pc('0'); return; }
	i = 0; while (n) buf[i++] = n%10 + '0', n/=10;
	while (i--) pc(buf[i]); 
}

typedef struct { char c; int a; int id; } DATA;

int partition(DATA *a, int lo, int hi)
{
	int i, j;
	int key;
	DATA t;
	
	key = a[hi].a, i = lo-1;
	for (j = lo; j < hi; j++) {
		if (a[j].a <= key) i++, t = a[i], a[i] = a[j], a[j] = t;
	}
	t = a[++i], a[i] = a[hi], a[hi] = t;
	return i;
}

void quick_sort(DATA *a, int lo, int hi)
{
	int mi;

	if (lo < hi) {
		mi = partition(a, lo, hi);
		quick_sort(a, lo, mi-1);
		quick_sort(a, mi+1, hi);
	}
}

DATA a[100002];

int main()
{
	int N, i, f;

	N = in();
	for (i = 0; i < N; i++) {
		a[i].c = gc(), gc();
		a[i].a = in(), a[i].id = i;
	}
	quick_sort(a, 0, N-1);
	f = 0; for (i = 1; i < N; i++) {
		if (a[i-1].a == a[i].a && a[i-1].id > a[i].id) { f = 1; break; }
	}
	puts(f? "Not stable": "Stable");
	for (i = 0; i < N; i++) {
		pc(a[i].c), pc(' '), mypr(a[i].a), pc('\n');
	}
	return 0;
}


Measured memory_bytes: 2772
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		    Scanner sc = new Scanner(System.in);

		    int N = sc.nextInt();
		    int T = sc.nextInt();
		    int[] c = new int[N];
		    int[] t = new int[N];
		    int mincost = 10000;
		    
		    for(int i = 0; i < N; i++) {
		    	c[i] = sc.nextInt();
		    	t[i] = sc.nextInt();
		    	if(t[i] > T) {
		    		continue;
		    	}
		    	else {
		    		if(c[i] < mincost) {
		    			mincost = c[i];
		    		}
		    	}
		    }
		    if(mincost > 1000) {
		    	System.out.println("TLE");
		    }
		    else {
		    	System.out.println(mincost);
		    }
		    
		    sc.close(); }
}


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

int main() {
  string A;
  cin >> A;

  if ((A[0] == A[1]) and (A[0] == A[2])){
    cout << "Yes" << endl;
  }
  else if ((A[3] == A[1]) and (A[3] == A[2])){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,a[1000001],sum;
bool exist1;
string in;
int cnt2(int a){
    int res=0;
    while(a>0){
        res+=a/2;
        a/=2;
    }
    return res;
}
signed main(){
    cin>>n>>in;
    rep(i,n)a[i]=in[i]-'1';
    rep(i,n)if(a[i]==1)exist1=true;
    if(!exist1){
        rep(i,n)a[i]/=2;
    }
    rep(i,n){
        if(cnt2(n-1)<=cnt2(i)+cnt2(n-i-1))sum+=a[i];
    }
    sum%=2;
    if(exist1)cout<<sum<<endl;
    else cout<<sum*2<<endl;
    return 0;
}


Measured memory_bytes: 9476
#include <bits/stdc++.h>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	long long int A[3010] = {}; 
	long long int sum = 0; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
		sum += A[i]; 
	}
	long long int dp[3010][3010] = {}; //dp[上からi枚とった][下からj枚とった] = 残りの太郎のmax
	for(int s = N - 1; s >= 0; s--){
		for(int i = 0; i <= s; i++){
			int j = s - i; 
			if(s % 2 == 1){ // 次は二郎君
				dp[i][j] = min(dp[i+1][j], dp[i][j+1]); 
			}
			if(s % 2 == 0){ // 次は太郎君．上からi+1枚目or下からj+1枚目
				dp[i][j] = max(A[i] + dp[i+1][j], A[N-j-1] + dp[i][j+1]); 
			}
		}
	}
	cout << dp[0][0] * 2 - sum << endl; 
}

Measured memory_bytes: 71168
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int y = Integer.parseInt(s.substring(0,4));
		int m = Integer.parseInt(s.substring(5,7));
		int d = Integer.parseInt(s.substring(8,10));
		if(y<2019||(y==2019 && m<=4)) System.out.println("Heisei");
		else System.out.println("TBD");
		return;
	}
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> L(m), R(m);
  int s = 1, e = n; 
  for(int i = 0; i < m; i++) {
    cin >> L.at(i) >> R.at(i);
    if(e < L.at(i) || s > R.at(i)) {
      cout << 0;
      exit(0);
    }
    if(L.at(i) > s && e >= L.at(i))s += abs(L.at(i) - s);
    if(e > R.at(i) && R.at(i) >= s)e -= abs(e - R.at(i));
  }
  cout << e - s + 1;
}

Measured memory_bytes: 1024
M, D = map(int, input().split())

c = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        if d >= 10:
            d1 = int(str(d)[1])
            d10 = int(str(d)[0])
            if d1 >= 2 and d10 >= 2 and d1*d10==m:
                c += 1
print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    string s;
    cin >> s;
    ll q;
    cin >> q;
    REP(i, q){
        string order;
        ll a, b;
        cin >> order >> a >> b;
        if(order == "print"){
            cout << s.substr(a, b - a + 1) << endl;
        }else if(order == "reverse"){
            string tmp = s.substr(a, b - a + 1);
            reverse(tmp.begin(), tmp.end());
            s.replace(a, tmp.size(), tmp);
        }else{ // replace
            string p;
            cin >> p;
            s.replace(a, p.size(), p);
        }
    }
    return 0;
}



Measured memory_bytes: 3216
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Twin_string ts = new Twin_string(sc.next());
		int q = sc.nextInt();
		int t, f;
		boolean reverse = false;
		for (int i = 0; i < q; i++) {
			t = sc.nextInt();
			if(t==1) {
				reverse = !reverse;
			}else {
				f = sc.nextInt();
				String c = sc.next();
				if((!reverse&&f==1)||(reverse&&f==2)) ts.addFirst(c);
				else ts.addLast(c);;
			}
		}
		System.out.println(ts.toString(reverse));
		sc.close();
	}
	public static class Twin_string{
		StringBuilder sb1;
		StringBuilder sb2;
		public Twin_string(String s) {
			sb1 = new StringBuilder();
			sb2 = new StringBuilder(s);
		}
		public void addFirst(String s) {
			sb1.append(s);
		}
		public void addLast(String s) {
			sb2.append(s);
		}
		public String toString(boolean reverse) {
			if(reverse) {
				return new String(sb2.reverse()) + new String(sb1);
			}else {
				return new String(sb1.reverse()) + new String(sb2);
			}
		}
	}
}

Measured memory_bytes: 120268
#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
  int N;
  cin >> N;
  
  vector<double> value(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> value.at(i);
  }
  
  sort(value.begin(), value.end());
  double s = (value.at(0) + value.at(1)) / 2;
  if (N >= 3) {
    for (int i = 2; i < N; i++) {
      s = (s + value.at(i)) / 2;
    }
  }
  
  cout << s;
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
        int a, b, c;
        int ans;

        scanf("%d%d%d", &a, &b, &c);

        ans = c - (a - b);

        if(ans < 0){
                ans = 0;
        }

        printf("%d\n", ans);

        return 0;
}

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


void solve(long long N, std::vector<long long> V, std::vector<long long> C){
  long long acc = 0;
  for(long long i = 0; i < N; i++){
    if(V[i] - C[i] > 0) acc += (V[i] - C[i]);
  }

  cout << acc << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> V(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&V[i]);
  }
  std::vector<long long> C(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&C[i]);
  }
    solve(N, std::move(V), std::move(C));
    return 0;
}


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

using namespace std;
int N,K;
typedef pair <int,int> P;
vector<int> G[100001];
int dist[100001];
int main() {

  cin >> N;
  for(int i = 0; i < N-1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  cin >> K;
  priority_queue<P,vector<P>, greater<P> > Q;
  fill(dist,dist+N,-1);
  for(int i = 0; i < K; i++) {
    int v,p;
    cin >> v >> p;
    v--;
    dist[v] = p;
    Q.push(P(p,v));
  }

  while(!Q.empty()) {
    P p = Q.top(); Q.pop();
    for(int i = 0; i < G[p.second].size(); i++) {
      if(dist[G[p.second][i]] == -1) {
	dist[G[p.second][i]] = p.first+1;
	Q.push(P(dist[G[p.second][i]],G[p.second][i]));
      }

      else if (dist[G[p.second][i]]) {
	if(abs(dist[G[p.second][i]] - p.first) != 1) {
	  cout << "No" <<endl; return 0;
	}
      }
    }
  }

  cout << "Yes" <<endl;
  for(int i = 0; i < N; i++) cout << dist[i] <<endl;
}
    
  



Measured memory_bytes: 7924
#include<iostream>
#include<algorithm>
#include<queue>
using lint=long long;
using namespace std;

const int dw[]={1,0,-1,0};
const int dh[]={0,-1,0,1};

class info
{
	public:
	int h,w,dist;
};

int main()
{
	int H,W;
	char s[55][55];
	int wcnt=0;
	
	cin >> H >> W;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			cin >> s[i][j];
			if(s[i][j]=='.')
				wcnt++;
		}
	}
	
	queue<info> q;
	q.push({0,0,1});
	int dist=-1;
	while(!q.empty())
	{
		info cur=q.front();
		q.pop();
		
		if(cur.h==H-1 && cur.w==W-1)
		{
			dist=cur.dist;
			break;
		}
		
		for(int i=0;i<4;i++)
		{
			int nh=cur.h+dh[i];
			int nw=cur.w+dw[i];
			if(nh<0 || nw<0 || nh>=H || nw>=W)continue;
			if(s[nh][nw]=='.')
			{
				q.push({nh,nw,cur.dist+1});
				s[nh][nw]='#';
			}
		}
	}
	
	if(dist==-1)
		cout << -1;
	else
		cout << wcnt-dist;
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	l := scanInt(sc)
	k := int64(scanInt(sc))
	aSeq := make([]int, l)
	for i := 0; i < l; i++ {
		aSeq[i] = scanInt(sc)
	}

	// A 内の転倒数
	p := int64(0)
	for a := 0; a < l-1; a++ {
		for b := a + 1; b < l; b++ {
			if aSeq[a] > aSeq[b] {
				p += 1
			}
		}
	}

	// 2つの A を並べた時の転倒数
	q := int64(0)
	for a := 0; a < l; a++ {
		for b := 0; b < l; b++ {
			if aSeq[a] > aSeq[b] {
				q += 1
			}
		}
	}

	// 両方の合計が全体の転倒数になる。
	md := int64(1000000000 + 7)
	totalP := (p * (k % md)) % md
	totalQ := (q * ((k * (k - 1) / 2) % md)) % md
	total := (totalP + totalQ) % md

	fmt.Println(total)
}

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


Measured memory_bytes: 640
#include <stdio.h>

int bus[24][60];

int main(void)
{
    int i, j;
    int f = 0;

    scanf("%d", &i);
    while (i-- > 0){
        int h, m;

        scanf("%d %d", &h, &m);
        bus[h][m] = 1;
    }
    scanf("%d", &i);
    while (i-- > 0){
        int h, m;

        scanf("%d %d", &h, &m);
        bus[h][m] = 1;
    }

    for (i = 0; i < 24; i++){
        for (j = 0; j < 60; j++){
            if (bus[i][j]){
                if (f){
                    printf(" %d:%02d", i, j);
                }
                else {
                    printf("%d:%02d", i, j);
                    f = 1;
                }
            }
        }
    }
    puts("");

    return 0;
}

Measured memory_bytes: 624
main :: IO ()
main = do
    l1 <- getLine
    l2 <- getLine
    let a = map read $ words l2 :: [Integer]
    print $ f 1 a

f y [] = if y > 10 ^ 18
	then -1
    else y
f y (x:xs) = if y > 10 ^ 18
    then (if 0 `elem` xs then 0 else -1)
    else f (y*x) xs


Measured memory_bytes: 64224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<ll> cost(m);
  vector<ll> val(m);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    cost[i] = a;
    rep(j, b) {
      int c;
      cin >> c;
      c--;
      val[i] += 1<<c;
    }
  }
  vector<vector<ll>> dp(m+1, vector<ll>(1<<n, longinf));
  dp[0][0] = 0;
  rep(i, m) rep(j, 1<<n) {
    dp[i+1][j] = min(dp[i][j], dp[i+1][j]);
    dp[i+1][j|val[i]] = min(dp[i][j]+cost[i], dp[i+1][j|val[i]]);
  }
  cout << (dp[m][(1<<n)-1]==longinf ? -1 : dp[m][(1<<n)-1]) << "\n";
  return 0;
}


Measured memory_bytes: 35328
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//BELOW
void solve(void)
{
  int n;
  cin >> n;
  int t_sum = 0;
  vector<int> t(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> t[i];
    t_sum += t[i];
  }
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
  }
  vector<int> smax(t_sum + 1, 0);
  int ct = 1;
  smax[0] = v[0];
  smax[t_sum] = v.back();
  for (int i = 0; i < n; i++)
  {
    int tt = t[i];
    while (tt > 0)
    {
      smax[ct - 1] = v[i];
      ct++;
      tt--;
    }
  }
  // DEBUG(smax);

  vector<double> s1(t_sum * 2 + 1, 0);
  for (int i = 1; i <= 2 * t_sum; i++)
  {
    s1[i] = min(s1[i - 1] + 0.5, (double)smax[(i - 1) / 2]);
  }
  // DEBUG(smax);
  vector<double> s2(2 * t_sum + 1, 0);
  for (int i = 2 * t_sum - 1; i >= 0; i--)
  {
    s2[i] = min(s2[i + 1] + 0.5, (double)smax[(i) / 2]);
  }

  vector<double> speed(2 * t_sum + 1, 0);
  for (int i = 0; i < 2 * t_sum; i++)
  {
    speed[i] = min(s1[i], s2[i]);
  }

  // for (int i = 0; i < 2 * t_sum + 1; i++)
  // {
  //   cout << speed[i] << " " << s1[i] << " " << s2[i] << " " << i << endl;
  // }

  // DEBUG(speed);
  double dist = 0;
  for (int i = 0; i < 2 * t_sum; i++)
  {
    double a = speed[i] + speed[i + 1];
    dist += a / 2 / 2;
  }
  cout << dist << endl;

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    long long ma, mi;

    mi = a.at(0);
    ma = a.at(n - 1);
    if (n > 2)
    {
        for (int i = 1; i < n - 1; i++)
        {
            if (a.at(i) < 0)
            {
                ma = ma - a.at(i);
            }
            else
            {
                mi = mi - a.at(i);
            }
        }
    }
    cout << ma - mi << endl;

    mi = a.at(0);
    ma = a.at(n - 1);
    if (n > 2)
    {
        for (int i = 1; i < n - 1; i++)
        {
            if (a.at(i) < 0)
            {
                cout << ma << " " << a.at(i) << endl;
                ma = ma - a.at(i);
            }
            else
            {
                cout << mi << " " << a.at(i) << endl;
                mi = mi - a.at(i);
            }
        }
    }
    cout << ma << " " << mi << endl;
}

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

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

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

constexpr ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int bfs(pair<int,int> s,pair<int,int> g,const vector<string>& maze){
    queue<pair<int,int>> que;
    que.push(s);
    int h = maze.size();
    int w = maze[0].size();
    vector<vector<int>> c(h,vector<int>(w,-1));
    c[s.first][s.second] = 0;
    while(!que.empty()){
        auto t = que.front();
        que.pop();
        int y = t.first, x = t.second;
        for(int i = 0; i<4; i++){
            int ny = y+dy[i], nx = x+dx[i];
            if(0<=ny && ny < h && 0<= nx && nx < w && maze[ny][nx]!='#' && c[ny][nx]<0){
                que.push(make_pair(ny,nx));
                c[ny][nx] = c[y][x]+1;
            }
        }
    }
    return c[g.first][g.second];
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans = 0;
    rep(i,h) rep(j,w) rep(k,h) rep(l,w){
        if(s[i][j]=='#' || s[k][l]=='#') continue;
        int result = bfs(make_pair(i,j),make_pair(k,l),s);
        ans = max(ans,result);
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int,input().split())
dx = tx-sx
dy = ty-sy
dxp1 = dx+1
dyp1 = dy+1
route = "R"*dx+"U"*dy+"L"*dx+"D"*dy + "L" + "U"*dyp1 + "R"*dxp1 + "D" + "R" + "D"*dyp1 + "L"*dxp1 + "U"
print(route)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n, m;
  cin >> n >> m;
  ll a = 1900 * m + 100 * (n - m);
  ll b = 1;
  rep(i,m){
    b *= 2;
  }
  ll ans = a * b;
  print(ans);
}


Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	static int keep = 0;
	static int[] num = new int[500];
	
	public static void push(int x){
		keep++;
		num[keep] = x;
	}
	
	public static int pop(){
		keep--;
		return num[keep+1];
	}
	
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		String lineHold = scan.nextLine();
		
		String[] operations = lineHold.split(" ");
		for (int i = 0; i < operations.length; i++){
			if(operations[i].equals("+")){
				int x = pop();
				int y = pop();
				push(x+y);
			}
			else if (operations[i].equals("-")){
				int x = pop();
				int y = pop();
				push(y-x);
			}
			else if (operations[i].equals("*")){
				int x = pop();
				int y = pop();
				push(x*y);
			}
			else{
				push(Integer.parseInt(operations[i]));
			}
		}
		
		System.out.println(pop());
	}
	
	
}




Measured memory_bytes: 26184
#include <iostream>
#include <algorithm>
#include <vector>
#include <cctype>

using namespace std;

inline int prev(int idx, int size) { idx--; if(idx < 0) idx = size-1; return idx; }
inline void adv(int& idx, int size) { idx++; if(idx == size) idx = 0; }


inline bool isNumber(const string& s, int& ret) {
  ret = -1;
  int tmp = 0;
  int const size=s.size();
  for(int i=0; i<size; i++) {
    if(!isdigit(s[i])) return false;
    (tmp *= 10) += s[i]-'0';
  }
  ret = tmp;
  return true;
}

void rem(vector<int>& player, int& idx) {
  adv(idx, player.size());
  player.erase(player.begin()+prev(idx, player.size()));
  if(player.size()==1) idx = 0;
  else if(idx!=0) idx--;
}

int main() {
  
  int M, N;
  while(cin >> M >> N && (M|N)) {
    int idx = 0;
    vector<int> player(M);
    for(int i=0; i<M; i++) player[i] = i+1;
    for(int fcnt=1; fcnt<=N; fcnt++) {
      string s; cin >> s;
      if(player.size() == 1) continue;
      int num;
      if(s == "Fizz" && fcnt % 3 != 0) rem(player, idx);
      else if(s == "Buzz" && fcnt % 5 != 0) rem(player, idx);
      else if(s == "FizzBuzz" && fcnt % 15 != 0) rem(player, idx);
      else if(isNumber(s, num)) {
        if(num != fcnt) rem(player, idx);
        else if(num % 3 == 0) rem(player, idx);
        else if(num % 5 == 0) rem(player, idx);
        else if(num % 15 == 0) rem(player, idx);
        else adv(idx, player.size());
      }
      else {
        if(s == "Fizz" || s == "Buzz" || s == "FizzBuzz") adv(idx, player.size());
        else rem(player, idx);
      }
    }
    for(int i=0; i<player.size(); i++) {
      if(i) cout << " ";
      cout << player[i];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1236
#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;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
  int N,P;cin>>N>>P;
  string S;cin>>S;
  if(P == 2) {
    ll cnt = 0;
    rep(i,N) {
      int now = S[i] - '0';
      if(now % 2 == 0) {
	cnt += i + 1;
      }
    }
    cout<<cnt<<endl;
    return 0;
  } else if(P == 5) {
    ll cnt = 0;
    rep(i,N) {
      int now = S[i] - '0';          
      if(now % 5 == 0) {
	cnt += i + 1;
      }
    }
    cout<<cnt<<endl;
    return 0;
  }
  vector<int> r(N+1,0);
  int ten = 1;
  map<int,ll> dic;
  rep(i,N) {
    r[i+1] = (r[i] + (ten * (S[N-1-i] - '0'))) % P;
    dic[r[i+1]]++;
    ten = (ten * 10) % P;
  }
  ll ans = 0;
  for(auto it = dic.begin();it != dic.end(); ++it) {
    //    cout << it->first << " " << it->second << endl;
    ans += ((it->second) * (it->second - 1) / 2);
    if(it->first == 0) ans += it->second;
  }
  cout << ans << endl; 
}


Measured memory_bytes: 4976
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        int w = tx - sx;
        int h = ty - sy;

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < h; i++) {
            sb.append('U');
        }
        for (int i = 0; i < w; i++) {
            sb.append('R');
        }
        for (int i = 0; i < h; i++) {
            sb.append('D');
        }
        for (int i = 0; i < w; i++) {
            sb.append('L');
        }
        sb.append('L');
        for (int i = 0; i < h+1; i++) {
            sb.append('U');
        }
        for (int i = 0; i < w+1; i++) {
            sb.append('R');
        }
        sb.append('D');
        sb.append('R');
        for (int i = 0; i < h+1; i++) {
            sb.append('D');
        }
        for (int i = 0; i < w+1; i++) {
            sb.append('L');
        }
        sb.append('U');
        System.out.println(sb);

    }
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int n,k;cin>>n>>k;


  int sum=0;
  rep(i,0,n){
    int x;cin>>x;

    sum+=min(2*x,2*abs(x-k));
  }

  out(sum);

  return 0;
}


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

int main()
{
 int a, b;
 int ans=0;
 cin>>a>>b;
 for(int i=a;i<b+1;i++){
   string s = to_string(i);
   if((s[0]==s[4])&&(s[1]==s[3])) ans++;
 }
 cout<<ans;
  return 0;
}

Measured memory_bytes: 256
import math
N = int(input())
res = float('Inf')
M = int(math.sqrt(N))
for A in range(1, M+1):
    if N % A == 0:
        B = int(N / A)
        a = len(str(A))
        b = len(str(B))
        c = max(a, b)
        if res > c:
            res = c
print(res)

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

n,k=map(int,input().split())
A=list(map(int,input().split()))
F=list(map(int,input().split()))
A.sort()
F.sort(reverse=True)
left=0
right=10**12+1
ok=inf
while left<right:
    mid=(left+right)//2
    # print(mid)
    tmp=0
    for i in range(n):
        tmp+=max(0,A[i]-mid//F[i])
    if tmp>k:
        left=mid+1
    else:
        right=mid
        ok=min(ok,mid)
print(ok)


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

namespace Atcoder
{
    public class Program
    {
        private static long mod = 1000000007;

        static void Main(string[] args)
        {
            var r = ReadSplit();
            var x = r[0].Int();
            var y = r[1].Int();
            if (x * 4 < y)
            {
                WriteRead("No");
                return;
            }
            if (((y - 2 * x) / 2) < 0)
            {
                WriteRead("No");
                return;
            }
            if ((y - 2 * x) % 2 == 0)
            {
                WriteRead("Yes");
            }
            else
            {
                WriteRead("No");
            }
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios::sync_with_stdio(false)
#define pb push_back
#define mp make_pair
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) (x).begin(), (x).end()
#define uint usigned int
typedef vector <ll> vi;
ll mod=1e9+7;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n,m,k,x,i,y,j,z,ans=0,sum=0,c=0;
	char s;
	cin>>s;
	if(s=='A') cout<<"T";
	if(s=='T') cout<<"A";
	if(s=='C') cout<<"G";
	if(s=='G') cout<<"C";
    return 0; 
}

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


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

	stack<int>	S;
	string		s;
	while (cin >> s)
	{
		int	a, b;
		if (s == "+" || s == "-" || s == "*")
		{
			b = S.top();
			S.pop();
			a = S.top();
			S.pop();
			if (s == "+")
				S.push(a + b);
			else if (s == "-")
				S.push(a - b);
			else
				S.push(a * b);
		}
		else
			S.push(stoi(s));
	}
	cout << S.top() << endl;
}



Measured memory_bytes: 3256
#include <iostream>
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#include <cstdio>
#include <math.h>
#include <map>
#include <algorithm>
#include <deque>
#include <stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int>pa;
const int N =2e5+100;
const int inf=0x3f3f3f3f;


int main()
{
   int n;scanf("%d",&n);
   int a[N];
   for(int i=1;i<=n;i++) scanf("%d",&a[i]);
   if(n&1){
    printf("0\n");
    return 0;
   }
   sort(a+1,a+n+1);
   int k=n/2;
   int f=0;
   for(int i=k;i<n;i++){
      if(a[i+1]!=a[i]) break;
      else {
        f=1;break;
      }
   }
   if(f){
      printf("0\n");
    return 0;
   }
   printf("%d\n",a[k+1]-a[k]);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9 + 7;
int INF = 2e18;

signed main() {
    string S;
    cin >> S;
    bool check = true;
    for (int i = 0; i < S.length(); i++) {
        if (i % 2 == 0) {
            if (!(S[i] == 'R' || S[i] == 'U' || S[i] == 'D')) check = false;
        } else {
            if (!(S[i] == 'L' || S[i] == 'U' || S[i] == 'D')) check = false;
        }
    }
    cout << (check ? "Yes" : "No") << endl;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int a[100000], b[100000];
vector<int> all;

int main() {
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    forn(i, n) scanf("%d", b + i);
    LL sum = 0;
    forn(i, n) sum += a[i] - b[i];
    if (sum < 0) {
        cout << -1 << endl;
        return 0;
    }
    sum = 0;
    int cnt = 0;
    forn(i, n) if (a[i] < b[i]) {
        sum += b[i] - a[i];
        cnt += 1;
    }
    forn(i, n) if (a[i] > b[i]) {
        all.pb(a[i] - b[i]);
    }
    sort(all.begin(), all.end());
    reverse(all.begin(), all.end());
    for (int x : all) {
        if (sum > 0) {
            ++cnt;
            sum -= x;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int t;
    cin >> t;

    while (t--) {
        int n;
        cin >> n;

        vector<ll> a(n);
        REP(i, n) cin >> a[i];

        string s;
        cin >> s;

        int ans = 0;
        vector<ll> dp;
        for (int i = n; i--;) {
            for (auto j : dp) a[i] = min(a[i], a[i]^j);
            if (s[i] == '0') {
                if (a[i]) dp.push_back(a[i]);
            } else if (a[i]) {
                ans = 1;
                break ;
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3580
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    long long sum=0;
    sum+=min(a,d);
    d=d-a-b;
    if(d>0){
        sum-=d;
    }
    cout<<sum<<endl;
    
}



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int H,W;
  cin>>H>>W;
  for(int i=0;i<H;i++){
    string s;
    cin>>s;
    cout<<s<<endl<<s<<endl;
  }
  return 0;
}


Measured memory_bytes: 256