akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int w, h;
int c[100][100];

int dx[] = { 0,1,1,1,0,-1,-1,-1 };
int dy[] = { 1,1,0,-1,-1,-1,0,1 };

void solve(int y, int x) {
	c[y][x] = 0;
	rep(i, 8) {
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (ny >= 0 && ny < h&&nx >= 0 && nx < w) {
			if (c[ny][nx] == 1)solve(ny, nx);
		}
	}
}

int main() {
	while (cin >> w >> h&&w + h) {
		ll ans = 0;
		rep(i, h) {
			rep(j, w) {
				cin >> c[i][j];
			}
		}
		rep(i, h) {
			rep(j, w) {
				if (c[i][j] == 1) {
					ans++;
					solve(i, j);
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3132
export const main = (input: string) => {
  const lines = input.split('\n')
  const tmp = lines[0].split(' ')
  const a = parseInt(tmp[0], 10)
  const b = parseInt(tmp[1], 10)
  console.log(`${((a * b) % 2) === 0 ? 'Even' : 'Odd'}`)
}

if (process.env.NODE_ENV !== 'test') {
  main(require('fs').readFileSync('/dev/stdin', 'utf8'))
}


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

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
		if(str.equals("hi") || str.equals("hihi") || str.equals("hihihi") || str.equals("hihihihi") || str.equals("hihihihihi")) {
        	System.out.println("Yes");
        } else {
        	System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue<int,vector<int> ,greater<int>>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int power(int a,int n)
{
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return a*power(a*a,n/2);
    return power(a*a,n/2);
}

const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....when p is prime
}

void solve(){
   string s;
   cin >> s;
   int cnt[2020],ans = 0;
   memset(cnt,0,sizeof cnt);
   FOR(i,0,sz(s)){
    int tmp[2019];
    FOR(j,0,2019)if((10*j+s[i]-'0')%2019 == 0){
        ans += cnt[j];
    }
    FOR(j,0,2019)tmp[(j*10+s[i]-'0')%2019] = cnt[j];
    FOR(j,0,2019)cnt[j] = tmp[j];
    cnt[s[i]-'0']++;
   }
   cout << ans << "\n";
}

signed main()
{
    showoff;
    int t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...  

Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a,vector<vector<ll>> b,int n){
	int i,j,k,t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k]*b[k][j] % M)%M;
			c[i].push_back(t);
		}
	}
	return c;
}
int main() {
	int k, i, p=1;
	char s[111];
	cin >> s >> k;
	for (i = 0; s[i] != '\0'&&i < k; i++) {
		if (s[i] != '1') {
			p = s[i] - '0';
			break;
		}
	}
	cout << p << endl;
}


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


int main(){
  int n,i;
  cin >> n;
  int j=2*n;
  vector<int> l(j);
  for(i=0;i<j;++i){
    cin >> l[i];
  }
  sort(l.begin(),l.end());
  int ans=0;
  for(i=0;i<=j-2;i=i+2){
    ans=ans+l[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

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

int v[100005];

int main(void) {
  int n, k;
  cin >> n >> k;
  rep(i, 0, n) scanf("%d", &v[i]);
  int t = v[0], mx = v[0];
  rep(i, 1, n) {
    t = gcd(t, v[i]);
    mx = max(mx, v[i]);
  }
  
  if (k<=mx && k%t==0) puts("POSSIBLE");
  else puts("IMPOSSIBLE");
  
  
    return 0;
}



Measured memory_bytes: 640
//codeforces
#include <algorithm>
#include <vector>
#include <string>
#include <ctype.h>
#include <set>
#include <map>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<bitset>
#include <climits>
#include<tr1/unordered_set>
#include<tr1/unordered_map>


#define FOR(i,j,k) for(int i=j;i<k;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
//#define int long long
#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define VAR(i,n) __typeof(n) i = (n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();i++)
#define FORDEACH(i,c) for( VAR(i,(c).rbegin()),i!=(c).rend();i++)
#define REP(i,n) FOR(i,0,n)
#define ld long double
const int INF = 1e9+7;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;

using namespace std;

class TrieNode{
    public:
    bool isword;
    char c;
    map<char,TrieNode*> m;
    string word;
    public:
    TrieNode(){}
    TrieNode(char ch){
        c=ch;
        isword=false;
    }
};

void insert(TrieNode* root,string word){
    TrieNode* temp=root;
    for(char c:word){
        if(temp->m.find(c)==temp->m.end())
            temp->m[c]=new TrieNode(c);
        temp=temp->m[c];
    }
    temp->isword=true;
    temp->word=word;
}

#pragma GCC optimize ("Ofast")
static auto _ = [] { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0); std::cerr.tie(0); return 0; } ();

int main() {
    int n;
    cin>>n;
  	int k;
  	cin>>k;
    vector<int> v(n),dp(n,INT_MAX);
    for(int i=0;i<n;i++)
        cin>>v[i];
    dp[0]=0;

    for(int i=0;i<n;i++){
        for(int j=1;j<=k;j++){
        if(i+j<n)
            dp[i+j]=min(dp[i+j],dp[i]+abs(v[i]-v[i+j]));
        }
    }

    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 4000
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		char ch1[];
		char ch2[];
		String str1 = sc.next();
		ch1=str1.toCharArray();

		String str2 = sc.next();
		ch2=str2.toCharArray();
		// 出力

		for(int i=0;i<ch1.length;i++){
			if(ch1[i]!=ch2[ch2.length-i-1]) {
				System.out.println("NO");
				System.exit(0);
			}
		}
		System.out.println("YES");
	}

}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N, x;
int ans[200010];

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

	if (x == N*2-1 || x == 1) {
		puts("No");
	} else {
		puts("Yes");

		ans[N] = x + 1;
		ans[N-1] = x;
		ans[N-2] = x - 1;

		int i = 0, c = 1;
		while (i < N*2-1) {
			if (i == N-2) {
				i = N+1;
			}
			if (c == x - 1) {
				c = x + 2;
			}

			ans[i] = c++; 
			++i;
		}

		rep(i, N*2-1) printf("%d\n", ans[i]);
	}

	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>


using namespace std;

int main() {
	int n, count, x, i, s, a;

	cin >> n;

	count = 0;
	s = 0;
	a = 0;
	for (i = 0; i < n; i++) {
		cin >> x;
		if (x % 4 == 0) {
			count++;
		}
		else if (x % 2 == 0) {
			a++;
		}
	}
	count += a / 2;

	if (n / 2 <= count) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;

signed main() {
	int cnt[101] = {0};
	int i, n;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		int d;
		cin >> d;
		cnt[d]++;
	}
	
	int ans = 0;
	for (i = 0; i <= 100; i++) {
		if (cnt[i] > 0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+100,M=2e5+100,INF=0x7fffffff/2;
bool vis[N],flag;
int n,m,dis[N];
struct Graph{
	int tot,tail[N];
	struct edge{
		int v,w,last;
	}e[M<<1];
	void clear(){tot=0;memset(tail,0,sizeof tail);} 
	void add(int x,int y,int w){
		e[++tot]=(edge){y,w,tail[x]};
		tail[x]=tot;
	}
}G;
void SPFA_DFS(int h)
  {
       if(flag) return ;
       register int p,v,w;
       vis[h]=true;
       for(p=G.tail[h];p;p=G.e[p].last)
       {
           v=G.e[p].v,w=G.e[p].w;
           if(dis[v]>dis[h]+w)
          {
              if(vis[v]){flag=true;return ;}
              dis[v]=dis[h]+w;
              SPFA_DFS(v);
              if(flag) return ;
          }    
      }
      vis[h]=false;
  }
int main()
{
	register int i,l,r,d;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;++i){
		scanf("%d%d%d",&l,&r,&d);
		G.add(l,r,d),G.add(r,l,-d);
	}
	for(i=1;i<=n;++i){
		SPFA_DFS(i); if(flag) break;
	}
	if(flag) printf("No");
	else printf("Yes");
	return 0;
} 

Measured memory_bytes: 7808
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()

typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int32_t, int32_t> pii;
typedef vector<int32_t> vi;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;

  int32_t n, k;
  cin >> n >> k;
  int32_t a[n];
  bool dp[k + 1];
  rep(i, n) { cin >> a[i]; }

  rep(ik, k + 1) {
    auto res = false;
    rep(ia, n) {
      if (ik - a[ia] >= 0 && !dp[ik - a[ia]]) {
        res = true;
        break;
      }
    }
    dp[ik] = res;
  }

  cout << (dp[k] ? "First" : "Second");
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include<set>
using namespace std;

int main()
{
	const int M = 1000005;
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) cin >> a[i];

	vector<int> cnt(M);
	for (int i = 0; i < N; ++i)
	{
		if (cnt[a[i]] != 0)
		{
			cnt[a[i]] = 2;
			continue;
		}
		for (int j = a[i]; j < M; j += a[i]) cnt[j]++;
	}

	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (cnt[a[i]] == 1) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 7988
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
// ll const MOD = 1000000007;
ll const MOD = 998244353;

struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}

    mint operator-() const { return mint(-x); }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;

        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    // 順列の計算
    mint p(int n, int k) { return fact[n] * ifact[n - k]; }
};

int main() {
    INIT;

    ll N, M, K;
    cin >> N >> M >> K;

    combination comb(N);
    mint ans = 0;
    rep(k, K + 1) {
        ans += mint(M) * comb(N - 1, k) * mint(M - 1).pow(N - 1 - k);
    }
    cout << ans << endl;
    // cout << mint(M).pow(1) * mint(99).pow(99) << endl;

    return 0;
}

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

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)
#define _popcnt __builtin_popcount

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

// typedef long long ll;
#define int long long
#define double long double

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

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int H, N, A; cin >> H >> N;
  int sum = 0;
  REP(i, N){
    cin >> A; sum += A;
  }
  if(sum >= H) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define pb push_back
#define inf 1e+18L
#define MOD 1000000007

int main()
{
    FastIO 
    int n,x,y;
    int ans [2001];
    cin >> n >> x >> y;
    for(int i = 1 ; i <= n - 1 ; i++){
        ans[i] = 0;
    }
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 + i ; j <= n; j++){
            int min_dist = j - i ;
            if(min_dist > abs(i-x) + 1 + abs(j-y)){
                min_dist = abs(i-x) + 1 + abs(j-y);
            }
            if(min_dist > abs(i-y) + 1 + abs(j-x)){
                min_dist = abs(i-y) + 1 + abs(j-x);
            }
            ans[min_dist]++;
        }
    }
    for(int i = 1 ; i <= n-1 ; i++){
        cout << ans[i] <<"\n";
    }
    return 0;
}

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int x, y;
    while (true){
        cin >> x >> y;
        if(x == 0 && y == 0){
            break;
        }
        cout << min(x, y) << " " << max(x, y) << endl;
    }
}


Measured memory_bytes: 3088
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}


static void B_task()
{
	int N;
	get1int(N);

	int p[50] = { 0 };
	std::map<int, int> list;
	for (int i = 0; i < N; i++) {
		get1int(p[i]);
		list[p[i]] = i;
	}
	
	int i = 0;
	int diffCnt = 0;
	int firstDiff = 0;
	for (auto it = list.begin(); it != list.end(); it++, i++) {
		if (i != it->second) {
			if (diffCnt == 0) {
				firstDiff = i;
				diffCnt++;
			}
			else {
				if (firstDiff != it->second) {
					printf("NO\n");
					return;
				}
				diffCnt++;
			}
		}
	}

	if ((diffCnt == 2) || (diffCnt == 0)) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<queue>

using namespace std;


int main() {
	int H, R;
	cin >> H >> R;

	if (H > -R) {
		cout << 1 << endl;
	}
	if (H == -R) {
		cout << 0 << endl;
	}
	if (H < -R) {
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3116
N = int(input())
mod = 10**9 +7
stack = [[0 for _ in range(64)] for _ in range(N+1)]
LI = ['0','1','2','3']
def judge(x):
    for i in range(4):
        if i >= 1:
            x[i-1], x[i] = x[i], x[i-1]
        if ''.join(x).count('012') >= 1:
            return False
        if i >= 1:
            x[i-1], x[i] = x[i], x[i-1]
    return True
def nu(x,y,z):
    return 16*int(x)+4*int(y)+int(z)
for i in range(64):
    if (i == 6) or (i == 9) or (i == 18):
        stack[3][i] = 0
    else:
        stack[3][i] = 1
for i in range(4,N+1):
    for j in LI:
        for k in LI:
            for l in LI:
                cnt = 0
                for m in LI:
                    if judge([m,j,k,l]):
                        cnt += stack[i-1][nu(m,j,k)] 
                stack[i][nu(j,k,l)] = cnt % mod
ans = 0
for i in range(64):
    ans += stack[N][i]
print(ans % mod)

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

int main(){
  long long a, b, c;
  cin >> a >> b >> c;
  c -= a+b;
  if(c <= 0)cout << "No" << endl;
  else{
    if(4*a*b < c*c)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

using namespace std;

int main()
{
    string s, t;    cin >> s >> t;

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

    string u;   cin >> u;

    if(u == s)  A--;
    if(u == t)  B--;

    cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;


int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    vector<vector<int>> F(n,vector<int>(10,0)), P(n,vector<int>(11,0));
    
    for(int i=0; i<n; i++){
        for(int j=0; j<10; j++){
            cin>>F[i][j];
        }
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<=10; j++){
            cin>>P[i][j];
        }
    }
    
    int ans=-MOD;
    for(int mask=1; mask<(1<<10); mask++){
        vector<int> cts(n,0);
        int anst=0;
        for(int j=0; j<10; j++){
            if(mask&(1<<j)){
                for(int i=0; i<n; i++){
                    if(F[i][j]){
                        cts[i]++;
                    }
                }
            }
        }
        for(int i=0; i<n; i++){
            anst+=P[i][cts[i]];
        }
        ans=max(ans,anst);
        
        
    }
    
    cout<<ans;
   
    
    
    return 0;
}

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


int main() {
  int N, M;
  cin >> N >> M;
  int tmpL, tmpR;
  int under_lim=1, up_lim=N;
  
  for (int i=0; i<M; i++) {
    cin >> tmpL >> tmpR;
    if(tmpL>under_lim) under_lim = tmpL;
    if(tmpR<up_lim) up_lim = tmpR;
  }
  
  if (up_lim<under_lim) cout << 0 << endl;
  else cout << up_lim -under_lim + 1 << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int next_num(int s) {
    int square = s * s;
    return (square % 1000000) / 100;
}

void print_random(int s) {
    int prev = s;
    for (int i = 0; i < 10; i++) {
        prev = next_num(prev);
        cout << prev << endl;
    }
}

int main() {
    int n; cin >> n;
    for (int i = 1; i <= n; i++) {
        int s; cin >> s;
        cout << "Case " << i << ":\n";
        print_random(s);
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////

int main() {
	ll N;
	cin >> N;
	vll C(4,0);
	vector<string> s = { "AC","WA","TLE","RE" };

	rep(i, N) {
		string t;
		cin >> t;
		rep(j, 4) { if (t == s[j]) { C[j]++; } }
	}

	rep(j, 4) {
		cout << s[j] << " x " << C[j] << endl;
	}


}

Measured memory_bytes: 3584
from collections import deque


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    A = [read_int() for _ in range(N)]
    A.sort()
    i, j = 0, N-2
    left = right = N-1 # points to left and right side of array
    answer = 0
    while i <= j:
        d, i, j, left, right = max([(abs(A[left]-A[i]), i+1, j, i, right),
                                    (abs(A[left]-A[j]), i, j-1, j, right),
                                    (abs(A[right]-A[i]), i+1, j, left, i),
                                    (abs(A[right]-A[j]), i, j-1, left, j)])
        answer += d
    return answer


if __name__ == '__main__':
    print(solve())


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

using namespace std;

int main(){
    
    int N, C;
    cin >> N >> C;
    
    pair<int, pair<int, int> > tv[N];
    
    for (int i = 0; i < N; i++) {
        cin >> tv[i].second.first >> tv[i].second.second >> tv[i].first;
    }
    
    sort(tv, tv+N);
    
    
    
    vector<int> time(100002, 0);
    
    int chan = 1;
    int i = 0;
    while (i < N) {

        vector<int> ch(100002, 0);
        
        if (chan == tv[i].first) {
            
            while (chan == tv[i].first) {
                
                for (int j = tv[i].second.first; j < tv[i].second.second; j++) {
                    
                    ch[j] += 1;
                    
                    
                }
                
                
                i += 1;
                
            }
            
            ch[100001] = 1;
            
            for (int k = 0; k <= 100000; k++) {
                if (ch[k] == 1 && ch[k+1] == 1) {
                    time[k] += 1;
                    
                    
                }else if(ch[k] == 1 && ch[k+1] == 0){
                    time[k] += 1;
                    time[k+1] += 1;
                    
                    
                }
            }
            
            
        }
        
        chan += 1;
    }
    
    int ans = 0;
    
    
    for (int i = 1; i <= 100000; i++) {
        ans = max(ans, time[i]);
        
    }
    
    
    cout << ans << endl;
    
}


Measured memory_bytes: 2304
x, k, d = map(int, input().split())
x_pre = x
y = abs(x) - k*d

if y >= 0:
    print(y)
    exit()

while k > 0:
    if x >= 0:
        x -= d
    else:
        x += d

    if abs(x) >= abs(x_pre):
        if k % 2 == 0:
            print(abs(x_pre))
            exit()
        else:
            print(abs(abs(x_pre) - d))
            exit()
    else:
        x_pre = x
        k -= 1

print(abs(x_pre))

Measured memory_bytes: 62952
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

struct Vertex {
  int64_t direction{-1};
  vector<int64_t> neighbours;
};

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

  int64_t N, M;
  cin >> N >> M;
  vector<Vertex> vertices(N + 1);
  for (int64_t i = 0; i < M; ++i) {
    int64_t a, b;
    cin >> a >> b;
    vertices[a].neighbours.emplace_back(b);
    vertices[b].neighbours.emplace_back(a);
  }

  queue<int64_t> q;
  vertices[1].direction = 1;
  q.emplace(1);
  while (!q.empty()) {
    const int64_t t = q.front();
    q.pop();
    for (const int64_t neighbour : vertices[t].neighbours) {
      if (vertices[neighbour].direction < 0) {
        vertices[neighbour].direction = t;
        q.emplace(neighbour);
      }
    }
  }
  bool is_okay = true;
  for (int64_t i = 1; i <= N; ++i) {
    if (vertices[i].direction < 0) {
      is_okay = false;
    }
  }
  if (is_okay) {
    cout << "Yes" << endl;
    for (int64_t i = 2; i <= N; ++i) {
      cout << vertices[i].direction << endl;
    }
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 12864
import java.awt.RadialGradientPaint;
import java.awt.geom.CubicCurve2D;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;



public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            long[] input = reader.readLongsSplitByDelimiter(" ");
            long takahasi = input[0];
            long nakahasi = input[1];
            long ktimes = input[3];

            if (ktimes % 2 == 0) {
                System.out.println(takahasi - nakahasi);
            } else {
                System.out.println(nakahasi - takahasi);
            }
        }
    }
}
 
class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;
 
    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }
 
    String readLine() throws IOException {
        return this.br.readLine();
    }
 
    int readInt() throws IOException {
        return Integer.parseInt(this.br.readLine());
    }
 
    long readLong() throws IOException {
        return Long.parseLong(this.br.readLine());
    }
 
    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.br.readLine().split(delimiter);
    }
 
    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);
 
        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }
 
        return ints;
    }
 
    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);
 
        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }
 
        return longs;
    }
 
    @Override
    public void close() throws IOException {
        br.close();
    }
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define hi cout<<'h'<<'i'<<'\n' 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define all(v) v.B,v.E
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;
    string s;
    cin>>s;
    n=sz(s);

    int pre[n+1];
    pre[n]=0;
    int ten=1;
    map<int,int> mp;
    mp[0]++;
    for(i=n-1;i>=0;i--)
    {
        pre[i]=ten*(s[i]-'0')+pre[i+1];
        ten*=10;
        ten%=2019;
        pre[i]%=2019;
        mp[pre[i]]++;
    }

    ll ans=0;
    for(auto &z:mp)
    {
        ans+= z.S*((ll)z.S-1)/2;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 4528
using System;
using System.Linq;
using System.Text;

namespace V0043{
    public class Program{
        public static void Main(string[] args){
            string input;
            while((input = Console.ReadLine()) != null){
                var tile = new int[12];
                Array.ForEach(input.ToCharArray(), c => tile[c - '0']++);

                var hora = false;
                Action<int> act = null;
                act = x =>{
                    if(tile[x] < 0 || tile[x + 1] < 0 || hora) {
                        return;
                    }

                    if(x >= 9){
                        if(tile.Count(i => i == 2) == 1 && tile.All(i => i == 0 || i == 2 || i == 3)){
                            hora = true;
                        }
                        return;
                    }

                    for(var i = 0; i <= tile[x]; i++) {
                        if(tile[x] - i == 1) continue;
                        for(var j = 0; j < 3; j++) tile[x + j] -= i;
                        act(x + 1);
                        for(var j = 0; j < 3; j++) tile[x + j] += i;
                    }
                };

                
                var result = new bool[9 + 1];
                for(var i = 1; i <= 9; i++){
                    tile[i]++;
                    if(tile[i] < 5) act(1);
                    result[i] = hora;
                    hora = false;
                    tile[i]--;
                }

                if(result.Any(b => b)){
                    var sb = new StringBuilder();
                    for(var i = 1; i <= 9; i++) if(result[i]) sb.Append(i + " ");
                    Console.WriteLine(sb.ToString().Trim());
                } else{
                    Console.WriteLine(0);
                }

            }
        }
    }
}

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

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
		int n;
		map<int,int> cnt;
		cin >> n;
		for(int i=0;i<n;i++){
				int tmp;
				cin >> tmp;
				cnt[tmp]++;
		}
		int ans = 0;
		for(auto& A : cnt){
				ans += A.second-1;
		}
		if(ans % 2 == 1) ans++;
		ans = n - ans;
		cout << ans << endl;
}


Measured memory_bytes: 6528
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;
int main() {
	string s, p;
	cin >> s >> p;
	s = s + s;
	bool ret = false;
	for (int i = 0; i <= s.size() - p.size(); i++) {
		bool flag = true;
		for (int j = 0; j < p.size(); j++) {
			if (s[i + j] != p[j])flag = false;
		}
		if (flag)ret = true;
	}
	if (ret)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3240
#include<stdio.h>
int main(void){
  int counter=0,a;
  double b,c,d;
  scanf("%d",&a);
  scanf("%lf",&b);
  for(int i=0;i<a;i++){
    scanf("%lf%lf",&c,&d);
  	if(c*c+d*d<=b*b)counter++;
  }
  printf("%d",counter);
}

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++)  cin >> h[i];
    h[0]--;
    bool valid = true;
    for(int i = 1; i < n; i++){
        if(h[i] > h[i-1])    h[i]--;
        else if(h[i] < h[i-1])  valid = false;
    }
    cout << (valid ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);

	        int N = sc.nextInt();
	        int H = 1000000;
	        int[] m = new int[1000005];
	        for(int i=0;i<N;i++) {
	        	m[sc.nextInt()]++;
	        }
	        long ans=0;
	        for(int i=1;i<=H+3;i++) {
	        	if(m[i]!=0) {
		        	if(m[i]==1)ans++; 
	        		for(int j=i+i;j<H+5;j=j+i) {
	        			if(m[j]==1)m[j]=0;
	        		}	        		
	        	}
	        }
	        
	        System.out.println(ans);
	    }
	}

Measured memory_bytes: 63980
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/



int main() {
int X,Y;
cin>>X>>Y;
if(Y%2!=0){
  cout<<"No"<<endl;
  return 0;
}
Y/=2;
if((Y-X>=0)&&(2*X-Y>=0)){
  cout<<"Yes"<<endl;
}
else{
  cout<<"No"<<endl;
}

return 0;
}



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

public class Main {

	public static void main(String[] args) throws IOException {



		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] imput = br.readLine().split(" ");
		int r = Integer.parseInt(imput[0]);
		int c = Integer.parseInt(imput[1]);
		int[][] data = new int[r+1][c+1];
		int[] sumR = new int[c];
		int[] sumC = new int[r];
		int sumX = 0;
		int sumA =0;
		int cnt=0;

		for(int i=0;i<r;i++){
			String[] str = br.readLine().split(" ");
			for(int j=0;j<c;j++){
				//System.out.println(str[j]);
				data[i][j] = Integer.parseInt(str[j]);

			}
		}

		for(int i=0;i<r;i++){
			
			for(int j=0;j<c;j++){
				sumA += data[i][j];
				sumX += data[i][j];
				//System.out.println(sumX);
				if(j == c-1){
					data[i][c]=sumX;
					sumX=0;
				}
			}//System.out.print(data[r][i]+" ");
			
			for(int j=0;j<c;j++){
				
				data[r][j] += data[i][j];
				
				
			}
			
		}
		
		//System.out.println(sumA);
		
		for(int i=0;i<r+1;i++){
			for(int j=0;j<c+1;j++){
				
				if(i==r&&j==c){
					System.out.print(sumA);
				}else{
					System.out.print(data[i][j]);
					if(j!=c){
						System.out.print(" ");
					}
				}

			}System.out.println();
		}

	}
}

Measured memory_bytes: 31156
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int M,K;
    cin >> M >> K;
    int MX=pow(2,M)-1;
    if(MX>=K&&M!=1){
        per(i,MX){
            if(i==K)continue;
            cout << i << ' ';
        }
        cout << K << ' ';
        rep(i,MX+1){
            if(i==K)continue;
            cout << i << ' ';
        }
        cout << K << endl;
    }
    else if(K==0){
        cout << "1 1 0 0" << endl;
    }
    else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll oo = 1e18;
const int N = (1e2) + 5;
const int VAL = (1e5) + 5;
ll memo[N][VAL];
int wt[N], val[N];
int n, w;

ll dp(int n, int sum) {
	if (n == 0) return (sum == 0? 0 : oo);
	ll &ret = memo[n][sum];
	if (ret != -1) return ret;
	if (sum - val[n - 1] >= 0) {
		return ret = min(wt[n - 1] + dp(n - 1, sum - val[n - 1]), dp(n - 1, sum));
	}
	return ret = dp(n - 1, sum);
}

int knapsack(int n, int total) {
	int ret = -1;
	memset(memo, -1, sizeof memo);
	for (int i = 0; i <= total; ++i) {
		if (dp(n, i) <= w) {
			ret = i;
		}
	}
	return ret;
}

int main() {
	scanf("%d", &n);
	scanf("%d", &w);
	int total = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d %d", &wt[i], &val[i]);
		total += val[i];
	}
	int ans = knapsack(n, total);
	printf("%d\n", ans);
	return 0;
}

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

class mydeque
{
public:
    int A[800000] = {0};

    void push(int d, int x);
    void randomAccess(int q);
    void pop(int d);

private:
    int count = 0;
    int begin = 400000;
};

void mydeque::push(int d, int x)
{
    if (d)
    {
        int end = begin + count;
        A[end] = x;
        count++;
    }
    else
    {
        begin--;
        A[begin] = x;
        count++;
    }
}

void mydeque::randomAccess(int q)
{
    cout << A[begin + q] << "\n";
}

void mydeque::pop(int d)
{
    if (d)
    {
        count--;
    }
    else
    {
        begin++;
        count--;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q, query, x, p, d;
    cin >> q;
    mydeque A;

    for (int i = 0; i < q; ++i)
    {
        cin >> query;
        switch (query)
        {
        case 0:
            cin >> d;
            cin >> x;
            A.push(d, x);
            break;
        case 1:
            cin >> p;
            A.randomAccess(p);
            break;
        case 2:
            cin >> d;
            A.pop(d);
            break;
        }
    }
}


Measured memory_bytes: 6328