akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;
#define mpr make_pair

void solve(){
    int n; cin>>n;
    vl a(n);
    lint xand = 0;
    for (int i=0; i<n; ++i){
        cin>>a[i];
        xand ^= a[i];
    }
    if (xand == 0) {
        cout<<"DRAW\n"; return;
    }
    int bit = 33;
    for (bit=33; bit>=0; bit--){
        if (xand & (1LL<<bit)) break;
    }
    int cnt = 0;
    for (lint v : a)
        if (v & (1LL<<bit))
            cnt++;
    assert(cnt%2);
    int k = cnt/2;

    if (k % 2 == 0) cout<<"WIN\n";
    else
    {
        if ((n- cnt)%2==0 ) cout<<"LOSE\n";
        else cout<<"WIN\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);    cin.tie(NULL);    cout.tie(NULL);

    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int cnt = 0;
    while(b<=a){
        cnt++;
        b *= 2;
    }
    while(c<=b){
        cnt++;
        c*=2;
    }
    if (cnt <= k) cout<<"Yes";
    else cout<<"No";

}


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

using namespace std;

int main()
{
    string s;
    char c;
    cin >> s;
    int n, a, I;
    n = s.length();
    int D[n+1], P[n+1], K[n+1], N[26][n+1];
    D[0] = 0;
    for (int i = 0; i < 26; i++)
    {
        N[i][n] = n;
        N[i][n-1] = n;
    }
    for (int i = n-2; i >= 0; i--)
    {
        for (int y = 0; y < 26; y++)
        {
            N[y][i] = N[y][i+1];
        }
        a = s[i+1] - 'a';
        N[a][i] = i+1;
    }
    D[n] = 0;
    for (int i = n-1; i >= 0; i--)
    {
        D[i] = 1000000;
        for (int y = 0; y < 26; y++)
        {
            if (D[N[y][i]] + 1 < D[i])
            {
                D[i] = D[N[y][i]] + 1;
                P[i] = N[y][i];
                K[i] = y;
            }
        }
    }
    int M = 1000000;
    a = s[0] - 'a';
    N[a][0] = 1;
    for (int y = 0; y < 26; y++)
    {
        if (D[N[y][0]] + 1 < M)
        {
            M = D[N[y][0]] + 1;
            c = 'a' + y;
            I = N[y][0];
        }
    }
    string r="";
    r += c;
    while (I != n)
    {
        c = K[I] + 'a';
        r += c;
        I = P[I];
    }
    cout << r;
    return 0;
}


Measured memory_bytes: 23172
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int v[n+1],c[n+1];
	for(int i=1;i<=n;i++)
		scanf("%d",&v[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&c[i]);
	if(n==1){
		printf("0\n");
		return 0;
	}
	int b[n+1];
	for(int i=0;i<=n;i++)
		b[i]=0;
	int maxv=0;
	while(b[0]==0){
		int j=n;
		while(b[j]==1){
			b[j]=0;
			j--;
		}
		b[j]++;
//		for(int i=1;i<=n;i++)
//			cout<<b[i];
//		cout<<endl;
		int x=0,y=0;
		for(int i=1;i<=n;i++){
			if(b[i]){
				x+=v[i];
				y+=c[i];
			}
		}
		if(x-y>maxv)
			maxv=x-y;
	}
	printf("%d\n",maxv);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  ll n;
  cin>>n;

  if(n%2==0){
    cout << -1 << endl;
    return 0;
  }

  ll cnt=1;
  ll now=7;
  ll ju=10;
  now%=n;
  ju%=n;
  rep(i,10000000){
    if(now==0) {
      cout << cnt << endl;
      return 0;
    }
    now+=7*ju;
    ju*=10;
    now%=n;
    ju%=n;
    cnt++;
  }

  cout << -1 << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

ll pow_mod(ll a, ll d, ll p){
    if(d == 0) return 1;
    if(d % 2){
        return a * pow_mod(a, d - 1, p) % p;
    }
    return pow_mod(a * a % p, d / 2, p);
}

int main(){
    string s;
    cin >> s;
    ll la = 0;
    ll lp = 0;
    ll rc = 0;
    ll rp = 0;

    rep(i, s.size()){
        if(s[i] == 'C'){
            rc ++;
        }
        if(s[i] == '?'){
            rp ++;
        }
    }

    ll ans = 0;
    ll p = 1e9 + 7;

    rep(i, s.size()){
        if(s[i] == '?'){
            rp --;

        }
        if(s[i] == 'B' || s[i] == '?'){
            ll left = pow_mod(3, lp, p) * la % p;
            if(lp >= 1){
                left += pow_mod(3, lp - 1, p) * lp % p;
            }
            ll right = pow_mod(3, rp, p) * rc % p;
            if(rp >= 1){
                right += pow_mod(3, rp - 1, p) * rp % p;
            }
            ll tmp = left * right % p;
            ans = (ans + tmp) % p;
        }
        if(s[i] == 'A'){
            la ++;
        }
        if(s[i] == 'C'){
            rc --;
        }
        if(s[i] == '?'){
            lp ++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
// Bubble sort
 void BubbleSort(vector<string> &a, int n){
  for(int j=n;j>=1;j--){
    for(int i=1;i<j;i++){
      if(a.at(i-1).at(1)>a.at(i).at(1)){
        string wk = a.at(i-1);
        a.at(i-1)=a.at(i);
        a.at(i)=wk;
      }
    }
  }
 }

// Selection sort
void SelectionSort(vector<string> &a, int n){
  for(int i=0;i<n;i++){
    int min_j=i;
    for(int j=i;j<n;j++){
      if(a.at(j).at(1)<a.at(min_j).at(1))
        min_j=j;
    }
    if(a.at(i).at(1)>a.at(min_j).at(1)){
      string wk=a.at(i);
      a.at(i)=a.at(min_j);
      a.at(min_j)=wk;
    }
  }
}

// display vector 
void DisplayVector(vector<string> &a, int n){
  for(int i=0;i<n;i++){
    if(i<n-1)
      cout<<a.at(i)<<' ';
    else
      cout<<a.at(i)<<endl;
  }
}

bool isStable(vector<string> &in, vector<string> &out, int n){
  bool flg=true;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int a=0;a<n;a++){
        for(int b=a+1;b<n;b++){
          if(in.at(i).at(1)==in.at(j).at(1) && in.at(i)==out.at(b) && in.at(j)==out.at(a))
            flg=false;
        }
      }
    }
  }
  return flg;
}


int main() {
 

  // input vector size
  int n;
  cin>>n;

  // input vector data
  vector<string> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  vector<string> a1=a;
  vector<string> a2=a1;

  // bubble sort
  BubbleSort(a1,n);
  // output sorted vector
  DisplayVector(a1,n);
  // check sort stable?
  if(isStable(a,a1,n))
    cout<<"Stable"<<endl;
  else
    cout<<"Not stable"<<endl;

  // selection sort
  SelectionSort(a2,n);
  // output sorted vector
  DisplayVector(a2,n);
  // check sort stable?
  if(isStable(a,a2,n))
    cout<<"Stable"<<endl;
  else
    cout<<"Not stable"<<endl;

	return 0;
}


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

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

    if( s[0] != 'A' || s[1] == 'C' || *s.rbegin() == 'C' )
        return cout << "WA" << endl, 0;

    int c = false;
    for( int i = 1; i < s.size(); i++ ){
        if( s[i] == 'C' ) c++;
        else if( s[i] < 'a' ) return cout << "WA" << endl, 0;
    }
    cout << (c == 1 ? "AC" : "WA") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n, k; cin >> n >> k;
	vi v(n); rep(i, 0, n) cin >> v[i];
	ll lo = *max_element(all(v)) - 1;
	ll hi = accumulate(all(v), 0L);
	ll p, P, m;
	while(hi - lo > 1) {
		p = P = (lo + hi) / 2;
		m = 1;
		rep(i, 0, n) {
			if(v[i] > p) {
				p = P;
				++m;
			}
			p -= v[i];
		}
		(m <= k ? hi : lo) = P;
	}
	P(hi);
	return 0;
}

Measured memory_bytes: 3248
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	x, k, d = tin()
	#s = input()
	na = abs(x) // d
	#pa(na)
	if na >= k:
		return min(abs(x - d*k), abs(x+d*k))
	else:
		xa = x - d*na if x >= 0 else x+d*na
		ka = k-na
		kb = ka%2
		#pa(xa)
		if kb==1:
			return min(abs(xa+d), abs(xa-d))
		else:
			return min(abs(xa-2*d),abs(xa+2*d),abs(xa))
		
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 61948
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

ll ans;
ll n;
void solve(ll x,bool a,bool b,bool c){
	if(x<=n){
		if(a&&b&&c){
		ans++;
		}
		solve(x*10+3,true,b,c);
		solve(x*10+5,a,true,c);
		solve(x*10+7,a,b,true);
	}
	else{
		return;
	}

}

int main(){
	cin>>n;
	solve(0,false,false,false);
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        d: usize,
        cv: [isize; 26],
        sv: [[isize; 26]; d],
        tv: [Usize1; d]
    };

    let mut last = vec![0; 26];
    let mut res = 0;
    for i in 0..d {
        let t = tv[i];
        res += sv[i][t];
        last[t] = i + 1;
        for j in 0..26 {
            res -= cv[j] * (i + 1 - last[j]) as isize;
        }
        println!("{}", res);
    }
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2356
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
typedef long long  ll;
typedef long double lb;
using namespace std;
int main() {
    int a;
    cin >> a;
    if (a % 10 == 7)cout << "Yes";
    else if ((a / 10) % 10 ==7)cout<< "Yes";
    else if (a / 100 == 7)cout<< "Yes";
    else cout << "No";
}


Measured memory_bytes: 3624
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()
	a := map[int]int{}
	for i := 0; i < n; i++ {
		tmp := scanInt()
		a[tmp]++
	}

	q := scanInt()
	b, c := make([]int, q), make([]int, q)
	for i := 0; i < q; i++ {
		b[i], c[i] = scanInt(), scanInt()
	}

	sum := 0
	for i, cnt := range a {
		sum += i * cnt
	}

	for i := 0; i < q; i++ {
		diff := c[i] - b[i]
		a[c[i]] += a[b[i]]
		sum += diff * a[b[i]]
		a[b[i]] = 0
		fmt.Println(sum)
	}

}


Measured memory_bytes: 9804
from operator import add
N, M, X = map(int, input().split())


def toBook(line):
    xs = line.split()
    cost = int(xs[0])
    values = list(map(int, xs[1:]))
    return (cost, values)


Books = [toBook(input()) for i in range(N)]
maxCost = 10 ** 15


def isSatisfied(xs):
    return all([x >= X for x in xs])


def rec(i, proficiency, totalCost):
    if i == N:
        if isSatisfied(proficiency):
            return totalCost
        else:
            return maxCost
    else:
        _proficiency = list(map(add, proficiency, Books[i][1]))
        _totalCost = totalCost + Books[i][0]
        cost1 = rec(i + 1, proficiency, totalCost)
        cost2 = rec(i + 1, _proficiency, _totalCost)
        return min(cost1, cost2)


cost = rec(0, [0] * M, 0)
if cost == maxCost:
    print("-1")
else:
    print(cost)


Measured memory_bytes: 9248
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	int n,k;
	scanf("%d%d",&n,&k);
	printf("%d",n-k+1);
	return 0;
}

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

int main()
{
    int W, H, N;
    int x, y, a;

    int x_max, x_min;
    int y_max, y_min;

    cin >> W >> H >> N;

    x_min = 0;
    y_min = 0;
    x_max = W;
    y_max = H;

    for (int i = 0; i < N; i++)
    {
        cin >> x >> y >> a;
        
        if (a == 1)
        {
            if (x_min < x) x_min = x;
        }
        if (a == 2)
        {
            if (x_max > x) x_max = x;
        }
        if (a == 3)
        {
            if (y_min < y) y_min = y;
        }
        if (a == 4)
        {
            if (y_max > y) y_max = y;
        }
    }

    if ((x_max - x_min < 0) || (y_max - y_min < 0))
    {
        cout << 0 << endl;
        return 0;
    } 

    int area = (x_max - x_min) * (y_max - y_min);
    cout << area << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int x,int y)
{
    int r;
    while(y!= 0)
    {
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}
int order(int g,int mod)
{//The minimum n such that g^n == 1(mod mod)
    int multi=1;
    if(mod == 1)
        return 0;
    for(int i=0;i<mod;i++)
    {
        multi*=g;
        multi %= mod;
        if(multi == 1)
            return i+1;
    }
    return -1;
}
int main(void)
{
    int x,y;
    while(scanf("%d%d",&x,&y),x!=0 || y!= 0)
    {
        int g=gcd(x,y);
        x/=g;
        y/=g;
        int cnt=0;
        while(1)
        {
            int f25=gcd(y,10);
            if(f25 == 1)
                break;
            y/=f25;
            cnt++;
        }
        printf("%d %d\n",cnt,order(10,y));
    }
    return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll mod=1000000007;
ll add(ll a,ll b){
    return (a+b)%mod;
}
ll mul(ll a, ll b){
    return (a*b)%mod;
}
struct node
{
    ll x,y;    
};
int main() {
    
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T;T=1;
    // cin>>T;
    while(T--){
        int n;cin>>n;
        int a[n];
        rep(i,n)cin>>a[i];
        int x=1;
        int ans=-1;
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans++;x++;
            }
        }
        if(ans!=-1){
            x--;
            ans=n-x;
        }
        cout<<ans;
    }
    return 0;   
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c;
int main(){
	cin >> a >> b >> c;
	if(a == b && b != c) cout << "Yes" << endl;
	else if(b == c && a != c ) cout << "Yes"<< endl;
	else if(a == c && a != b) cout << "Yes" <<endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
      #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
       ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
           # #  # # #                   # #      ###### #    # #    # #      #####
      #    # #   #  #              #    # #      #    # #    # #    # #      #   #
       ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 

 
 
int main()
{
	
	long long a,b;
	char c;
	cin>>a>>c>>b;
	if(c=='-')cout<<a-b<<endl;
	else cout<<a+b<<endl;
			
			
			
    exit()
 
 
}


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

int main(){
        int n,x,c=0;
        cin>>n>>x;
        vector<int>V(n+1);
        V[0]=0;
        for(int i=1;i<n+1;i++)
            cin>>V[i];
//      for(int x:V)
//          cout<<x<<" ";
//      cout<<endl;
        for(int i=1;i<n+1;i++){
            V[i]+=V[i-1];
//          cout<<V[i]<<" ";
            if(V[i]<=x)
                ++c;
        }
        cout<<c+1<<endl;
}


Measured memory_bytes: 256
"""
pythonはオーバーフローしないが、桁数がデカい整数の計算をすると、計算が間に合わなくなる。
O（N^2)とかになる。

0のときは0を答えないとダメなので、0があったら0とするでよい。

"""


import sys

N = int(input())

An = [int(_) for _ in input().split()]
An.sort()

ans = 1

for val in An:
    # 0がきたらすぐに抜ける
    if(int(val) == 0):
        print(0)
        sys.exit()
    ans *= val
    # ansが10^18を超えた時点で-1にする
    if(ans > 10 **18):
        print(-1)
        sys.exit()

print(ans)

Measured memory_bytes: 84900
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i=1;i<=n;i+=2){
    int cnt = 0;
    for(int j=1;j<=i;j++){
      if(i%j==0) cnt++;
    }
    if(cnt == 8) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b, c, d) = readLine()?.toCharArray()?.map{ it.toInt() - 48 } ?: return

    // a は正なので、b,c,dの計算結果を7-aにする必要がある
    val total = 7 - a

    // +,-の組み合わせは8通り
    for (i in 0 until 8) {
        val bAppliedOpe1 = if (i.and(0b0100) == 0b0100) b else -b
        val cAppliedOpe2 = if (i.and(0b0010) == 0b0010) c else -c
        val dAppliedOpe3 = if (i.and(0b0001) == 0b0001) d else -d

        if (bAppliedOpe1 + cAppliedOpe2 + dAppliedOpe3 == total) {
            val ope1 = if (i.and(0b0100) == 0b0100) '+' else '-'
            val ope2 = if (i.and(0b0010) == 0b0010) '+' else '-'
            val ope3 = if (i.and(0b0001) == 0b0001) '+' else '-'
            println("$a$ope1$b$ope2$c$ope3$d=7")
            return
        }
    }
}

Measured memory_bytes: 33636
m, d = map(int, input().split())
D = [str(i) for i in range(1,d+1)]
c = 0

for i in range(1, m+1):
	for j in D:
		if len(j) == 2 and int(j[0]) >= 2 and int(j[1]) >= 2:
			
			if i == int(j[0]) * int(j[1]):
					
				c += 1

print(c)

Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>

int main() {
	int n, m, k, a, cnt[35], ans = 0;
	scanf("%d %d", &n, &m);
	memset(cnt, 0, sizeof cnt);
	for (int i = 0; i < n; i++) {
		scanf("%d", &k);
		for (int j = 0; j < k; j++) {
			scanf("%d", &a);
			cnt[a]++;
		}
	}
	for (int i = 1; i <= m; i++)
		if (cnt[i] == n)
			ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){

    int N;
    cin >> N;
    map<int, bool> exists;
    int a;
    for(int i=0; i<N; i++) {
        cin >> a;
        if (exists[a]){
            cout << "NO" << endl;
            return 0;
        }
        exists[a] = true;
    }
    cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 9600
/**
 * The man who codes no bugs
 * McCheng is the man studying Maths in CUHK with IQ200
 * @author McCheng
 */

#include <bits/stdc++.h>
using namespace std;
#define int long long
class APayment {
public:
    static constexpr int kStressCount = 0;
    static void generateTest(ostream& test) {}
	void solve(istream& cin, ostream& cout) {
int n;
cin>>n;
int ans=n%1000;
if (ans==0){
    cout<<0;
}else{
    cout<<1000-ans;
}
	}
};

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream &in(cin);
    ostream &out(cout);
    out << fixed;
    out.precision(20);
    APayment solver;
    solver.solve(in, out);
}


Measured memory_bytes: 3648
import fractions # math.gcdはatcoderでは通らないので注意

A, B, C, D = map(int, input().split())

def lcm(x, y):
    return((x * y) // fractions.gcd(x, y))

n = B - A + 1
cn = B // C - (A - 1) // C
dn = B // D - (A - 1) // D
cdn = B // lcm(C, D) - (A - 1) // lcm(C, D)

ans = n - (cn + dn - cdn)
print(ans)

Measured memory_bytes: 5088
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define p_q priority_queue
#define MN 1000000009

int n, a, b, c, d;
int main(){
    while(cin >> n){
        if (n==0) return 0;
        c=d=0;
        for (int l=0; l<n; ++l){
            cin >> a >> b;
            if (a>b) c+=a+b;
            else if (b>a) d+=a+b;
            else {c+=a; d+=a;}
        }
        cout << c << ' ' << d << endl;
    }
    return 0;
}

Measured memory_bytes: 3072
N, M = map(int, input().split())

AB = dict()

for _ in range(M):
    a, b = map(int, input().split())
    AB.setdefault(a, [])
    AB[a].append(b)

    AB.setdefault(b, [])
    AB[b].append(a)

a = [-1 for _ in range(N + 1)]

a[1] = 0
current = 1
pos = [1]

while True:
    next_pos = []

    for p in pos:
        for n in AB[p]:
            if a[n] == -1:
                a[n] = p
                next_pos.append(n)

    pos = next_pos
    if not pos:
        break

if -1 in a[2:]:
    print('No')
else:
    print('Yes')
    for i in a[2:]:
        print(i)


Measured memory_bytes: 112040
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        
        int ans = 0;
        if (k >= a){
            ans += a;
            k = k - a;
        }else{
            ans += k;
            k = 0;
            System.out.println(ans);
            return;
        }
        
        if (k >= b){
            k = k - b;
        }else{
            k = 0;
            System.out.println(ans);
            return;
        }
        
        if (k >= c){
            ans -= c;            
        }else{
            ans -= k;
        }

        System.out.println(ans);

    }
}


Measured memory_bytes: 35764
def gcd(x,y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    if  x % y == 0:
        return y
    else:
        return gcd(y, x%y)

n = int(input())
a = list(map(int, input().split()))
x = [0]*n
y = [0]*n

for i in range(1,n):
    x[i] = gcd(x[i-1],a[i-1])
for i in range(n-1,0,-1):
    y[i-1] = gcd(y[i],a[i])

z = [gcd(x[i],y[i]) for i in range(n)]

print(max(z))

Measured memory_bytes: 14488
#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>;


int main() {
  ll p = 1000000007;

  int n;
  cin >> n;

  ll p10 = 1;
  ll p8 = 1;
  ll p92 = 2;
  //cout << "Initial p10 is " << p10 << ", n is " << n << endl; 

  rep(i,n){
    p10 *= 10;
    p8  *= 8;
    p92 *= 9;
    p10 %= p; 
    p8  %= p; 
    p92 %= p;
//    cout << "p10 is " << p10 << ", n is " << n << endl; 
  }

  ll ans = p10 + p8 - p92;
  while(ans < 0) ans += p;
  ans %= p;
  cout << ans;
}

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

int main() {
  int x;
  cin >> x;
  int num = 20;
  if(x < 600){
    num = 8;
  }else if(x < 800){
    num = 7;
  }else if(x < 1000){
    num = 6;
  }else if(x < 1200){
    num = 5;
  }else if(x < 1400){
    num = 4;
  }else if(x < 1600){
    num = 3;
  }else if(x < 1800){
    num = 2;
  }else{
    num = 1;
  }
  cout << num << endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
namespace 令和{
    class ABC{
        static void Main(){
            int n = int.Parse(Console.ReadLine());
            int[] u = new int[n];
            int[] v = new int[n];
            int[] w = new int[n];
            //bool[] isEven = new bool[n-1];
            List<int[]>[] tonari = new List<int[]>[n+1];
            int[] ans = new int[n+1];
            for(int i=0;i<n+1;i++){
                tonari[i] = new List<int[]>();
                ans[i] = -1;
            }
            for(int i=1;i<n;i++){
                string[] uvw = Console.ReadLine().Split();
                u[i] = int.Parse(uvw[0]);
                v[i] = int.Parse(uvw[1]);
                w[i] = int.Parse(uvw[2]);
                tonari[u[i]].Add(new int[2]{v[i],w[i]});
                tonari[v[i]].Add(new int[2]{u[i],w[i]});
                /*
                if(w[i]%2==0){
                    isEven[i] = true;
                }else{
                    isEven[i] = false;
                }
                */
            }
            Queue<int> q = new Queue<int>();
            q.Enqueue(1);
            ans[1] = 0;
            while(q.Count!=0){
                int p = q.Dequeue();
                foreach(int[] tnr in tonari[p]){
                    if(ans[tnr[0]]==-1){
                        ans[tnr[0]] = (tnr[1]+ans[p])%2;
                        q.Enqueue(tnr[0]);
                    }
                }
            }
            for(int i=0;i<n;i++){
                Console.WriteLine(ans[i+1]);
            }


        }
    }
}


Measured memory_bytes: 38472
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    int n; cin >> n;
    vector<vector<int>> G(n);
    int remove = n/2*2-1;
    rep(i, n) {
        FOR(j, i+1, n) {
            if (j == remove) continue;
            G[i].push_back(j);
        }
        remove--;
    }
    print(G);
    int cnt = 0;
    rep(i, n) cnt += sz(G[i]);
    cout << cnt << endl;
    rep(i, n) {
        rep(j, sz(G[i])) cout << i+1 << " " << G[i][j]+1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans=1,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,p;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>p;
    if(n==1)Cout(p);
    else if(p==1)Cout(1);
    else{
    long double aa;
    aa=pow(p,1.0/(long double)n);
    a=(ll)aa;
    long double z;
    for(ll i=a;i>=ans-1000;i--){
        if(i<=0)continue;
        z=pow(i,n-1);
        b=(ll)z;
        if(b<=0)continue;
        c=__gcd(i,p/b);
        if(c>=ans&&p%b==0){
            ans=c;
        }
    }
    Cout(ans);
    }
    return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)

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

const int INF = 0x3fffffff;

class Flow{
	public:
		int N;
		vector< vector<int> > F, C;
		Flow(int n, int e): F(n,vector<int>(n)), C(n,vector<int>(n)), N(n) {}
		void addEdge(int f, int t, int c){ F[f][t] = C[f][t] = c; }
		int flow(int n, int c, int T, vector<bool> &bf){
			if( n == T ) return c;
			bf[n] = true;
			rep(i,N) if( F[n][i] > 0 && !bf[i] ){
				int f = flow(i, min(c, F[n][i]), T, bf);
				F[n][i] -= f;
				F[i][n] += f;
				if( f > 0 ) return f;
			}
			return 0;
		}
		int maxFlow(int S, int T){
			int ret = 0;
			vector<bool> bf(N);
			for(int add; add = flow(0, INF, T, bf); bf.assign(N,0)) ret += add;
			return ret;
		}
		void clear(){ rep(i,N) rep(j,N) F[i][j] = C[i][j]; }
};

int main(){
	int V, E;
	cin >> V >> E;
	Flow fl(V,E);
	for(int i=1; i<=E; i++){
		int u, v, c;
		cin >> u >> v >> c;
		fl.addEdge( u, v, c );
	}

	cout << fl.maxFlow(0, V-1) << endl;

	return 0;
}

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

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

	if (s.length() % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}

	auto mid = s.length() / 2;
	if (s.substr(0, mid) == s.substr(mid)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

int main()
{
    string s;
    int a=0,b=0,c=0;
    while(cin>>s)
    {
        for(int i=0;i<3;i++)
        {
            if(s[i]=='a') a=1;
            else if(s[i]=='b') b=1;
            else if(s[i]=='c') c=1;
        }
        if(a==1&&b==1&&c==1) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int arr[11];

int main(void) 
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	arr[a]++; arr[b]++; arr[c]++;
	if (arr[5] == 2 && arr[7] == 1) printf("YES\n");
	else printf("NO\n");

	return 0;
}

Measured memory_bytes: 128
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int d,t,s; cin>>d>>t>>s;
	if (d<=s*t) cout<<"Yes";
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  double T,X;
  scanf("%lf %lf",&T,&X);
  printf("%lf",T/X);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<fstream>
#include<vector>

int main(){
  //std::ifstream in("input.txt");
  //std::cin.rdbuf(in.rdbuf());

  std::vector<int> a;
  int N, tmp, cnt, break_cnt;
  std::cin >> N;
  for(int i = 0; i < N; i++){
    std::cin >> tmp;
    a.push_back(tmp);
  }
  cnt = 1;
  break_cnt = 0;

  for(int i = 0; i < N; i++){
    if(a[i] == cnt){
      cnt++;
    }else{
      break_cnt++;
    }
  }
  if(break_cnt == N){
    std::cout << "-1" << std::endl;
    return 0;
  }
  std::cout << break_cnt << std::endl;
  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int mod=1e9+7;
int n,k,small[64000]={0},big[64000]={0},sum[64000];

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

    int i,j,cnt=0;
    cin>>n>>k;
    for(i=n;i>0;)
    {
        j=n/(n/i+1);
        small[cnt++]=i-j;
        i=j;
    }

    for(i=0;i<cnt;i++)
        big[i]=small[i];
    for(i=1;i<k;i++)
    {
        for(sum[0]=big[cnt-1],j=1;j<cnt;j++)
            sum[j]=(sum[j-1]+big[cnt-1-j])%mod;

        for(j=0;j<cnt;j++)
        {
            big[j]=(sum[j]*1LL*small[j])%mod;
            //cout<<sum[j]<<'/'<<big[j]<<' ';
        }
    }
    int ans=0;
    for(i=0;i<cnt;i++)
        ans=(ans+big[i])%mod;
    cout<<ans<<endl;
    /*for(i=0;i<cnt;i++)
        cout<<sum[i]<<'/'<<big[i]<<' ';
    cout<<endl;*/
    return 0;
}


Measured memory_bytes: 1024
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

approved = true

n.times do |i|
  next if a[i] % 2 == 1
  if a[i] % 3 != 0 && a[i] % 5 != 0
    approved = false
    break
  end
end

puts approved ? 'APPROVED' : 'DENIED'

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    int num = 1;
    while(1) {
        if ( num * num > n ) break;
        ++num;
    }
    --num;
    cout << num * num << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static int seach_AC (String s,int start,int end) {
		int result = 0;
			for(int i = start; i < end; i++) {
				if(s.substring(i,i+2).equals("AC")) {
					i++;
					result++;
				}
			}
		return result;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc  = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		String s = sc.next();
		int[] table = new int[s.length()];
		table[0] = 0;
		for(int i = 1; i < s.length(); i++) {
			table[i] = table[i-1] + seach_AC(s,i-1,i); 
		}
		
		System.out.println("");
		for(int i = 0; i < q; i++) {
			int r = sc.nextInt();
			int l = sc.nextInt();
			System.out.println(table[l-1] - table[r-1]);
		}
		sc.close();
	}
}


Measured memory_bytes: 67964
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    use std::collections::BTreeSet;
    let n: u32 = read();
    let a: BTreeSet<u32> = (0..n).map(|_| read()).collect();
    println!("{}", a.len());
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int c = 0;
    for (int j = 0; j < n; j++)
    {
        if (a[j] % 2 == 0)
        {
            if (a[j] % 3 != 0 && a[j] % 5 != 0)
            {
                cout << "DENIED" << endl;
                c++;
                break;
            }
        }
    }
    if (c == 0)
        cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    ll N;
    cin >> N;
    vector<ll>  a(N);
    REP(i, N) cin >> a[i];
    ll res = 0; 

    ll cnt = 0;
    REP(i, N)
    {
        if(cnt + 1 == a[i])
        {
            ++cnt;
        }
    }

    if(cnt == 0)
    {
        res = -1;
    }
    else
    {
        res = N - cnt;
    }
    

    cout << res << endl;
    return 0;
}


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

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

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld ",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define fo(i,a,b) for(int i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#define ll long long
const int M=1e9+7;
#define endl "\n"
const double pyi=3.14159265358979323846;

int main() 
{ 
    int x,y;
    cin>>x>>y;

    if(y%2==1 || y<2*x || y>4*x)
    	cout<<"No"<<endl;
    else
    	cout<<"Yes"<<endl;
    return(0);
}





Measured memory_bytes: 3600
N = int(input())
testCase = []
for i in range(N):
  testCase.append(input())
print("AC x " + str(testCase.count("AC")))
print("WA x " + str(testCase.count("WA")))
print("TLE x " + str(testCase.count("TLE")))
print("RE x " + str(testCase.count("RE")))


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

using namespace std;


void solve() {
    int n,m;
    cin >> n >> m;
    vector<vector<pair<int,int>>> g(n);
    for (int _ = 0; _ < m; _++) {
        int x,y,c;
        cin >> x >> y >> c;
        x--; y--;
        g[x].emplace_back(y,c);
        g[y].emplace_back(x,-c);
    }
    vector<long long> d(n);
    function<void(int)> dfs = [&](int u){
        for (auto& p: g[u]) {
            int v,c;
            tie(v,c) = p;
            if (d[v]) {
                if (d[u]+c != d[v]) {
                    cout << "No"; exit(0);
                }
            } else {
                d[v] = d[u]+c;
                dfs(v);
            }
        }
    };
    for (int i = 0; i < n; i++) {
        if (!d[i]) {
            d[i] = 1ll<<40;
            dfs(i);
        }
    }
    cout << "Yes";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 13312
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)


Measured memory_bytes: 32220
package main

import "fmt"

var memo []int

func main() {
	var N int
	fmt.Scan(&N)

	memo = make([]int, N+1)
	for i := 0; i < N+1; i++ {
		memo[i] = -1
	}

	ans := dfs(N)
	fmt.Println(ans)
}

func dfs(n int) int {
	if n == 0 {
		return 0
	}
	if memo[n] != -1 {
		return memo[n]
	}

	res := n
	for pow6 := 1; pow6 <= n; pow6 *= 6 {
		res = min(res, dfs(n-pow6)+1)
	}

	for pow9 := 1; pow9 <= n; pow9 *= 9 {
		res = min(res, dfs(n-pow9)+1)
	}

	memo[n] = res

	return res
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 16640
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    while(1){
        int i,n,k,m,p;
        cin>>n>>k>>m;
        if(n==0) break;
        vector<int> data;
        for(i=0;i<n;i++){
            data.push_back(i);
        }
        p=m-1;
        for(i=0;i<n-1;i++){
            int tmp=p;
            data.erase(data.begin() + tmp);
            p=(p+k-1)%data.size();
        }
        cout<<data[0]+1<<'\n';
    }
    return 0;
}


Measured memory_bytes: 3184
from itertools import combinations 
n = int(input())
march_num = {"M":0,"A":0,"R":0,"C":0,"H":0}

for _ in range(n):
    s = input()
    if s[0] in set(march_num):
        march_num[s[0]] += 1;
        
ans = 0
for x,y,z in combinations(set(march_num),3):
    ans += march_num[x] * march_num[y] * march_num[z]
        
print(ans)

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

int main(){
  string s; int count = 0; int ans =0;
  cin >> s;
  for(char c:s) {
    if(c=='R') count++;
    else count = 0;
    ans = max(ans, count);
  }
  
  cout << ans ;
  
    return 0;
  }


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

int main() {
	char n[4];
	for (int i = 0; i < 4; i++) {
		cin >> n[i];
	}
	int ans = 0; 
	for (int i = 0; i < 4; i++) {
		if (n[i] == '2') ans++;
	}

	cout << ans << endl;
}

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

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define Sort(a)   sort(a.begin(), a.end())
const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
    int n; cin >> n;
    vector<int> x;
    for(int i = 0; i < n; ++i) {
        int buffer;
        cin>>buffer;
        x.emplace_back(buffer);
    }

    sort(x.begin(), x.end(), greater<int>());

    int ans = 0;
    for(int i = 1; i < n; ++i) ans += x[i];

    cout << ((x[0] < ans) ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

ll MOD = 1000000007;

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

	if(a>=3200)
	{
		cout << s << endl;
	}
	else
	{
		cout << "red" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
struct edge
{
	ll x,w;
};
ll n,m,x,y,w,vis[100005],a[100005],b[100005],i,l,r;
vector<edge> s[100005];
bool ok=true;
void dfs(int p)
{
	if(ok==false)return;
	edge v;
	ll i,tmp1,tmp2,u,vv;
	vis[p]=1;
	for(i=0;i<s[p].size();i++)
	{
		v=s[p][i];
		tmp1=v.w-a[p];
		tmp2=-b[p];
		if(vis[v.x])
		{
			if(tmp1!=a[v.x]||tmp2!=b[v.x])
			{
				if((tmp2==b[v.x]&&tmp1!=a[v.x])||(tmp1-a[v.x])%(b[v.x]-tmp2)!=0)
				{
					ok=false;
					return;
				}
				u=(tmp1-a[v.x])/(b[v.x]-tmp2);
				r=min(r,u);
				l=max(l,u);
			}
			continue;
		}
		a[v.x]=tmp1;
		b[v.x]=tmp2;
		dfs(v.x);
		if(ok==false)return;
	}
}
int main()
{
	l=1;r=1e18;
	cin>>n>>m;
	for(i=1;i<=m;i++)
	{
		cin>>x>>y>>w;
		s[x].push_back((edge){y,w});
		s[y].push_back((edge){x,w});
	}		
	a[1]=0;
	b[1]=1;
	dfs(1);
	if(ok==false)
	{
		cout<<"0"<<endl;
		return 0;
	}
	for(i=1;i<=n;i++)
	{
		if(b[i]==-1)r=min(r,a[i]-1);
		else l=max(l,-a[i]+1);
	}
	cout<<max(1LL*0,r-l+1);
	return 0;
}

Measured memory_bytes: 14848
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int main()
{
  char s[110000];
  cin >> s;

  rep(i,strlen(s)){
    if(i%2==0) cout << s[i];
  }

  cout << endl;
}


Measured memory_bytes: 384