akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n;
    Scd(n);
    char s[66];

    int letter[256];
    int tmp[256] = {};
    fill(letter,letter+256,33333);
    Rep(i,n){
        Scs(s);
        int leng = strlen(s);
        fill(tmp,tmp+256,0);
        Rep(j,leng){
            tmp[s[j]]++;
        }
        Rep(j,256){
            letter[j] = min(letter[j],tmp[j]);
        }
    }

    Rep(i,256){
        Rep(j,letter[i])
            printf("%c", i);
    }

    printf ("\n");

    return 0;
}



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

#define MOD 1000000007

using namespace std;

int main() {
	string s;
	cin >> s;
	vector<int> a(13, 0);
	a[0] = 1;
	for (int i = 0; i < s.size(); i++) {
		int k = s[i] - '0';
		vector<int> b(13, 0);
		if (k < 10) {
			for (int j = 0; j < 13; j++) {
				int t = (j * 10 + k) % 13;
				b[t] = (b[t] + a[j]) % MOD;
			}
		} else {
			for (int j = 0; j < 13; j++) {
				for (k = 0; k < 10; k++) {
					int t = (j * 10 + k) % 13;
					b[t] = (b[t] + a[j]) % MOD;
				}
			}
		}
		a = b;
	}
	cout << a[5] << endl;
	return 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (auto &&pi : p)
    {
        cin >> pi;
    }

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

    int price = 0;
    for (int i = 0; i < k; i++)
    {
        price += p[i];
    }

    cout << price << endl;

    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    int res = N<<(N&1);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())

count = 0
for i in range(1, n+1):
    if i % 2 == 1:
        yaku = 0
        for j in range(1, i+1):
            if i % j == 0:
                yaku += 1
        if yaku == 8:
            count += 1
print(count)

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

const int MAXN = 10000 + 10;
int a[MAXN];
long long res;

int main() {
	int N;
	cin >> N;
	for(int i = 1; i <= N; ++i) {
		cin >> a[i];
		while(a[i]){
			if(a[i] & 1) break;
			else res++;
			a[i] >>= 1;
		}
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 256
N = int(input())
K = int(input())
x_list = list(map(int, input().split()))

result = 0
for i in range(N):
    A_dis = x_list[i]
    B_dis = abs(K - x_list[i])
    min_dif = min(A_dis, B_dis)
    result = result + (min_dif * 2)

print(result)


Measured memory_bytes: 2940
n = gets.to_i
hs = gets.split.map(&:to_i).reverse
present = hs.first
ans = 'Yes'
hs.each do |h|
  if h - present > 1
    ans = 'No'
    break
  elsif h - present == 1
    present = h - 1
  else
    present = h
  end
end
puts ans

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

void dfs(int node, vector<int> adj[], int dp[], bool vis[]) 
{ 
	vis[node] = true; 

	for (int i = 0; i < adj[node].size(); i++) { 

		if (!vis[adj[node][i]]) 
			dfs(adj[node][i], adj, dp, vis); 

		dp[node] = max(dp[node], 1 + dp[adj[node][i]]); 
	} 
} 

int findLongestPath(vector<int> adj[], int n) 
{ 
	int dp[n + 1]; 
	memset(dp, 0, sizeof dp); 

	bool vis[n + 1]; 
	memset(vis, false, sizeof vis); 

	for (int i = 1; i <= n; i++) { 
		if (!vis[i]) 
			dfs(i, adj, dp, vis); 
	} 
	int ans = 0; 
	for (int i = 1; i <= n; i++) { 
		ans = max(ans, dp[i]); 
	} 
	return ans; 
} 
int main() 
{ 
    int n,e;cin>>n>>e;
	vector<int> adj[n + 1]; 
    while(e--)
    {
        int x,y;cin>>x>>y;
        adj[x].push_back(y);
    }
	cout << findLongestPath(adj, n); 
	return 0; 
} 


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



int main() {
	long long int N, K;
	long long int sum = 0;
	long long int memo[200000] = { 0 };
	long long int memo2[200000] = { 0 };
	long long int a = 0, b = 0, c = 0, d = 0;
	cin >> N >> K;

	if (N + 1 == K) {
		cout << 1;
		return 0;
	}
	
	for (int i = 1; i < N+1; i++) {
		memo[i] = memo[i - 1] + i;
		memo2[i] = memo2[i - 1] + N + 1 - i;
		//cout << memo[i] << "    " << memo2[i] << endl;
	}
	for (int i = K; i < N + 1; i++) {
		sum += memo2[i] - memo[i - 1] + 1;
        while(sum>1000000007){
        sum-=1000000007;
        }
		//cout << sum << endl;

	}
	cout << sum + 1;
}

Measured memory_bytes: 6760
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N; cin >> N;
  vector<ll> x(N), y(N);
  vector<double> arg(N);
  for (int i = 0; i < N; i++) {
    cin >> x.at(i) >> y.at(i);
    arg.at(i) = atan2(y.at(i), x.at(i));
  }
  vector<int> ordA(N);
  iota(ordA.begin(), ordA.end(), 0);
  sort(ordA.begin(), ordA.end(),
       [&](int a, int b) { return arg.at(a) < arg.at(b); });
  ll dsqr = 0;
  
  for (int i = 0; i < N; i++) {
    ll sx = 0;
    ll sy = 0;
    for (int j = i; j < i + N; j++) {
      int k = ordA.at(j % N);
      sx += x.at(k);
      sy += y.at(k);
      dsqr = max(dsqr, sx * sx + sy * sy);
    }
  }
  double ans = sqrt(dsqr);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	double in;
	while(cin>>in){
		double sum=in;
		loop(i,2,11){
			if(i%2)in/=3.0;
			else in*=2;
			sum+=in;
		}
		printf("%.9f\n",sum);
	}
}

Measured memory_bytes: 1236
import numpy as np

def calc_all_physical_strength(X, P):
    X = np.array(X)
    return np.sum((X-P)**2)

if __name__ == "__main__":
    N = int(input())
    X = list(map(int, input().split()))
    min_P = sum(X) / N
    print(min(calc_all_physical_strength(X, int(min_P)), calc_all_physical_strength(X, int(min_P)+1)))

Measured memory_bytes: 27240
#include<bits/stdc++.h>
using namespace std;
int n,m,s,t;
int op[200][200];
int fa[200][200];
int fb[200][200];
int fc[200][200];
int fd[200][200];
int num[200][200];
int Anum[200][200];
int Cnum[200][200];
int Onum[200][200];
int numO[200][200];

struct data{
  int from,to,type;
  data(int a,int b,int c):from(a),to(b),type(c){}
};

void init(){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      op[i][j]=0;
      fa[i][j]=0;
      fb[i][j]=0;
      fc[i][j]=0;
      fd[i][j]=0;
      num[i][j]=0;
      Anum[i][j]=0;
      Cnum[i][j]=0;
      Onum[i][j]=0;
    }
  }
}

bool solve(){
  queue< data > Q;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(num[i][j]==1)
        Q.push(data(i,j,0));
  
  while(!Q.empty()){
    data d=Q.front();Q.pop();
    if(d.from==s&&d.to==t&&d.type==0)return true;
    if(d.type==0){
      for(int nfrom=0;nfrom<n;nfrom++){
        if(op[nfrom][d.from]==1){
          if(Onum[nfrom][d.to]==0){
            Onum[nfrom][d.to]=1;
            Q.push(data(nfrom,d.to,3));
          }
        }
        if(fa[nfrom][d.from]==1){
          if(Anum[nfrom][d.to]==0){
            Anum[nfrom][d.to]=1;
            Q.push(data(nfrom,d.to,1));
          }
        }
        if(fc[nfrom][d.from]==1){
          if(Cnum[nfrom][d.to]==0){
            Cnum[nfrom][d.to]=1;
            Q.push(data(nfrom,d.to,2));
          }
        }
      }
      for(int nto=0;nto<n;nto++){
        if(Onum[d.to][nto]==1){
          if(num[d.from][nto]==0){
            num[d.from][nto]=1;
            Q.push(data(d.from,nto,0));
          }
        }
      }
    }
    if(d.type==1){
      for(int nto=0;nto<n;nto++){
        if(fb[d.to][nto]==1){
          if(num[d.from][nto]==0){
            num[d.from][nto]=1;
            Q.push(data(d.from,nto,0));
          }
        }
      }
    }
    if(d.type==2){
      for(int nto=0;nto<n;nto++){
        if(fd[d.to][nto]==1){
          if(num[d.from][nto]==0){
            num[d.from][nto]=1;
            Q.push(data(d.from,nto,0));
          }
        }
      }
    }
    if(d.type==3){
      for(int nfrom=0;nfrom<n;nfrom++){
        if(num[nfrom][d.from]==1){
          if(num[nfrom][d.to]==0){
            num[nfrom][d.to]=1;
            Q.push(data(nfrom,d.to,0));
          }
        }
      }
    }
  }
  return false;
}

int main(){
  while(1){
    cin>>n>>m>>s>>t;
    if(n==0&&m==0&&s==0&&t==0)break;
    s--,t--;
    init();
    for(int i=0;i<m;i++){
      int from,to;
      string str;
      cin>>from>>to>>str;
      from--,to--;
      if(str=="*"||str=="+"){
        op[from][to]=1;
      }else if(str=="("){
        fa[from][to]=1;
      }else if(str==")"){
        fb[from][to]=1;
      }else if(str=="["){
        fc[from][to]=1;
      }else if(str=="]"){
        fd[from][to]=1;
      }else if(str=="a"){
        num[from][to]=1;
      }
    }
    cout<< (solve()?"Yes":"No") <<endl;
  }
  return 0;
}



Measured memory_bytes: 6080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
const int MOD = 1000000007;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}


int main() {
    ll l,r; cin >> l >> r;
    ll ans = 10000;
    if(r-l >= 2500){
        cout << 0;
        return 0;
    }else{
        for(ll i = l;i < r;i++){
            for(ll j = i+1;j <= r;j++){
                ans = min(ans,(i*j)%2019);
            }
        }
    }
    cout << ans;
}


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

using namespace std;

void print(vector<vector<int> > a){
    for(int i = 1; i < a.size(); i++){
        for(int j = 1; j < a[0].size(); j++){
            cout << a[i][j];
            if(j + 1 < a[0].size())cout << " ";
        }
        cout << endl;
    }
}

int main(void){
    int n;
    cin >> n;
    vector<vector<int> > a(n+1, vector<int>(n+1));
    for(int i = 1; i <= n; i++){
        int k, l;
        cin >> k >> l;
        for(int j = 1; j <= l; j++){
            int temp;
            cin >> temp;
            a[i][temp] = 1;
        }
    }
    print(a);
    return 0;
}


Measured memory_bytes: 3124
#include <cstdio>
#include <map>
#define I(M,A) for(i=0;i<M;i++){scanf("%d",&x);A[i+1]=A[i]+x;}
using namespace std;int main(){for(int n[1501], m[1501],o,a,b,i,j,x;scanf("%d%d",&a,&b),a;printf("%d\n",o)){
map<int,int>z;n[0]=m[0]=o=0;I(a,n)I(b,m)for(i=0;i<=a;i++)for(j=0;j<=b;j++)z[n[i]+m[j]]++;
for(map<int,int>::iterator p=z.begin();p!=z.end();p++)o+=(p->second)*((p->second)-1)/2;
}}

Measured memory_bytes: 18000
import java.util.Scanner;

/**
 * Registration.
 */
public class Main {
    public static void main(String[] args) {
        var scanner = new Scanner(System.in);
        var s = scanner.next();
        var t = scanner.next();

        if (t.startsWith(s)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

}

Measured memory_bytes: 32520
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <ctime>
#include <set>
#include <sstream>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <climits>

#define pb push_back
#define mp make_pair
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ull unsigned long long
#define rep(i,a,b) for(ll i = a; i < b; ++i)
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(typeofa((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define p(a) cout << a << "\n";
#define p1(a) cout << a << " ";

#define PI 3.141592653589793
#define MOD (ll)(1e9 + 7)

using namespace std;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 

void solve()
{
	int n;
	cin >> n;
	ll ans = 0;
	rep(i,0,n)
	{
		int a,b;
		cin >> a >> b;
		ans += b-a+1;
	}	
	p(ans)
}
int main()
{
	bool testing = false;
	IOS
	if(testing)
	{
		freopen("test.txt","rt",stdin);
		int start = clock();
		solve();
		int end = clock();
		cout << "time: " << (end - start)/(double)(CLOCKS_PER_SEC)*1000 << " milliseconds\n";
	}
	else
	{
		solve();
	}
} 

Measured memory_bytes: 256
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[(1,z)for z in a]
b=[tuple(map(int,input().split()))for i in range(m)]
b+=a
b.sort(key=lambda x:x[1])
cnt=0
ans=0
while True:
    c=b.pop()
    if cnt+c[0]<=n:
        ans+=c[0]*c[1]
        cnt+=c[0]
    else:
        ans+=c[1]*(n-cnt)
        break
print('{0}'.format(ans))

Measured memory_bytes: 31976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;

void subtractOrDelete(map<ll,ll> &mp,ll x){
  if(mp[x]==1) mp.erase(x);
  else mp[x]-=1;
}

int main() {
  ll N,L; cin>>N>>L;
  vi a(N); REP(i,N) cin>>a[i];
  map<ll,ll> mp; REP(i,L) mp[a[i]]+=1;
  vi ans; ans.PB((*mp.begin()).first);
  FOR(i,L,N) {mp[a[i]]+=1; subtractOrDelete(mp,a[i-L]); ans.PB((*mp.begin()).first);}
  REP(i,N-L+1) if(i==0) cout<<ans[i]; else cout<<' '<<ans[i]; cout<<endl;

}

Measured memory_bytes: 25112
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
// #include <numeric> // gcdとかlcmとか C++17から
#include <time.h> // time_t timer; time(&timer); でtimerに現在時刻が代入される．
#include <unistd.h> // sleep関数．引数は秒単位．
using namespace std;

typedef long long ll;


// sortの仕方
// 	■ string s の場合
// 	昇順: sort(s.begin(), s.end())
// 	降順: sort(s.rbegin(), s.rend())
//
// 	■ ll a[N] の場合
// 	昇順: sort(a, a+N)
// 	降順: 不明

// vector の使い方
// 宣言：
// vector<int> v;
// vector<int> v(N);
// 初期化:
// vector<int> v(10, 5); 要素数10，全ての要素の値5．
// vector<int> v = {1, 2, 3};
// 代入：
// v[0] = 3;
// sort:
// sort(v.begin(), v.end());
//

// int alph2int(char character) {
//     int x = character - 'a';
//     return x;
// }

ll my_gcd(ll a, ll b){
	return (b==0) ? a : my_gcd(b, a%b);
}

ll my_lcm(ll a, ll b){
	return a*b / my_gcd(a,b);
}

ll factorial(ll a){
	ll ans = 1;
	for(ll i=a; i>0; i--){
		ans *= i;
	}
	return ans;
}

ll pow(ll a, ll b) {
	ll a_powered = 1;
	for (int i=0; i<b; i++) {
		a_powered *= a;
	}
	return a_powered;
}


int main(int argc, char *argv[]){
    int N;
    cin >> N;
    int h[N];
    for (int i=0; i<N; i++) {
        cin >> h[i];
    }

    int ans = 0;
    bool h_past;
    bool h_present;

    for (int j=0; j<100; j++){
        h_past = false;
        for (int i=0; i<N; i++) {
            if(h[i] > 0){
                h_present = true;
                h[i] -= 1;
            } else {
                h_present = false;
            }

            if (h_past == false && h_present == true ){
                ans += 1;
                h_past = true;
            } else if (h_past == true && h_present == false) {
                h_past = false;
            }
        }
    }

    cout << ans << endl;
}


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

string str;
stack<int> vec;
int main()
{
cin>>str;
vec.push(int(str[0]-'0'));
int len=str.size();
for(int i=1;i<len;++i)
{
	if(vec.empty()||(vec.top()==(str[i]-'0')))vec.push(int(str[i]-'0'));
	else vec.pop();
}
//cout<<str.size()<<endl;
cout<<str.size()-vec.size()<<endl;

return 0;
}


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

#define inf (1<<28)

struct g{
  int to, cost;
};
int k;
int v, e;
vector<g> glaph[16];
int dp[1<<15][15];

int solve(int bit, int now){

  int ret = inf;

  if(dp[bit][now] != -1) return dp[bit][now];
  if(bit == (1<<v)-1 && now == k){
    return dp[bit][now] = 0;
  }
  for(int i = 0; i < (int)glaph[now].size(); i++){

    if((bit & (1<<glaph[now][i].to)) == 0){
      ret = min(ret, solve(bit | (1<<glaph[now][i].to), glaph[now][i].to) + glaph[now][i].cost);
    }
  }
  return dp[bit][now] = ret;
}


int main(){

  cin >> v >> e;



  for(int i = 0; i < e; i++){
    int s, t, d;
    cin >> s >> t >> d;
    glaph[s].push_back((g){t,d});
  }

  // for(int i = 0; i < v; i++) glaph[i][i] = 0;
  /*
  for(int a = 0; a < v; a++){
    for(int b = 0; b < v; b++){
      for(int c = 0; c < v; c++){
	glaph[b][c] = min(glaph[b][c], glaph[b][a] + glaph[a][c]);
      } 
    } 
  }
  */
  int ans = inf;
  for(int i = 0; i < v; i++){
    memset(dp,-1,sizeof(dp));
    k = i;
    ans = min(solve(0,i),ans);
  }
  if(ans != inf)  cout << ans << endl;
  else cout << -1 << endl;

}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  ll x,y;
  cin >> x >> y;
  swap(x,y);
  bool ok = false;
  rep(i,1000)rep(j,1000){
    int I = i,J = j;
    ll sum = 2 * I + 4 * J;
    if(sum == x && I + J == y)ok = true;
  }
  if(ok)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = Integer.parseInt(sc.next());

    long sumIn = 0;
    Map<Long, Integer> sumMap = new HashMap<>();
    sumMap.put((long) 0, 1);
    long count = 0;
    for (int i = 0; i < N; i++) {
      sumIn += Integer.parseInt(sc.next());
      sumMap.merge(sumIn, 1, Integer::sum);
      count += sumMap.get(sumIn) - 1;
    }
    System.out.println(count);
  }
}

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

#define PI acos(-1)

int main() {
	int n;
	while (cin >> n) {
		if (n == -1) break;

		double dir = PI / 2.0, x = 0., y = 0.;
		for (; --n >= 0;) {
			dir -= (PI / 2.0);

			x += cos(dir);
			y += sin(dir);

			dir = PI + atan2(y, x);
		}
		printf("%.2lf\n%.2lf\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 3656
S = input()
mod = 10**9 + 7
N = len(S)
cA = 0
cAB = 0
cABC = 0
total = 1
for i in range(N):
    if S[i] == 'A':
        cA += total
    elif S[i] == 'B':
        cAB += cA
    elif S[i] == 'C':
        cABC += cAB
    else:
        cABC *= 3
        cABC += cAB
        cAB *= 3
        cAB += cA
        cA *= 3
        cA += total
        total *= 3
    cABC %= mod
    cAB %= mod
    cA %= mod
    total %= mod
print(cABC)


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

int main() {
    Int n;
    string s;
    cin >> n >> s;
    for (Int i = 0; i < s.size(); i++) {
        Int add = (s[i] - 'A' + n) % 26;
        cout << (char)('A' + add);
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int solve(string s) {
  vector<vector<char>> runs;

  vector<char> tmp;
  for (int i = 0; i < s.size(); i++) {
    if (tmp.size() < 1 || tmp.back() == s[i]) {
      tmp.push_back(s[i]);
    } else {
      runs.push_back(tmp);

      tmp.clear();
      tmp.push_back(s[i]);
    }

    if (i == s.size() - 1) {
      runs.push_back(tmp);
    }
  }

  return (int)runs.size();
}

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

  int n;
  string s;
  cin >> n >> s;

  cout << solve(s) << endl;

  return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef long long ll;

const int len = 2e5+5, inf = 1e9+5;
int suf[2*len];
ii arr[len];
vector<ii> vec;

int main(){
    int n, mn = inf, mx = -inf, mnrig = inf, mxlef = -inf;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d %d", &arr[i].fi, &arr[i].se);
        if (arr[i].fi > arr[i].se)
            swap(arr[i].fi, arr[i].se);

        mn = min(mn, arr[i].fi);
        mx = max(mx, arr[i].se);

        mnrig = min(mnrig, arr[i].se);
        mxlef = max(mxlef, arr[i].fi);
    }

    if (n == 1){
        printf("0\n");
        return 0;
    }

    for (int i = 0; i < n; i++){
        vec.pb(mp(arr[i].fi, i));
        vec.pb(mp(arr[i].se, -1));
    }

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

    suf[2*n-1] = -inf;
    for (int i = 2*n-2; i >= 0; i--){
        suf[i] = suf[i+1];
        if (vec[i+1].se != -1)
            suf[i] = max(suf[i], vec[i+1].fi);
    }

    ll ans = (mxlef-mn)*1LL*(mx-mnrig);

    for (int i = 0, cur = -inf; i < 2*n; i++){
        ans = min(ans, (mx-mn)*1LL*(max(cur, suf[i])-vec[i].fi));

        //printf("i = %d, po = %d, tp = %d, cur = %d, suf = %d\n", i, vec[i].fi, vec[i].se, cur, suf[i]);

        if (vec[i].se == -1)
            break;
        else
            cur = max(cur, arr[vec[i].se].se);
    }

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


Measured memory_bytes: 7920
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int n, C; std::cin >> n >> C;
	std::vector<std::vector<int>> schedule(C, std::vector<int>(100002, 0));
	std::vector<int> overwrap(100002, 0);
	for (auto i = 0; i < n; ++i) {
		int s, t, c; std::cin >> s >> t >> c; --c;
		schedule[c][s]++; schedule[c][t]--;
	}
	for (auto c = 0; c < C; ++c) {
		for (auto i = 1; i < schedule[c].size(); ++i) {
			schedule[c][i] += schedule[c][i - 1];
			if (schedule[c][i - 1] < schedule[c][i]) {
				overwrap[i]++;
			}
			else if (schedule[c][i - 1] > schedule[c][i]) {
				overwrap[i + 1]--;
			}
		}
	}
	for (auto i = 1; i < overwrap.size(); ++i) {
		overwrap[i] += overwrap[i - 1];
	}
	std::cout << *std::max_element(overwrap.begin(), overwrap.end()) << std::endl;
}

Measured memory_bytes: 12536
def factorization(n):
    if n < 2:
      return []
    
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
factor=factorization(n) 
cnt=0
for f in factor:
  c=f[1]
  for i in range(1,100):
    c-=i
    if c < 0:
      break
    cnt+=1
  
print(cnt)


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

int main()
{
	int N;
	cin >> N;

	int maxNum = 0;
	int minNum = pow(10, 9);
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		maxNum = max(maxNum, a);
		minNum = min(minNum, a);
	}

	cout << abs(maxNum - minNum) << endl;
}






Measured memory_bytes: 3580
#include<iostream>
using namespace std;
int main(){
  int n,m,temp,sum=0;
  cin>>n>>m;
  for(int i=0;i<m;++i){
	cin>>temp;
	sum+=temp;
  }
  if(n-sum>=0) cout<<n-sum<<endl;
  else cout<<"-1"<<endl;
  return 0;
}


Measured memory_bytes: 3628
import java.util.*;
class Dice{
    int[] dice = new int[6];
    Dice(int a,int b,int c,int d,int e,int f){
       	dice[0] = a;
        dice[1] = b;
        dice[2] = c;
        dice[3] = d;
        dice[4] = e;
        dice[5] = f;
    }
    public int DiceMove(String f){
        int copy1 = 0;
        int copy2 = 0;
        if(f.equals("S")){//
            
            copy1 = dice[1];
            dice[1] = dice[0];
            copy2 = dice[5];
            dice[5] = copy1;
            copy1 = copy2;
            copy2 = dice[4];
            dice[4] = copy1;
            copy1 = copy2;
            dice[0] = copy1;
        }
        else if(f.equals("N")){//
            
           copy1 = dice[4];
            dice[4] = dice[0];
            copy2 = dice[5];
            dice[5] = copy1;
            copy1 = copy2;
            copy2 = dice[1];
            dice[1] = copy1;
            copy1 = copy2;
            dice[0] = copy1;
            
        }else if(f.equals("W")){//
            
            copy1 = dice[3];
            dice[3] = dice[0];
            copy2 = dice[5];
            dice[5] = copy1;
            copy1 = copy2;
            copy2 = dice[2];
            dice[2] = copy1;
            copy1 = copy2;
            dice[0] = copy1;
            
        }else{ // f. E
            
            copy1 = dice[2];
            dice[2] = dice[0];
            copy2 = dice[5];
            dice[5] = copy1;
            copy1 = copy2;
            copy2 = dice[3];
            dice[3] = copy1;
            copy1 = copy2;
            dice[0] = copy1;
            
        }
        return dice[0];
    }
}
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] D = new int[6];
        int ans = 0;
        
        
        for(int i = 0;i<6;i++){
            D[i] = sc.nextInt();
        }
        
        String line = sc.next();
        String[] array = line.split("");
        
        Dice d = new Dice(D[0],D[1],D[2],D[3],D[4],D[5]);
        
        
        for(String str : array){
            ans = d.DiceMove(str);        
        }
        System.out.println(ans);
            
        
        
       
    }
}


Measured memory_bytes: 26436
import sys
import numpy as np
#from numba import njit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
#@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

A = np.array(read().split(), np.int32)[1:]
 
print(solve(A))

Measured memory_bytes: 39340
#include<iostream>

using namespace std;

int main()
{
    long long H; cin >> H;
    long long tmp,result;
    tmp=1;
    result = 1;
    while(H / 2)
    {
        H = H /2;
        result = result + 1;
    }
    for(int i=0;i<result;i++)
    {
        tmp = 2*tmp;
    }
    cout << tmp -1  <<endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
  int N;
  int A[3][101];

  cin >> N;
  for (int i = 1; i <= N; i++) cin >> A[1][i];
  for (int i = 1; i <= N; i++) cin >> A[2][i];
  
  int maximum = 0;
  for (int i = 1; i <= N; i++) {
    int sum = 0;
    for (int k = 1; k <= i; k++) {
      sum += A[1][k];
    }
    for (int k = i; k <= N; k++) {
      sum += A[2][k];
    }
    if (maximum < sum) maximum = sum;
  }
  cout << maximum << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int i;
	double n,v,y;
	
	for(;cin >> n;)
	{
		v=double(n)/9.8;
		y=4.9*v*v;
		for(i=1;5*(i-1)<y;i++)
		{}
		cout << i << endl;
	}
}

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

using namespace std;

typedef long long  ll;

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

    int n, swap_time = 0;

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

    bool flag = true;
    for (int i = 0; flag; ++i) {
        flag = false;
        for (int j = n - 1; j > i; --j)
            if (a[j] < a[j - 1]) {
                ++swap_time;
                flag = true;
                swap(a[j], a[j - 1]);
            }
    }

    for (int i = 0; i < n; ++i)
        cout << a[i] << (i == n - 1 ? '\n' : ' ');
    cout << swap_time << "\n";

    return 0;
}

Measured memory_bytes: 1200
N = input()
n_dig = len(N)
N = int(N)

def dfs(cur_n, n_3, n_5, n_7, cur_dig) : 
    if cur_dig == n_dig : 
        if cur_n <= N and n_3 >= 1 and n_5 >= 1 and n_7 >= 1 : 
#            print(cur_n, n_3, n_5, n_7, cur_dig)
            return 1
        else : 
            return 0

    a = dfs(cur_n*10 +3, n_3 +1, n_5, n_7, cur_dig +1)
    b = dfs(cur_n*10 +5, n_3, n_5 +1, n_7, cur_dig +1)
    c = dfs(cur_n*10 +7, n_3, n_5, n_7 +1, cur_dig +1)
    d = 0
    
    if (n_dig -3) > cur_dig and n_3 == 0 and n_5 == 0 and n_7 == 0 : 
        d = dfs(cur_n, n_3, n_5, n_7, cur_dig +1)
    
    return(a + b + c + d)

print(dfs(0, 0, 0, 0, 0))

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int l = Integer.parseInt(scanner.next());

        IntStream.range(0, n)
                .mapToObj(v -> scanner.next())
                .sorted()
                .forEach(System.out::print);

        scanner.close();
    }
}

Measured memory_bytes: 27988
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll i,j,k,l,m,n,a,b,c,d,cnt=0;
    string s,s1;
    cin>>s>>s1;
    ll l1=s1.length();
    l=s.length();
    if(l>=l1)
        cout<<"No"<<endl;
    else
    {for(i=0;i<l;i++)
    {
        if(s[i]==s1[i])
            cnt++;
    }
    if(cnt==l && (l1==(l+1)))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define MAXN 100005
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
using namespace std;

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	int n;
	char s[MAXN];
	int sol = 1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		if (i and s[i] != s[i - 1]) sol++;
	}
	
	cout << sol;
	
	return 0;
}
 

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

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

int MDay(int y, int m, int d)
{
  y--; m--; d--;
  return 195*y + (y/3 * 5) + 20*m - ((y+1)%3 != 0) * (m/2) + d;
}
int main()
{
  int t = MDay(1000, 1, 1);
  rep(i, in()){
    int y, m, d;
    y = in(), m = in(), d = in();
    printf("%d\n", t - MDay(y, m, d));
  }
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

	vl a(n);
	FOR(i,0,n) cin >> a[i];
	sort(all(a));
	cout << (unique(all(a)) == end(a) ? "YES" : "NO") << endl;


}



Measured memory_bytes: 1792
import numpy as np

mod = 10**9+7
n=int(input())
A=np.array(list(map(int,input().split())))
ans = 0

for i in range(60):
  n1 = np.count_nonzero((A>>i)&1)
  n0 = n-n1
  ans += (2**i)*n1*n0 % mod
ans %= mod
print(ans)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n;

signed main() {
    cin >> n;
    int b = sqrt(n)+1;
    for(int i=b;i>=0;--i) {
        if (n%i == 0) {
            cout << i + n/i - 2 << endl;
            return 0;
        }
    }
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	long i,n,a=0;
	cin>>s;
	n=s.size();
	for(i=0;i<n;i++)
	{
		a=a+(s[i]-'0');
	}
	if(a%9==0)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


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

const int N = (int) 1e5 + 7;
long long q[N];
long long res[N];

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int nq; cin >> nq;
    for (int i = 0; i < nq; ++i) cin >> q[i];
    vector<long long> v (1, n);
    for (int i = 0; i < nq; ++i) {
        while (!v.empty() && q[i] <= v.back()) v.pop_back();
        v.push_back(q[i]);
    }
    vector<long long> cnt (v.size());
    cnt.back() = 1;
    for (int i = (int) v.size() - 1; i >= 0; --i) {
        long long l = v[i];
        while (l > v[0]) {
            int p = lower_bound(v.begin(), v.end(), l) - v.begin() - 1;
            cnt[p] += l / v[p] * cnt[i];
            l %= v[p];
        }
        res[l] += cnt[i];
    }
    for (int i = n - 1; i > 0; --i) res[i] += res[i + 1];
    for (int i = 1; i <= n; ++i) cout << res[i] << '\n';
    return 0;
}


Measured memory_bytes: 4980
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	long long X, Y;
	cin >> X >> Y;

	long long ans = 0;
	long long Aval = X;

	while (Aval <= Y) {
		ans += 1;
		Aval *= 2;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
const int MAXN = 1e5+7;
const int INF = 0x3f3f3f3f;
char s[MAXN];
int n,m,f[MAXN],pre[MAXN];
struct SegmentTree{
    int val[MAXN<<2],l[MAXN<<2],r[MAXN<<2];
    inline int ls(int rt) { return rt << 1; }
    inline int rs(int rt) { return rt << 1 | 1; }
    void pushup(int rt){ val[rt] = min(val[ls(rt)],val[rs(rt)]); }
    void build(int L, int R, int rt){
        l[rt] = L, r[rt] = R;
        if(L+1==R) return;
        int mid =(L+R) >> 1;
        build(L,mid,ls(rt));
        build(mid,R,rs(rt));
    } 
    void update(int pos, int rt, int x){
        if(l[rt]+1==r[rt]){
            val[rt] = x;
            return;
        }
        int mid = (l[rt]+r[rt]) >> 1;
        if(pos<mid) update(pos,ls(rt),x);
        else update(pos,rs(rt),x);
        pushup(rt);
    }
    int querymin(int L, int R, int rt){
        if(l[rt]>=R || L>=r[rt]) return INF;
        if(L<=l[rt] && r[rt]<=R) return val[rt];
        return min(querymin(L,R,ls(rt)),querymin(L,R,rs(rt)));
    }
}ST;
int main(){
    ____();
    cin >> n >> m >> s;
    if(s[0]=='1'||s[n]=='1'){
        cout << -1 << endl;
        return 0;
    }
    ST.build(0,n+1,1);
    for(int i = n-1; i >= 0; i--){
        if(s[i]=='1') ST.update(i,1,f[i]=INF);
        else ST.update(i,1,f[i]=ST.querymin(i+1,min(n,i+m)+1,1)+1);
    }
    if(f[0]>=INF){
        cout << -1 << endl;
        return 0;
    }
    vector<int> vec;
    vec.push_back(0);
    while(vec.back()!=n){
        for(int i = vec.back()+1;;i++){
            if(f[i]==f[vec.back()]-1){
                vec.push_back(i);
                break;
            }
        }
    }
    for(int i = 1; i < vec.size(); i++) cout << vec[i]-vec[i-1] << ' ';
    cout << endl;
    return 0;
}

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

int main() {

	int count[4][3][10];
	int n;
	int b, f, r, v;

	//
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 10; ++k) {
				count[i][j][k] = 0;
			}
		}
	}

	//
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> b >> f >> r >> v;
		count[b - 1][f - 1][r - 1] += v;
	}

	//
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 10; ++k) {
				cout << " " << count[i][j][k];
			}
			cout << endl;
		}
		if (i < 3)
			cout << "####################\n";
	}

	return 0;
}

Measured memory_bytes: 1168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] iArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long X = iArray[0];
            long Y = iArray[1];
            string result = "No";

            if (Y < X * 4 && X * 2 < Y)
            {
                long turu = ((X * 4) - Y) / (4 - 2);
                long kame = X - turu;
                if (Y == turu *2+ kame * 4)
                {
                    result = "Yes";
                }
            }
            else if (X * 4 == Y)
            {
                result = "Yes";
            }
            else if (X * 2 == Y)
            { 
                result = "Yes";
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 28208
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d=0;
    scanf("%d %d %d",&a,&b,&c);
    d=c-(a-b);
    if(d>0){
    printf("%d",d);
    }else{
        printf("0");
    }
    return 0;
}

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

public class Main{
  static final int INF = Integer.MAX_VALUE / 2;
  static int n, ma, mb;
  static int[] a, b, c;

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

    n = sc.nextInt();
    ma = sc.nextInt();  mb = sc.nextInt();
    a = new int[n];
    b = new int[n];
    c = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      c[i] = sc.nextInt();
    }

    int[][][] dp = new int[n + 1][n * 10 + 1][n * 10 + 1];

    for(int j = 0; j < dp[0].length; j++){
      Arrays.fill(dp[0][j], INF);
    }
    dp[0][0][0] = 0;

    for(int i = 1; i <= n; i++){
      for(int j = 0; j < dp[i].length; j++){
        for(int k = 0; k < dp[i][j].length; k++){
          if(j - a[i - 1] >= 0 && k - b[i - 1] >= 0){
            dp[i][j][k] =
              Math.min(dp[i - 1][j][k], 
                  dp[i - 1][j - a[i - 1]][k - b[i - 1]] + c[i - 1]);
          }
          else{
            dp[i][j][k] = dp[i - 1][j][k];
          }
        }
      }
    }

    int min = INF;
    for(int i = 1; Math.max(i * ma, i * mb) < dp[0][0].length; i++){
      min = Math.min(min, dp[n][i * ma][i * mb]);
    }

    if(min != INF){
      System.out.println(min);
    }
    else{
      System.out.println(-1);
    }
  }
}


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

#define DB	double
#define lf	else if
#define	I64	long long
#define Rd()	(rand() << 15 | rand())
#define For(i,a,b)	for(int i=a;i<=b;i++)
#define Rep(i,a,b)	for(int i=a;i>=b;i--)
	
#define fi	first
#define se	second
#define MK	make_pair
#define PA	pair<int, int>

#define CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for (; CH < '0' || ch > '9';)	f= (ch == '-');
		for (; ch >= '0' && ch <= '9'; CH)	(x*= 10)+= ch - '0';
		return	f ? -x : x;
}

int		N, Y;

int		main()	{
		N= IN();
		Y= IN();
		
		For(i, 0, N)	For(j, 0, N - i)
			if	(i*10000 + j*5000 + (N-i-j)*1000 == Y)	{
				printf("%d %d %d\n", i, j, N-i-j);
				return	0;
			}
			
		puts("-1 -1 -1");
}


Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

namespace A {
    class Program {
        static void Main(string[] args) {
            var hiInf = new Regex(@"^hi{2,}");
            var regex = new Regex(@"^(hi)+$");
            var str = Console.ReadLine();

            if (hiInf.IsMatch(str)) {
                Console.WriteLine("No");
                return;
            }

            if (regex.IsMatch(str))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            
        }
    }
}


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

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

int main(){
    int N;
    cin >> N;
    int a = 0, b = 0, c = 0, d = 0;
    rep(i, N){
        string s;
        cin >> s;
        if(s == "AC") a++;
        if(s == "WA") b++;
        if(s == "TLE") c++;
        if(s == "RE") d++;
    }
    printf("AC x %d\n", a);
    printf("WA x %d\n", b);
    printf("TLE x %d\n", c);
    printf("RE x %d\n", d);
    return 0;
}

Measured memory_bytes: 3704
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};

typedef struct node* Nodepointer;
Nodepointer nil, root;

Nodepointer treeMinimum(Nodepointer x){
  while( x->left != nil ) x = x->left;
  return x;
}

Nodepointer find(Nodepointer u, int k){
  while( u != nil && k != u->key ){
    if( k < u->key ) u = u->left;
    else u = u->right;
  }
  return u;
}

Nodepointer treeSuccessor(Nodepointer x){
  if( x->right != nil ) return treeMinimum(x->right);
  Nodepointer y = x->parent;
  while( y != nil && x == y->right ){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Nodepointer z){
  Nodepointer y;
  Nodepointer x;

  if( z->left == nil || z->right == nil ) y = z;
  else y = treeSuccessor(z);

  if( y->left != nil ) x = y->left;
  else x = y->right;

  if( x != nil ) x->parent = y->parent;
  if( y->parent ==nil ) root = x;
  else {
    if( y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }

  if( y != z ){
    z->key = y->key;
  }

  free(y);
}

void insert(int k){
  Nodepointer x, y, z;
  y = nil;
  x = root;

  z = (Nodepointer)malloc(sizeof(struct node));
  z->key = k;
  z->left = nil;
  z->right = nil;
  
  while( x != nil ){
    y = x;
    if( z->key < x->key ) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if( y == nil ) root = z;
  else if( z->key < y->key ) y->left = z;
  else y->right = z;
}

void inorder(Nodepointer u){
  if( u == nil ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Nodepointer u){
  if( u == nil ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  char com[7];

  scanf("%d", &n);

  for( i = 0 ; i < n ; i++ ){
    scanf("%s",com);
    if( com[0] == 'f' ){
      scanf("%d", &x);
      Nodepointer t = find(root, x);
      if( t != nil ) printf("yes\n");
      else printf("no\n");
    }
    else if( strcmp("insert",com) == 0 ){
      scanf("%d", &x);
      insert(x);
    }
    else if( strcmp("print",com) == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if( strcmp("delete", com) == 0 ){
      scanf("%d", &x);
      treeDelete(find(root, x));
    }
  }
  return 0;

}



Measured memory_bytes: 20456
#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<set>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
	while(1){
		int w,h;
		cin>>w>>h;
		if(w==0)break;
		
		int dp[22][22]={0};
		int masu[22][22]={0};
		
		reps(i,h){
			reps(j,w){
				cin>>masu[i][j];
			}
		}
		
		reps(j,w){
			if(masu[1][j]!=0)continue;
			dp[1][j]=1;
		}
		
		reps(i,h-1){
			reps(j,w){
				if(masu[i][j]==0){
					if(masu[i+1][j]!=1) dp[i+1][j]+=dp[i][j];
					if(masu[i+1][j-1]==0) dp[i+1][j-1]+=dp[i][j];
					if(masu[i+1][j+1]==0) dp[i+1][j+1]+=dp[i][j];
				}
				if(masu[i][j]==1){
					
				}
				if(masu[i][j]==2){
					if(masu[i+2][j]!=1)dp[i+2][j]+=dp[i][j];
				}
			}
		}
		
		/*
		rep(i,h+3){
			rep(j,w+2){
				printf("%d ",dp[i][j]);
			}puts("");
		}*/
		
		int ans=0;
		rep(i,2){
			reps(j,w){
				ans += dp[h+i][j];
			}
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll ans = 0;
  rep(i,n-1) {
    ll t = a[i] + a[i+1];
    if (t > x) {
      a[i+1] -= t-x;
      ans += t-x;
      if (a[i+1] < 0) {
        a[i+1] = 0;
      }
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3952