akhauriyash/Code-Regression huggingface dataset:
/* template.cpp(shinobu_menkoi) {{{ */
#include <bits/stdc++.h>
using namespace std;

// clang-format off
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (lint i = (a); i < (lint)(n); i += (s))
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rrep1(a) rrep2(_, a)
#define rrep2(i, a) rrep3(i, a, 0)
#define rrep3(i, a, n) rrep4(i, a, n, 1)
#define rrep4(i, a, n, s) for (lint i = (a); i >= (lint)(n); i -= (s))
#define each(i, ctn) for (auto &&i : (ctn))

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) begin(v), end(v)
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
#define TEMP_T template <class T>
#define TEMP_TU template <class T, class U>

TEMP_T using vec = vector<T>;
TEMP_T using heap = priority_queue<T>;
TEMP_T using minheap = priority_queue<T, vec<T>, greater<T>>;
using lint = long long;
using ulint = unsigned long long;
using ld = long double;
using vi = vec<int>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<int, int>;
using vs = vec<string>;

TEMP_TU ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << p.fi << " " << p.se; }
TEMP_TU istream &operator>>(istream &is, pair<T, U> &p) { return is >> p.fi >> p.se; }

const int INF{1001001001};
const lint LINF{1001001001001001001ll};
const int MOD{(int)1e9 + 7};
const double EPS{1e-9};
const double PI{acos(-1)};
const int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1};

inline bool inside(int y, int x, int h, int w) { return y >= 0 && x >= 0 && y < h && x < w; }
TEMP_T inline bool chmin(T &a, const T &b) { if (a > b) a = b; return a > b; }
TEMP_T inline bool chmax(T &a, const T &b) { if (a < b) a = b; return a < b; }
TEMP_T inline void print(const T &x) { cout << x << '\n'; }
TEMP_T inline void print(const vec<T> &v, string d = "\n") { rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? "\n" : d); }
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = string> vec<T> split(const string &s, char d = ',') {
  vec<T> v; stringstream ss(s); for (string b; getline(ss, b, d); ) {
    stringstream conv(b); T t; conv >> t; v.eb(t); } return v;
}
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__;
// clang-format on
/* }}} */

signed main() {
  lint x;
  cin >> x;
  lint res = x / 11;

  res *= 2;
  if (x % 11 == 0) {
    print(res);
    return 0;
  }
  if (x % 11 <= 6) {
    print(res + 1);
  } else {
    print(res + 2);
  }
}


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

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

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

        int[] dp = new int[n];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;

        for(int i=1;i<n;i++){
            dp[i] = Math.min(dp[i],dp[i-1] + Math.abs(input[i] - input[i-1]));
            if(i>1){
                dp[i] = Math.min(dp[i],dp[i-2] + Math.abs(input[i] - input[i-2]));
            }
        }
        
        System.out.println(dp[n-1]);

    }

}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll N;
vll A;
vvll x, y;


bool ok(ll state){
  ll p=0;
  ll ps=1;
  while(ps<=state){
    if(ps&state){
      REP(i,A[p]){
        if(y[p][i]==1){
          if(((1<<x[p][i])&state)==0) return false;
        }else{
          if((1<<x[p][i])&state) return false;
        }
      }
    }
    p++;
    ps<<=1;
  }
  return true;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N);
  A.resize(N);
  x.resize(N);
  y.resize(N);
  REP(i,N){
    IN(A[i]);
    x[i].resize(A[i]);
    y[i].resize(A[i]);
    REP(j,A[i]){
      IN(x[i][j], y[i][j]);
      x[i][j]--;
      y[i][j];
    }
  }

  ll ans = 0;
  REP(state,1<<N){
    if(ok(state)){
      chmax(ans, popcount(state));
    }
  }

  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}


bool dp[100][100][14000];


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h,w;cin >> h >> w;
	vector<vector<int>> a(h,vector<int>(w)), b(h,vector<int>(w));
	rep(i,h) rep(j,w) cin >> a[i][j];
	rep(i,h) rep(j,w) cin >> b[i][j];
	dp[0][1][7000] = true;
	dp[1][0][7000] = true;
	rep(i,h){
		rep(j,w){
			rep(k,14000){
				if(k + a[i][j] - b[i][j] >= 0 && k + a[i][j] - b[i][j] < 14000){
					if(dp[i + 1][j][k + a[i][j] - b[i][j]]) dp[i + 1][j + 1][k] = true;
					if(dp[i][j + 1][k + a[i][j] - b[i][j]]) dp[i + 1][j + 1][k] = true;
				}
				if(k + b[i][j] - a[i][j] >= 0 && k + b[i][j] - a[i][j] < 14000){
					if(dp[i + 1][j][k + b[i][j] - a[i][j]]) dp[i + 1][j + 1][k] = true;
					if(dp[i][j + 1][k + b[i][j] - a[i][j]]) dp[i + 1][j + 1][k] = true;
				}
			}
		}
	}
	int ans = 14000;
	rep(i,14000){
		if(dp[h][w][i]) ans = min(ans,abs(i - 7000));
	}
	cout << ans << endl;
}


Measured memory_bytes: 109312
n = int(input())
leaves = list(map(int, input().split()))

ans = 0
nodes_min = [0] * (n + 1)
nodes_max = [0] * (n + 1)
nodes_min[n] = leaves[n]
nodes_max[n] = leaves[n]

for depth in range(n, 0, -1):
    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2
    nodes_min[depth - 1] = leaves[depth - 1] + root_min
    root_max = nodes_max[depth]
    nodes_max[depth - 1] = leaves[depth - 1] + root_max
nodes = [0] * (n + 1)
nodes[0] = 1
for depth in range(n):
    roots = nodes[depth]-leaves[depth]
    if nodes[depth] < nodes_min[depth]:
        print(-1)
        break
    nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])
else:
    if nodes[n] < nodes_min[n]:
        print(-1)
    else:
        print(sum(nodes))

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    string s,t;
    cin >> s >> t;
    cout << t << s << endl;
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
int N,M,i,j,A[9],num[9]={2,5,5,4,5,6,3,7,6};
string dp[10101];
void chmax(string &s,string t){
  if(s=="_"||s.size()<t.size()||(s.size()==t.size()&&s<t))s=t;
}
int main(void){
  cin>>N>>M;
  for(i=0;i<M;i++)cin>>A[i];
  fill(dp,dp+10101,"_");
  dp[0]="";
  for(i=0;i<=N;i++){
    if(dp[i]=="_")continue;
    for(j=0;j<M;j++)chmax(dp[i+num[A[j]-1]],dp[i]+(char)(A[j]+'0'));
  }
  cout<<dp[N]<<endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 44928
public class Main {

	void main(){
		for(int i = 1; i <= 9; i++) {
			for(int j = 1; j <= 9; j++) {
				System.out.println(i + "x" + j + "=" + i*j);
			}
		}
	}
	public static void main(String[] args) {
		new Main().main();
	}

}



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

ll mod = 1e9 + 7;

int main(){
	double a,b,c,d;
	cin >> a >> b >> c >> d;
	if(ceil(a / d) >= ceil(c / b))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3716
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[210][15];
ll a[210];
ll cnt;
int main(){
	ll n;
	scanf("%lld",&n);
	rep(i,0,n){
		char ss[15];
		scanf("%s",ss);
		ll idx=0;
		while(idx<cnt&&strcmp(s[idx],ss))idx++;
		strcpy(s[idx],ss);
		cnt=max(cnt,idx+1);
		a[idx]++;
	}
	ll m;
	scanf("%lld",&m);
	rep(i,0,m){
		char ss[15];
		scanf("%s",ss);
		ll idx=0;
		while(idx<cnt&&strcmp(s[idx],ss))idx++;
		strcpy(s[idx],ss);
		cnt=max(cnt,idx);
		a[idx]--;
	}
	
	ll ans=0;
	rep(i,0,cnt)ans=max(ans,a[i]);
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

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

	vector<ll> S(n+1),X(n+1);
	for(int i = 0; i < n; i++){
		S[i+1] = S[i]+a[i];
		X[i+1] = X[i]^a[i];
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
		int l = i+1,r = n+1;
		while(r-l>1){
			int mid = (r+l)/2;
			if((S[mid]-S[i]) == (X[mid]^X[i])) l = mid;
			else r = mid;
		}
		ans += l-i;
	}

	// ll sum = 0,xor_sum = 0;
	
	// int l = 0,r = 0;
	// int cnt = 0;
	// ll ans = 0;
	// while(l<n){
	// 	cnt++;
	// 	if(cnt == 15) break;
	// 	if(l == n-1)break;
	// 	cout << "l = " << l << " r = " << r << endl;
	// 	for(int i = r; i < n; i++){
	// 		sum += a[i];
	// 		xor_sum ^= a[i];

	// 		cout << sum << "  " << xor_sum << endl;
	// 		if(sum != xor_sum){
	// 			r = i;
	// 			//ans += r-l+1;
	// 			break;
	// 		}
	// 	}
	// 	for(int i = l; i <= r; i++){
	// 		ans += r-l+1;
	// 		sum -= a[i];
	// 		xor_sum ^= a[i];
	// 		if(sum != xor_sum){
	// 			l = i;
	// 			break;
	// 		}
	// 	}
	// }

	cout << ans << endl;

	return 0;
}

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

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


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;
int K, S;


int main(void) {
    scanf("%d %d", &K, &S);

    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S - x - y;
            if (z >= 0 && z <= K) ans++;
        }
    }
   

  
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
#coding: utf-8

def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line)

def bubble_sort(A, N):
    #print_list(A)
    #flag: ???????????????????????????True???????´?
    flag = True
    counter = 0

    while flag:
        flag = False
        for j in range(1, N):
            if A[j] < A[j-1]:
                tmp_val = A[j]
                A[j] = A[j-1]
                A[j-1] = tmp_val

                flag = True
                counter += 1
        #print_list(A)
    print_list(A)
    print(counter)

N = int(input())
A = list(map(int, input().split()))

bubble_sort(A, N)

Measured memory_bytes: 7696
#include <iostream>
using namespace std;
int main() {
	long long N, M;

	cin >> N >> M;

	long long ans = 0;
	for (long long i =M/N; i>=1 ; i--)
	{
		long long K;
		K = M - N*i;
		if (K < 0) {
			continue;
		}
		//cout <<"i" <<i <<"K:" << K << endl;

		if (K == 0) {
			ans = i;
			break;
		}
		else if(K>0){
			
			if (K%i==0) {
				ans = i;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 9)
 
N,M,K = map(int, input().split())

friends = {i: set() for i in range(N)}
blocks = {i: set() for i in range(N)}

for _ in range(M):
  a,b = map(int, input().split())
  a-=1;b-=1
  friends[a].add(b)
  friends[b].add(a)
for _ in range(K):
  a,b = map(int, input().split())
  a-=1;b-=1
  blocks[a].add(b)
  blocks[b].add(a)

ans = [0] * N
visited = [False] * N

def DFS(u):
  if visited[u]:
    return
  visited[u] = True
  for v in friends[u]:
    s.add(v)
    DFS(v)

for u in range(N):
  if not visited[u]:
    s = set()
    DFS(u)
    l = len(s)
    for i in s:
      ans[i] += l-1
      ans[i] -= len(blocks[i].intersection(s))
      ans[i] -= len(friends[i].intersection(s))
print(*ans)

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

int main(){
  string S;
  long long K;
  cin >> S >> K;
  int N = S.size();
  if(K>100){
    K = 100;
  }
  int L = K;
  char ans='1';
  for(int i=0;i<min(L,N);i++){
    if(S.at(i) == '1'){
    }else{
      ans = S.at(i);
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
A = list(map(int, input().split()))
BC = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: -x[1])

add = []

for b,c in BC:
  add += [c]*b
  if len(add)>n:
    break
    
ans = sorted(A+add)    
print(sum(ans[-n:]))

Measured memory_bytes: 39372
void main()
{
    long a = rdElem, b = rdElem, c = rdElem;

    long s = 3 * c;
    long[][] x = new long[][](3, 3);
    x[0][0] = a, x[0][1] = b, x[0][2] = s - a - b;
    x[1][0] = 4 * c - 2 * a - b, x[1][1] = c, x[1][2] = 2 * a + b - 2 * c;
    x[2][0] = a + b - c, x[2][1] = s - b - c, x[2][2] = s - a - c;

    x.wrMat;
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 256
using System;
class program{
  static void Main(string[] args){
    program p = new program();
    p.Run();
  }
  void Run(){
	string[] inp = Console.ReadLine().Split();
   	int ab = int.Parse(inp[0]);
   	int bc = int.Parse(inp[1]);
    int res =(int)(ab*bc/2);
   	Console.WriteLine(res.ToString());
  }
}


Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main(){
    int n, x;
    int S = 0;
    
    while(1){
        cin >> n >> x;
        
        if((n == 0) && (x == 0))break;
        
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                for(int k = 1; k <= n; k++){
                    if(((i + j + k) == x) && (i != j) && (j != k) && (k != i)){
                        S += 1;
                    }
                }
            }
        }
        
        S = S / 6;
        
        cout << S << endl;
        
        S = 0;
    }
    
    
    
}



Measured memory_bytes: 3108
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>

using namespace std;

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

	cin >> n;
	while(n--){
		int ret = 1;
		double d;

		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		d = sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
		if(ra + rb < d){
			ret = 0;
		}else if(ra - rb > d){
			ret = 2;
		}else if(rb - ra > d){
			ret = -2;
		}

		cout << ret << endl;
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
const ll MOD = 998244353;

template<class T> T powmod(T x, ll n, ll m)
{
    T r = 1;
    T a = x % m;
    while (n>0)
    {
        if (n & 1)
            r = (r*a)%m;
        a = (a*a)%m;
        n = n >> 1;
    }
    return r;
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\contests\\stdout", "w", stdout);
    }

    int n;
    cin >> n;
    map<int, int> H;
    vector<int> a(n);
    FOR(i, n){
        cin >> a[i];
        H[a[i]]++;
    }
    if (a[0] != 0 || H[0]>1){
        cout << 0 << endl;
        return 0;
    }

    ll res = 1;
    int last = 0;
    for(auto it : H){
        if (it.first == 0){
            last = 0;
            continue;
        }
        if (it.first != last+1){
            cout << 0 << endl;
            return 0;
        }
        res = res * powmod((ll)H[it.first-1], it.second, MOD) % MOD;
        last = it.first;
    }
    cout << res << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,i,nr,sum=0;
    cin>>n;
    bitset<4000006> bit(1);
    for(i=1; i<=n; i++) {
        cin>>nr;
        bit|=(bit<<nr);
        sum+=nr;
    }
    for(i=sum/2+sum%2; i<=sum; i++) {
        if(bit[i]==1) {
            cout<<i<<'\n';
            break;
        }
    }
    return 0;
}


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

class MNode {
private:
	const string key;
	int value;
	MNode *left, *right;
public:
	MNode(string k, int v);
	~MNode();
	MNode* find(string k);
	int& Value() { return value; }
};

MNode::MNode(string k, int v) : key(k), value(v) {
	left = nullptr;
	right = nullptr;
}

MNode::~MNode() {
	if (left != nullptr)
		delete left;
	if (right != nullptr)
		delete right;
}

MNode* MNode::find(string k) {
	if (key == k)
		return this;
	else if (k < key) {
		if (left == nullptr) {
			left = new MNode(k, 0);
			return left;
		}
		else
			return left->find(k);
	}
	else {
		if (right== nullptr) {
			right = new MNode(k, 0);
			return right;
		}
		else
			return right->find(k);
	}
}

class StrIntMap {
private:
	MNode *root;
	const string center;
public:
	StrIntMap();
	~StrIntMap();
	int& operator [](string str) {
		return (root->find(str))->Value();
	}
};

StrIntMap::StrIntMap() : center("n") {
	root = new MNode(center, 0);
}

StrIntMap::~StrIntMap() {
	delete root;
}

int main() {
	string str;
	StrIntMap m;
	int maxlen = 0, maxnum = 0;
	string maxlen_str, maxnum_str;
	while (cin >> str) {
		if (++m[str] > maxnum) {
			maxnum = m[str];
			maxnum_str = str;
		}
		if (str.size() > maxlen) {
			maxlen = str.size();
			maxlen_str = str;
		}
	}
	cout << maxnum_str << ' ' << maxlen_str << endl;
}


Measured memory_bytes: 3164
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

std::vector<size_t> make_vector(size_t n, size_t x) {
  return std::vector<size_t>(n, x);
}

template <class Tp>
std::vector<Tp> make_vector(size_t n, const Tp& x) {
  return std::vector<Tp>(n, x);
}

template <class... Ts>
auto make_vector(size_t n, size_t m, const Ts&... x) {
  return std::vector<decltype(make_vector(m, x...))>(n, make_vector(m, x...));
}

int main() {
  size_t N;
  scanf("%zu", &N);

  auto a = make_vector(N, N, 0);
  for (auto& ai: a)
    for (auto& aij: ai)
      scanf("%d", &aij);

  constexpr intmax_t mod = 1e9+7;

  size_t M = 1 << N;
  auto dp = make_vector(M, intmax_t(0));
  dp[0] = 1;
  for (size_t i = 0; i+1 < M; ++i) {
    size_t k = __builtin_popcount(i);
    for (size_t j = 0; j < N; ++j) {
      if (!a[k][j]) continue;
      if (i >> j & 1) continue;
      size_t ni = i | (1 << j);
      (dp[ni] += dp[i]) %= mod;
    }
  }

  printf("%jd\n", dp[M-1]);
}


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

int main(void) {
    int A,B,C,X,Y;cin>>A>>B>>C>>X>>Y;
    int sonomama = A * X + B * Y;
    int oome, sukuname;
    if (X >= Y) {
        oome = C * 2 * X;
        sukuname = C * 2 * Y + A * (X - Y);
    } else {
        oome = C * 2 * Y;
        sukuname = C * 2 * X + B * (Y - X);
    }
    cout << min(sonomama, min(oome,sukuname)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  long A, B, K; cin >> A >> B >> K;

  if ( A>=K ) A -= K;
  else {
    long temp = B-( K-A );
	if ( temp < 0 ) {
      B=0;
    } else B = temp;
    A = 0;
  }
  cout << A << ' ' << B << endl;
}


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

int main() {
	int i,j,len,flag=1;
	string s;
	cin>>s;
	len=s.size();
	for(i=0;i<len-1;i++){
		for(j=i+1;j<len;j++){
			if(s[i]==s[j]) flag=0;
		}
	}
	if(flag){
		cout<<"yes"<<endl;
	}else{
		cout<<"no"<<endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define STMAX 50
int main(void)
{
  int i, slen, tlen, spos, tpos;
  char str[STMAX+1], ttr[STMAX+1];
  scanf("%s%*c", str);
  scanf("%s%*c", ttr);
  slen = strlen(str);
  tlen = strlen(ttr);
  spos = slen - 1;
  tpos = tlen - 1;
  while (spos >= 0) {
    if (str[spos] != '?') {
      while (tpos < tlen && str[spos] != ttr[tpos]) tpos++;
    }
    if (!tpos) break;
    spos--;
    tpos--;
  }
  if (spos != -1) {
    for (i = spos; i < spos + tlen; i++) str[i] = ttr[i-spos];
    for (i = 0; i < slen; i++) {
      if (str[i] == '?') str[i] = 'a';
    }
    printf("%s\n", str);
  } else printf("UNRESTORABLE\n");
}

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

int main() {
  int X, N;
  cin >> X >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  bool b = false;
  int A,B,C,D;
  int E = 1000;
  C = 1000;
  for(int i = 0; i < 102; i++) {
    b = true;
    for(int j = 0; j < N; j++) {
      if(p.at(j) == i) {
        b = false;
      }
    }
    if(b) {
      A = abs(i-X);
      if(A < E) {
        E = A;
        B = i;
      }
    }
  }
  cout << B << endl;
}


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

typedef long long int ll;
typedef long double ld;

#define Pb push_back
#define Mp make_pair

#define ff first
#define ss second

#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

const int mod = 1e9+7;
const int N = 1e5+5;

void solve()
{
	int a,b;
	cin >> a >> b;
	cout << a*b;
}

signed main()
{
  	IOS;
  	//freopen("input.txt", "rt", stdin);
  	//freopen("output.txt", "wt", stdout);
  	int t=1;
  	//cin >> t;
  	while(t--)
  	{
   	solve();
  	}
  	return 0;
}
/*==============================================================================================================================================================*/


Measured memory_bytes: 3640
program abc134d
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,cnt
    integer(int32), allocatable:: a(:)
    integer(int32), allocatable:: box(:)

    read*, n
    allocate(a(n))
    allocate(box(n),source=0)
    read*, a(:)

    do i=n,1,-1
        cnt=0
        j = i
        do while(j <= n)
            cnt=cnt+box(j)
            j=j+i
        end do
        if (mod(cnt,2) /= a(i)) box(i) = 1
    end do

    print'(i0)', sum(box)
    do i=1,n
        if (box(i) == 1) print'(i0)', i
    end do

end program abc134d

Measured memory_bytes: 2816
#include <iostream>
#include <deque>
#include <vector>

#define inf 0x3f3f3f3f

using namespace std;

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

int main(){

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

    ch--; cw--; dh--; dw--;

    vector<vector<int>> dist(h, vector<int>(w, inf));
    vector<vector<char>> maze(h, vector<char>(w));

    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            cin >> maze[i][j];
        }
    }

    deque<pair<int, int>> pending;

    pending.push_front({ch, cw});
    dist[ch][cw] = 0;

    auto isValid = [&](int i, int j){
        if (i < 0 or j < 0 or i >= h or j >= w or maze[i][j] == '#') return false;
        return true;
    };

    while(!pending.empty()){

        auto cur = pending.front(); pending.pop_front();

        for (int i=0; i<4; i++){
                int nx = cur.first + dx[i];
                int ny = cur.second + dy[i];

                if (isValid(nx, ny) and dist[nx][ny] > dist[cur.first][cur.second]){
                    pending.push_front({nx, ny});
                    dist[nx][ny] = dist[cur.first][cur.second];
                }
        }

        for (int i=cur.first-2; i<cur.first+3; i++){
            for (int j=cur.second-2; j<cur.second+3; j++){
                if (isValid(i, j) and dist[cur.first][cur.second] + 1 < dist[i][j]){
                    pending.push_back({i, j});
                    dist[i][j] = 1 + dist[cur.first][cur.second];
                }
            }
        }

    }

    if (dist[dh][dw] > 1e6) cout << -1 << endl;
    else cout << dist[dh][dw] << endl;

    return 0;
}

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

int main(void){
    int s, w;
    std::cin >> s >> w;
    std::cout << ((s <= w)? "unsafe" : "safe" ) << std::endl;

    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    // Your code here!
    string str,order;
    cin>>str;
    int n,i,l,r;
    cin>>n;

    for(i=0; i<n; i++){
        cin>>order;
        cin>>l>>r;
        
        if(order=="print"){
            cout<<str.substr(l,r-l+1)<<endl;
        }
        else if(order=="replace"){
            string word;
            cin>>word;
            str.replace(l,r-l+1,word);
        }
        else{
            string rword=str.substr(l,r-l+1);
            reverse(rword.begin(),rword.end());
            str = str.substr(0,l)+rword+str.substr(r+1,str.size()-l-1);
        }
    }
    return 0;
}




Measured memory_bytes: 3232
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100001
using namespace std;

int main() {
  ull a,b,x;
  cin >> a >> b >> x;
  ull ans =  b/x-a/x;
  if(a%x==0) ans++;
  cout << ans << endl;
  return 0;
}

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

const int MOD = 1e5;

int conv[256];
int k2b[10946], b2k[1 << 19];

int n, m;
int g[20][20];
int dp[2][10946][2];

int main()
{
	for (int i = 0; i < 4; i++){
		conv["JOI?"[i]] = i;
	}
	
	cin >> n >> m;
	int u = 1;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			char c;
			cin >> c;
			g[i][j] = conv[c];
			if (c == '?') u = (u * 3) % MOD;
		}
	}
	
	int tm = 0;
	for (int i = 0; i < (1 << (m - 1)); i++){
		bool f = true;
		for (int j = 0; j < m - 2; j++){
			if (((i >> j) & 1) & ((i >> (j + 1)) & 1)) f = false;
		}
		if (f){
			k2b[tm] = i;
			b2k[i] = tm;
			tm++;
		}
	}
	
	auto &src = dp[0];
	auto &dst = dp[1];
	int mask = (1 << (m - 1)) - 1;
	src[0][0] = 1;
	for (int i = 0; i < n * m; i++){
		memset(dst, 0, sizeof(dst));
		for (int j = 0; j < tm; j++){
			for (int k = 0; k < 2; k++){
				if (!src[j][k]) continue;
				int x = i / m, y = i % m;
				if (g[x][y] == 0 || g[x][y] == 3){
					int nj = b2k[(k2b[j] << 1) & mask];
					int nk = y < m - 1;
					dst[nj][nk] = (dst[nj][nk] + src[j][k]) % MOD;
				}
				if (g[x][y] == 1 || g[x][y] == 3){
					int nj = b2k[((k2b[j] << 1) & mask) | k];
					int nk = 0;
					dst[nj][nk] = (dst[nj][nk] + src[j][k]) % MOD;
				}
				if (g[x][y] == 2 || g[x][y] == 3){
					if (((~k2b[j]) >> (m - 2)) & 1){
						int nj = b2k[(k2b[j] << 1) & mask];
						int nk = 0;
						dst[nj][nk] = (dst[nj][nk] + src[j][k]) % MOD;
					}
				}
			}
		}
		swap(src, dst);
	}
	
	int res = 0;
	for (int i = 0; i < tm; i++){
		for (int j = 0; j < 2; j++){
			res = (res + src[i][j]) % MOD;
		}
	}

	cout << (u - res + MOD) % MOD << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;

map<ll,ll> mp;


ll dp(ll n){
  if(mp[n])return mp[n];

  if(n == 1){
    mp[n] = 1;
    return 1;
  }else{
    ll ret = 2 * dp(n/2);
    mp[n] = ret; 
    return ret;
  }
}

int main(){
  ll h;
  cin >> h;
  dp(h);
  ll ans=0;
  for(auto x : mp) {
        ans += x.second;
  }
  cout << ans << endl;
}



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

string s[104];
int dp[104][104];

int main() {
    int h, w;
    cin >> h >> w;

    for (int i = 0; i < h; i++) cin >> s[i];

    for (int i = h-1; i >= 0; i--) {
        for (int j = w-1; j >= 0; j--) {
            if (i+1 < h) {
                dp[i][j] = dp[i+1][j] + ( (s[i][j] == '.') && (s[i+1][j] == '#') );
            } else {
                if (j+1 < w) dp[i][j] = 1000;
            }
            if (j+1 < w) {
                dp[i][j] = min(dp[i][j], dp[i][j+1] + ( (s[i][j]=='.') && (s[i][j+1] == '#') ) );
            }
        }
    }

    int ans = dp[0][0] + (s[0][0] == '#');

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    if(S == "Sunny")
    {
        cout << "Cloudy" << endl;
    }
    else if(S == "Cloudy")
    {
        cout << "Rainy" << endl;
    }
    else
    {
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
def getIndex(n):
    i = 6
    if n < 165:
        i = 1
    elif n >= 165 and n < 170:
        i = 2
    elif n >= 170 and n < 175:
        i = 3
    elif n >= 175 and n < 180:
        i = 4
    elif n >= 180 and n < 185:
        i = 5
    return i

nums = [0] * 7
n = int(input())

for i in range(0,n):
    h = float(input())
    nums[getIndex(h)] += 1

for i in range(1,len(nums)):
    ans = str(i) + ":"
    for j in range(0,nums[i]):
        ans += "*"
    print(ans)


Measured memory_bytes: 5612
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
// typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;

int dp[30005][3];

int main(){
  int n; cin>>n;
  string s; cin>>s;

  int ans=0;
  rep(i,1000){
    string t;
    int x=i;
    int h=100;
    rep(j,3){
      t+=x/h+'0';
      x%=h;
      h/=10;
    }
    int ti=0;
    rep(j,s.size()){
      if(s[j]==t[ti])
      ti++;
      if(ti==3){
        ans++;
        break;
      }
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
M = len(S)
N = len(T)

dp = [[0] * (N+1) for _ in range(M+1)]

for i, s in enumerate(S):
    for j, t in enumerate(T):
        if s == t:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])

res = ""
while M > 0 and N > 0:
    if dp[M][N] == dp[M-1][N]:
        M -= 1
    elif dp[M][N] == dp[M][N-1]:
        N -= 1
    else:
        res = S[M-1] + res
        M -= 1
        N -= 1

print(res)


Measured memory_bytes: 113372
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 105;
bool cmp(string a,string b)
{
    return a+b<b+a;
}
string str[maxn];
char ss[maxn];
int main()
{
    int n,a;
    scanf("%d%d",&n,&a);
    for(int i=1;i<=n;i++)
    {
        scanf("%s",ss);
        str[i]=ss;
    }
    sort(str+1,str+1+n,cmp);
    for(int i=1;i<=n;i++) printf("%s",str[i].c_str());
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,y,z;
  cin >> x >> y >> z;
  int m,n;
  m = max(x,max(y,z));
  n = min(x,min(y,z));
  cout << n << " " << x+y+z-m-n << " " << m << endl;
}

Measured memory_bytes: 1164
N = int(input())
xyh=[]
for _ in range(N):
    xyh.append(tuple(map(int, input().split())))

def func():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H=[el[2]+abs(el[0]-Cx)+abs(el[1]-Cy) for el in xyh if el[2]!=0]
            if H[0]>=1 and len(set(H))==1:
                temp=[H[0]-abs(el[0]-Cx)-abs(el[1]-Cy) for el in xyh if el[2]==0]
                for el in temp:
                    if el>0:
                        break
                else:
                    print(Cx, Cy, H[0])
                    return None
func()


Measured memory_bytes: 43372
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;

int main(){
  ll sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  ll a=tx-sx,b=ty-sy;
  rep(i,0,a)cout<<"R";
  rep(i,0,b)cout<<"U";
  rep(i,0,a)cout<<"L";
  rep(i,0,b)cout<<"D";
  cout<<"D";
  rep(i,0,a+1)cout<<"R";
  rep(i,0,b+1)cout<<"U";
  cout<<"L"<<"U";
  rep(i,0,a+1)cout<<"L";
  rep(i,0,b+1)cout<<"D";
  cout<<"R";
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e5+5,INF = 1e18;

ll power(ll a,ll b)
{
    a = a%mod;
    ll result = 1;

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

int main() 
{ 
    BOOST

    int r,d,x[2011];
    cin>>r>>d>>x[2000];
    for(int i=2001;i<=2010;i++)
    {
        x[i] = (r*x[i-1]) - d;
        cout<<x[i]<<"\n"; 
    }
    return 0;    
} 

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

int main(void) {
	int n, m, x, y;

	std::cin >> n >> m >> x >> y;

	std::vector<int> a(n), b(m);

	int max = -1000;

	for (size_t i = 0; i < n; i++) {
		std::cin >> a[i];
		max = std::max(max, a[i]);
	}

	if (max < x) {
		max = x;
	}
	max += 1;

	int min = 1000;

	for (size_t i = 0; i < m; i++) {
		std::cin >> b[i];
		min = std::min(min, b[i]);
	}

	if (min > y) {
		min = y;
	}

	if (max <= min) {
		std::cout << "No War" << std::endl;
	}
	else {
		std::cout << "War" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	char s;

	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf(" %c",&s);
		if(s=='Y'){
			printf("Four");
			return 0;
		}
	}
	printf("Three");
	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int X = sc.nextInt();
        int Y = sc.nextInt();
        for(int x=0;x<=X;x++){
            int y = X-x;
            if(x*2+y*4==Y){

                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

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


Measured memory_bytes: 35712
#include <iostream>
#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 <climits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// 2???????????????????????????????±???????
double dot(P a, P b) {
    return (a.X * b.X + a.Y * b.Y);
}

// 2???????????????????????????????±???????
double cross(P a, P b) {
    return (a.X * b.Y - a.Y * b.X);
}

int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if( cross(b,c) > EPS ) return +1;
    if( cross(b,c) < -EPS ) return -1;
    if( dot(b,c) < 0 ) return +2;
    if( norm(b) < norm(c) ) return -2;
    return 0;
}

// ?????? a1, a2 ??¨?????? b1, b2 ???????????????
bool isec_ss(P a1, P a2, P b1, P b2) {
    return ( ccw(a1,a2,b1) * ccw(a1,a2,b2) <= 0 ) &&
           ( ccw(b1,b2,a1) * ccw(b1,b2,a2) <= 0 );
}

int main() {
    P a, b, c, d; 
    int q; cin >> q;
    rep(i,0,q) {
        cin >> a.X >> a.Y >> b.X >> b.Y >> c.X >> c.Y >> d.X >> d.Y;
        if(isec_ss(a,b,c,d)) cout << 1 << endl;
        else cout << 0 << endl;
    }
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=200005;
int n;
int a[maxn],b[maxn];
priority_queue<pii>q;
ll ans;

int main(){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	rep(i,n){
		scanf("%d",&b[i]);
		if(b[i]<a[i]){
			puts("-1");
			return 0;
		}
		if(b[i]>a[i])q.push(mp(b[i],i));
	}
	while(!q.empty()){
		int x=q.top().snd;
		q.pop();
		int tmp=b[x]-a[x],sum=b[(x+1)%n]+b[(x+n-1)%n];
		assert(tmp>0);
		if(tmp<sum){
			puts("-1");
			return 0;
		}
		ans+=tmp/sum;
		b[x]=a[x]+tmp%sum;
		if(b[x]>a[x])q.push(mp(b[x],x));
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
  int n, m;
  string s;
  cin >> n >> s;
  vector<int> e(n), w(n);
  for(int i = 0; i < n; i++) {
    if(i)
      w.at(i) = w.at(i - 1);
    if(s.at(i) == 'W')
      w.at(i)++;
  }
  for(int i = n - 1; i >= 0; i--) {
    if(i != n - 1)
      e.at(i) = e.at(i + 1);
    if(s.at(i) == 'E')
      e.at(i)++;
  }
  m = e.at(1);
  for(int i = 1; i < n - 1; i++)
    m = min(m, e.at(i + 1) + w.at(i - 1));
  m = min(m, w.at(n - 2));
  cout << m << endl;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define lp(i, a, b) for (int i=a; i<(b); i++)
#define lpd(i,a,b) for (int i = (b)-1; i >= a; i--)
	
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, cur, prev = 1e9, sum = 0, mini=1e9;
    cin>>n;

    lp(i, 0, n-1){
        cin>>cur;
        sum += min(cur, prev);
        prev = cur;
    }
    cur = 1e9;
    sum += min(cur, prev);
    cout<<sum<<endl;
 
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i+=2) {
        if (s[i] == 'h' && s[i+1] == 'i') {
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int search = 1;
			for(int i = 0 ; i < n ; i++) {
				if(sc.nextInt() == search) {
					search++;
				}
			}
			System.out.println(search == 1 ? -1 : n - (search - 1));
		}

	}

}


Measured memory_bytes: 64616