akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#define MAX 100
using namespace std;
int ans;
void BubbleSort(int *a, int n){
	if(n==1)return;
	for(int i=0;i<n;i++){
		for(int j=0;j<n-i-1;j++){
			if(a[j]>a[j+1]){
				swap(a[j], a[j+1]);
				++ans;
			}
		}
	}
}
int main(){
	while(true){
		int n;
		int a[MAX];
		scanf("%d", &n);
		if( n==0 ) break;
		for(int i=0;i<n;++i){
			int t;
			scanf("%d", &t);
			a[i]=t;
		}
		ans=0;
		BubbleSort(a,n);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while (true) {
            String s = sc.nextLine();
            if (s.equals("END OF INPUT")) {
                break;
            }
            for (String x : s.split(" ")) {
                sb.append(x.length());
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 25812
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<58;
const double eps = 1e-13;

int f[100009];

int main(){
	DRI(n);
	REP(i,n){
		DRI(x);
		f[x]++;
	}
	int h=n/2;
	LL ans=1;
	if(n%2){
		if(f[0]!=1){
			printf("0");return 0;
		}
		for(int i=2;i<n;i+=2){
			if(f[i]!=2){
				printf("0");return 0;
			}
		}
		for(int i=0;i<h;i++){
			ans=(ans*2)%MOD;
		}
	}
	else{
		for(int i=1;i<n;i+=2){
			if(f[i]!=2){
				printf("0");return 0;
			}
		}
		for(int i=0;i<h;i++){
			ans=(ans*2)%MOD;
		}
	}
	printf("%lld",ans);
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>>point(m);
  vector<pair<int,int>>stu(n);
  for(int i=0;i<n;i++)
    cin >> stu.at(i).first >> stu.at(i).second;
  for(int i=0;i<m;i++)
    cin >> point.at(i).first >> point.at(i).second;
  for(int i=0;i<n;i++){
    int d=1e9,re=0;
    for(int j=m-1;j>=0;j--){
      if(abs(point.at(j).first-stu.at(i).first)+abs(point.at(j).second-stu.at(i).second)<=d){
        d=abs(point.at(j).first-stu.at(i).first)+abs(point.at(j).second-stu.at(i).second);
        re=j+1;
      }
    }
    cout << re << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n, m;
    cin >> n >> m;

    set<ll> se;
    rep(i, 0, m) {
        ll a;
        cin >> a;
        se.insert(a);
    }

    ll dp[110000] = {0};
    dp[0] = 1;
    rep(i, 0, n) {
        if (se.find(i+1) != se.end()) dp[i+1] = 0;
        else dp[i+1] += dp[i] % MOD;
        if (se.find(i+2) != se.end()) dp[i+2] = 0;
        else dp[i+2] += dp[i] % MOD;
    }

    cout << dp[n] % MOD << endl;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		int a = 0;
		int w = 0;
		int t = 0;
		int r = 0;

		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		for (int i = 0; i<= N; i++) {
			String x = s.nextLine();
			if(x.equals("AC")) {
				a= a+ 1;
			}
			if(x.equals("WA")) {
				w= w+ 1;
			}
			if(x.equals("TLE")) {
				t= t+ 1;
			}
			if(x.equals("RE")) {
				r= r+ 1;
			}
		}
		System.out.println("AC x " + a);
		System.out.println("WA x " + w);
		System.out.println("TLE x " + t);
		System.out.println("RE x " + r);

	}
}

Measured memory_bytes: 61012
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep2(i,k,n) for(int i = (k); i < (n); i++)

inline void readInt2(int *a, int *b) {
  int c, p = 0; char s[20] = "";
  for(int i = 0; (c = getchar()) != '\n'; i++) {
    if (c == ' ') { *a = atoi(s); strcpy(s, ""); p = i+1; continue; }
    else s[i] = c;
  }
  *b = atoi(s+p);
}

inline void readInt3(int *a, int *b, int *c) {
  int d, p = 0; char s[20] = "";
  for(int i = 0; (d = getchar()) != '\n'; i++) {
    if(d == ' ') {
      if(p == 0) { *a = atoi(s); strcpy(s, ""); p = i+1; }
      else {*b = atoi(s+p); strcpy(s, ""); p = i+1; }
    } else s[i] = d;
  }
  *c = atoi(s+p);
}

int parent[105], rank[105];
void uf_init(int n);
void unite(int x, int y);
bool same(int x, int y);
int find(int x);

// kruskal
struct edge {
  int u, v, cost;
};

bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}

edge es[5000];
int N, M; // ????????°??¨????????°

int kruskal() {
  int res = -1, max_edge, min_edge, ecount;
  sort(es, es + M, comp);
  rep(i,M) {
    uf_init(N);
    min_edge = es[i].cost;
    ecount = 0;
    rep2(j,i,M) {
      edge e = es[j];
      if (!same(e.u, e.v)) {
        unite(e.u, e.v);
        max_edge = e.cost;
        ecount++;
      }
    }
    if (ecount == N-1 && (res == -1 || res > (max_edge - min_edge))) res = max_edge - min_edge;
  }
  return res;
}

// Union Find
void uf_init(int n) {
  rep(i,n+1) { parent[i] = i; rank[i] = 0; }
}
int find(int x) {
  if (parent[x] == x) return x;
  else return parent[x] = find(parent[x]);
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if(x == y) return;
  if (rank[x] < rank[y]) parent[x] = y;
  else {
    parent[y] = x;
    if(rank[x] == rank[y]) rank[x]++;
  }
}
bool same(int x, int y) {
  return find(x) == find(y);
}

signed main(void) {
  int a, b, w, ans = 0;

  while(readInt2(&N, &M), N | M) {
    rep(i,M) {
      readInt3(&a, &b, &w);
      es[i].u = a; es[i].v = b; es[i].cost = w;
    }
    ans = kruskal();
    printf("%Ld\n", ans);
  }
  return 0;
}

Measured memory_bytes: 2624
s = input()
s2 = []
s3 = 0
scount = 0
for i in range(len(s)):
    s2.append(s[i])
s3 = int(len(s2) / 2)
for i in range(s3):
    if s2[i] != s2[-1-i]:
        scount += 1
print(scount)

Measured memory_bytes: 3060
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        
        if(x==7 || x==5 || x==3 ) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                string[] temp = input.Split(' ');
                int c1 = int.Parse(temp[0]);
                int c2 = int.Parse(temp[1]);
                int c3 = int.Parse(temp[2]);

                bool[] memo = new bool[11];
                memo[c1] = memo[c2] = memo[c3] = true;

                bool flg = true;

                int limit = 20 - (c1 + c2);
                int count = 0;

                if (limit < 7)
                {
                    for (int i = 1; i <= limit; i++)
                    {
                        if (!memo[i]) count++;
                    }

                    flg = count * 100 / 7 >= 50 ? true : false;
                }

                sb.AppendLine(flg ? "YES" : "NO");
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n;
	string s;
	cin >> n;
	cin >> s;
	int i =0;
	int c = 0;
	while(i < n) {
		if (s[i] =='A' && s[i +1] == 'B' && s[i+2] == 'C'){
			c++;
			i += 3;
		}
		else{
			i++;
		}
	}
	cout << c << endl;
	return 0;
}

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

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
  for (int i = 0; i < N; i++)
    cin >> b[i];
  long long cnt = 0;
  for (int i = 0; i < N; i++)
    if (a[i] < b[i])
      cnt += (b[i] - a[i]) / 2;
    else
      cnt -= a[i] - b[i];
  if (cnt < 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 384
import sys
def input():
    return sys.stdin.readline()[:-1]
import heapq
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(reverse=True)
h=[]
# print(ab)
ans=0
for i in range(m):
    while(ab and ab[-1][0]<=i+1):
        heapq.heappush(h,-ab[-1][1])
        ab.pop()
    if h:
        ans-=heapq.heappop(h)
    # print(ab)
    # print(ans)


print(ans)

Measured memory_bytes: 68444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e2 + 10;
int a[maxn], n, k, s, t, tot;
int vis[300010];
ll C[51][51], D[51][51];
int main() {
	scanf("%d%d%d%d",&n,&k,&s,&t);
	
	for (int i = 0; i <= n; i++)
		D[i][0] = C[i][0] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= i; j++) {
			C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
			D[i][j] = D[i][j - 1] + C[i][j]; 
		}
	for (int i = 1, x; i <= n; i++) {
		scanf("%d",&x);
		if ((x & s) == s && (x & t) == x)
			a[++tot] = x;
	} 
	t ^= s;
	int cnt = 0;
	for (int j = 0; j < 18; j++)
		if (t >> j & 1) cnt++;
	//printf("%d %d\n",cnt,tot);
	for (int i = 1; i <= tot; i++) {
		int val = 1, sum = 0;
		for (int j = 0; j < 18; j++) {
			if ((a[i] >> j & 1) && (t >> j & 1))
				sum += val;
			if (t >> j & 1)
				val *= 2;
		}
		a[i] = sum;
	}
	ll ans = 0;
	for (int i = 0; i < (1 << cnt); i++)
		vis[i] = 0;
	for (int t = 0; t < (1 << cnt); t++) {
		int s = 1;
		for (int j = 0; j < cnt; j++)
			if (t >> j & 1) s *= -1;
		ll sum = 0;
		for (int i = 1; i <= tot; i++) {
			sum -= D[vis[a[i] & t]][min(vis[a[i] & t],k)];
			vis[a[i] & t]++;
			sum += D[vis[a[i] & t]][min(vis[a[i] & t],k)];
		}
		//if (t == 0) printf("****%lld %lld\n",vis[0],C[5][5]);
		for (int i = 1; i <= tot; i++)
			vis[a[i] & t]--;
		//printf("%lld %lld\n",t,s * sum);
		ans += s * sum;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4864
//package com.zhangyong.algorithm;

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Main {

    FastScanner in;
    PrintWriter out;

    class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        private FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        private FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    private void solve() {

        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        String[] str = new String[n];
        for (int i = 0; i < str.length; i++) {
            str[i] = in.next();
        }
        Arrays.sort(str, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.compareTo(o2);
            }
        });
        for (int i = 0; i < str.length; i++) {
            out.print(str[i]);
        }
    }

    private void run() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 21588
<?php
// C
fscanf(STDIN, '%d', $n);
$ans = 1001;
for ($i  = 0; $i < $n; $i++) fscanf(STDIN, '%d %d %d', $x[], $y[], $h[]);

for ($p = 0; $p <= 100; $p++) {
    for ($q = 0; $q <= 100; $q++) {
        $flag = true;
        $pH = null;
        for ($i = 0; $i < $n; $i++) {
            if ($h[$i] === 0) continue;
            $H  = $h[$i] + abs($x[$i] - $p) + abs($y[$i] - $q);
            if (isset($pH)) {
                if ($H !== $pH) {
                    $flag = false;
                    break;
                }
            }
            $pH = $H;
        }
        if ($flag) {
            for ($i = 0; $i < $n; $i++) {
                $ht = max($H - abs($x[$i] - $p) - abs($y[$i] - $q), 0);
                if ($ht !== $h[$i]) $flag = false;
            }
            if ($flag) {
                $ans = [$p, $q, $H];
                echo implode(' ', $ans);
                exit;
            }
        }
    }
}

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

using namespace std;

main(){
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    if ((n - 1) * (n - 2) / 2 < k){
        cout << -1;
        return 0;
    }
    vector < pair < int, int > > out;
    for (int i = 2; i <= n; ++i) out.push_back({1, i});
    int it1 = 2, it2 = 3;
    while ((n - 1) * (n - 2) / 2 != k){
        out.push_back({it1, it2});
        it2++;
        if (it2 == n + 1){
            it1++;
            it2 = it1 + 1;
        }
        ++k;
    }
    cout << out.size() << '\n';
    for (auto key : out) cout << key.first << " " << key.second << '\n';
    return 0;
}



Measured memory_bytes: 384
//https://atcoder.jp/contests/abc125/tasks/abc125_d
//D - Flipping Signs
//任意の二項の正負反転する操作になる
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll n;
vector<ll> a;

int main() {
    cin >> n; a.resize(n);
    for (int i = 0; i < n; i++) scanf("%Ld", &a[i]);
    vector<ll> pos, neg;
    for (int i = 0; i < n; i++) {
        if (a[i] >= 0) pos.push_back(a[i]);
        else neg.push_back(a[i]);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end(), greater<ll>());
    ll res = (ll)accumulate(pos.begin(), pos.end(), 0ll) - (ll)accumulate(neg.begin(), neg.end(), 0ll);
    if (neg.size()%2) {
        if (pos.size() != 0 && -neg[0] > pos[0]) res += -2*pos[0];
        else res += 2*neg[0];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2424
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = -1;
	string	s;
	cin >> k;

	a = 7;
	for(i=1;i<=k;i++) {
		if (a%k==0) {
			ans = i;
			break;
		}
		a = (a%k)*10 + 7;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 2);

  A[0] = 0;
  repp(i, 1, N) cin >> A[i];
  A[N + 1] = 0;

  ll all = 0;
  repp(i, 0, N) { all += abs(A[i] - A[i + 1]); }

  vector<int> save(N + 1, 0);
  repp(i, 1, N) {
    bool can_save = (A[i + 1] < A[i] && A[i - 1] < A[i]) ||
                    (A[i + 1] > A[i] && A[i - 1] > A[i]);
    if (can_save) {
      save[i] = 2 * min(abs(A[i + 1] - A[i]), abs(A[i - 1] - A[i]));
    }
  }
  repp(i, 1, N) { cout << all - save[i] << endl; }
}

Measured memory_bytes: 2048
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> A(N), B(N);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> B[i];

    int ans = 0;
    for(int b=0; b<29; b++) {
        int mask  = (1 << (b+1)) - 1;
        int mask2 = (1 <<  b   ) - 1;
        vector<int> nums;
        for(int i=0; i<N; i++) nums.push_back(B[i] & mask);
        sort(nums.begin(), nums.end());

        vector< pair<int, int> > segs;
        for(int i=0; i<N; i++) {
            // 周期 2^{i+1} [lb, ub]
            int lb, ub, numA = A[i] & mask2;
            if(A[i] >> b & 1) {
                lb = (1 << (b+1)) - numA;
                ub = lb + (1 << b) - 1;
            }
            else {
                lb = (1 << b) - numA;
                ub = lb + (1 << b) - 1;
            }
            // fprintf(stderr, "b = %lld, A[%lld] = %lld, numA = %lld, lb = %lld, ub = %lld\n", b, i, A[i], numA, lb, ub);

            int t = (1 << (b+1));
            if(lb / t != ub / t) {
                segs.push_back(make_pair(lb%t, t-1));
                segs.push_back(make_pair(0, ub%t));
            }
            else {
                segs.push_back(make_pair(lb%t, ub%t));
            }
        }

        int tmp = 0;
        for(auto x : segs) {
            int l, r; tie(l, r) = x;
            auto idx = lower_bound(nums.begin(), nums.end(), l);
            auto jdx = upper_bound(nums.begin(), nums.end(), r);
            (tmp += (jdx - idx)) %= 2;
        }
        ans += (tmp << b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19564
#include<bits/stdc++.h>
using namespace std;
string s;
int x;
const string t="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
int main()
{
	cin>>x>>s;
	for(int i=0;i<s.size();i++)
		cout<<char(toupper(t[s[i]-'A'+x]));
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int[] n = new int[14];
			int[] m = new int[14];
			
			String s = sc.next();
			
			int start;
			int j=0;
			for(int i=0;i<4;i++){
				start = j;
				while(s.substring(j,j+1).compareTo(",")!=0)j++;
				n[Integer.valueOf(s.substring(start,j))]++;
				j++;
			}
			n[Integer.valueOf(s.substring(j,s.length()))]++;
			
			m = Arrays.copyOf(n,14);
			
			Arrays.sort(m);
			
			if(m[13]==4){
				System.out.println("four card");
			}else if(m[13]==3 && m[12]==2){
				System.out.println("full house");
			}else if(m[13]==3 && m[12]==1){
				System.out.println("three card");
			}else if(m[13]==2 && m[12]==2){
				System.out.println("two pair");
			}else if(m[13]==2 && m[12]==1){
				System.out.println("one pair");
			}else{
				if(n[10]==1 && n[11]==1 && n[12]==1 && n[13]==1 && n[1]==1){
					System.out.println("straight");
				}else{
					boolean flag = true;
					for(int i=1;i<10;i++){
						if(n[i]==1 && n[i+1]==1 && n[i+2]==1 && n[i+3]==1 && n[i+4]==1){
							System.out.println("straight");
							flag = false;
							break;
						}
					}
					if(flag==true){
						System.out.println("null");
					}	
				}
				
			}	
			
		}
	
	}	
}

Measured memory_bytes: 15324
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>


#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

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

  map<int, int> x, y;
  vector<int> ans;
  for(int i = 0; i < N; i++){
    x[a[i]]++;
    y[a[N - 1 - i]]++;
    if(x == y) ans.push_back(i + 1);
  }

  for(int i = 0; i < ans.size(); i++){
    if(i)cout << ' ';
    cout << ans[i];
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 7868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i++<n;)

int main(){
  int n,a[100010],k,c=1;
  cin>>n;
  fr(i,n) cin>>a[i];
  k=a[1];
  set<int> s={1};
  while(1-s.count(k)){
    s.insert(k);
    if(k==2){
      cout<<c<<endl;
      return 0;
    }
    k=a[k];
    c++;
  }
  cout<<-1<<endl;
}

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

using namespace std;

int main(){

    int N;
    int D1,D2;
    int cnt = 0;
    int flg = 0;

    cin >> N;

    for(int i = 0; i<N;i++){
        cin >> D1 >> D2;
        if(D1 == D2){
            cnt++;
        }else{
            cnt = 0;
        }

        if(cnt == 3){
            flg = 1;
        }
    }
    
    if(flg){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cstdio>
typedef long long ll;
using namespace std;
static const int MAX = 41;
static const long long INFTY = 100000000000000001;
int n;
ll w[MAX], v[MAX];
ll W;
pair <ll, ll> ps[1 << (MAX/2)];

int main()
{
    cin >> n >> W;
    for (int i = 0; i < n; i++) cin >> v[i] >> w[i];

    int n2 = n / 2;
    for (int i = 0; i < 1 << n2; i++) {
        ll sw = 0, sv = 0;
        for (int j = 0; j < n2; j++) {
            if (i >> j & 1) {
                sw += w[j];
                sv += v[j];
            }
        }
        ps[i] = make_pair(sw, sv);
    }

    sort(ps, ps +(1 << n2));
    int m = 1;
    for (int i = 1; i < 1 << n2; i++) {
        if (ps[m-1].second < ps[i].second) ps[m++] = ps[i];
    }

    long long res = 0;
    for (int i = 0; i < 1 << (n - n2); i++) {
        ll sw = 0, sv = 0;
        for (int j = 0; j < n - n2; j++) {
            if (i >> j & 1) {
                sw += w[n2+j];
                sv += v[n2+j];
            }
        }
        if (sw <= W) {
            ll tv = (lower_bound(ps, ps+m, make_pair(W - sw, INFTY)) - 1) -> second;
            res = max(res, sv + tv);
        }
    }
    cout << res << endl;
    return 0;
}



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

long long n, ch;
string s;

int main()
{
    scanf("%lld", &n);
    while(n) {
        ch = n % 26;
        n = n/26;
        if (ch == 0) {
            s += 'z';
            n--;
        }
        else {
            s += 'a' + ch - 1;
        }
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3748
def func():
    n = int(input())
    w = []
    for i in range(n):
        w.append(input())
    if len(set(w)) != n:
        print("No")
        return
        
    before = ""
    for wn in w:
        if before != "" and wn[0] != before[-1]:
            print("No")
            break
        before = wn
    else:
        print("Yes")
func()

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

typedef struct{
    int p,x;
}drink_t;

int main(){

    int N;
    cin >> N;
    int t[N+1];
    for(int i=1;i<=N;i++)cin >> t[i];

    int M;
    cin >> M;
    drink_t drink[M];
    for(int i=0;i<M;i++){
        cin >> drink[i].p >> drink[i].x;
    }

    for(int i=0;i<M;i++){
        int ans = 0;
        for(int j=1;j<=N;j++){
            if(drink[i].p == j)ans += drink[i].x;
            else ans += t[j];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
n = input()

l = len(n)

if l == 1:
    print(int(n))
elif l == 2:
    print(9)
elif l == 3:
    print(9 + int(n) - 99)
elif l == 4:
    print(909)
elif l == 5:
    print(909 + int(n) - 9999)
elif l == 6:
    print(90909)
    

Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner stdIn = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String upper_str = str.toUpperCase();
        System.out.println(upper_str);
	}
}

Measured memory_bytes: 17184
#include <bits/stdc++.h>
using namespace std;
#define int long long




signed main() {
    int n,a,b,c,d;
    string s;
    cin>>n>>a>>b>>c>>d>>s;
    int t=0;
    for(int i=a-1;i<c-1;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            t=1;
            break;
        }
    }
    for(int i=b-1;i<d-1;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            t=1;
            break;
        }
    }
    if(t==0&&d<c){
        t=1;
        for(int i=b-1;i<=d-1;i++){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i-1]=='.'){
                t=0;
                break;
            }
        }
    }
    if(t==0)cout<<"Yes";
    else cout<<"No";
   return 0;
}


Measured memory_bytes: 640
n, k = map(int, input().split())
snak = [False] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        snak[j - 1] = True
ans = 0
for i in snak:
    if not i:
        ans += 1
print (ans)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
  int a,b,x;
  cin>>a>>b>>x;
  b+=a;
  if(b>=x&&a<=x)  cout<<"YES"<<endl;
  else  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define mod 1000000007
typedef long long ll;
ll n,m,a[222],sz,ans,cnt;
void read(ll &x)
{
	scanf("%lld",&x);
}
void print(ll x)
{
	printf("%lld ",x);
}
void println(ll x)
{
	printf("%lld\n",x);
}
int main()
{
	cin>>n;
	while(ans<=n)
		ans=ans*2+1,cnt++;
	ans=(ans-1)/2;
	cnt--;
	for(ll i=1;i<=cnt;i++)
		a[++sz]=i;
	for(ll i=1;i<=cnt;i++)
		a[++sz]=i;
	for(ll i=cnt-1;i>=0;i--)
		if((1LL<<i)+ans<=n)
		{
			ans+=(1LL<<i);
			a[++sz]=++cnt;
			++sz;
			for(ll j=sz;j>i+1;j--)
				a[j]=a[j-1];
			a[i+1]=cnt;
		}
	cout<<sz<<endl;
	for(ll i=1;i<=sz;i++)
		cout<<a[i]<<" ";
}

Measured memory_bytes: 256
n = int(input())
temp = list(map(int, input().split()))
palace = list(map(int, input().split()))

tmin = float("inf")
for i in range(n):
    t = temp[0] - palace[i] * 0.006
    a = abs(temp[1] - t)
    if a < tmin:
        tmin = a
        k = i + 1
    else:
        pass

print(k)

Measured memory_bytes: 3060
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/

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


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend();
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         <vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define MN                           INT_MIN
#define MX                           INT_MAX

bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}
int32_t main()
{
	int n;
	cin >> n;
	vector<string> v;
	unordered_map<string,int> m;
	string s;
	for(int i = 1;i<= n;i++)
	{
		s = to_string(i);
		string k = "";
		k+= s[0];
		k+= s.back();
		v.pb(k);
		m[k]++;
	}
	int ans = 0;
	for(auto x: v)
	{
		string z = "";
		z+= x.back();
		z+= x[0];
		ans+= m[z];
	}
	cout << ans << endl;
}

Measured memory_bytes: 11696
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n; cin >> n;
    std::vector<pii> a(n); rep(i,n){ int _a; cin >> _a; a[i]=make_pair(_a, i+1);}

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

    rep(i,n){
        if(i!=n-1) cout << a[i].second << " ";
        else cout << a[i].second << '\n';
    }



    return 0;
}

Measured memory_bytes: 1664
import java.util.*;
import java.util.Collections;
import java.util.ArrayList;

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

        int N = sc.nextInt();
        int L = sc.nextInt();
        String ans = "";
        ArrayList<String> list = new ArrayList<String>();

        for(int i=0; i<N; i++){
            list.add(sc.next());
        }

        Collections.sort(list);

        for(int i=0; i<N; i++){
            ans += list.get(i);
        }
        System.out.println(ans);
    }
}

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

void gen(const std::vector<int> &d, std::vector<std::vector<int>> &ans,
  const std::vector<int> &cur) {
  for (const auto i : d) {
    if (std::find(cur.cbegin(), cur.cend(), i) == cur.cend()) {
      auto tmp = cur;
      tmp.push_back(i);
      if (tmp.size() == d.size()) {
        ans.push_back(std::move(tmp));
      } else {
        gen(d, ans, tmp);
      }
    }
  }
}

int main() {
  int64_t n, m, r;
  std::cin >> n >> m >> r;
  std::vector<int> d(r);
  for (auto &i : d) {
    std::cin >> i;
    i--;
  }
  std::vector<std::vector<int64_t>> c(n,
    std::vector<int64_t>(n, 1000000000000000));
  for (int64_t i = 0; i < n; i++) {
    c[i][i] = 0;
  }

  for (int64_t i = 0; i < m; i++) {
    int64_t a_i, b_i, c_i;
    std::cin >> a_i >> b_i >> c_i;
    c[a_i - 1][b_i - 1] = c[b_i - 1][a_i - 1] = c_i;
  }

  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          if (c[i][j] > c[i][k] + c[k][j]) {
            c[i][j] = c[i][k] + c[k][j];
            flag = true;
          }
        }
      }
    }
  }
  std::vector<std::vector<int>> ans;
  gen(d, ans, {});

  int64_t len = 1000000000000000;
  for (const auto &i : ans) {
    int64_t tmp = 0;
    for (int j = 0; j < i.size() - 1; j++) {
      tmp += c[i[j]][i[j + 1]];
    }
    len = std::min(len, tmp);
  }

  std::cout << len << std::endl;
  return 0;
}

Measured memory_bytes: 4152
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func calcNextPn(num int) int {
	current := num
	for {
		current++
		if checkPn(current) {
			return current
		}
	}
}

func checkPn(num int) bool {
	isPrime := true
	for j := 2; j < num; j++ {
		if num%j == 0 {
			isPrime = false
			break
		}
	}
	return isPrime
}

func isUniq(a []int) bool {
	encountered := map[int]bool{}
	for i := 0; i < len(a); i++ {
		if !encountered[a[i]] {
			encountered[a[i]] = true
		} else {
			return false
		}
	}
	return true
}

func getPattern(a []int, n int) [][]int {
	s := len(a)
	return pick(a, s, []int{}, 0, s-(n+1))
}

func pick(source []int, n int, subset []int, begin, end int) [][]int {
	p := [][]int{}
	for i := begin; i < end; i++ {
		tmp := append(subset, source[i])
		if end+1 <= n {
			p = append(p, pick(source, n, tmp, i+1, end+1)...)
		} else {
			p = append(p, tmp)
		}
	}
	return p
}

func hasPrime(pna []int) bool {
	patterns := getPattern(pna, 5)
	for i := 0; i < len(patterns); i++ {
		p := patterns[i]
		sum := 0
		for j := 0; j < len(p); j++ {
			sum += p[j]
		}
		isPrime := checkPn(sum)
		if isPrime {
			return true
		}
	}
	return false
}

// func hasPrime(pna []int) bool {
// 	n := len(pna)
// 	checkedSlice := [][]int{}
// 	for i := 0; i < n; i++ {
// 		for j := 0; j < n; j++ {
// 			for k := 0; k < n; k++ {
// 				for l := 0; l < n; l++ {
// 					for m := 0; m < n; m++ {
// 						a := []int{pna[i], pna[j], pna[k], pna[l], pna[m]}
// 						sort.Sort(sort.IntSlice(a))
// 						checked := false
// 						for p := 0; p < len(checkedSlice); p++ {
// 							if reflect.DeepEqual(a, checkedSlice[p]) {
// 								checked = true
// 								break
// 							}
// 						}
// 						if checked {
// 							continue
// 						}
// 						checkedSlice = append(checkedSlice, a)
// 						if !isUniq([]int{i, j, k, l, m}) {
// 							continue
// 						}
// 						sum := 0
// 						for o := 0; o < len(a); o++ {
// 							sum += pna[o]
// 						}
// 						isPrime := checkPn(sum)
// 						if isPrime {
// 							return true
// 						}
// 					}
// 				}
// 			}
// 		}
// 	}
// 	return false
// }

func main() {
	var n int
	fmt.Scan(&n)
	// pn := []int{2}
	// for i := 0; i < n; i++ {
	// 	nPn := calcNextPn(pn[len(pn)-1])
	// 	pn = append(pn, nPn)
	// }

	pns := []int{2}
	for {
		pn := calcNextPn(pns[len(pns)-1])
		pns = append(pns, pn)
		if pn > 55555 {
			break
		}
	}

	result := []int{}
	for i := 0; i < len(pns); i++ {
		if pns[i]%5 == 1 {
			result = append(result, pns[i])
			if len(result) == n {
				break
			}
		}
	}
	sa := []string{}
	for i := 0; i < n; i++ {
		sa = append(sa, strconv.Itoa(result[i]))
	}
	fmt.Println(strings.Join(sa, " "))
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t go(int64_t a,int64_t b){
  return a*a*a*a*a-b*b*b*b*b;
}
int main(){
  int x;
  cin >> x;
  int64_t j;
  for(j=-100;j<=10000;j++){
    for(int k=0;k<=10000;k++){
      int64_t c=go(k,j);
      if(c==x){
        cout << k << " " << j;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3636
'''
[point 1]
1817181712114 の部分 "18171"について考える...

    181710000 / 10000 ≡ 0 (MOD 2019) ならば、2019の倍数
    181710000 ≡ 0 (MOD 2019) でよい

[point 2]
    181710000
    =
    181712114
    -
         2114

    なので、特定区間の値 は 累積和の差 から瞬時に求められる。
    さらに、181710000 ≡ 0 (MOD 2019) を考えると、

    0 ≡ 181712114 - 2114
    → 181712114 ≡ 2114

    となる。
    結局の所、MOD2019において合同な累積和のペアの数の数え上げ。
'''

from collections import defaultdict

def gen_10exp_mod(n, mod):
    a = 1
    yield a
    for _ in range(1, n):
        a = (a*10) % mod
        yield a

def main():
    MOD = 2019
    S = input()[::-1]
    # 桁ごとの実際の値を計算 (MOD)
    A = [int(s)*n % MOD for s, n in zip(S, gen_10exp_mod(len(S), MOD))]
    # 累積和を計算
    ACC = [0]
    for a in A:
        ACC.append((ACC[-1] + a) % MOD)
    # ペア数え上げ
    d = defaultdict(int)
    for acc in ACC:
        d[acc] += 1
    ans = sum(v*(v-1)//2 for v in d.values())
    print(ans)


main()


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

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#define int long long
#define ld1 long double
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'
#define vcc vector<char>
#define rep(i,a,b) for(int i=a;i<b;i++)

// if you have no idea just guess the appropriate well-known algo instead of doing nothing -- Benq inspiration
const int mod=998244353;
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int powmod(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return powmod(a,mod-2);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int N=(int)1e6;


void solve(){
    int x,y; cin >> x >> y;

    if(y&1){
        cout<<"No"<<endl;
        return;
    }
    if( y >= 2*x and y <= 4*x){
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
    return;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("input.txt");
    WRITE("output.txt");
    double beg=clock();
#endif

    int t=1;
//    cin>>t;

    while(t--){
        solve();
    }

#ifndef ONLINE_JUDGE
    double endd=clock();
    cout<<endl;
    cerr<<"*** Total time = "<<(endd-beg)/CLOCKS_PER_SEC;
#endif
}


Measured memory_bytes: 3652
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()

  l=[[0 for _ in range(10)]for __ in range(10)]

  for i in range(1,n+1):
    a=str(i)[0]
    b=str(i)[-1]

    l[int(a)][int(b)]+=1

  ans=0
  for i in range(10):
    for j in range(10):
      ans+=l[i][j]*l[j][i]

  return ans

# main()
print(main())


Measured memory_bytes: 5712
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
fn main(){
    input!{
        s: String,
        t: String
    }
    let mut ss = String::new();
    ss.push_str(&s);
    ss.push_str(&s);
    println!("{}", if let Some(_x)=ss.find(&t){"Yes"}else{"No"});
}



Measured memory_bytes: 4352
<?php
$b=trim(fgets(STDIN))-1;
$a=explode(' ',trim(fgets(STDIN)));
for($i=1;$i<=$b;$i++)$a[$i]+=$a[$i-1];
$c=1<<31;
for($i=0;$i<$b;$i++)$c=min($c,abs($a[$b]-2*$a[$i]));
echo $c.PHP_EOL;

Measured memory_bytes: 20980
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define min3(a,b,c) min(min(a,b),c)
#define STR_MAX 1000
#define BUF_SIZE (STR_MAX+50)

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int main(void) {
    char str1[BUF_SIZE];
    char str2[BUF_SIZE];
    get_str(&str1[1], BUF_SIZE);
    get_str(&str2[1], BUF_SIZE);
    int len1 = strlen(&str1[1])-1;
    int len2 = strlen(&str2[1])-1;
#ifdef DEBUG
    printf("%d %d\n", len1, len2);
#endif
    static int dp[STR_MAX+1][STR_MAX+1];

    int i, j;
    for(i = 0; i <= len1; i++) {
        dp[i][0] = i;
    }
    for(i = 0; i <= len2; i++) {
        dp[0][i] = i;
    }

    for(i = 1; i <= len1; i++) {
        for(j = 1; j <= len2; j++) {
            dp[i][j] = min3(
                dp[i-1][j-1] + (str1[i] != str2[j]),
                dp[i][j-1] + 1,
                dp[i-1][j] + 1
            );
#ifdef DEBUG
            printf("dp[%d][%d] = %d\n", i, j, dp[i][j]);
#endif
        }
    }
    printf("%d\n", dp[len1][len2]);
    return 0;
}


Measured memory_bytes: 5664
import sys
input = sys.stdin.readline

def Warshall_Floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d
h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
n = 10
Warshall_Floyd(c)

A =[list(map(int, input().split())) for _ in range(h)]
S = []
S_append = S.append
for a in A:
    for i in a:
      if i != -1 and i != 1:
        S_append(i)
ans = 0
for s in S:
  ans += c[s][1]
print(ans)

Measured memory_bytes: 42076
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	int a[3][3];
	
	for(int i = 0; i < 3; ++i) {
		for(int j = 0; j < 3; ++j) {
			cin >> a[i][j];
		}
	}
	
	int n;
	
	cin >> n;
	
	int b[n];
	
	int vis[3][3] {};
	
	for(int k = 0; k < n; ++k) {
		cin >> b[k];
		
		for(int i = 0; i < 3; ++i) {
			for(int j = 0; j < 3; ++j) {
				if(a[i][j] == b[k]) {
					vis[i][j] = 1;
				}
			}
		}
	}
	
	for(int i = 0; i < 3; ++i) {
		int s1 = 0;
		int s2 = 0;
		
		s1 += vis[i][0] + vis[i][1] + vis[i][2];
		s2 += vis[0][i] + vis[1][i] + vis[2][i];
		
		if(s1 == 3 or s2 == 3) {
			cout << "Yes";
			return;
		}
	}
	
	if(vis[0][0] + vis[1][1] + vis[2][2] == 3) {
		cout << "Yes";
		return;
	}
	if(vis[0][2] + vis[1][1] + vis[2][0] == 3) {
		cout << "Yes";
		return;
	}
	
	cout << "No";
}

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


Measured memory_bytes: 3548
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let mut d: Vec<i32> = (0..n).map(|_| input()).collect();
    d.sort();

    let l = d[n / 2 - 1];
    let r = d[n / 2];
    println!("{}", r - l);
}


Measured memory_bytes: 4352