akhauriyash/Code-Regression huggingface dataset:
import numpy as np

N = int(input())

number = list(range(1, N+1))

lst = [[0]*3 for i in range(N)]

for i in range(N):
    name, point = map(str, input().split())
    point = int(point)
    lst[i][0] = name
    lst[i][1] = point
    lst[i][2] = i + 1

lst.sort(key=lambda x:(x[1]), reverse=True)
lst.sort(key=lambda x:(x[0]))

name = np.array(lst).T.tolist()[0]
point = np.array(lst).T.tolist()[1]
number = np.array(lst).T.tolist()[2]

for i in range(N):
    print(number[i])

Measured memory_bytes: 12508
#include<bits/stdc++.h>
using namespace std;
int main(){
	int H,W;
	cin>>H>>W;
	char a[H][W];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>a[i][j];
		}
	}
	int cnt=0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cnt=0;
			if(a[i][j]=='#'){
				if(i-1>=0){
					if(a[i-1][j]=='#'){
						cnt++;
					}
				}
				if(i+1<H){
					if(a[i+1][j]=='#'){
						cnt++;
					}
				}
				if(j-1>=0){
					if(a[i][j-1]=='#'){
						cnt++;
					}
				}
				if(j+1<W){
					if(a[i][j+1]=='#'){
						cnt++;
					}
				}
				if(cnt==0){
					cout<<"No";
					return 0;
				}
			}
		}
	}
	cout<<"Yes";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
using namespace std;
int main(){
	int n,i,j,r,sum,A;
	int a[100];
	sum = 1000000007;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> A;
		a[i] = A;
	}
	for (i = -100; i <= 100; i++) {
		r = 0;
		for (j = 0; j < n; j++) {
			r += (a[j] - i)*(a[j] - i);
		}
		sum = min(sum, r);
	}
	cout << sum << endl;
	return 0;
}

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

const int INF = 1e9 ;
const int maxN = 200 + 5;
ll n,k;
ll h[maxN];
ll t[maxN];
ll solve(ll n,ll x)
{
	if(n == 0)
		return 1;
	ll mid = (h[n]+1)/2;
	if(x == h[n])
		return t[n];
	else if (x==1)
		return 0;
	else if(x<mid)
	{
		return solve(n-1,x-1);
	}
	else if(x == mid)
	{
		return solve(n-1,x-2) + 1;
	}
	else if(x>mid)
	{
		return t[n-1] + 1 + solve(n-1,x-mid);
	}
}

int main()
{
	scanf("%lld%lld",&n,&k);
	h[0] = 1;
	t[0] = 1;
	for(int i=1;i<=n;i++)
	{
		h[i] = 3 + 2*h[i-1];
		t[i] = 2 * t[i-1] + 1;
	}
	ll ans = solve(n,k);
	printf("%lld\n",ans);
	return 0;
} 

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

using namespace std;

const int N = 1e6 + 5;
const int MOD = 1e9 + 7;

int fact[N];
int rev[N];

int bin_pow(int a, int b, int mod) {
  if (!b)
    return 1;
  if (b & 1)
    return a * bin_pow(a, b - 1, mod) % mod;
  int t = bin_pow(a, b / 2, mod);
  return t * t % mod;
}

signed main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  fact[0] = 1;
  rev[0] = 1;
  for (int i = 1; i <= 200000; ++i) {
    fact[i] = (fact[i - 1] * i) % MOD;
    rev[i] = bin_pow(fact[i], MOD - 2, MOD);
  }
  int ret = 0;
  for (int i = 1; i <= h - a; ++i) {
    int cntt = i - 1;
    int cntt1 = b - 1;
    int x = (fact[cntt + cntt1] * rev[cntt] % MOD * rev[cntt1] % MOD);
    int cnt1 = h - i;
    int cnt2 = max(0ll, w - b - 1);
    ret += x * (fact[cnt1 + cnt2] * rev[cnt1] % MOD * rev[cnt2] % MOD) % MOD;
    ret %= MOD;
  }
  cout << ret;
  return 0;
}


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

bool DEBUG = false;

/**
* @brief ナップザック問題を解く関数
* @param[in] W(最大容量) 重さの和はこれを超えてはならない
* @param[in] w(重さの配列) それぞれの要素の重さ
* @param[in] v(価値の配列) それぞれの要素の価値
* @return ret(価値の最大値) 価値の総和の最大値
* @details 重さw価値vの荷物がいくつかあり、容量Wのナップザックにどれを入れるか選ぶ。今回は同じ荷物は1度しか入れられない。この時の価値の最大値を求める問題。
*/

int knapsack(int W, vector<int> &w, vector<int> &v){
    int ret = 0;
    int n = w.size();

    // デバッグ出力
    if(DEBUG){
        for(int i = 0; i < n; i++) {
            cout << w[i] << " " << v[i] << endl;
        }
    }

    vector<vector<int> > dp(n);
    for(int i = 0; i < n; i++) {
        dp[i].resize(W+1, 0);
    }

    // 一行目の初期化
    for(int i = 0; i <= W; i++) {
        if(w[0] <= i){
            dp[0][i] = v[0];
        }else{
            dp[0][i] = 0;
        }
    }

    // dp
    for(int i = 1; i < n; i++) {
        for (int j = 0; j <= W; j++){
            if(j - w[i] < 0){
                dp[i][j] = dp[i-1][j];
            }else{
                dp[i][j] = max(dp[i-1][j - w[i]] + v[i], dp[i-1][j]);
            }
        }
    }

    // デバッグ出力
    if(DEBUG){
        for(int i = 0; i < n; i++) {
            for (int j = 0; j <= W; j++){
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }
    }
    
    
    ret = dp[n-1][W];
    return ret;
}


/**
* @brief ナップザック問題（重複可）を解く関数
* @param[in] W(最大容量) 重さの和はこれを超えてはならない
* @param[in] w(重さの配列) それぞれの要素の重さ
* @param[in] v(価値の配列) それぞれの要素の価値
* @return ret(価値の最大値) 価値の総和の最大値
* @details 重さw価値vの荷物がいくつかあり、容量Wのナップザックにどれを入れるか選ぶ。今回は同じ荷物をいくつでも入れられる。この時の価値の最大値を求める問題。
*/
int knapsack_duplicate(int W, vector<int> w, vector<int> v){
    int ret = 0;
    int n = w.size();


    // デバッグ出力
    if(DEBUG){
        cout << "n : " << n << endl;
        for(int i = 0; i < n; i++) {
            cout << w[i] << " " << v[i] << endl;
        }
    }

    vector<vector<int> > dp(n);
    for(int i = 0; i < n; i++) {
        dp[i].resize(W+1, 0);
    }

    // 一行目の初期化
    for(int i = 0; i <= W; i++) {
        if(w[0] <= i){
            dp[0][i] = dp[0][i - w[0]] + v[0];
        }else{
            dp[0][i] = 0;
        }
    }

    // dp
    for(int i = 1; i < n; i++) {
        for (int j = 0; j <= W; j++){
            if(j - w[i] < 0){
                dp[i][j] = dp[i-1][j];
            }else{
                dp[i][j] = max(dp[i][j - w[i]] + v[i], dp[i-1][j]);
            }
        }
    }

    // デバッグ出力
    if(DEBUG){
        for(int i = 0; i < n; i++) {
            for (int j = 0; j <= W; j++){
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }
    }
    
    
    ret = dp[n-1][W];
    return ret;
}

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

    vector<int> v(N), w(N);
    for(int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }

    int ans = knapsack_duplicate(W, w, v);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k;
    string s;
    cin>>k>>s;
    if(s.length()>k) cout<<s.substr(0,k)<<"..."<<'\n';
    else cout<<s<<'\n';
}

Measured memory_bytes: 3660
import random

class dice:
    def __init__(self, t, S, E):
        self.dice = list(map(int, input().split()))
        self.t = t
        self.S = S
        self.E = E
        self.now_dice()
    
    def roll(self, order):
        if order == 'E':
            self.t, self.E = self.W, self.t
        elif order == 'N':
            self.t, self.S = self.S, self.g
        elif order == 'S':
            self.t, self.S = self.N, self.t
        elif order == 'W':
            self.t, self.E = self.E, self.g
        self.now_dice()
    
    def now_dice(self):
        self.N = 7 - self.S
        self.g = 7 - self.t
        self.W = 7 - self.E
        self.now = [self.t, self.S, self.E, self.N, self.W, self.g]
        return self.now

if __name__ == '__main__':
    dice = dice(1, 2, 3)
    x = int(input())
    for _ in range(x):
        a, b = map(int, input().split())
        while 1:
            direc = ['N', 'E', 'W']
            random.shuffle(direc)
            dice.roll(direc[0])
            if dice.dice[dice.t-1] == a and dice.dice[dice.S-1] == b:
                print(dice.dice[dice.E-1])
                break


Measured memory_bytes: 8184
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef long double Real;

Real eps = 1e-12;

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

bool equal(Real a, Real b) {
    return add(a, -b) == 0;
}

struct P {
    Real x, y;
    P() {}
    P(Real x, Real y) : x(x), y(y) {}
    P operator+(P p) const {return P(add(x, p.x), add(y, p.y));}
    P operator-(P p) const {return P(add(x, -p.x), add(y, -p.y));}
    P operator*(Real d) const {return P(x*d, y*d);}
    Real dot(P p) const {return add(x*p.x, y*p.y);} // ??????
    Real det(P p) const {return add(x*p.y, -y*p.x);} // ??????
    Real dist(P p) const {return sqrt((x-p.x)*(x-p.x) + (y-p.y)*(y-p.y));} // ?????¢
    void normalize() {Real d = sqrt(x*x+y*y); x /= d; y /= d;} // ??£??????
    bool operator<(const P& rhs) const {
        if (x != rhs.x) return x < rhs.x;
        return y < rhs.y;
    }
    bool operator==(const P& rhs) const {
        return equal(x, rhs.x) && equal(y, rhs.y);
    }
};

// ??????p1-p2?????????q???????????????????????????
bool on_seg(P p1, P p2, P q) {
    return (p1-q).det(p2-q) == 0 && (p1-q).dot(p2-q) <= 0;
}

// ??´???p1-p2??¨??´???q1-q2??????????????????????????????
bool parallel(P p1, P p2, P q1, P q2) {
    P a = p2-p1;
    P b = q2-q1;
    return a.det(b) == 0;
}

const int MAXN = 55;
P pnts[MAXN];
int n;

void solve() {
    if (n % 2 == 1) {
        cout << "NA" << endl;
        return;
    }
    Real ax = 0, ay = 0;
    for (int i = 0; i < n; i++) {
        ax += pnts[i].x;
        ay += pnts[i].y;
    }
    ax /= n; ay /= n;
    P a(ax, ay);
    for (int i = 0; i < n/2; i++) {
        if (!on_seg(pnts[i], pnts[i+n/2], a) || a.dist(pnts[i]) != a.dist(pnts[i+n/2])) {
            cout << "NA" << endl;
            return;
        }
    }
    printf("%.10Lf %.10Lf\n", ax, ay);
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> pnts[i].x >> pnts[i].y;
    solve();
    return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h,w,n,i,j;
  string s[50];
  char c;
  cin>>h>>w;
  for (i=0;i<h;i++) {
    cin>>s[i];
  }
  for (i=0;i<h;i++) {
    for (j=0;j<w;j++) {
      if (s[i].at(j)=='.') {
        n=0;
        if (i>0) {
          if (s[i-1].at(j)=='#') n++;
          if (j>0 && s[i-1].at(j-1)=='#') n++;
          if (j<w-1 && s[i-1].at(j+1)=='#') n++;
        }
        if (i<h-1) {
          if (s[i+1].at(j)=='#') n++;;
          if (j>0 && s[i+1].at(j-1)=='#') n++;
          if (j<w-1 && s[i+1].at(j+1)=='#') n++;
        }
        if (j>0 && s[i].at(j-1)=='#') n++;
        if (j<w-1 && s[i].at(j+1)=='#') n++;
        c='0'+n;
        s[i].at(j)=c;
      }
    }
    cout<<s[i]<<endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int n; cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a; cin >> a;
        if (mp[a] == 0) mp[a] = 1;
        else mp[a] = 0;
    }
    int c = 0;
    for (auto e : mp) {
        if (e.second == 1) c++;
    }
    cout << c << endl;
}


Measured memory_bytes: 4864
package main

import (
	"fmt"
)

func main() {
	for {
		var h, w int
		fmt.Scan(&h)
		fmt.Scan(&w)

		if h == 0 && w == 0 {
			break
		}

		draw(h, func() {
			drawLine("#", w)
			fmt.Print("\n")
		}, func() {
			draw(w, func() {
				fmt.Print("#")
			}, func() {
				fmt.Print(".")
			})
			fmt.Print("\n")
		})
		fmt.Print("\n")
	}
}

func draw(number int, topAndBottom func(), other func()) {
	otherNum := number - 2
	topAndBottom()
	for index := 0; index < otherNum; index++ {
		other()
	}
	topAndBottom()
}

func drawLine(a string, num int) {
	for index := 0; index < num; index++ {
		fmt.Print(a)
	}
}

Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)
 
bool grid[1004][1004];
bool vis[1004][1004];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int h,w;
	cin>>h>>w;

	int ch,cw,dh,dw;
	cin>>ch>>cw>>dh>>dw;

	ch++;
	cw++;
	dh++;
	dw++;

	for(int i=2; i<=h+1; i++)
	{
		string s;
		cin>>s;

		for(int j=0; j<w; j++)
		{
			if(s[j] == '.') grid[i][j+2]=1;
		}
	}

	vis[ch][cw]=1;

	vector<pair<int,int>> BFS = {{ch,cw}};

	for(int ans=0; ans<=h*w; ans++)
	{
		vector<pair<int,int>> all_cur=BFS;

		while(!BFS.empty())
		{
			vector<pair<int,int>> new_BFS;

			for(auto P:BFS)
			{
				int x=P.ff;
				int y=P.ss;

				for(int xb=-1; xb<=1; xb++)
				{
					for(int yb=-1; yb<=1; yb++)
					{
						if(abs(xb)+abs(yb)!=1) continue;

						if(grid[x+xb][y+yb] && !vis[x+xb][y+yb])
						{
							vis[x+xb][y+yb]=1;
							all_cur.push_back({x+xb,y+yb});
							new_BFS.push_back({x+xb,y+yb});
						}
					}
				}
			}

			BFS=new_BFS;
		}

		if(vis[dh][dw])
		{
			cout << ans << "\n";
			return 0;
		}

		vector<pair<int,int>> new_BFS;

		for(auto P:all_cur)
		{
			int x=P.ff;
			int y=P.ss;
			for(int xb=-2; xb<=2; xb++)
			{
				for(int yb=-2; yb<=2; yb++)
				{
					if(grid[x+xb][y+yb] && !vis[x+xb][y+yb])
					{
						vis[x+xb][y+yb]=1;
						// all_cur.push_back({x+xb,y+yb});
						new_BFS.push_back({x+xb,y+yb});
					}
				}
			}
		}

		BFS=new_BFS;
	}

	cout << "-1\n";
}

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

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

inline int tetrahedral(int n) {
	return n * (n + 1) * (n + 2) / 6;
}

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

	const int MAX = 1000000;
	vector<int> dp(MAX, MAX), odd_dp(MAX, MAX);
	dp[0] = 0;
	odd_dp[0] = 0;
	for(int n = 1;; ++n) {
		const int tmp = tetrahedral(n);
		if(tmp >= MAX)
			break;

		for(int i = 0; i + tmp < MAX; ++i)
			chmin(dp[i + tmp], dp[i] + 1);

		if(tmp & 1)
			for(int i = 0; i + tmp < MAX; ++i)
				chmin(odd_dp[i + tmp], odd_dp[i] + 1);
	}

	for(int x; cin >> x, x;)
		cout << dp[x] << " " << odd_dp[x] << endl;

	return EXIT_SUCCESS;
}

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

using namespace std;

int main(){
  long long int n, m, k;
  cin>>n>>m>>k;

  vector<long long> A(n+1, 0);
  vector<long long> B(m+1, 0);
  int count=0;
  long long int sum_a, sum_b=0;
  for(int i=0; i<n; i++){
    int a;
    cin>>a;
    A[i+1]=A[i]+a;
  }
  for(int j=0; j<m; j++){ 
    int b;
    cin>>b;
    B[j+1]=B[j]+b;
  }
  int subM=m;
  for(int i=0; i<=n; i++){
    for(int j=subM; j>=0; j--){
      if(A[i]+B[j] <=k){
        count=max(count, i+j);
        subM=j;
        break;
      }
    }
  }
  cout<<count<<endl;

}


Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
const int N = 25000 + 10, K = 410, mo = 1e9 + 7;
typedef long long ll;
int n,k,m,a[N],cnt[K];
ll ans;
ll ksm(ll x, ll y) {
	ll ret = 1; for(; y; y>>=1){
		if (y & 1) ret = ret * x % mo;
		x = x * x % mo;
	}
	return ret;
}


ll f[2][K], o, g[2][K];
inline void add(ll &x, ll y) {
	x = (x + y) % mo;
}

//长为n的non-colorful的串中，长为m的互异连续段有多少个.
ll dp1() {
	memset(f[o], 0, sizeof f[o]);
	memset(g[o], 0, sizeof g[o]);
	g[o][0] = 1;
	for(int i = 0; i < n; i++) {
		memset(f[1 - o], 0, sizeof f[1 - o]);
		memset(g[1 - o], 0, sizeof g[1 - o]);
		for(int j = 0; j < k; j++) {
			if (j + 1 != k) {
				add(g[1 - o][j + 1], g[o][j] * (k - j));
				add(f[1 - o][j + 1], f[o][j] * (k - j));
				add(g[1 - o][j + 2], - g[o][j] * (k - j));
				add(f[1 - o][j + 2], - f[o][j] * (k - j));
			}
			add(f[1 - o][1], f[o][j]);
			add(f[1 - o][j + 1], - f[o][j]);

			add(g[1 - o][1], g[o][j]);
			add(g[1 - o][j + 1], - g[o][j]);
		}
		o = 1 - o;
		for(int j = 1; j < k; j++) {
			add(g[o][j], g[o][j - 1]);
			add(f[o][j], f[o][j - 1]);
		}
		for(int j = m; j < k; j++)
				add(f[o][j], g[o][j]);
	}
	ll ret = 0;
	for(int i = 0; i < k; i++) add(ret, f[o][i]);
	return ret;
}

ll le[N][K], ri[N][K];
void dp2(int sig, ll f[N][K]) {
	memset(f, 0, sizeof f);
	memset(cnt, 0, sizeof cnt);
	if (sig == 0) { //left
		for(int i = 1; i <= m; i++) if (cnt[a[i]] == 0) {
			cnt[a[i]]++;
		} else {
			f[0][0] = f[0][i - 1] = 1;
			break;
		}
	} else {
		for(int i = m; i; i--) if (cnt[a[i]] == 0) {
			cnt[a[i]]++;
		} else {
			f[0][0] = f[0][m - i] = 1;
			break;
		}
	}
	for(int i = 0; i < n - m; i++) {
		for(int j = 1; j < k; j++) {
			if (j + 1 != k) {
				add(f[i + 1][j + 1], f[i][j] * (k - j));
				add(f[i + 1][j + 2], - f[i][j] * (k - j));
			}
			add(f[i + 1][1], f[i][j]);
			add(f[i + 1][j + 1], - f[i][j]);
		}
		for(int j = 1; j < k; j++) {
			add(f[i + 1][j], f[i + 1][j - 1]);
			add(f[i + 1][0], f[i + 1][j]);
		}
	}
}

int main() {
	cin>>n>>k>>m;
	for(int i = 1; i <= m; i++) scanf("%d", &a[i]);
	ans = (n - m + 1) * ksm(k, n - m) % mo;

	int non = 0;
	if (m >= k) {
		int js = 0;
		for(int i = 1; i <= k; i++)	{
			if (cnt[a[i]]++==0) js++;
		}
		if (js != k) {
			for(int i = 1; i + k - 1 < m; i++) {
				if (--cnt[a[i]]==0) js--;
				if (cnt[a[i + k]]++==0) js++;
				if (js == k) break;
			}
		}
		non = js != k;
	} else non = 1;

	if (non) {
		int same = 0;
		if (m <= k) {
			for(int i = 1; i <= m; i++) {
				for (int j = i + 1; j <= m; j++) if (a[i] == a[j]) {
					same = 1; break;
				}
			}
		} else same = 1;
		if (!same) {
			ll P = 1;
			for(int i = k; i > k - m; i--) P = P * i % mo;
			ans = (ans - ksm(P, mo - 2) * dp1()) % mo;
		} else {
			dp2(0, le), dp2(1, ri);
			for(int i = 0; i + m <= n; i++) {
				ans = (ans - le[i][0] * ri[n - m - i][0]) % mo;
			}
		}
	}
	cout << (ans + mo) % mo<<endl;
}
 

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


int main(void){
	int i,j,x,max=1;

	scanf("%d",&x);

	for(i=2;i*i<=x;i++){
		for(j=i*i;j<=x;j*=i){
			if(max<j){
				max=j;
			}
		}
	}

	printf("%d",max);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

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

  ll ans = 0;
  ll tmp = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      ans += tmp/2;
      tmp = 0;
    }
    else {
      tmp += a[i];
    }
  }
  ans += tmp/2;

  cout << ans << endl;
}


Measured memory_bytes: 1024
from itertools import groupby
n = int(input())
P = list(map(int, input().split()))
T = [val == (itr + 1) for itr, val in enumerate(P)]

ans = 0
for k, v in groupby(T):
  if k == True:
    ans += (sum(v) - 1) // 2 + 1
    
print(ans)

Measured memory_bytes: 14256
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define dump(x)      cerr << #x << " = " << (x) << endl;

void sortVecPair(vector<pair<auto, auto>>& X, VI& idx, auto comparator) {
    VI idx2(SZ(idx));
    iota(ALL(idx2), 0);
    stable_sort(ALL(idx2), comparator);
    FSORT(X);
    REP(i, SZ(idx)) idx2[i] = idx[idx2[i]];
    REP(i, SZ(idx)) idx[i] = idx2[i];
}

int main() {
    LL N;
    cin >> N;
    vector<pair<string, LL>> X(N);
    REP(i, N) {
        string s;
        LL x;
        cin >> s >> x;
        X[i] = make_pair(s, x);
    }

    VI idx(SZ(X));
    iota(ALL(idx), 0);
    sortVecPair(X, idx, [&] (auto& i, auto& j) {return X[i].second > X[j].second;});
    SRSORT(X);

    sortVecPair(X, idx, [&] (auto& i, auto& j) {return X[i].first < X[j].first;});
    FSORT(X);

    REP(i, N) {
        cout << idx[i] + 1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let nums = get_line().split_whitespace()
        .map(|n| n.parse().unwrap())
        .collect::<Vec<u64>>();
    let (a, b) = (nums[0], nums[1]);

    for x in 1..1001 {
        let aa = ((x as f64) * 0.08) as u64;
        let bb = ((x as f64) * 0.10) as u64;
        if aa == a && bb == b {
            println!("{}", x);
            return;
        }
    }
    println!("{}", -1);
}


Measured memory_bytes: 4352
#define MAX 200100;
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    int a_time, b_time, c_time, d_time;

    //100あたりe溶ける
    //fまで入れることができる

    double tmp_per = 0, ans_per = -100;
    int ans_1 = 0, ans_2 = 0;

    for (a_time = 0; a_time * 100 * a <= f; ++a_time)
    {
        // cout<<"a"<<endl;
        for (b_time = 0; b_time * 100 * b + a_time * a * 100 <= f; ++b_time)
        {
            // cout<<"b"<<endl;
            int water = 100 * (a * a_time + b * b_time);

            for (c_time = 0; c_time * c <= f - water && c_time * c * 100 <= water * e; ++c_time)
            {
                for (d_time = 0; d_time * d + c_time * c <= f - water && (d_time * d + c_time * c) * 100 <= water * e; ++d_time)
                {

                    if (water != 0)
                    {
                        tmp_per = (c_time * c + d_time * d) * 1000000 / (a_time * a + b_time * b);

                        if (ans_per < tmp_per)
                        {
                            ans_per = tmp_per;
                            ans_2 = c_time * c + d_time * d;
                            ans_1 = water + ans_2;
                            // cout<<ans_per<<endl;
                        }
                    }
                }
            }
        }
    }

    cout << ans_1 << " " << ans_2 << "\n";

    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate

def max_from_acc(A, b):
    r = -10**9-1
    acc = [0] + list(accumulate(A + A[:b]))
    for i in range(len(A)):
        for j in range(1, b+1):
            r = max(r, acc[i+j]-acc[i])
    return r

n, k = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

P = [p - 1 for p in P]

checked = [False] * n
loops = []
for i in range(n):
    if checked[i]:
        continue
    checked[i] = True
    tmp = [i]
    next = P[i]
    while next != i:
        tmp.append(next)
        checked[next] = True
        next = P[next]
    loops.append(tmp)

# print(loops)

ans = -10**9-1
for loop in loops:
    t =len(loop)
    div, mod = divmod(k, t)
    if mod == 0:
        mod = t
        div -= 1
    C_loop = [C[p] for p in loop]
    loop_score = sum(C_loop)

    if t >=k:
        ans = max(ans, max_from_acc(C_loop, k))
    else:
        if loop_score > 0:
            ans = max(ans, max_from_acc(C_loop, mod)+loop_score*div)
        else:
            ans = max(ans, max_from_acc(C_loop, t))

print(ans)

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;

int main(){
	int a,b;
	string s;
	cin>>a>>b>>s;
	bool ans=true;
	for(int i=0;i<a+b+1;i++){
		if(i==a){
			if(s[i]=='-')continue;
			else{
				ans=false;
				break;
			}
		}else{
			int num=s[i]-'0';
			if(0<=num && num<=9){
				continue;
			}else{
				ans=false;
				break;
			}
		}
	}
	if(ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

// 平方数かどうかの判定
bool is_squere(int N) {
    int r = (int)floor(sqrt((double)N));  // 切り捨てした平方根
    return (r * r) == N;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, b;
  cin >> a >> b;
  int c = stoi(a + b);
  YesorNo(is_squere(c));
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    long long int n,m,a[50],b[50],c[50],d[50],s[50],i,j,x,y,xy,min;
    scanf("%lld%lld",&n,&m);
    for(i=1;i<=n;i++)
        scanf("%lld%lld",&a[i],&b[i]);
    for(j=1;j<=m;j++)
        scanf("%lld%lld",&c[j],&d[j]);
    for(i=1;i<=n;i++){
        x=a[i]-c[1];
            if(x<0) x=-x;
            y=b[i]-d[1];
            if(y<0) y=-y;
            min=x+y;
            s[i]=1;
        for(j=2;j<=m;j++){
            x=a[i]-c[j];
            if(x<0) x=-x;
            y=b[i]-d[j];
            if(y<0) y=-y;
            xy=x+y;
            if(min>xy){
                min=xy;
                s[i]=j;
            }
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld\n",s[i]);
    return 0;
}

Measured memory_bytes: 1620
import sys
from heapq import heappush, heappop
from operator import itemgetter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1), reverse=True)
    hq = []
    ans = [0] * Q

    for i, d in enumerate(query):
        while work and work[-1][1] <= d:
            heappush(hq, work[-1])
            work.pop()
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 66172
N,M = map(int,input().split())
X = list(map(int,input().split()))
X2 = sorted(X)
div_X = []
for i in range (M-1):
    div_X.append(X2[i+1]-X2[i])
Y = sorted(div_X)


if N >= M:
    ans = 0
else:
    ans = sum(Y[0:M-N])

print (ans)


Measured memory_bytes: 13968
#include <cstdio>
int N, a[100001], ref[100001], _[3][100001], d[100001], T[100001], cover[100001];
void P(int x)
{
	while (x <= N)
	{
		T[x]++;
		x += x & -x;
	}
}
int G(int x)
{
	int r = 0;
	while (x)
	{
		r += T[x];
		x &= x - 1;
	}
	return r;
}
int main()
{
	scanf("%d", &N);
	for (int i = 0; i < 3; i++)
		for (int j = 1; j <= N; j++)
			scanf("%d", _[i] + j);
	for (int i = 1; i <= N; i++)
		if (_[0][i] == _[1][i] - 1 && _[1][i] == _[2][i] - 1 && _[2][i] % 3 == 0)
		{
			a[i] = _[2][i] / 3;
			ref[a[i]] = i;
			d[a[i]] = 0;
		}
		else if (_[0][i] == _[1][i] + 1 && _[1][i] == _[2][i] + 1 && _[0][i] % 3 == 0)
		{
			a[i] = _[0][i] / 3;
			ref[a[i]] = i;
			d[a[i]] = 1;
		}
		else
		{
			puts("No");
			return 0;
		}
	for (int i = 1; i <= N; i++)
		if (i - a[i] & 1)
		{
			puts("No");
			return 0;
		}
	for (int i = N - !(N & 1); i >= 1; i -= 2)
	{
		cover[i] ^= 1;
		cover[i + (G(ref[i]) << 1)] ^= 1;
		d[a[i]] ^= i - a[i] >> 1 & 1;
		P(ref[i]);
	}
	for (int i = 2; i <= N; i++)
		cover[i] ^= cover[i - 1];
	for (int i = 2; i <= N; i += 2)
		d[a[i]] ^= cover[i];
	for (int i = 1; i <= N; i += 2)
		a[i] = ref[i] = i;
	for (int i = 1; i <= N; i++)
		cover[i] = T[i] = 0;
	for (int i = N - (N & 1); i >= 2; i -= 2)
	{
		cover[i] ^= 1;
		cover[i + (G(ref[i]) << 1)] ^= 1;
		d[a[i]] ^= i - a[i] >> 1 & 1;
		P(ref[i]);
	}
	for (int i = 2; i <= N; i++)
		cover[i] ^= cover[i - 1];
	for (int i = 1; i <= N; i += 2)
		d[a[i]] ^= cover[i];
	if (N == 3)
		puts(d[1] == 0 && d[2] == 0 && d[3] == 0 ? "Yes" : "No");
	else if (N == 4)
		puts(d[1] == d[2] && d[2] == d[3] && d[3] == d[4] ? "Yes" : "No");
	else
	{
		int c0 = 0, c1 = 0;
		for (int i = 1; i <= N; i += 2)
			c0 += d[i];
		for (int i = 2; i <= N; i += 2)
			c1 += d[i];
		puts((c0 & 1) || (c1 & 1) ? "No" : "Yes");
		return 0;
	}
}


Measured memory_bytes: 3328
#include <iostream>
#include <cmath>

struct Circle {
    const double x, y, r;
    Circle(const double x, const double y, const double r) :x(x), y(y), r(r) {};
    ~Circle() = default;
    bool include(const Circle& C) const;
};

inline double distance(const Circle& A, const Circle& B);
int circles_intersection(const Circle& A, const Circle& B);

int main(void) {
    u_int n;
    double xa, ya, ra, xb, yb, rb;

    std::cin >> n;
    for (u_int i = 0; i < n; ++i) {
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
        Circle A(xa, ya, ra), B(xb, yb, rb);
        std::cout << circles_intersection(A, B) << std::endl;
    }

    return 0;
}

bool Circle::include(const Circle& C) const {
    const auto d = distance(*this, C);
    return (d*d < (r - C.r)*(r - C.r) && r > C.r);
}

inline double distance(const Circle& A, const Circle& B) {
    return std::sqrt((A.x - B.x)*(A.x - B.x) + (A.y - B.y)*(A.y - B.y));
}

int circles_intersection(const Circle& A, const Circle& B) {
    if (distance(A, B) > A.r + B.r)
        return 0;
    else if (A.include(B))
        return 2;
    else if (B.include(A))
        return -2;
    else
        return 1;
}

Measured memory_bytes: 1240
#include <stdio.h>

int main(void)
{
	int N,K,i,a,b,ans=0;
	scanf("%d %d",&N,&K);
	int x[N];
	for(i=0;i<N;i++){
		scanf("%d",&x[i]);
		a=x[i]*2;
		b=(K-x[i])*2;
		if(a<=b)ans+=a;
		else ans+=b;
	}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 3000000000000000000;

int main() {
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];
    vector<int> t(D);
    rep(i, D) {
        cin >> t[i];
        --t[i];
    }
    
    vector<int> last(26, -1);
    int score = 0;
    rep(i, D) {
        score += s[i][t[i]];
        last[t[i]] = i;
        rep(j, 26) score -= c[j] * (i - last[j]);
        cout << score << "\n";
    }
    return 0;
}


Measured memory_bytes: 3548
N = int (input())
A = list(map(int,input().split()))

count = 0

while True:
    for i in range(N):
        if (A[i] % 2 ) == 1:
            break
        A[i] = int (A[i] / 2)
    else:
        count = count + 1
        continue
    break

print(count)

Measured memory_bytes: 3064
#include<stdio.h>
#define MAX 250

int main(){
  int i,n,A[MAX];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i!=1) printf("parent key = %d, ",A[i/2]);
    if(2*i<=n) printf("left key = %d, ",A[2*i]);
    if((2*i+1)<=n) printf("right key = %d, ",(A[2*i+1]));
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
h, w, k = map(int, input().split())

c = [list(input()) for l in range(h)]

cnt = 0

for i in range(w):
    for j in range(h):
        if c[j][i] == "#":
            cnt += 1
# print(cnt)
ans = 0
ans2 = 0
s = []
for i in range(w):
    s.append(i)

t = []
for i in range(h):
    t.append(i)

#print(s, t)
n = len(s)
for i in range(2 ** n):
    bag = []
    for j in range(n):
        if (i >> j) & 1:
            bag.append(s[j])
    n2 = len(t)
    for i11 in range(2 ** n2):
        bag2 = []
        for j in range(n2):
            if (i11 >> j) & 1:
                bag2.append(t[j])
        #print(bag)
        #print("aaa", bag2)
        d = 0
        for i3 in bag:
            for i2 in range(h):
                if c[i2][i3] == "#":
                    d += 1
            for j3 in bag2:
                if c[j3][i3] == "#":
                    d -= 1

        for j3 in bag2:
            for j2 in range(w):
                if c[j3][j2] == "#":
                    d += 1

        if cnt - d == k:
            ans += 1

print(ans)


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

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

  do {
    
    bool test = true;
    for ( int I=2 ; I < X ; ++I ) {
      if ( X % I == 0 ) {
        test = false;
        break;
      }
    }

    if ( test ) {
      break;
    }

    X += 1;

  } while(true);

  cout << X << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

LL gcd(LL m, LL n){
    if(m < n) swap(m, n);
    if (n==0) return m;
    return gcd(n, m%n);
}

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

    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    REP(i, N) {
        cin >> x[i];
        x[i] -= X;
        if(x[i] < 0) x[i] = -x[i];
    }
   
    int ans = x[0];
    REP(i, N){
        ans = gcd(ans, x[i]);
    }

    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  string x,y;
  cin >> x >> y;
  if(x.size()>y.size()){cout << "GREATER" << endl;return 0;}
  if(x.size()<y.size()){cout << "LESS" << endl;return 0;}
  if(x>y){cout << "GREATER" << endl;}
  if(x==y){cout << "EQUAL" << endl;}
  if(x<y){cout << "LESS" << endl;}
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    int x, y = 0;
    int temp = 0;
    
    while (cin >> x >> y, x != 0 || y != 0) {
        if (x > y) cout << y << " " << x << endl;
        else cout << x  << " " << y << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main(){
    string s,t;
    int memo = 0;
    
    cin >> s;
    rep(i,0,s.size()){
        s[i] = toupper(s[i]);
    }
    cin >> t;
    while(t != "END_OF_TEXT"){
        rep(i,0,t.size()){
            t[i] = toupper(t[i]);
        }
        
        if(t == s) memo++;
        cin>> t;
    }
    
    cout << memo << endl;
    return 0;
}


Measured memory_bytes: 3208
//#pragma GCC optimize("03,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb           push_back
#define ff           first
#define ss           second
#define gcd(a, b)    __gcd(a, b)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define all(v)       v.begin(),v.end()
#define lllim        2147483648
#define Pi           2*acos(0.0)
#define sci(n)	     scanf("%d",&n)
#define scii(n,m)    scanf("%d%d",&n,&m)
#define scl(n)       scanf("%lld",&n)
#define scll(n,m)    scanf("%lld%lld",&n,&m)
#define pii          pair<int,int>
#define pll 	     pair<ll,ll>
#define mem(a,b)     memset(a, b, sizeof(a))
#define fill_(a,b)   fill(a,a+n,b);
#define MOD          1000000007
#define fast_cin     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define filein       freopen("input.txt","r", stdin)
#define watch(x)     cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define case		 int t,cas=1;cin>>t;while(t--)
#define forn(i,a,n)  for(int i=a;a==0?i<n:i<=n;i++)



/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};  // Kings Move
//const int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

using namespace std;
using namespace __gnu_pbds;

const int maxn=1e5+5;


void solve()
{
	int x,y;
	cin>>x>>y;
	//ll p=(4*x-y)%2;
	
	bool f=0;
	
	for(int i=0;i<=x;i++)
	{
		int l=2*i +(x-i)*4;
		if(l==y)
		{
			f=1;
			break;
		}
	}
	
	if(f)
	{
		cout<<"Yes"<<endl;
		
	}
	else
	cout<<"No"<<endl;
   

}


int main()
{
    fast_cin;
    //case
    {
        //cout<<""<<cas++<<""<<endl;
        solve();
    }

    return 0;
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<double> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &a[i]);
  }
  sort(a.begin(), a.end());
  for (int i = 1; i < n; ++i) {
    a[i] = (a[i - 1] + a[i]) / 2;
  }
  printf("%.10f\n", a[n - 1]);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

#define FOR(i,n) for(ll i=0;i<n;i++) 
#define RFOR(i,n) for(ll i=n-1;i>=0;--i)
#define COUT(str) cout << str << endl

//入力
char a,b;

int main() {

	cin >> a >> b;


	if ((a == 'H'&&b == 'H')||(a == 'D'&&b == 'D')) COUT('H');
	if ((a == 'H'&&b == 'D')||(a == 'D'&&b == 'H')) COUT('D');

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << endl)

using namespace std;
using ll = unsigned long long;

int main() {
	string S;
	int K;
	IN(S);
	IN(K);
	REP(i, K) {
		if(S[i] != '1') {
			OUT(S[i]);
			return 0;
		}
	}
	OUT(1);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] a = new int[101][101];
		for(int i = 0; i < n; i++) {
			int kind = sc.nextInt();
			for(int j = 0; j < kind; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		int[] count = new int[101];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j <= m; j++) {
				count[a[i][j]] ++;
			}
		}
		int ans = 0;
		for(int i = 1; i <= 100; i++) {
			if(count[i] == n) {
				ans ++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22916
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#pragma comment(linker, "/STACK:400000000")

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(it=X.begin();it!=X.end();it++)
#define iss istringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sst stringstream
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

int T,P,R,fail[55][11];

typedef pair<pi,int> tri;
tri t[55];

bool comp(tri a,tri b){
	return a.fir.fir > b.fir.fir
	|| a.fir.fir == b.fir.fir && a.fir.sec < b.fir.sec
	|| a.fir.fir == b.fir.fir && a.fir.sec == b.fir.sec && a.sec < b.sec;
}

int main(){
	while(cin>>T>>P>>R && T){
		rep(i,T)t[i]=mp(mp(0,0),i);
		memset(fail,0,sizeof(fail));
		rep(i,R){
			int tid,pid,time;
			string mes;
			cin>>tid>>pid>>time>>mes;
			if(mes[0]=='C'){
				t[tid-1].fir.fir++;
				t[tid-1].fir.sec+=fail[tid-1][pid-1]*1200+time;
			}else{
				fail[tid-1][pid-1]++;
			}
		}
		sort(t,t+T,comp);
		rep(i,T){
			cout<<t[i].sec+1<<" "<<t[i].fir.fir<<" "<<t[i].fir.sec<<endl;
		}
	}
}

Measured memory_bytes: 932
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	xs := make([][]int, n)
	ys := make([][]int, n)
	for i := 0; i < n; i++ {
		xs[i] = []int{intScanner(), i}
		ys[i] = []int{intScanner(), i}
	}
	sort.Sort(SliceSort(xs))
	sort.Sort(SliceSort(ys))
	edges := make([][]int, 0, n*4)
	for i := 0; i < n-1; i++ {
		edges = append(edges, []int{abs(xs[i][0] - xs[i+1][0]), xs[i][1], xs[i+1][1]})
		edges = append(edges, []int{abs(ys[i][0] - ys[i+1][0]), ys[i][1], ys[i+1][1]})
	}
	fmt.Println(kruscal(n, edges))
}

type SliceSort [][]int

func (x SliceSort) Len() int           { return len(x) }
func (x SliceSort) Less(i, j int) bool { return x[i][0] < x[j][0] }
func (x SliceSort) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func kruscal(n int, list [][]int) int {
	uf := newUnionFind(n)
	sort.Sort(SliceSort(list))
	distSum := 0
	edgeNum := 0
	for _, v := range list {
		d := v[0]
		a, b := v[1], v[2]
		if !uf.same(a, b) {
			distSum += d
			uf.unite(a, b)
			edgeNum++
		}
		if edgeNum == n-1 {
			break
		}
	}
	if edgeNum == n-1 {
		return distSum
	} else {
		return -1
	}
}

type UnionFind struct {
	par []int
}

func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}
func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}
func (u UnionFind) unite(x, y int) {
	xr := u.root(x)
	yr := u.root(y)
	if xr == yr {
		return
	}
	u.par[yr] += u.par[xr]
	u.par[xr] = yr
}
func (u UnionFind) same(x, y int) bool {
	if u.root(x) == u.root(y) {
		return true
	}
	return false
}
func (u UnionFind) size(x int) int {
	return -u.par[u.root(x)]
}


Measured memory_bytes: 27648
#include<stdio.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline char CH()
{
  static char buf[100000],*ptr1=buf,*ptr2=buf;
  return ptr1==ptr2&&(ptr2=(ptr1=buf)+fread(buf,1,100000,stdin),ptr1==ptr2)?EOF:*ptr1++;
}
static inline int IN(void)
{
  int x=0,f=0,c=CH();while(c<48||c>57){f^=c==45,c=CH();}
  while(c>47&&c<58){x=x*10+c-48,c=CH();}return f?-x:x;
}
static inline void OUT(long x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
static inline void Radix32(int A[],const int sz)
{
  int temp[200001];const int bit=8;
  rep(k,4)
  {
    int u[256]={},v[256]={};
    rep(i,sz)u[A[i]>>bit*k&((1<<bit)-1)]++;
    rep(i,(1<<bit)-1)u[i+1]+=u[i];
    rep(i,sz){temp[--u[A[sz-1-i]>>bit*k&((1<<bit)-1)]]=A[sz-1-i];}k++;
    rep(i,sz)v[temp[i]>>bit*k&((1<<bit)-1)]++;
    rep(i,(1<<bit)-1)v[i+1]+=v[i];
    rep(i,sz)A[--v[temp[sz-1-i]>>bit*k&((1<<bit)-1)]]=temp[sz-1-i];
  }
}
int main(void)
{
  int N,p=0,m=0,z=0,A[200000];
  long K,count=0,l=-2e18,r=-l,mid,x=scanf("%d %ld",&N,&K);
  rep(i,N){x=IN();if(x>0)A[m+p++]=x;else if(x<0)A[p+m++]=x;else z++;}
  Radix32(A,m+p);
  if(K>1l*m*p&&K<1l*m*p+1l*z*(N-1)/2)return puts("0"),0;
  if(K<=1l*m*p)r=1l;else l=-1l;x=1l*z*(p+m)+1l*z*(z-1)/2+1l*p*m;
  while(l<=r)
  {
    mid=(l+r)/2;count=0;
    if(mid>=0)
    {
      int plus=p-1,minus=m-1;count+=x;if(count>=K){r=mid-1l;continue;}
      rep(i,p){while(1l*A[i]*A[plus]>mid){plus--;}if(i>=plus){break;}count+=1l*plus-i;}
      if(count>=K){r=mid-1l;continue;}
      rep(i,m){while(1l*A[m+p-1-i]*A[m+p-1-minus]>mid){minus--;}if(i>=minus){break;}count+=1l*minus-i;}
    }
    else{int low=0;rep(i,m){while(1l*A[low]*A[p+i]>mid&&low<p){low++;}count+=1l*p-low;}}
    if(count>=K)r=mid-1l;else l=mid+1l;
  }
  return OUT(l),0;
}

Measured memory_bytes: 3132