akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int n, k;
ll a[20];
ll maxs[20][20];

signed main() {

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

    for(int i = 0; i < n; i++) 
        for(int j = i; j < n; j++) 
            for(int k = i; k <= j; k++) chmax(maxs[i][j], a[k]);

    ll miv = LINF;
    
    for(int bit = 0; bit < (1 << n); bit++) {
        ll count = 1, macs = 0, sum = 0;
        for(int i = 1, p = 0; i < n; i++) {
            if(max(macs,maxs[p][i-1]) < a[i])
                count++;
            else if(bit&(1<<i)) {
                count++;
                sum += (macs = max(macs, maxs[p][i-1]) + 1) - a[i];
                p = i;
            }
        }
        if(count >= k) {
            chmin(miv, sum);
        }
    }

    cout << miv << endl;
    
    return 0;
}



Measured memory_bytes: 256
S = input()

a,b = 0,0
for i,c in enumerate(S):
  if i % 2 == 0:
    if c == '1':
      a += 1
    else:
      b += 1
  else:
    if c == '0':
      a += 1
    else:
      b += 1

print(min(a,b))

Measured memory_bytes: 3316
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

MOD = 10 ** 4 + 7

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

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(A - 1, N - B) + 1 + (B - A - 1) // 2)

Measured memory_bytes: 9464
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;

 int main()
 {
   string str;
   getline(cin,str);
   string result;
   for(int i=0;i<str.length();i++)
   {
     if(str[i]>='a'&&str[i]<='z') str[i]=('A'+(str[i]-'a'));
     else if(str[i]>='A'&&str[i]<='Z') str[i]=('a'+(str[i]-'A'));
     result+=str[i];          
   } 
   cout<<result<<endl;
   //while(1);
   return 0;
 }
 
 

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

using namespace std;
const int mod=1e9+7;
typedef long long ll;
const int maxn=4e5+100;
ll qpow(ll x,ll y){
    ll sum=1;
    while(y){
        if(y&1)
            sum=sum*x%mod;
        y/=2;
        x=x*x%mod;
    }
    return sum;
}
ll C(ll n,ll m){
    ll low=min(m,n-m);
    ll H=1,L=1;
    for(int i=n-low+1;i<=n;i++)
        H=H*i%mod;
    for(int i=1;i<=low;i++)
        L=L*i%mod;
    return H*qpow(L,mod-2)%mod;
}
int main()
{
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    printf("%lld\n",((qpow(2,n)-1-C(n,a)-C(n,b))%mod+mod)%mod);
    return 0;
}
/*
*/



Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# a〜z -- START --
alf1=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
# a〜z --- END ---

# A~Z -- START --
alf2=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
# A~Z --- END ---

def main():
  s=S()
  if s in alf1:
    return 'a'
  return 'A'

# main()
print(main())


Measured memory_bytes: 10592
#include<bits/stdc++.h>
#define MAXN 13
#define MAXM 550005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
string str;
int ans[MAXM];
int curdigit[MAXN],curres[MAXN];
string reduce(string &t)
{
    vector<char> st;
    string ret="";
    for(auto ch:t)
    {
        st.push_back(ch);
        if(st.size()>=2&&st[(int)st.size()-1]=='S'&&st[(int)st.size()-2]=='S') st.pop_back(),st.pop_back();
    }
    for(auto ch:st) ret+=ch;
    return ret;
}
void update_ans()
{
    int x=0,y=0;
    for(int i=n-1;i>=0;i--)
    {
        x=x*3+curdigit[i];
        y=y*3+curres[i];
    }
    ans[x]=y;
}
void solve(int cur,string t)
{
    if(cur==n) 
    {
        update_ans();
        return;
    }
    for(int d=0;d<3;d++)
    {
        string curt="";
        int curd=d;
        for(auto ch:t)
        {
            if(ch=='S')
            {
                if(curd) curd=3-curd;
                curt+='S';
            }
            if(ch=='R')
            {
                curd++;
                if(curd==3)
                {
                    curd=0;
                    curt+='R';
                }
            }
        }
        curdigit[cur]=d;
        curres[cur]=curd;
        solve(cur+1,reduce(curt));
    }
}
int main()
{
    scanf("%d",&n);
    cin>>str;
    solve(0,reduce(str));
    int p=1;
    for(int i=0;i<n;i++) p=p*3;
    for(int i=0;i<p;i++) printf("%d ",ans[i]);
    return 0;
}

Measured memory_bytes: 6672
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,a[100000],x,y;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
x=a[n/2-1];
y=a[n/2];
cout<<(y-x);
}


Measured memory_bytes: 1024
a[51],i,j;main(n){for(;scanf("%d",&n)*n;){for(i=n;i;)scanf("%d",a+i--);for(i=n;i;i--){for(j=i;a[j-1]==a[j]+1;j--);i-j?printf("%d-",a[i]),i=j:0;printf("%d%c",a[i],i-1?32:10);}}}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define LL long long

int get_int(){int x;scanf("%d",&x);return x;}
LL get_LL(){LL x;scanf("%lld",&x);return x;}


const int maxn = 200005;
int n;

int w[maxn];
int b[maxn];

int main()
{
    n = get_int();
    memset(w,0,sizeof(w));
    memset(b,0,sizeof(b));

    string s;
    cin >> s;

    _for(i,1,n+1){
        w[i] = w[i-1];
        b[i] = b[i-1];
        if(s[i-1] == '.') w[i]++;
        else b[i]++;
    }

    w[n+1] = w[n];
    b[n+1] = b[n];

    int szw = w[n];
    int szb = b[n];
    int res = maxn;

    _for(i,0,n+2){
        int ans = b[i] + szw-w[i];
        res = min(res,ans);
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 2180
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int N;

int main(){
    cin>>N;
    out(double((N+1)/2)/double(N));
    
    
}


Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt =0
for i in range(1,n):
    if a[i]+a[i-1]>x:
        cnt+=(a[i]+a[i-1]-x)
        a[i] = max(0,a[i]-(a[i]+a[i-1]-x))
print(cnt)

Measured memory_bytes: 14068
#include <iostream>
using namespace std;
int main(){
	int A,B,ans = 0;
  	cin >> A >> B;
  
  	for(int i = 0;i<2;i++){
    	if(A>B){
        	ans += A;
        	A--;
        }
    	else{
        	ans += B;
        	B--;
        }
    }
  	cout << ans;
}

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

int SW( int n, int k ){
    int h[n+1], custo[n+1];
    int menor = (1 << 30);
    
    for(int i=1;i<=n;i++) {
        cin >> h[i]; 
    }
    
    custo[1] = 0;
    custo[2] = abs(h[2]-h[1]);

    for( int i=3;i<=n;i++ ) {
        menor = (1 << 30);
        for(int j=1;j<=k;j++){
            if( i-j>0 ){
            custo[i]=custo[i-j] + abs(h[i]-h[i-j]);
            }
            if( custo[i]<menor ){
                menor = custo[i];
            }
        }
        custo[i] = menor;
    }

    return custo[n];
}


int main() {
int n,k;

cin >> n >> k;

cout << SW(n,k) << endl;

}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	M := nextInt()
	h := make(intHeap, N)
	for i := 0; i < N; i++ {
		h[i] = nextInt()
	}

	heap.Init(&h)

	for i := 0; i < M; i++ {
		heap.Push(&h, heap.Pop(&h).(int)/2)
	}

	var ans int
	for _, v := range h {
		ans += v
	}

	fmt.Println(ans)
}

// Heap. ----------

type intHeap []int

func (h intHeap) Len() int           { return len(h) }
func (h intHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h intHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *intHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *intHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]

	return x
}

// ---------- Heap.

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 4736
#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
int N, M;
LL x[1010], y[1010], z[1010];
LL ans;
std::vector<LL> data[8];
int main(){
    std::cin >> N >> M;
    for(int i = 0; i < N; i++){
        std::cin >> x[i] >> y[i] >> z[i];
        data[0].push_back(x[i] + y[i] + z[i]);
        data[1].push_back(x[i] - y[i] + z[i]);
        data[2].push_back(x[i] + y[i] - z[i]);
        data[3].push_back(x[i] - y[i] - z[i]);
        data[4].push_back(- x[i] + y[i] + z[i]);
        data[5].push_back(- x[i] - y[i] + z[i]);
        data[6].push_back(- x[i] + y[i] - z[i]);
        data[7].push_back(- x[i] - y[i] - z[i]);
    }
    for(int i = 0; i < 8; i++){
        std::sort(data[i].rbegin(), data[i].rend());
        LL sum = 0;
        for(int j = 0; j < M; j++){
            sum += data[i][j];
        }
        ans = std::max(ans, sum);
    }
    std::cout << ans << std::endl;
    return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    string S;
    cin >> S;
    vector<char> T(q), D(q);
    rep(i, q) cin >> T[i] >> D[i];

    int left = 0, right = n;
    int t;
    while (left + 1 < right) {
        t = (left + right) / 2;

        int cur = t;
        bool check = false;
        rep(i, q) {
            if (T[i] == S[cur]) {
                if (D[i] == 'L') --cur;
                else ++cur;
            }
            if (cur == -1) {
                check = true;
                break;
            }
            if (cur == n) {
                break;
            }
        }

        if (check) left = t;
        else right = t;
    }

    int ans1 = right;

    left = 0, right = n;
    while (left + 1 < right) {
        t = (left + right) / 2;

        int cur2 = t;
        bool check = false;
        rep(i, q) {
            if (T[i] == S[cur2]) {
                if (D[i] == 'L') --cur2;
                else ++cur2;
            }
            if (cur2 == n) {
                check = true;
                break;
            }
            if (cur2 == -1) {
                break;
            }
        }

        if (check) right = t;
        else left = t;
    }

    int ans2 = left;

    cout << max(0, ans2 - ans1 + 1) << endl;

    return 0;
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  string s; cin >> s;
  if(s[0] == 'S') cout << "Cloudy" << endl;
  else if(s[0] == 'C') cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
N = int(input())
A, B = [], []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
A.reverse()
B.reverse()
count = 0
for i in range(N):
    now = A[i] + count
    if now % B[i] == 0:
        pass
    elif now < B[i]:
        count += B[i] - now
    else:
        count += B[i] - (now % B[i])

print(count)

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

int main() {
  string s;
  int count=0;
  cin >> s;
  for (int i=0; i<16; i++) {
    s+='o';
  }
  for (int i=0; i<15; i++) {
    if (s.at(i)=='o') {
      count++;
    }
  }
  if (count>=8) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
/*  cout <<count << endl;*/
}


Measured memory_bytes: 256
N = int(input())
if N > 6:
    P = int(N / 11)
    Q = N % 11
    if Q > 6:
        R = 2
    elif Q > 0 and 7 > Q:
        R = 1
    else:
        R = 0
    print(P * 2 + R)
else:
    print(1)


Measured memory_bytes: 2940
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	e = [Int[] for i in 1:n]
	g = Array{Int}(2,n-1)
	for i in 1:n-1
		g[:,i] = readline() |> split |> parseMap
		push!(e[g[1,i]],g[2,i])
		push!(e[g[2,i]],g[1,i])
	end
	d = Array{Int}(n)
	for i in 1:n
		d[i] = length(e[i])
	end
	m = indmax(d)
	c = readline() |> split |> parseMap
	c = sort(c,rev=true)
	stack=Int[m]
	vst = zeros(Int,n)
	vst[m] = shift!(c)
	while !isempty(stack)
		now = shift!(stack)
		for i in 1:length(e[now])
			if vst[e[now][i]] == 0
				vst[e[now][i]] = shift!(c)
				push!(stack,e[now][i])
			end
		end
	end
	s = 0
	for i in 1:n-1
		s += min(vst[g[1,i]],vst[g[2,i]])
	end
	println(s)
	for i in 1:n-1
		print(vst[i], " ")
	end
	println(vst[n])
end

main()

Measured memory_bytes: 176776
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repn(i,a,b) for (int i = a; i >=b ;i--)
#define MOD 1000000007


int main(){
ios::sync_with_stdio(0);
cin.tie(0);
    ll n;cin>>n;
    map<ll,ll>mp;
    ll tmp,sum=0;
    rep(i,0,n){
        cin>>tmp;
        mp[tmp]++;
        sum+=tmp;
    }
    ll q;cin>>q;
    while(q--){
        ll b,c;cin>>b>>c;
        ll tmp=mp[b];
        sum+=tmp*(c-b);
        cout<<sum<<"\n";
        mp.erase(b);
        mp[c]+=tmp;
    }
 
return 0;
}

Measured memory_bytes: 7588
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}



template< class T >
struct CumulativeSum {
  vector< T > data;

  CumulativeSum(int sz) : data(sz, 0) {};

  CumulativeSum(vector< T> v) : data(v.size()+1,0) {rep(i,v.size()) add(i+1,v[i]); build();};

  void add(int k, T x) {
    k++;
    if(k<0 || k>= data.size()) return;
    data[k] += x;
  }

  void build() {
    for(int i = 1; i < data.size(); i++) {
      data[i] += data[i - 1];
    }
  }

  T query(int l,int r) {  // [l,r)
    if(l < 0) return (0);
    return (data[min(r,(int)data.size()-1)]-data[min(l,(int)data.size()-1)]);
  }

  T operator[](const int &k) const {
    return data[k];
  }

};



signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,t;
  cin>>n>>t;
  CumulativeSum<int> s(t+2);
  rep(i,n){
    int l,r;
    cin>>l>>r;
    s.add(l,1);
    s.add(r,-1);  
    
    /*
    rep(j,t+1){
      cout<<s[j]<<' ';
    }
    cout<<endl;
    */
    
  }
  s.build();

  /*
  rep(i,t+1){
    cout<<s[i]<<' ';
  }
  cout<<endl;
  */

  int ans=0;
  rep(i,t+1){
    ans=max(ans,s[i]);
  }

  cout<<ans<<endl;


}


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

#define M_PI 3.14159265358979323846

using namespace std;

//typedef
//-------------------------#include <bits/stdc++.h>

#define M_PI 3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

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

//repetition
//------------------------------------------
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;

#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const int INF = 2147483647;

ll N, A, B, C;
ll l[10];
ll ans = (1LL << 60);
void dfs(ll i, ll a, ll b, ll c, ll cost)
{
    if (i == N)
    {
        if (a == 0 || b == 0 || c == 0)
            return;
        ans = min(ans, abs(A - a) + abs(B - b) + abs(C - c) + cost);
        return;
    }

    dfs(i + 1, a, b, c, cost);
    dfs(i + 1, a + l[i], b, c, cost + (a != 0) * 10);
    dfs(i + 1, a, b + l[i], c, cost + (b != 0) * 10);

    dfs(i + 1, a, b, c + l[i], cost + (c != 0) * 10);
}

int dxy[5] = {-1, 0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);

    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++)
    {
        cin >> l[i];
    }
    dfs(0, 0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long q,x,y,mi,ma,ans,kon;
  cin>>q;
  for(int i=0; i<q; i++){
    cin>>x>>y;
    mi=min(x,y);
    ma=max(x,y);
    kon=sqrt(x*y);
    ans=mi-1+kon*2-mi-1;
    if(kon*kon==mi*ma){
      ans=ans-1;
    }
    if(x==y){
      ans=ans+1;
    }
    if(kon*(kon+1)<x*y){
      ans=ans+1;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
def dfs(i, f):
    if i == len(s) - 1:
        return sum(list(map(int, f.split("+")))) 
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])
 
s = input()
print(dfs(0, s[0]))

Measured memory_bytes: 3060
#include<cstdio>
#define N 3010
#define mod 1000000007
#define inv 500000004
int f[N][N],a[N];
int qpow(int base,int n)
{
	if (!n) return 1;
	int ans=base%mod;--n;
	while(n)
	{
		if (n&1) ans=1ll*ans*base%mod;
		base=1ll*base*base%mod;
		n>>=1;
	}
	return ans;
}
inline int read(){
	int n=0;char a;bool z=false;
	while(a=getchar())
	{
		if (a>'9'||a<'0')
			if (z) break;
			else continue;
		if (!z) z=true;
		n=(n<<1)+(n<<3)+(a^48);
	}
	return n;
}
int main()
{
	int n,Q,x,y,ans=0;
	scanf("%d%d",&n,&Q);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1;i<=n;++i)
		for (int j=1;j<=n;++j)
			f[i][j]=a[i]>a[j];
	for (int i=1;i<=Q;++i)
	{
		scanf("%d%d",&x,&y);
		f[x][y]=f[y][x]=1ll*(f[x][y]+f[y][x])*inv%mod;
		for (int j=1;j<=n;++j)
			if (j^x&&j^y)
			{
				f[j][x]=f[j][y]=1ll*(f[j][x]+f[j][y])*inv%mod;
				f[x][j]=f[y][j]=1ll*(f[x][j]+f[y][j])*inv%mod;
			}
	}
	for (int i=1;i<=n;++i)
		for (int j=1;j<i;++j)
			ans=(ans+f[j][i])>=mod?ans+f[j][i]-mod:ans+f[j][i];
	printf("%lld",1ll*ans*qpow(2,Q)%mod);
	return 0;
}

//by qlwpc


Measured memory_bytes: 35456
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100000;
const double eps = 1e-6;
const double PI = acos(-1.0);

int N;

int main()
{
	while(scanf("%d", &N) != EOF)
	{
		bool flag = false;
		for(int i = 1; i <= N; i++) {
			char c;
			scanf(" %c", &c);
			if(c == 'Y') flag = true;
		}
		if(flag) printf("Four\n");
		else printf("Three\n");
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int count = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 2 != 0) {
                count++;
            }
        }

        System.out.println(count /(double) n);
    }
}


Measured memory_bytes: 23764
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
#[allow(non_snake_case, unused_variables)]
fn main() {
    let S1: String = read();
    let S2 = "CODEFESTIVAL2016";
    let mut ans: u32 = 0;
    for (s1, s2) in S1.chars().zip(S2.chars()) {
        if s1!=s2 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

int main() {
  string s;
  cin>>s;
  char a=s.at(0),b=s.at(1),c=s.at(2),d=s.at(3);
  bool boo=false;
  if(a==b&&c==d&&a!=c)
    boo=true;
  else if(a==c&&b==d&&a!=b)
    boo=true;
  else if(a==d&&c==b&&a!=c)
    boo=true;
  if(boo)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

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

	COUT((k == 1 ? 0 : n - k));



	return 0;
}


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

int main()
{
    int n;
    string c;
    cin >> n >> c;
    int l=0, r=n-1, cnt=0;
    while(true){
        while(l<n && c[l]=='R')++l;
        while(0<=r && c[r]=='W')--r;
        if(l>=r)break;
        c[l]='R';
        c[r]='W';
        ++l;
        --r;
        ++cnt;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll n;
string s, sa;

inline string rev(string ss){
    reverse(ss.begin(), ss.end());
    return ss;
}

inline void work(){
    cin >> s;
    n = s.size();
    if (s != rev(s)){
        puts("No");
        exit(0);
    }
    REP(i, 1, (n - 1) / 2) sa += s[i - 1];
    if (sa != rev(sa)){
        puts("No");
        exit(0);
    }
    sa = "";
    REP(i, (n + 3) / 2, n) sa += s[i - 1];
    if (sa != rev(sa)) puts("No");
    else puts("Yes");
}

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

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

using namespace std;

int main()
{
    vector <int> a(5);
    int maxdif=0;
    int ans=0;
    for(auto& x:a)
    {
        cin >> x;
        int dif = (10-x%10)%10;
        maxdif = max(maxdif,dif);
        ans += ((x-1)/10+1)*10;
    }
    ans-=maxdif;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, n)
    {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    int ans = 0;
    rep(i, k) ans += p[i];
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll N,M,K; cin>>N>>M>>K;
	cout<<maxx(N,M,K)-minn(N,M,K);
		
}

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;

int main() {
  
  rep(i,3) {
    char a;
    cin >> a;
    if(a == '1') a='9';
    else a='1';
    cout << a;
  }
    
  cout << endl;
  
}


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

water_sugar = []
sugar_best = []
s = 0
max_sugar = 0

for a in range(0,31):
    water = A*a
    sugar = E*water
    if water==0:
        pass
    elif (water*100)>F:
        break
    elif (water*100)+sugar>F:
        s = F-(water*100)
        water_sugar.append([water*100,s])
    elif (water*100)+sugar<=F:
        s = sugar
        water_sugar.append([water*100,s])
    if s>max_sugar: max_sugar=s
    for b in range(1,31):
        water += B
        sugar = E*water
        if (water*100)>F:
            break
        elif (water*100)+sugar>F:
            s = F-(water*100)
            water_sugar.append([water*100,s])
        elif (water*100)+sugar<=F:
            s = sugar
            water_sugar.append([water*100,s])
        if s>max_sugar: max_sugar=s
        

#print(water_sugar)
#print(max_sugar)

sugar = []
c=0
while(True):
    s = c*C
    if s<=max_sugar:
        sugar.append(s)
    else:
        break
    while(True):
        s += D
        if s<=max_sugar:
            sugar.append(s)
        else:
            break
    c+=1
sugar = sorted(sugar,reverse=True)

#print(sugar)

for ws in water_sugar:
    for s in sugar:
        if s<=ws[1]: break
    ws[1] = s
    sugar_best.append((100*ws[1])/(ws[0]+ws[1]))
    
best = water_sugar[sugar_best.index(max(sugar_best))]

print(best[0]+best[1],best[1])

Measured memory_bytes: 5792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int P=1e9+7,maxn=1e5+10;
int n,m,a[maxn];
struct Mat{
    int a[3][3];
    Mat(){memset(a,0,sizeof(a));}
    int* operator [](int x){return a[x];}
}I,ans,A,B;
Mat operator *(Mat a,Mat b){Mat c;rep(i,0,2) rep(j,0,2) rep(k,0,2) c[i][j]=(c[i][j]+1ll*a[i][k]*b[k][j]%P)%P;return c;}
Mat operator ^(Mat a,int b){
    Mat ans=I;
    for(;b;b>>=1,a=a*a) if(b&1) ans=ans*a;
    return ans;
}
int main(){
    scanf("%d%d",&n,&m);rep(i,0,2) I[i][i]=1;
    rep(i,1,m) scanf("%d",&a[i]);ans[0][0]=1;a[++m]=n;
    sort(a+1,a+m+1);a[0]=-1;
    A[0][0]=1;A[0][1]=2;A[0][2]=1;A[1][1]=1;A[1][2]=1;A[2][0]=1;A[2][1]=2;A[2][2]=2;
    B[0][0]=1;B[0][1]=2;B[0][2]=1;B[1][1]=1;B[1][2]=1;B[2][2]=1;
    rep(i,1,m){
        ans=ans*(A^(a[i]-a[i-1]-1));
        if(i==m) break;
        ans=ans*B;
    }
    printf("%d\n",ans[0][2]);
    return 0;
}

Measured memory_bytes: 640
// AOJ 2361: Sort
// 2018.4.10 bal4u

#include <stdio.h>
#include <string.h>

#define QSIZE 600000

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

typedef struct { int s, t; } QUE;
QUE que[QSIZE+2]; int qsize;

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

#define INF 0x30303030
int c[8][8]; int n;
int three[10][10];
int dist[1<<24];

int main()
{
	int i, j, s, ss, ns, t, nt, a, b, bi, bj, ans;

	for (n = 1; n <= 8; n++) for (i = 0; i < n; i++) three[n][i] = 3*(n-i-1);

	n = in();
	for (i = 0; i < n; i++) for (j = 0; j < n; j++) c[i][j] = in();

	memset(dist, INF, sizeof(dist));
	s = 0; for (i = 0; i < n; i++) s = (s << 3) | i;
	ans = 0, qsize = 0, enq(s, 0);
	while (qsize) {
		s = que[0].s, t = que[0].t, deq();
		if (dist[s] <= t) continue;
		dist[s] = t;
		if (t > ans) ans = t;
		for (i = 0; i < n; i++) {
			bi = three[n][i], a = (s >> bi) & 7;
			ss = s ^ (a << bi);
			for (j = i+1; j < n; j++) {
				bj = three[n][j], b = ((s >> bj) & 7);
				ns = (ss ^ (b << bj)) | (b << bi) | (a << bj);
				nt = t + c[i][j];
				if (dist[ns] <= nt) continue;
				enq(ns, nt);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 71464
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    sort(h.begin(),h.end());
    vector<int> memo;
    for(int i=0;i<n-k+1;i++){
        memo.push_back(h[i+k-1]-h[i]);
    }
    sort(memo.begin(),memo.end());
    cout<<memo[0];
    return 0;
}

Measured memory_bytes: 1276
#include <stdio.h>

int main(void){
	int x , y , large , i , j , max = 0 , count = 0;
	int m[14][14] = {0};
	while(scanf("%d,%d,%d" , &x , &y , &large)!=EOF){
		x += 2;
		y += 2;
		if(large == 1){
			m[x][y]++;
			m[x-1][y]++;
			m[x+1][y]++;
			m[x][y-1]++;
			m[x][y+1]++;
		}else if(large == 2){
			for(i=y-1;i<=y+1;i++){
				for(j=x-1;j<=x+1;j++){
					m[j][i]++;
				}
			}
		}else{
			for(i=y-1;i<=y+1;i++){
				for(j=x-1;j<=x+1;j++){
					m[j][i]++;
				}
			}
			m[x-2][y]++;
			m[x+2][y]++;
			m[x][y-2]++;
			m[x][y+2]++;
		}
	}
	for(i=2;i<=11;i++){
		for(j=2;j<=11;j++){
			if(m[j][i] == 0) count++;
			else if(m[j][i] > max) max = m[j][i];
		}
	}
	printf("%d\n%d\n" , count , max);
	return 0;
}

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

int main(){
  char s;
  cin >> s;
  if (s == 'a' || s == 'u' || s == 'i' || s == 'e' || s == 'o'){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long N, long M, long[] A) {
    // discountable, price, used coupons
    alias T = Tuple!(long, long, long);
    auto heap = make!(RedBlackTree!(T, "a > b", true));
    foreach (a; A) {
        heap.insert(tuple((a + 1) / 2, a, 0L));
    }
    
    long asum = A.sum;
    long discount;
    foreach (_; 0 .. M) {
        auto d = heap.front;
        heap.removeFront;
        discount += d[0];

        if (discount >= asum)
            break;

        if (d[2] >= 40)
            heap.insert(tuple(0L, d[1], d[2] + 1));
        else
            heap.insert(tuple(d[1] / 2 ^^ (d[2] + 1) - d[1] / 2 ^^ (d[2] + 2), d[1], d[2] + 1));
    }

    return max(0, asum - discount);
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long M;
    M = input.front.to!long;
    input.popFront;

    long[] A = new long[](cast(size_t) (N));
    foreach (i; 0 .. cast(size_t) (N)) {
        A[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(N, M, A);
    else
        solve(N, M, A).writeln;
}


Measured memory_bytes: 19496
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,j,k,l,c=0;

    string s1,s2;
    k=0;
    l=0;
    cin>>s1;
    cin>>s2;
    for(i=0;i<s1.size()+s2.size();i++)
    {
        if(i%2==1)
            {
                cout<<s2[k++];

            }
        else
            cout<<s1[l++];
    }
}


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

namespace ABC130A
{
    class Program
    {
        public static void Main()
        {
            var n = Console.ReadLine()
                    .Split(' ').Select(x => int.Parse(x))
                    .ToArray();
            Console.WriteLine(n[0] < n[1] ? 0 : 10);
        }
    }
}


Measured memory_bytes: 11220
/*
    ( ´-ω･)︻┻┳══━一一一一一一一				(× _ ×)
	
	Stay Low. Go Fast
	Kill First. Die Last
	One Shot. One Kill
	No Luck. Pure Skill 
*/

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

/*************************** MACROS **************************/
#define ld long double
#define ll long long  
#define ull unsigned long long
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define rloop(i,x,y) for(ll i=x;i>=y;i--)
#define vll vector<ll>
#define pb push_back
#define S second
#define F first
#define B begin()
#define E end()
#define W(x) while(x--)
#define pll pair< ll,ll >
#define vpll vector< pll >
#define qll queue<ll>
#define dqll deque<ll>
#define qpll queue<pll>
#define dqpll deque<pll>
#define pqll priority_queue<ll>
#define pqpll priority_queue<pll>
#define Line cout<<"\n**************************\n\n";

/*************************** CONST ******************************/

const ll MOD = 1000000007;
const ll MOD1 = 998244353;
const ll MIN_LL = -1e18;
const ll MAX_LL = 1e18;
const int MAX_INT = 1e9;
const int MIN_INT = -1e9;
const ld pie = 3.1415926535;
 
/************************** POW UTIL *****************************/
 
ll fpow(ll n,ll p){;ll m=1;while(p){if(p%2)m*=n;p>>=1;n*=n;}return m;}
ll mfpow(ll n,ll p,ll M){ll m=1;n%=M;while(p){if(p%2)m=(m*n)%M;n=(n*n)%M;p>>=1;}return m%M;}
 
/************************* PRINT UTIL *****************************/

template<class T> inline ostream& operator<<(ostream& o,vector<T> v){for(auto i:v)o<<i<<" ";return o;};
template<class T> inline ostream& operator<<(ostream& o,set<T> s){for(auto i:s)o<<i<<" ";return o;}
template<class T> inline ostream& operator<<(ostream& o,multiset<T> s){for(auto i:s)cout<<i<<" ";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,pair<T1,T2> p){o<<p.F<<" "<<p.S<<"\n";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,map<T1,T2> m){for(auto p:m)o<<p.F<<" "<<p.S<<"\n";return o;}

/*************************** VARIABLES **************************/

const vll days={31,28,31,30,31,30,31,31,30,31,30,31};
 
bool br,br1,br2; 
char ch,ch1,ch2;
 

ll n,m,k,x,y,z,mini,maxi,l,r,sum,t,w;
pll p,p1,p2;

string s,s1,s2;

set<ll> st,st1,st2;
multiset<ll> mst; 

map<ll,ll> mp;

/**************************** FXNS ****************************/

ll X,Y;

void solve()
{

	cin>>X>>Y;

	x = (4*X-Y)/2;
	y = X-x;

	// cout<<x<<" "<<y<<endl;

	cout<<((x+y == X && x >= 0 && y >= 0 && 2*x+4*y == Y) ? "Yes" : "No")<<endl;

}
 
/*************************** MAIN ****************************/
 
int main(){
 
 
	// #ifndef ONLINE_JUDGE
	        // freopen("input.txt", "rt", stdin);
	        // freopen("output.txt", "wt", stdout);
	// #endif
 
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);

	solve();
 
	return 0;
}


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

using namespace std;
using ll = long long;

int main() {
	string s;
	cin >> s;
	bool isGood = true;
	
	for(int i=0; i<s.length(); i++) {
		// printf("s[i] = %c, i-2 = %d, s[i] == L ? %s\n", s[i], i%2, (s[i] == 'L') ? "Yes" : "No");
		if(i%2 == 0 && s[i] == 'L') {
			// printf("aaa\n");
			isGood = false;
			break;
		}
		if (i%2 == 1 && s[i] == 'R') {
			// printf("aaa\n");
			isGood = false;
			break;
		}
	}
	
	cout << (isGood ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

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

const double PI = 4 * atan(1);

#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair <int, int>
#define vi vector<int>
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define vpi vector<pair<int, int>>
#define vpd vector<pair<double, double>>
#define pd pair<double, double>

#define f0r(i,a) for(int i=0;i<a;i++)
#define f1r(i,a,b) for(int i=a;i<b;i++)
#define trav(a, x) for (auto& a : x)

template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
  cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}

void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
void io(string taskname){
    string fin = taskname + ".in";
    string fout = taskname + ".out";
    const char* FIN = fin.c_str();
    const char* FOUT = fout.c_str();
    freopen(FIN, "r", stdin);
    freopen(FOUT, "w", stdout);
    fast_io();
}
const int MAX = 2e2 + 5;
const int INF = 1e4 + 5;
vi adj[MAX];
int vis[MAX];
int color[MAX];
int graph[MAX][MAX];
int dist[MAX][MAX];
bool check(int v){
    for(int w: adj[v]){
        if(vis[w] == 0){
            vis[w] = 1;
            color[w] = 1-color[v];
            if(!check(w)) return false;
        }
        else if(color[w] == color[v]) return false;
    }
    return true;
}

int main(){
    fast_io();
    int n;
    cin >> n;
    f0r(i, n) f0r(j, n) graph[i][j] = INF;
    f0r(i, n) graph[i][i] = 0;
    string temporary;
    getline(cin, temporary);
    f0r(i, n){
        string line;
        getline(cin, line);
        f0r(j, n){
            if(line[j] - '0'){
                adj[i].eb(j);
                graph[i][j] = 1;
            }
        }
    }
    f0r(i, n){
        if(vis[i] == 0){
            if(check(i) == false){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    int ans = 0;
    f0r(i, n) f0r(j, n) dist[i][j] = graph[i][j];
    f0r(k, n){
        f0r(i, n){
            f0r(j, n){
                if(dist[i][k] + dist[k][j] < dist[i][j]){
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }
        }
    }
    f0r(i, n){
        f0r(j, n){
            if(dist[i][j] >= INF) continue;
            ans = max(ans, dist[i][j]);
        }
    }
    cout << ans + 1 << endl;
    return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

  int N;
  cin >> N;
  int M; cin >> M;
  int a;
  int total = 0;
  rep(i, 0, M) {
    cin >> a;
    total += a;
  }

  if (total > N) {
    cout << -1 << endl;
  } else {
    cout << N - total << endl;
  }

  return 0;
};


Measured memory_bytes: 3644
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner input = new Scanner (System.in);
    int a = input.nextInt();
    if (a >= 0 && a<=10){
      System.out.println(a + a * a + a * a * a);
    }else{
      return;
    }
  }
}


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

int main() {
  int X,Y;
  cin>>X>>Y;
  int N=(X+Y)/3;
  if((X+Y)%3!=0||X<N||Y<N){
    cout<<"0"<<endl;
  }
  else{
    int64_t Z=1;
    
    for(int i=1;i<=X-N;i++){
      Z*=N+1-i;
      Z=Z%1000000007;
      int64_t N=1000000005;
      int64_t a=1,b=0,c=1;
      while(N>0){
        a*=2;
        if(N%a!=0){
          N-=a/2;
          int64_t d=i;
          for(int j=0;j<b;j++){
            d=d*d;
            d=d%1000000007;
          }
          c=c*d;
          c=c%1000000007;
        }
        b++;
      }
      Z=Z*c;
      Z=Z%1000000007;
    }
    
    cout<<Z<<endl;
  }
  
    
}

Measured memory_bytes: 256