akhauriyash/Code-Regression huggingface dataset:
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
// #define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
void solve(){
	ll animal , leg ;
	cin>> animal>> leg;
	if(leg&1){
		cout<<"No"<<endl;
	}
	else{
		for(ll i=0;i<=animal;i++){
			ll a=animal-i;
			ll ans=i*2+a*4;
			if(ans==leg){
				cout<<"Yes"<<endl;
				return ;
			}
		}
		cout<<"No"<<endl;
	}
}
 
int main(){
	// mahakal(),fast;
	ll t =1 ;
	// cin>> t ;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 3668
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	private static final Pattern pattern = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			System.out.println(pattern.matcher(s).matches() ? "YES" : "NO");
		}
	}
}


Measured memory_bytes: 36792
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define rep(i, n) for(int i = 0; i < n; ++i) 
#define foreach(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it) 

#define TRACE(x...) x
#define watch(x) TRACE(cout << #x" = " << x << endl)
#define watcharr(i, x) TRACE(cout << #x" = "); rep(i, sz(x)) cout << x[i] << " "; cout << endl

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



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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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


struct Sieve {
  int n;
  vector<int> f, primes;
  //初期化、fの中にnまでの素数
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  //xが素数（fの中にある）かを判断
  bool isPrime(int x) { return f[x] == x;}
  //xを素因数分解
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  //素因数分解したものを、)vector<P> (値、数)にする
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  Sieve sv(1000001);
  map<int,int> mp;
  rep(i,n){
    auto fac=sv.factor(a[i]);
    for(auto f1:fac){
      mp[f1.first]=max(mp[f1.first],f1.second);
    }
  }
  mint ans=0;
  mint lcm=1;
  for(auto f2:mp){
    rep(i,f2.second){
      lcm*=f2.first;
    }
  }

  rep(i,n){
    mint b=lcm/a[i];
    ans+=b;
  }
  cout<<ans.x;



}


Measured memory_bytes: 4988
N, M = map(int, input().split())
height_list = list(map(int, input().split()))
node_dict ={}

for i in range(M):
    A, B = map(int, input().split())
    if A in node_dict.keys():
        node_dict[A].append(B)
    else:
        node_dict[A] = []
        node_dict[A].append(B)
    
    if B in node_dict.keys():
        node_dict[B].append(A)
    else:
        node_dict[B] = []
        node_dict[B].append(A)

good_tower_with_node = 0
for i in node_dict.keys():
    for j in node_dict[i]:
        if height_list[i-1] <= height_list[j-1]:
            break
    else:
        good_tower_with_node += 1
        
print(good_tower_with_node + N -len(node_dict.keys()))

Measured memory_bytes: 31404
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> fst;

const int N=3e3+7;
double dp[N][N],ar[N],ans=0;
int n;

void solve()
{
    cin>>n;
	fin(ar,1,n+1);
	dp[0][0]=1;
	for(int i=1;i<=n;i++) dp[0][i]=(1-ar[i])*dp[0][i-1];
	for (int i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			dp[j][i]=dp[j][i-1]*(1-ar[i])+dp[j-1][i-1]*(ar[i]);
		}
	}
	for (int i=n/2+1;i<=n;i++) ans+=dp[i][n];
	cout<<setprecision(10)<<ans<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  i64 n, x;
  cin >> n >> x;
  cout << 3 * (n - __gcd(n, x)) << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

vector<int> make_primes(int N)
{
	vector<int> p(N + 1);
	iota(p.begin(), p.end(), 0);
	p[0] = 0;
	p[1] = 0;
	for (int i = 2; i * i <= N; ++i) {
		for (int j = i * i; j <= N; j += i) {
			p[j] = 0;
		}
	}
	p.erase(remove(p.begin(), p.end(), 0), p.end());
	return p;
}

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

	auto p = make_primes(55555);

	vector<int> ans;

	for (auto x : p) {
		if (x % 10 == 1) {
			ans.push_back(x);
			if (ans.size() == N) {
				break;
			}
		}
	}
	cout << ans[0];
	for (int i = 1; i < N; ++i) {
		cout << " " << ans[i];
	}
	cout << endl;
}


Measured memory_bytes: 512
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 100000
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

n = k()
a = l()

ruiseki = list(itertools.accumulate(a))

for i in range(n-1):
    ans += a[i]*(ruiseki[-1]-ruiseki[i])

print(ans % mod)

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

int n, stones[100001], sum;
int main(){
    while(cin >> n && n){
        for(int i = 1; i <= n; i++){
            cin >> stones[i];
            if(i % 2 == 0 && stones[i] != stones[i - 1]){
                for(int j = i - 1; j > 0; j--){
                    if(stones[j] != stones[i]){
                        stones[j] = stones[i];
                    } else{
                        break;
                    }
                }
            }
        }

        sum = 0;
        for(int i = 1; i <= n; i++){
            if(!stones[i]){
                sum++;
            }
        }

        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 1548
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

A, B, X = map(int, input().split())

for a in range(B+1):
    if A+a == X:
        print('YES')
        exit()
else:
    print('NO')


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


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> cnt((int)1e5 + 5);
    int64_t s = 0;
    for (int & x : a) {
        cin >> x;
        s += x;
        cnt[x]++;
    }
    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        s -= (int64_t) cnt[b] * b;
        cnt[c] += cnt[b];
        s += (int64_t) cnt[b] * c;
        cout << s << "\n";
        cnt[b] = 0;
    }
    return 0;
}



Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
typedef queue<int> qi;
typedef stack<int> sti;
typedef priority_queue<int> pqi;
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
#define maxn 100005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;
bool check(int x, vi& a, int k) {
    int cnt = 0;
    fori(i,0,a.size()) {
        if(a[i] <= x) continue;
        cnt += (a[i] + x - 1) / x - 1;
    }
    return cnt <= k;
}
void solve() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    fori(i,0,n) cin >> a[i];
    sort(all(a));
    int low = 0, high = a.back();
    while(low + 1 < high) {
        int mid = (low + high) >> 1;
        if(check(mid,a,k)) high = mid;
        else low = mid;
    }
    cout << high;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
   
    solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


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

int main(){
  string s;
  cin >> s;
  if (s[0]==s[1] && s[2]==s[3]){
    if(s[0]!=s[2]) cout << "Yes" << endl;
    else goto e;}
  else if (s[0]==s[2] && s[1]==s[3]){
    if(s[0]!=s[1]) cout << "Yes" << endl;
    else goto e;}
  else if (s[0]==s[3] && s[2]==s[1]){
    if(s[0]!=s[2]) cout << "Yes" << endl;
    else goto e;}
  else e: cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,x2,x1=0;
    cin>>n;
    string s;
    cin>>s;
    char ch;
    x2=x1;
    for(int i=0;i<n;i++){
        ch=s[i];
        if(ch=='I')
            x2+=1;
        else
            x2-=1;
        if(x2>x1){
            x=x2;
            x1=x2;
        }
        else
            x=x1;
    }
    printf("%d",x);
    return 0;
}


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

int main() {
    while (true) {
        int H, W;
        cin >> H >> W;
        if (H == 0 && W == 0) {
            break;
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
#define N 2000001
void CountingSort(int);

int n, A[N], B[N];



int main(void){
  int i, k=0;
  scanf("%d", &n);
  for(i=1; i <= n; i++){
    scanf("%d", &A[i]);
    if(A[i] > k) k = A[i];
}
  CountingSort(k);
  for(i=1; i <= n; i++){
 printf("%d", B[i]);
 if(i < n)printf(" ");
  }
  printf("\n");
  return 0;
}


void CountingSort(int k){
  int i, j, C[N];
  for(i = 0; i <= k; i++) C[i]=0;
  for(j = 1; j <= n; j++) C[A[j]]++;
  for(i = 1; i <= k; i++) C[i] = C[i] + C[i-1];
  for(j = n; j >=0; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}

Measured memory_bytes: 16272
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template

def main():
    n = ii()
    l = []
    r = []
    for i in range(n):
        a, b = mi()
        l.append(2 * a)
        r.append(2 * b)
    # print(l)
    l.sort()
    r.sort()
    if n % 2 == 0:
        ll = (l[n // 2] + l[n // 2 - 1]) // 2
        rr = (r[n // 2] + r[n // 2 - 1]) // 2
    else:
        ll = l[n // 2]
        rr = r[n // 2]
    # print(ll, rr)
    if n % 2 == 0:
        print(rr - ll + 1)
    else:
        print(rr // 2 - ll // 2 + 1)
    return

if __name__ == "__main__":
    main()


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


using namespace std;

typedef long long int ll;


int ans = 0;

ll sum(ll n){
	return  n * (n + 1) / 2;
}
void fact(ll n){
	
	for(ll i = 2; i * i <= n; i++){
		int cnt = 0;
		while(n % i == 0){
			n /= i;
			++cnt;
		}
		int mx = (sqrt(1 + 8 * cnt) - 1.0) / 2;
		int best = -1;
		for(int j = max(0,mx - 5); j < mx + 5; j++){
			if(sum(j) <= cnt){
				best = max(best,j);
			}
		}
		ans+=best;
	}
	if(n!=1) ans++;
	
}


int main(){
	ll n;
	cin >> n;
	fact(n);
	cout << ans; 
	return 0;
}


Measured memory_bytes: 3660
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

Tuple!(N, N)[] prime_division(N)(N n)
{
    Tuple!(N, N)[] res;
    foreach (N i; 2..10^^6+1) {
        if (n%i == 0) {
            N cnt;
            while (n%i == 0) {
                ++cnt;
                n /= i;
            }
            res ~= tuple(i, cnt);
        }
    }
    if (n != cast(N)1) res ~= tuple(n, cast(N)1);
    return res;
}

void main()
{
    auto N = readln.chomp.to!long;
    auto ps = prime_division(N);
    int r;
    foreach (p; ps) {
        auto k = p[1];
        foreach (i; 1..40) {
            if (k < i) break;
            ++r;
            k -= i;
        }
    }
    writeln(r);
}

Measured memory_bytes: 2716
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <climits>

using namespace std;

long long MOD = 1000000007;

int main(){
	long long n, i, ans=1;
	cin>>n;
	for(i = 2; i<=n; i++){
		ans = (ans*i)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 110;

int n, a[N], best = (int)1e9;

int main()
{
    init_ios();
    cin >> n;
    for (int i = 1; i <= n; ++i)
    	cin >> a[i];
    for (int i = -100; i <= 100; ++i) {
    	int tmp = 0;
    	for (int j = 1; j <= n; ++j)
    		tmp += (a[j]-i)*(a[j]-i);
    	best = min(best, tmp);
    }
    cout<<best<<"\n";
}

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

int main(){
	int k, n;
  	cin >> k >> n;
  	vector<int> A(n);
  	rep(i, n) cin >> A[i];

  	int maxi = 0;
  	int index;
  	rep(i, n){
		if(maxi < A[i + 1] - A[i]){
        	maxi = A[i + 1] - A[i];
        }
    }
  	if(maxi < (k - A[n - 1]) + A[0]){
    	maxi = (k - A[n - 1]) + A[0];
    }	
  
	cout << k - maxi << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define min(a,b) ((a>b)? b:a)
int main()
{
  string S;
  cin>>S;
  int ans=1000;
  for(int i=0;i<S.size()-2;i++){
    ans=min(ans,abs(753-stoi(S.substr(i,3))));
  }
  cout<<ans;
}

    

Measured memory_bytes: 256
from collections import defaultdict


def main():
    a = input()
    z = defaultdict(int)

    for c in a:
        z[c] += 1

    n = len(a)

    no_count = 0
    for k, v in z.items():
        no_count += v * (v - 1) // 2

    print(n * (n - 1) // 2 + 1 - no_count)


if __name__ == "__main__":
    main()





Measured memory_bytes: 40816
import java.util.*; 
import java.lang.*; 

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
                int M = scan.nextInt();
                int[] A = new int[M+1];
                int ans = -1;
                
                int hw = 0;
                
                for(int i=1; i<=M; i++){
                    A[i] = scan.nextInt();
                    hw = hw + A[i];
                }
                
                if(N<hw){
                    System.out.println(ans);
                }
                else{
                    System.out.println(N-hw);
                }
	}
}

Measured memory_bytes: 46092
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

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

    while(true) {
        int H = N / 100;
        int T = (N % 100) / 10;
        int D = (N % 100) % 10;
        if(H == T && T == D) break;
        N++;
    }

    cout << N << endl;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, K; cin >> N >> K;
	if (K == 1) {
		cout << 0 << endl;
	}
	else {
		cout << N - K << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <utility>
#include <queue>
#define ull unsigned long long
#define ll long long
#define mod 1000000007
using namespace std;



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

    char a[h][w];
    int dp[h][w];

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

    dp[0][0] = 1;
    for (int i=1;i<h;i++)
        if ( a[i][0] != '#' )
            dp[i][0] = dp[i-1][0];
        else break;

    for (int i=1;i<h;i++)
        if ( a[0][i] != '#' )
            dp[0][i] = dp[0][i-1];
        else break;

    for (int i=1;i<h;i++){
        for (int j=1;j<w;j++){
            if ( a[i][j] != '#' )
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
        }
    }

    cout<<dp[h-1][w-1];
    return 0;
}


Measured memory_bytes: 5120
#include<stdio.h>
#include <string.h>
#define rep(i, n) for (int i = 0; i <n; i++)


int main(){
  int a, b;
  scanf("%d %d", &a, &b);
 

 if(a < b )
    rep(i,b){
      printf( "%d", a);
    }
  else
  {
    rep(i,a){
      printf( "%d", b);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
n = int(input())
h = list(map(int, input().split()))

ans = 0
max = 0

for i in range(n):
  if i == 0:
    pass
  else:
    if h[i-1] >= h[i]:
      max += 1
    elif h[i-1] < h[i]:
      if ans < max:
        ans = max
      max = 0

if ans < max:
  ans = max

print(ans)


Measured memory_bytes: 14224
#include <cstdio>
#include <algorithm>
using namespace std;

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

int main() {
    int n;
    scanf("%d", &n);
    
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    
    int count = bubbleSort(a, n);
    for (int i = 0; i < n; i++) {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n%d\n", count);
    return 0;
}


Measured memory_bytes: 2668
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <stdio.h>
#include <math.h>
#include <utility>
#include <algorithm>
#include <sstream>

using namespace std;

void rec_all_pattern_with_a_b(int i, 
	int &cnt, 
	std::vector<bool> cur,
	std::vector<vector<int>> sm,
	vector<int> p
	)
{
	if (cur.size() == i) {
		for (int j = 0; j < sm.size(); j++) {
			int a = 0;
			for (int k = 0; k < sm[j].size(); k++) {
				if (cur[sm[j][k]]) {
					a++;
				}
			}
			if (a % 2 == p[j]) {
				//ok
			}
			else {
				return;
			}
		}
		cnt++;
		return;
	}
	cur[i] = true;
	rec_all_pattern_with_a_b(i + 1, cnt, cur, sm, p);
	cur[i] = false;
	rec_all_pattern_with_a_b(i + 1, cnt, cur, sm, p);
	return;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> sm(m);
	vector<int> p(m);
	for (int i = 0; i < m; i++) {
		int k;
		cin >> k;
		sm[i].resize(k);
		for (int j = 0; j < k; j++) {
			int a;
			cin >> a;
			sm[i][j] = a-1;
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}

	vector<bool> cur(n);
	int cnt = 0;
	rec_all_pattern_with_a_b(0, cnt, cur, sm, p);
	cout << cnt;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 500000
#define INFTY 1000000000

int count = 0;
int A[N];

void merge(int A[], int left, int mid, int right){
  int i,j,k;
  int n1,n2;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1],R[n2];

  for(i = 0; i < n1; i++){
    L[i] = A[left + i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left; k < right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      count++;
    }
    else{
      A[k] = R[j];
      j = j + 1;
      count++;
    }
  }
}

void mergeSort(int A[], int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n,i;
  int left,right;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  
  left = 0;
  right = n;
  mergeSort(A,left,right);

  for(i = 0; i < n; i++){
    if(i == n - 1) printf("%d\n",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 5600
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

char in[5];
int main() {
	scanf("%s", in);
	int s = 0;
	for (int i = 0; i < 3; i++) s += in[i] - '0';
	return !printf("%d\n", s);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    rep(i, 0, n-1){
        if(s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        if(i + 2 < n && s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;    
    return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;

const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax]){
    bool all_visited=true;

    for(int i=0;i<N;i++){
        if(visited[i]==false)
            all_visited=false;
    }

    if (all_visited){
        return 1;
    }
    
    int ret=0;
    for(int i=0;i<N;++i){
        if(graph[v][i]==false) continue;
        if(visited[i]) continue;

        visited[i]=true;
        ret+=dfs(i,N,visited);
        visited[i]=false;
    }
    return ret;
}

int main(){
    ll c=0,d=0,k=0,n,m,h,w,p,q,ans=0;
    string s,s1,s2;
    cin >> n >> m;
    for(int i=0;i<m;++i){
        int A,B;
        cin >> A >> B;
        graph[A-1][B-1]=graph[B-1][A-1]=true;
    }

    bool visited[nmax];
    for(int i=0;i<n;++i){
        visited[i]=false;
    }

    visited[0]=true;
    cout << dfs(0,n,visited) << endl;
    return 0;
}

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

using namespace std;

int n;
struct Block{
    int w, s, v;

    bool operator < (Block o) const {
        return s + w < o.s + o.w;
    }
};

long long dp[20010];
const long long INF = 1e18;
vector<Block> p;

int main(){
    scanf("%d", &n);

    p.resize(n);

    for(int i = 0; i < n; i++){
        scanf("%d%d%d", &p[i].w, &p[i].s, &p[i].v);
    }

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

    for(int i = 1; i <= 20000; i++) dp[i] = -INF;

    for(auto k : p){
        int s, w, v;
        s = k.s, w = k.w, v = k.v;

        for(int i = s; i >= 0; i--) dp[i + w] = max(dp[i + w], dp[i] + v);
    }

    long long ans = 0;
    for(int i = 0; i <= 20000; i++) ans = max(ans, dp[i]);

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

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	long n = sc.nextLong();
    	long cnt = 1;
    	long t = sc.nextLong();
    	for(int i = 1; i < n; i++){
    		long m = sc.nextLong();
    	    if(t > m){
    	    	cnt++;
    	    	t = m;
    	    }
    	}
    	System.out.println(cnt);
    	sc.close();
    }
}

Measured memory_bytes: 63320
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;
//abc179

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=0;
    for(ll a=1;a<=n;a++){
        for(ll b=1;a*b<=n;b++){
            if(n-a*b>0) ans++;
        }
    }
    out(ans);
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

Measured memory_bytes: 3632
n, y = list(map(int, input().split(' ')))
if y % 1000 != 0:
    print('-1 -1 -1')
    exit()
for ten_th in range(min(n, int(y / 10000)), -1, -1):
    if y < ten_th * 10000 or n < ten_th:
        continue
    for five_th in range(min(n - ten_th, int((y - ten_th * 10000) / 5000)), -1, -1):
        if y < ten_th * 10000 + five_th * 5000 or n < ten_th + five_th:
            continue
        if (y - ten_th * 10000 - five_th * 5000) % 1000 == 0:
            th = int((y - ten_th * 10000 - five_th * 5000) / 1000)
            if n == ten_th + five_th + th:
                print('{} {} {}'.format(ten_th, five_th, th))
                exit()
print('-1 -1 -1')

Measured memory_bytes: 3188
using System;
using System.Linq;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var lines = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
            var n = lines[0];
            var x = lines[1];
            var t = lines[2];

            var count = n / x;

            if (n % x != 0)
            {
                ++count;
            }
            Console.WriteLine(count * t);
        }
    }
}

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

int main(void){
    string O,E;cin>>O>>E;
    string ans;
    for(int i=0;i<O.size()+E.size();i++){
        if(i%2==0){
            ans+=O[i/2];
        }
        else{
            ans+=E[i/2];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  int a=0;
  
  for(int i=0;i<n;i++){
    int b;
    cin >> b;
    if(b>=k)
      a++;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define SQ(x) ((x) * (x))
#define EPS 1e-5
typedef struct {
    double x;
    double y;
} POINT;

int dist(POINT a, POINT b, double d)
{
    if (sqrt(SQ(a.x - b.x) + SQ(a.y - b.y)) - d > EPS){
        return (0);
    }
    return (1);
}

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

int main(void)
{
    POINT seal[100], v;
    static POINT l[300000];
    int s;
    double a, a0, d, t;
    int n;
    int count, ans;
    int i, j, k;
    
    while (1){
        scanf("%d", &n);
        
        if (!n){
            break;
        }
        
        for (i = 0; i < n; i++){
            scanf("%lf%*c%lf", &seal[i].x, &seal[i].y);
        }
        
        s = 0;
        
        for (i = 0; i < n; i++){
            for (j = 0; j < n; j++){
                if (dist(seal[i], seal[j], 2) && i != j){
                    d = sqrt(SQ(seal[i].x - seal[j].x) + SQ(seal[i].y - seal[j].y));
                    a = atan2(seal[j].y - seal[i].y, seal[j].x - seal[i].x);
                    a0 = acos(0.5 * d);
                    
                    l[s].x = seal[i].x + cos(a0 + a);
                    l[s].y = seal[i].y + sin(a0 + a);
                    s++;
                    l[s].x = seal[i].x + cos(a0 - a);
                    l[s].y = seal[i].y + sin(a0 - a);
                    s++;
                }
            }
        }
                    
        ans = 1;
        for (i = 0; i < s; i++){
            count = 0;
            for (j = 0; j < n; j++){
                if (dist(seal[j], l[i], 1)){
                    count++;
                }
            }
            ans = max(ans, count);
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <iostream>

int main(void)
{
    std::string T;
    std::cin >> T;
    if (!( 2 <= T.length() && T.length() <= 100000))
    {
        std::cout << "-1 -1" << std::endl;
        return 0;
    }

    for (auto itr = T.begin(); itr != T.end(); ++itr)
    {
        if (*itr == *std::next(itr, 1))
        {
            std::cout << (std::distance(T.begin(), itr) + 1) << " " << (std::distance(T.begin(), std::next(itr, 1)) + 1) << std::endl;
            return 0;
        }
        else if (*itr == *std::next(itr, 2))
        {
            std::cout << (std::distance(T.begin(), itr) + 1) << " " << (std::distance(T.begin(), std::next(itr, 2)) + 1) << std::endl;
            return 0;
        }
    }
    std::cout << "-1 -1" << std::endl;
    return 0;
}

Measured memory_bytes: 512
def prime(n):
  if n <= 1:
    return False
  for i in range(2, int(n**0.5)+1):
    if n % i == 0:
      return False
  return True
def digit(n):
  return len(str(n))
def F(a, b):
  return max(digit(a), digit(b))
r = N = int(input())
breakpoint = 0
if prime(N):
  print(digit(N))
else:
  for i in range(1, N+1):
    if i == breakpoint or i > N**0.5:
      break
    if N % i == 0:
      r = min(r, F(i, int(N/i)))
      breakpoint = i
  print(r)

Measured memory_bytes: 39664
#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define MAX 200010
#define pb push_back 
using namespace std;

vector<int> v[MAX],ans(MAX);
queue <int> vb,vw;

void dfs(int w,int u,int d){
	if(d%2) vw.push(w);
	else vb.push(w);
	rep(i,0,(int)v[w].size()){
		int to=v[w][i];
        // to avoid return
		if(to!=u) dfs(to,w,d+1);
	}
}

int main(){
	int n;
	cin>>n;
	rep(i,0,n-1){
		int a,b;
		cin>>a>>b;
        a--,b--;
		v[a].pb(b);
		v[b].pb(a);
	}
	dfs(0,-1,0);
    
	if(vb.size()<vw.size()) swap(vb,vw);
	rep(i,1,n+1){
		if(i%3==1){
			int u=vb.front();vb.pop();
			ans[u]=i;
		}
	}
    
	if(vb.size()<vw.size()) swap(vb,vw);
	rep(i,1,n+1){
		if(i%3==2){
			int u=vb.front();vb.pop();
			ans[u]=i;  
		}
	}
    
	rep(i,1,n+1){
		if(i%3==0){
			int u;
			if(!vb.empty()){u=vb.front();vb.pop();}
			else {u=vw.front();vw.pop();}
			ans[u]=i;
		}
	}
	rep(i,0,n) cout<<ans[i]<<" ";
    puts("");
}


Measured memory_bytes: 21632
N,M,Q = map(int,input().split(" "))
rule_list = []
for i in range(Q):
        rule_list.append(list(map(int,input().split(" "))))
basic_list = [0]*N
pattern_list = [basic_list]
def mklist(temp,temp2):
    global pattern_list
    global basic_list
    if temp>0:
        for j in range(temp2,N):
            basic_list[j] +=1
            pattern_list.append([*basic_list])
            mklist(temp-1,j)
            basic_list[j] -=1

temp = M-1
mklist(temp,0)
max_d = 0
for i in pattern_list:
    sum_d = 0
    for j in rule_list:
        a = j[0]
        b = j[1]
        c = j[2]
        d = j[3]
        dis = 0
        for k in range(a-1,b-1):
            dis += i[k]
        if dis == c:
            sum_d += d
    max_d = max(max_d,sum_d)
print(max_d)


Measured memory_bytes: 91184
#include<stdio.h>
int main()
{
   int A,B,C,D;
   scanf("%d%d%d",&A,&B,&C);
   if(C>A-B)
   {
       D=C-A+B;
       printf("%d",D);
   }
  else
   {
      printf("0");
   }
   return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  double A;
  double ans=0.0;
  for(int i=0;i<N;i++){
    cin>>A;
    ans+=1.0/A;}
  ans=1/ans;
  cout<<fixed<<setprecision(7)<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){

    int r , g , b , n;
    cin >> r >> g >> b;
    
    n = 100 * r + 10 * g + b;
    
    if(n % 4 != 0){
        cout << "NO";
    }
    
    else
        cout << " YES";

}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;



void solve()
{	

	int x,y;
	cin>>x>>y;

	for(int i=0;i<=x;i++)
	{
		for(int j=0;j<=x-i;j++)
		{
			if(i*2+j*4==y and i+j==x)
			{
				cout<<"Yes\n";
				rr;
			}
		}
	}

	cout<<"No\n";

}	

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;



	int t=1;
	// cin>>t;
	
	for(int i=1;i<=t;i++)
	{
		// cout<<"Case "<<i<<" : "<<endl;
		solve();
	}
	
	#ifndef ONLINE_JUDGE	
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC098A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var dirs = Console.ReadLine();

            // 先頭からある人までの間で東を向いている人数
            var east = new int[n];
            foreach (var i in Enumerable.Range(1, dirs.Length - 1))
            {
                east[i] = east[i - 1] + ((dirs[i - 1] == 'W') ? 1 : 0);
            }

            // 末尾からある人までの間で西を向いている人数
            var west = new int[n];
            // リーダとした場合に、動かなければいけない人数
            var total = new int[n];
            foreach (var i in Enumerable.Range(0, dirs.Length - 1).Reverse())
            {
                west[i] = west[i + 1] + ((dirs[i + 1] == 'E') ? 1 : 0);
                total[i] = east[i] + west[i];
            }
            total[dirs.Length - 1] = east.LastOrDefault() + west.LastOrDefault();

            //Console.WriteLine(string.Join(",", east));
            //Console.WriteLine(string.Join(",", west));
            //Console.WriteLine(string.Join(",", total));

            Console.WriteLine(total.Min());
        }
    }
}


Measured memory_bytes: 19040
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;

void sputs(){}
template <class Head, class... Tail>
void sputs(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) == 0) { cout << endl; }
  else { cout << " "; }
  sputs(std::move(tail)...);
}

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  // vector<string> ans = {"M", "F", "M", "F", "M", "Vacant", "F"};
  int n;
  cin>>n;
  // n = 7;
  int l = 0;
  int r = n-1;

  cout << 0 << endl;
  fflush(stdout);
  string z;
  cin>>z;
  // z = ans[0];
  if (z=="Vacant") return 0;

  int cnt = 0;
  while(r-l>1){
    assert(l<=r);
    assert(r>=0);
    assert(l>=0);
    
    int mid = (l+r)/2;
    cout << mid << endl;
    fflush(stdout);
    string res;
    cin>>res;
    // res = ans[mid];
    dump(l, r, mid, z, res);
    if (res=="Vacant") return 0;

    if (z==res && (mid-l)%2==0){
      l = mid; 
    }
    else if (z!=res && (mid-l)%2!=0){
      l = mid; 
      z = res;
    }
    else{ r = mid; }
    cnt++;
    if (cnt>30) return 0;
  }
  cout << r << endl;
  fflush(stdout);
  string tmp;cin>>tmp;
  assert(tmp=="Vacant");
  
  return 0;
}


Measured memory_bytes: 852
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define cost first
#define from second.first
#define to second.second
#define MOD (1000000007ll)
#define l_ength size

ll p[123456],q[123456];

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll inv(ll x){
	ll a = MOD-2,ans=1ll;
	while(a > 0){
		if((a&1)>0){
			mul_mod(ans,x);
		}
		a /= 2;
		mul_mod(x,x);
	}
	return ans;
}

ll comb(int x, int y){
	ll ans=1ll;
	if(x <= 0 || y < 0 || (x-y) < 0){
		return 0ll;
	}
	mul_mod(ans,p[x]);
	mul_mod(ans,q[y]);
	mul_mod(ans,q[x-y]);
	return ans;
}


int main(void){
	int n,i,x,y,z,w[123456],a;
	ll ans;
	fill(w,w+123456,-1);
	p[0] = 1ll;
	q[0] = 1ll;
	for(i=1; i<123456; ++i){
		p[i] = (ll)i;
		mul_mod(p[i],p[i-1]);
		q[i] = inv((ll)i);
		mul_mod(q[i],q[i-1]);
	}
	cin >> n;
	for(i=0; i<=n; ++i){
		cin >> a;
		if(w[a]<0){
			w[a] = i;
		}else{
			x = w[a];
			y = i;
		}
	}
	z = (n-y);
	y -= (x+1);
	for(i=0; i<=n; ++i){
		ans = 0ll;
		if(i == 0){
			add_mod(ans,ll(n));
		}else if(i == 1){
			add_mod(ans,comb(n-1,2));
			add_mod(ans,(ll)(n-1));
			add_mod(ans,(ll)y);
			add_mod(ans,1ll);
		}else{
			add_mod(ans,comb(n+1,i+1));
			add_mod(ans,-comb(x+z,i));
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3584
s = input()
t = input()

dic = dict()

for i in range(len(s)):
    w = s[i]
    if not w in dic:
        dic[w] = [i]
    else:
        dic[w].append(i)

ans = 0
last = 0

import bisect
for i in range(len(t)):
    w = t[i]
    if not w in dic:
        print(-1)
        exit()
    index = bisect.bisect_left(dic[w], last)
    
    if index < len(dic[w]):
        num = dic[w][index]
        ans -= last
        ans += num + 1
        last = num + 1
    else:
        ans -= last
        ans += len(s)
        ans += dic[w][0] + 1
        last = dic[w][0] + 1

print(ans)




Measured memory_bytes: 45808