akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()

typedef vector<int> vi;
typedef map<int, int> mi;
typedef pair<int, int> pi;
typedef long long ll;

int main() {
  string S;
  cin >> S;
  if (S == "MON") {
    cout << 6 << endl;
  } else if (S == "TUE") {
    cout << 5 << endl;
  } else if (S == "WED") {
    cout << 4 << endl;
  } else if (S == "THU") {
    cout << 3 << endl;
  } else if (S == "FRI") {
    cout << 2 << endl;
  } else if (S == "SAT") {
    cout << 1 << endl;
  } else {
    cout << 7 << endl;
  }
  return 0;
}

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

using namespace std;

#define pb push_back
#define mem(a) memset(a,0,sizeof(a))

typedef long long ll;
typedef pair<int,int> pii;

const int mn=55;

int n;
ll m,D;
int a[mn];
vector<int> g[mn];
struct item{
	ll v,w,num;//value weight
	bool operator < (const item &e) const{
		return v*e.w>e.v*w;
	}
}p[mn];
void dfs(int v,int x){
	p[x].w+=a[v];
	p[x].v++;
	for(int &i:g[v]){
		dfs(i,x);
	}
}

ll d[mn*mn*mn];

inline ll greedy(ll m){
	ll ans=0;
	for (int i = 1; i <= n; i++) {
		ll u = min(m / p[i].w,p[i].num);
		m -= u * p[i].w, ans += p[i].v * u;
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> m >> D;
	cin >> a[1];
	for (int i = 2; i <= n; i++) {
		int u;
		cin >> a[i] >> u;
		g[u].pb(i);
		p[i].num = max(D - 50,0ll);
	}
	p[1].num = 1e9;
	for (int i = 1; i <= n; i++) dfs(i, i);
	sort(p + 1, p + n + 1);
	int maxpos = 0;
	fill_n(d, mn*mn*mn, 1ll << 58);
	d[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int k = 1; k <= min(50ll, D); k++) {
			maxpos += p[i].v;
			for (int j = maxpos; j >= p[i].v; j--) {
				d[j] = min(d[j], d[j - p[i].v] + p[i].w);
			}
		}
	}
	ll ans=0;
	for (int i = 0; i <= maxpos; i++) {
		if (d[i] <= m) ans=max(ans,greedy(m-d[i])+i);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

const int MAX_N = 100005;

double add(double a,double b)
{
    if(abs(a+b) < EPS * (abs(a) + abs(b))){
        return 0;
    }
    return a + b;
}

struct P
{
    double x,y;
    P() {}
    P(double x,double y) : x(x),y(y) {}
    P operator + (P p){
        return P(add(x,p.x),add(y,p.y));
    }
    P operator - (P p){
        return P(add(x,-p.x),add(y,-p.y));
    }
    P operator * (double d){
        return P(x*d,y*d);
    }
    double dot(P p){
        return add(x*p.x,y*p.y);
    }
    double det(P p){
        return add(x*p.y,-y*p.x);
    }
};

int n;
P ps[MAX_N];

bool cmp_x(const P& p,const P& q)
{
    if(p.x != q.x){
        return p.x < q.x;
    }
    return p.y < q.y;
}

vector<P> convex_hull(P* ps,int n)
{
    sort(ps,ps+n,cmp_x);
    int k = 0;
    vector<P> qs(n*2);
    rep(i,n){
        while(k > 1 && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0){
            k--;
        }
        qs[k++] = ps[i];
    }
    for(int i = n-2,t=k;i >= 0;i--){
        while(k > t && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0){
            k--;
        }
        qs[k++] = ps[i];
    }
    qs.resize(k-1);
    return qs;
}

double dist(P p,P q)
{
    return (p-q).dot(p-q);
}

int main()
{
	scanf("%d",&n);
	rep(i,n){
        double a,b;
		scanf("%lf%lf",&a,&b);
        ps[i] = P(a,b);
	}
    vector<P> qs = convex_hull(ps,n);
    if(qs.size() == 2){ //???????????°??????????????´???
        printf("%.0f\n",dist(qs[0],qs[1]));
        return 0;
    }
    int i = 0,j = 0;
    rep(k,qs.size()){
        if(!cmp_x(qs[i],qs[k])){
            i = k;
        }
        if(cmp_x(qs[j],qs[k])){
            j = k;
        }
    }
    double res = 0;
    int si = i,sj = j;
    while(i != sj || j != si){
        res = max(res,dist(qs[i],qs[j]));
        if((qs[(i+1) % qs.size()] - qs[i]).det(qs[(j+1) % qs.size()] - qs[j]) < 0){
            i = (i+1) % qs.size();
        }else{
            j = (j+1) % qs.size();
        }
    }
    printf("%.10lf\n",sqrt(res));
	return 0;
}

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

using namespace std;
using ll = long long;

const ll md = 1e9 + 7;

int main()
{
  ios_base::sync_with_stdio (0);
  cin.tie (0);
  string s;
  cin >> s;
  ll n = (ll) s.length();
  vector<ll>pos (n);
  ll lst = -1;
  for (ll i = 0; i < n; i++) {
    if (s[i] == 'R') { lst = i; }
    else { pos[i] = lst; }
  }
  lst = n;
  for (ll i = n - 1; i >= 0; i--) {
    if (s[i] == 'L') { lst = i; }
    else { pos[i] = lst - 1; }
  }
  vector<ll>ans (n);
  for (ll i = 0; i < n; i++) {
    ll cur = abs (pos[i] - i);
    if (cur & 1) {
      if (s[pos[i]] == 'L') { ans[max (0LL, pos[i] - 1)]++; }
      if (s[pos[i]] == 'R') { ans[min (pos[i] + 1, n - 1)]++; }
    } else {
      ans[pos[i]]++;
    }
  }
  for (ll i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 2256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC091_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = new string[n];
            for(var i=0;i<n;i++)
            {
                s[i] = Console.ReadLine();
            }
            var m = int.Parse(Console.ReadLine());
            var t = new string[m];
            for(var i=0;i<m;i++)
            {
                t[i] = Console.ReadLine();
            }
            var ans = 0;
            foreach(var ch in s)
            {
                var c = s.Count(x => x == ch) - t.Count(x => x == ch);
                ans = Math.Max(ans, c);
            }
            Console.WriteLine(ans);
        }
    }
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> a(n);
  REP(i,n)cin >> a[i];
  int32 ans = INF;
  FOR(y,-100,101){
    int32 sum = 0;
    REP(i,n){
      int32 d = a[i] - y;
      sum += d * d;
    }
    ans = min(ans, sum);
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

//block linked list
#define Bsize 900 /*2sqrt(n)*/
typedef struct block{
	int cnt;
	ll a[Bsize+1];
	struct block*pre;
	struct block*nxt;
}block;
void Bpush(block*b,ll x){
	//リストにxを追加する
	if((*b).nxt&&(*(*b).nxt).a[0]<x){
		//次へ
		Bpush((*b).nxt,x);
		return;
	}
	int i=(*b).cnt;
	for(;i>0&&(*b).a[i-1]>x;i--)(*b).a[i]=(*b).a[i-1];
	(*b).a[i]=x;
	(*b).cnt++;
	if((*b).cnt>=Bsize){
		//分割
		block*nn=(block*)malloc(sizeof(block));
		(*nn).cnt=Bsize-Bsize/2;
		rep(i,0,Bsize-Bsize/2)(*nn).a[i]=(*b).a[i+Bsize/2];
		(*nn).pre=b;
		(*nn).nxt=(*b).nxt;
		if((*b).nxt)(*(*b).nxt).pre=nn;
		(*b).cnt=Bsize/2;
		(*b).nxt=nn;
	}
}
ll Bans(block*b,int k){
	//リストのk番目を返す
	//リストにk個未満しかなければ適当に返す
	if((*b).cnt<=k){
		if((*b).nxt)return Bans((*b).nxt,k-(*b).cnt);
		else return -1;
	}
	return (*b).a[k];
}
void con(block*p,block*q){
	//qをpにマージしてqを消す
	rep(i,0,(*q).cnt)(*p).a[(*p).cnt+i]=(*q).a[i];
	(*p).cnt+=(*q).cnt;
	(*p).nxt=(*q).nxt;
	if((*q).nxt)(*(*q).nxt).pre=p;
	free(q);
}
int Bdel(block*b,int k){
	//リストからkを(存在すれば)1個削除する
	//存在すれば1、しなければ0を返す
	if((*b).cnt==0||(*b).a[(*b).cnt-1]<k){
		if((*b).nxt)return Bdel((*b).nxt,k);
		else return 0;
	}
	int i=0;
	for(;(*b).a[i]<k;i++);
	if((*b).a[i]!=k)return 0;
	for(;i<(*b).cnt-1;i++)(*b).a[i]=(*b).a[i+1];
	(*b).cnt--;
	
	if((*b).cnt==0&&(*b).pre){
		(*(*b).pre).nxt=(*b).nxt;
		if((*b).nxt)(*(*b).nxt).pre=(*b).pre;
		free(b);
	}else if((*b).pre&&(*(*b).pre).cnt+(*b).cnt<Bsize/4)con((*b).pre,b);
	else if((*b).nxt&&(*(*b).nxt).cnt+(*b).cnt<Bsize/4)con(b,(*b).nxt);
	return 1;
}


ll a[400010],x[200010];
int c(const void*p,const void*q){
	if(a[*(ll*)p]<a[*(ll*)q])return -1;
	return 1;
}
block b;
ll idx[400010];
int main(){
	ll n,q;
	scanf("%lld%lld",&n,&q);
	rep(i,0,n){
		ll s,t;
		scanf("%lld%lld%lld",&s,&t,x+i);
		a[2*i  ]=s-x[i];
		a[2*i+1]=t-x[i];
	}
	rep(i,0,2*n)idx[i]=i;
	qsort(idx,2*n,sizeof(ll),c);
	
	ll crr=0;
	rep(_,0,q){
		ll d;
		scanf("%lld",&d);
		while(crr<2*n&&a[idx[crr]]<=d){
			if(idx[crr]%2)Bdel(&b,x[idx[crr]/2]);
			else Bpush(&b,x[idx[crr]/2]);
			crr++;
		}
		printf("%lld\n",Bans(&b,0));
	}
}


Measured memory_bytes: 11132
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
int a[1000];
int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int res1=0,res2=0;
  bool flag=true;
  for(int i=n-1;i!=-1;i--){
    if(flag){res1+=a[i];flag=false;}
    else {res2+=a[i];flag=true;}
  }
  cout<<res1-res2<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
int i,a,b,c;
char aa[10];
while(1==scanf("%s",aa))
{int x=0,min=753;
 
for(i=0;aa[i+2]!='\0';i++)
{
	a=aa[i]-'0';b=aa[i+1]-'0';c=aa[i+2]-'0';
x=abs(100*a+10*b+c-753);
if(!x) min=0;
if(x<min)
min=x;}
printf("%d",min);
}
return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main(){
  int i, j, k, N, key;
  int A[100];
  
  scanf("%d",&N);
  if(N < 1 || N > 100){
    fprintf(stderr,"Please enter the number of elements in the range from 1 to 100.(1st line)\n");
    exit(1);
  }
    
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
    
    if(A[i] < 0 || A[i] > 1000){
      fprintf(stderr,"Please enter the element in the range from 0 to 1000. (2nd line :%d)\n",i+1);
      exit(2);
    }
  }

  for(k = 0; k < N-1; k++){
      printf("%d ",A[k]); 
    }
    printf("%d\n",A[k]);
    
  for(i = 1; i < N; i++){
    key = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;

    for(k = 0; k < N-1; k++){
      printf("%d ",A[k]); 
    }
    printf("%d\n",A[k]);

  }

  return 0;
}



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

int main() {
  string str;
  cin >> str;
  if(str.size()==2){
    cout << str;
  }
  if(str.size()==3){
    reverse(str.begin(),str.end());
    cout << str;
  }
  return 0;
}


Measured memory_bytes: 3604
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

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


int main()
{
	int N, K;
	while (1) {
		int cards[100010] = {0};
		cin >> N >> K;
		if (N == 0 && K == 0)break;

		int flag = 0;
		for (int i = 0; i < K; i++) {
			int card;
			cin >> card;
			if (card == 0)
				flag = 1;
			else
				cards[card] = 1;
		}
		
		for (int i = 1; i <= N; i++) {
			if(cards[i] != 0 && cards[i-1] != 0)
			cards[i] += cards[i - 1];
 		}

		int ans = 0;
		if (!flag) {
			sort(cards, cards + N + 1);
			cout << cards[N] << endl;
		}
		else {
			int num1 = 0, num2 = 0;
			for (int i = N; i >= 1; i--) {
				if (cards[i] != 0)
					num1 = max(num1, cards[i]);
				if (num1 != 0 && cards[i] == 0) {
					num2 = cards[i - 1];
					ans = max(ans, num1 + num2);
					num1 = 0;
					num2 = 0;
				}
			}
			cout << ans + 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3364
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

void solve(void)
{
  int N, M; cin >> N >> M;
  auto ans = M >= N ? "Yes" : "No";
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define maxn 100005
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m,a;cin>>n>>m;
    for(int i=1;i<=m;++i)
    {
        cin>>a;n-=a;
    }
    if(n<0) cout<<-1;else cout<<n;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,j,k,a[5][5],b[5],c[5];
int main()
{
	for (i=1;i<=3;i++)
	{
		for (j=1;j<=3;j++)
		{
			cin>>a[i][j];
		}
	}
	for (b[1]=0;b[1]<=100;b[1]++)
	{
		for (b[2]=0;b[2]<=100;b[2]++)
		{
			for (b[3]=0;b[3]<=100;b[3]++)
			{
				for (i=1;i<=3;i++) c[i]=a[i][i]-b[i];
				bool ok=1;
				for (i=1;i<=3;i++)
				{
					for (j=1;j<=3;j++)
					{
						if (b[i]+c[j]!=a[i][j])
						{
							ok=0;
						}
					}
				}
				if (ok) {cout<<"Yes";return 0;}
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CSugarWater {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int w1 = 100 * in.nextInt();
            int w2 = 100 * in.nextInt();
            int s1 = in.nextInt();
            int s2 = in.nextInt();
            int ratio = in.nextInt();
            int capacity = in.nextInt();

            int water = 0, sugar = 0;

            int answerW = w1, answerS = 0;

            for (int a = 0; water + sugar + w1 * a <= capacity; a++) {
                water += w1 * a;

                for (int b = 0; water + sugar + w2 * b <= capacity; b++) {
                    water += w2 * b;

                    for (int c = 0; water + sugar + s1 * c <= capacity; c++) {
                        sugar += s1 * c;

                        for (int d = 0; water + sugar + s2 * d <= capacity; d++) {
                            sugar += s2 * d;

                            if (!(sugar > ratio * water / 100)) {
                                if (sugar * answerW > answerS * water) {
                                    answerW = water;
                                    answerS = sugar;
                                }
                            }

                            sugar -= s2 * d;
                        }

                        sugar -= s1 * c;
                    }

                    water -= w2 * b;
                }

                water -= w1 * a;
            }

            out.println((answerS + answerW) + " " + answerS);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')
k, a, b = LI()

# a 枚を 1 円に交換、1 円を b 枚に交換 の 2 回の操作で b - a 枚増える
if b - a <= 2:
    print(1 + k)
    exit()

rest_k = k - (a - 1)  # 初めに a 枚になるまで増やした後の残り回数
if rest_k < 0:
    ans = 1 + k  # a 枚にすることができないならただ k 枚増やす
else:
    ans = a
    # 残りの操作回数で 可能な限り b - a 枚増やす操作を行う
    ans += (b - a) * (rest_k // 2)
    ans += rest_k % 2  # 残りが奇数回なら最後の １ 回は 1 枚増やす
print(ans)


Measured memory_bytes: 9164
N, A, B = map(int, input().split())
ans = []
a = 0
b = 0
c = 0
for i, s in enumerate(input()):
    if s == 'a':
        if a + b < A + B:
            ans.append('Yes')
            a += 1
        else:
            ans.append('No')
    if s == 'b':
        if a + b < A + B and c < B:
            ans.append('Yes')
            b += 1
        else:
            ans.append('No')
        c += 1
    if s == 'c':
        ans.append('No')

print(*ans, sep='\n')


Measured memory_bytes: 6232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, m, n) for (int i = m; i < n; ++i)
const ll INF = 1LL << 50;

int main(void) {
    int N, M, P;
    cin >> N >> M >> P;
    const int NMAX = 2525;
    const int MMAX = 5050;
    int a[MMAX], b[MMAX];
    ll c[MMAX];

    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i] + P;
    }

    ll dist[NMAX];

    for (int i = 0; i < N; ++i) {
        dist[i] = INF;
    }

    dist[0] = 0;

    for (int loop = 0; loop < N - 1; ++loop) {
        for (int i = 0; i < M; ++i) {

            if (dist[a[i] - 1] == INF)
                continue;

            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
            }
        }
    }

    ll ans = dist[N - 1];

    bool negative[NMAX];

    for (int i = 0; i < N; ++i) {
        negative[i] = false;
    }

    for (int loop = 0; loop < N; ++loop) {
        for (int i = 0; i < M; ++i) {
            if (dist[a[i] - 1] == INF)
                continue;

            if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
                dist[b[i] - 1] = dist[a[i] - 1] + c[i];
                negative[b[i] - 1] = true;
            }

            if (negative[a[i] - 1] == true) {
                negative[b[i] - 1] = true;
            }
        }
    }

    if (negative[N - 1])
        cout << -1 << endl;
    else {
        if(-ans < 0) cout << 0 << endl;
        else cout << -ans << endl;
    }
    return 0;
}


Measured memory_bytes: 384
n = int(input())
c = input()
s = [0]
for i in range(n):
  if c[i] == 'R':
    s.append(s[i])
  else:
    s.append(s[i] + 1)
r = n - s[n]
ans = 10**10
for i in range(n + 1):
  ans = min(ans, max(s[i], r - i + s[i]))
print(ans)


Measured memory_bytes: 16932
#include <bits/stdc++.h>
#define reps(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) for(int i=0;i<a;i++)
typedef long long int ll;
using namespace std;


struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){
int N;
int T;
cin>>N>>T;
int A[N];
rep(i,N){
    cin>>A[i];
}

int imasagaku=0;
int kaburi=1;
int imasaisho=1000000001;
rep(imabasho,N){
    if(imasaisho>A[imabasho]){
        imasaisho=A[imabasho];
    
    }
    
    else{
    if(A[imabasho]-imasaisho>imasagaku){
        imasagaku=A[imabasho]-imasaisho;
        kaburi=1;
    }
    else if(A[imabasho]-imasaisho==imasagaku){
        kaburi++;
    }
    }
}

cout<<kaburi<<endl;

return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <istream>
#include <assert.h>
#include <vector>
#include <cstdio>

using namespace std;

int main()
{
//    freopen("input.txt", "r", stdin);
    int n, cnt = 0;
    string str;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        str = to_string(i);
        if(str.length() % 2 == 1) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}




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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  map<string, int> m;
  for (int i = 0; i < n; ++i) {
    m[s[i]]++;
  }
  cout << m.size() << endl;
}


Measured memory_bytes: 24992
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

vll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

int main(){

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

    cin >> N;
    rep(ni,N){
        cin >> ltmp;
        A.push_back(ltmp);
    }
    sort(A.rbegin(),A.rend());

    ll ans = 0;
    for( ll ni = 1 ; ni <N ; ni++ ){
        ll index = ni/2;
        ans += A[index];
       
    }    
    cout << ans << endl;

}

Measured memory_bytes: 5316
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vector<ll> a(n);
    vector<ll> asum(n);
    rep(i, n){
        cin >> a[i];
        asum[i] = (i==0) ? a[i] : a[i] + asum[i-1];
    }

    ll ans = INFLL;
    // すぬけがi番目までカードを取る
    rep(i, n-1){
        ll score_s = asum[i];
        ll score_a = asum[n-1] - asum[i];
        chmin(ans, abs(score_s - score_a));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    dd = [MII() for i in range(n)]
    cnt = 0
    for d1, d2 in dd:
        if d1 != d2:
            cnt = 0
        else:
            cnt += 1
        if cnt == 3:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9196
import java.math.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int count = 0;

        for(int i = 0; i < num; i++){
            String x = sc.next();
            if(new BigInteger(x).isProbablePrime(5)){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 51884
#include <stdio.h>
#define N 1001

int a[N << 1], b[N] = {0}, c = 0;

int main()
{		
	int n, x, t, i, j, k, ans = 0;
		
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &x);
		b[x]++;
	}
	for(i = 1; i < N; i++){
		t = b[i];
		while(t--) a[c++] = i;
	}
	for(i = 0; i < c; i++){
		for(j = i + 1, k = j + 1; j < c; j++){
			t = a[i] + a[j];
			if(j == k) k++;
			for( ; k < c && a[k] < t; k++);
			ans += k - j - 1;
		}
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
enum = enumerate
INF = 1001001001

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().rstrip().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def bye(res):
	sT = "IMPOSSIBLE POSSIBLE".split()
	print(sT[res])
	#print(res)
	exit(0)

def main():
	N,K = linput()
	vA = linput(int,set)

	res = 0
	l,r = min(vA), max(vA)
	if K in vA:
		bye(1)
	if not K<=r:
		bye(0)

	g = 0	# GCD for all
	for a in vA:
		g = gcd(g, a)
	print(g, file=sys.stderr)###
	
	if (r-K)%g:
		res = 0
	else:
		res = 1
	bye(res)


if __name__ == "__main__":
	main()


Measured memory_bytes: 25208
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9+7;
signed main() {
    int n;
    cin>>n;
    int dp[3][n];
    int a[n],b[n],c[n];
    for(int i=0 ; i<n ; i++) {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[0][0]=a[0];
    dp[1][0]=b[0];
    dp[2][0]=c[0];
    for(int i=1 ; i<n ; i++) {
        dp[0][i]=max(dp[1][i-1]+a[i],dp[2][i-1]+a[i]);
        dp[1][i]=max(dp[0][i-1]+b[i],dp[2][i-1]+b[i]);
        dp[2][i]=max(dp[0][i-1]+c[i],dp[1][i-1]+c[i]);
    }
    cout<<max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});
}


Measured memory_bytes: 5956
x, y = [int(i) for i in input().split()]
if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
    if y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
        print("Yes")
    else:
        print("No")
elif x == 4 or x == 6 or x == 9 or x == 11:
    if y == 4 or y == 6 or y == 9 or y == 11:
        print("Yes")
    else:
        print("No")
else:
    if y == 2:
        print("Yes")
    else:
        print("No")

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

int n;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		string s, t;

		cin >> s >> t;

		int v = s.size(), w = t.size();

		if (v < w) {
			string y = s;
			s = t;
			t = y;

			swap(v, w);
		}

		int k = 0;
		string u;

		for (int i = 0; i < v; i++) {
			k += s[v - i - 1] - '0';

			if(i < w)
				k += t[w - i - 1] - '0';

			u = (char)('0' + (k % 10)) + u;
			k /= 10;
		}

		if (k > 0)
			u = '1' + u;

		if (u.size() <= 80)
			cout << u << endl;
		else
			cout << "overflow" << endl;
	}

	return 0;
}


Measured memory_bytes: 3056
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		//		new Main().solveC();
		//		new Main().solveC2();
		new Main().solveC3();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String line = "";

		try {
			scanner = new Scanner(System.in);
			line = scanner.next();

			System.out.println(line.replaceAll("2017", "2018"));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int n = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();
			int[] wk = new int[n];

			for (int i = 0; i < n; i++) {
				wk[i] = scanner.nextInt();
			}

			Arrays.sort(wk);

			int res = 0;
			for (int i = 0; i < wk.length; i++) {
				if (i == 0) {
					res++;
				} else if (wk[i] != wk[i - 1]) {
					res++;
				}

			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC2() {
		Scanner scanner = null;
		int n = 0;
		int y = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();
			y = scanner.nextInt();

			for (int i = n; i >= 0; i--) {
				if (i * 10000 > y) {
					continue;
				}
				for (int j = 0; j <= n - i; j++) {
					int k = n - i - j;
					if (i * 10000 + j * 5000 + k * 1000 == y) {
						System.out.println(i + " " + j + " " + k);
						return;
					}
				}
			}

			System.out.println(-1 + " " + -1 + " " + -1);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC3() {
		Scanner scanner = null;
		int n = 0;
		int y = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();
			y = scanner.nextInt();

			for (int i = n; i >= 0; i--) {
				if (i * 10000 > y) {
					continue;
				}
				for (int j = 0; j <= n; j++) {
					if (i + j <= n && i * 10000 + j * 5000 + (n - i - j) * 1000 == y) {
						System.out.println(i + " " + j + " " + (n - i - j));
						return;
					}
				}
			}

			System.out.println(-1 + " " + -1 + " " + -1);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int n = 0;
		int y = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();
			y = scanner.nextInt();

			for (int i = n; i >= 0; i--) {
				if (i * 10000 > y) {
					continue;
				}
				for (int j = 0; j <= n - i; j++) {
					for (int k = 0; k <= n - i - j; k++) {
						if (n == i + j + k && i * 10000 + j * 5000 + k * 1000 == y) {
							System.out.println(i + " " + j + " " + k);
							return;
						}
					}
				}
			}

			System.out.println(-1 + " " + -1 + " " + -1);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() {
    char board[50][50], ans[50][50];
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> board[i][j];
            if (board[i][j] == '.')
                ans[i][j] = '0';
            else
                ans[i][j] = '#';
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (board[i][j] == '#') {
                for (int a : {-1, 0, 1}) {
                    for (int b : {-1, 0, 1}) {
                        if (a == 0 && b == 0) continue;
                        int x = i + a, y = j + b;
                        if (0 <= x && x < h && 0 <= y && y < w && board[x][y] != '#') {
                            ans[x][y]++;
                        }
                    }
                }
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i m mi =
        if i = n then mi else
            if abs a.(i) > abs m then loop (i + 1) a.(i) i
                                 else loop (i + 1) m mi
    in
    let mi = loop 0 0 0 in
    let m = a.(mi) in
    let adjust = Array.fold_left (fun acc v -> if v * m < 0 then acc + 1 else acc) 0 a in
    Printf.printf "%d\n" (adjust + n - 1);
    Array.iteri (fun i v ->
        if v * m < 0 then Printf.printf "%d %d\n" (mi + 1) (i + 1)) a;
    if m > 0 then for i = 0 to n - 2     do Printf.printf "%d %d\n" (i + 1) (i + 2) done
             else for i = n - 1 downto 1 do Printf.printf "%d %d\n" (i + 1) i       done

)

Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApp1
{
    class Program
    {
        static int Calc(int data1, int data2) {
 
            int ans = data1 % data2;
            if (ans == 0) { return data2; }
 
            return Calc(data2, ans);    
        }
 
        static void Main(string[] args)
        {
            int inputData = int.Parse(Console.ReadLine());
            //string stringData = Console.ReadLine();
 
            Console.WriteLine(2* Math.PI * inputData);
            Console.ReadLine();
        }
    }
}

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

int main()
{
	int base[4]={},out_count=0,point=0;
	int count;
	string event;
	cin >> count;
	
	while(count){
		cin >> event;
		
		if(event == "HIT"){
			for(int i=3;i>=0;--i){
				base[i+1] += base[i];
				base[i] = 0;
			}
			++base[0];
		}
		
		if(event == "HOMERUN"){
			base[3] = base[0]+base[1]+base[2]+1;
			base[0] = 0;
			base[1] = 0;
			base[2] = 0;
		}
		
		if(event == "OUT"){
			++out_count;
		}
		
		if(out_count != 3){
			point += base[3];
			
		}else{
			cout << point << endl;
			--count;
			point = 0;
			out_count = 0;
			base[0] = 0;
			base[1] = 0;
			base[2] = 0;
		}
		
		base[3] = 0;
	}
	
	return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>

int
main(int argc, char *argv[])
{
        int a, b, c;
        int ck;

        scanf("%d %d %d", &a, &b, &c);
        ck = (c - b) * (b - a);
        if (ck <= 0)
                printf("No\n");
        else
                printf("Yes\n");

        return 0;
}

Measured memory_bytes: 580
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while( (line = br.readLine()) != null){
            double v = Double.parseDouble(line);
            int f = 0;
            while(true){
                f++;
                double height = 5*f - 5;
                double t = Math.sqrt(height / 4.9);
                double vReal = 9.8 * t;
                if(vReal >= v)  break;
            }
            System.out.println(f);
        }

    }
}

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

int main(){
    int S, h, m, s;
    cin >> S;
    h = S / 3600;
    m = (S % 3600) / 60;
    s = S % 60;
	cout << h << ":" << m << ":" << s << endl;
    return 0;
}


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

int main(){
	int N,x=0,y=0;
	string S,T,ans;

	cin >> N;
	cin >> S >> T;

	for(int j = 0;j < N*2;j++){
		if(j%2 == 0){
			ans[j] = S[x];
			x++;
		}else{
			ans[j] = T[y];
			y++;
		}
		cout << ans[j];
	}
	printf("\n");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename T> int           ones_count_32(T x) { return __builtin_popcount(x); }
template<typename T> int  leading_zeros_count_32(T x) { return __builtin_clz(x); }
template<typename T> int trailing_zeros_count_32(T x) { return __builtin_ctz(x); }
template<typename T> int           ones_count_64(T x) { return __builtin_popcountll(x); }
template<typename T> int  leading_zeros_count_64(T x) { return __builtin_clzll(x); }
template<typename T> int trailing_zeros_count_64(T x) { return __builtin_ctzll(x); }
#define pi 3.141592653589793238
#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(int i=a;i<b;i++)
#define fb(i,b,a) for(int i=b;i>a;i--)
#define f0(a,b) for(int i=a;i<b;i++)
#define fn(b,a) for(int i=b;i>a;i--)
#define frll(i,a,b) for(long long int i=a;i<b;i++)
#define fbll(i,b,a) for(long long int i=b;i>a;i--)
#define f0ll(a,b) for(long long int i=a;i<b;i++)
#define fnll(b,a) for(long long int i=b;i>a;i--)
#define dbg(x); cout<<"\n"<<#x<<": "<<x;
#define ret return
#define ub upper_bound
#define lb lower_bound
#define psb push_back
#define psf push_front
#define pof pop_front
#define pob pop_back
#define sq(a) (a)*(a)
#define fs first
#define sc second
#define el "\n"
#define brk break
#define cont continue
#define all(a) a.begin(),a.end()
#define e9 1000000007
#define e8 100000007
#define e7 10000007
#define e6 1000007
#define e5 100007
#define inf 1e18+7
typedef long double ld;
typedef long long int lli;  //  1e-18 to 1e18
typedef vector<int> vi;
typedef multiset<int> msi;
typedef set<int> si;
typedef string str;
typedef priority_queue<int> pqi;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<long long int> vll;
typedef pair<int,int> pii;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvll;
void readVec(vi &a,int n){
    a.resize(n);
    f0(0,n) cin>>a[i];
}
void writeVec(vi &a){
	for(int x:a) cout<<x<<" ";
	cout<<el;
}
void readVecll(vll &a,lli n){
    a.resize(n);
    f0(0,n) cin>>a[i];
}
void writeVecll(vll &a){
	for(lli x:a) cout<<x<<" ";
	cout<<el;
}
void solve(){
    int n;
    cin>>n;
    vi h;
    readVec(h,n);
    vi mcr(n);//min cost of reaching i
    mcr[1]=abs(h[1]-h[0]);
    f0(2,n) mcr[i]=min(mcr[i-1]+abs(h[i]-h[i-1]),mcr[i-2]+abs(h[i]-h[i-2]));
    cout<<mcr[n-1]<<el;
}
int main(){
    fastIO();
    int t(1);
    // cin>>t;
    while(t--) solve();
    ret 0; 
}

Measured memory_bytes: 3960
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef ll Weight;
typedef vector<vector<Weight>> Graph;
void add_edge(vector<vector<Weight>>& g, Weight from, Weight to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

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

	ll k;
  cin >> k;
	//vector<ll> a(n); 
	int a = 7 % k;
	rep(i, k * 7 + 1) {
	  if (a == 0) {cout << i + 1 << endl; return 0;}
	  a = (a * 10 + 7) % k;
	}
	cout << -1 << endl;

}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e5+11;
ll const LG=(ll)log2(N)+1;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>x>>y;
        if(y%2==1){
                cout<<"No\n";
                return;
        }
        if(y>=2*x && y<=4*x){
                cout<<"Yes\n";
        }else{
                cout<<"No";
        }
        
       
}   
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//const ll MOD = 1e9 + 7;
const ll INF = 1e10;
const vector<int> dy = {-1,0,1,0};
const vector<int> dx = {0,1,0,-1};

const int MAXN = 100005;
int MOD;
vector<vector<int>> G(MAXN);
vector<vector<int>> dp(MAXN);
vector<int> deg(MAXN);
vector<int> parents(MAXN);
vector<int> answer(MAXN);


int dfs1(int v,int p = -1) {
    ll ans = 1;
    rep(i,deg[v]) {
        int e = G[v][i];
        if (e == p) {
            parents[v] = i;
            continue;
        }
        dp[v][i] = dfs1(e,v);
        ans *= dp[v][i] + 1;
        ans %= MOD;
    }
    return ans;
}

void dfs2(int v,int res_p = 1,int p = -1) {
    if (p != -1) dp[v][parents[v]] = res_p;
    vector<ll> cuml(deg[v] + 1,1);
    vector<ll> cumr(deg[v] + 1,1);
    rep(i,deg[v]) cuml[i + 1] = cuml[i] * (dp[v][i] + 1) % MOD;
    for (int i = deg[v] - 1; i >= 0; i--) cumr[i] = cumr[i + 1] * (dp[v][i] + 1) % MOD;
    answer[v] = cumr[0];
    rep(i,deg[v]) {
        int e = G[v][i];
        if (e == p) continue;
        dfs2(e,cuml[i] * cumr[i + 1] % MOD,v);
    }
}

int main() {
    int n; cin >> n >> MOD;
    rep(_,n - 1) {
        int a,b; cin >> a >> b;
        a --; b --;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i,n) {
        deg[i] = G[i].size();
        vector<int> a(deg[i],1);
        dp[i] = a;
    }

    dfs1(0);
    dfs2(0);
    rep(i,n) cout << answer[i] << endl;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  string a,b;
  cin >> a >> b;
  int n=a.length(),m=b.length();
  int dp[n+1][m+1];
  mems(dp);
  f(i,n+1)
  {
      f(j,m+1)
      {
          if(i==0 || j==0)
            continue;
           if(a[i-1]==b[j-1])
            dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
           else
            dp[i][j]=max({dp[i][j],dp[i-1][j],dp[i][j-1]});
      }
  }
  int len=dp[n][m];
  string s;
  s="";
  int l=n,r=m;
  while(l>0 && r>0)
  {
      if(a[l-1]==b[r-1])
      {
          s+=a[l-1];
          l--;r--;
          len--;
      }
      else if(dp[l-1][r]>dp[l][r-1])
        l--;
      else
        r--;
  }
  reverse(all(s));
  cout << s << '\n';
  return;
} 

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 73912
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
	 double pai = 3.141592653589793,r, x, y, z;
	cin >> r;
	printf("%1.6f %1.6f",r*r*pai, 2 * r*pai);
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
char s[20];int n;
void work(int d,int w){
	if(!d){
		puts(s);
		return;
	}
	for(int i='a';i<w;i++){
		s[n-d]=i;work(d-1,w);
	}
	s[n-d]=w;work(d-1,w+1);
}
int main(){
	scanf("%d",&n);
	work(n,'a');
	return 0;
}

Measured memory_bytes: 1536