akhauriyash/Code-Regression huggingface dataset:
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextLong()
  val reverseCount =
    (N, M) match {
      case (1, 1) => 1
      case (1, m) => m - 2
      case (n, 1) => n - 2
      case (n, m) => (n - 2) * (m - 2)
    }
  println(reverseCount)
}


Measured memory_bytes: 55284
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define umap unordered_map
#define uset unordered_set
#define cina(s, n, a) for(int quer = s; quer < n; quer++) cin >> a[quer]
#define couta(s, n, a) for(int quer = s; quer < n; quer++) cout << a[quer] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES\n" : "NO\n")
#define mod(a, b) (abs(b) + (a % abs(b))) % abs(b)
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;

void add_self (int& a, int b){ a += b; if (a >= MOD) a -= MOD; }
void mul(ll &x, ll y){ x *= y; if(x >= MOD) x %= MOD; }
ll bp(ll a, ll n){ ll r = 1; while(n){ if(n & 1) r = r % MOD * a % MOD; a = a % MOD * a % MOD; n >>= 1;} return r % MOD;}
//-------------------------------------------------------------------------------------------------------//

void solve(){
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++){
        if(s[i] == s[i + 1]){
            cout << "Bad";
            return;
        }
    }
    cout << "Good";
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


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

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

  long long a,b,c;
  b=2;
  c=1;

  if(n == 0){
    cout << 2 << endl;
  }
  else if(n == 1){
    cout << 1 << endl;
  }
  else{
    for(int i=0; i < n-1; i++){
      a=b;
      b=c;
      c = a + b;
    }

    cout << c << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cassert>

using namespace std;

using lint = long long;
using ldouble = long double;

bool solve() {
    int n;
    cin >> n;
    if (n == 0) return false;

    map<string, vector<string>> groups;
    string root;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;

        string group;
        int j = 0;
        while (s[j] != ':') {
            group.push_back(s[j]);
            ++j;
        }
        if (i == 0) root = group;

        while (s[j] != '.') {
            ++j;
            string name;
            while (islower(s[j])) {
                name.push_back(s[j]);
                ++j;
            }
            groups[group].push_back(name);
        }
    }

    map<string, set<string>> dp;
    function<set<string>(string)> dfs =
        [&](string group) {
            set<string> ret;

            if (!groups.count(group)) {
                ret.insert(group);
            } else if (dp.count(group)) {
                ret = dp[group];
            } else {
                for (auto name : groups[group]) {
                    auto res = dfs(name);
                    for (auto s : res) {
                        ret.insert(s);
                    }
                }
                dp[group] = ret;
            }
            return ret;
        };
    auto ans = dfs(root);

    cout << ans.size() << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}



Measured memory_bytes: 3388
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long int gcd(long int a, long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
  return a * b / gcd(a, b);
}



// min
int main(void){

  long int a, b;
  long int y[100001] = {0};
  long int cnt = 0;
  long int yakusu;
  long int ans = 0;;

  scanf("%ld%ld", &a, &b);

  // 最大公約数を求める
  yakusu = gcd(a, b);

  if(yakusu == 1){
    printf("1\n");
    return 0;
  }

  /*
  y[0] = yakusu;
  cnt++;
  */
  /*
  // 最大公約数より小さい数たちが公約数
  for(long int i = yakusu - 1; i > 0; i--){
    if(yakusu % i == 0){
      y[cnt] = i;
      cnt++;
    }
  }
  */
  /*
  // 約数となる値を詰めてみた
  // 配列への詰め方を変更
  for(long int i = 1; i*i <=  yakusu; i++){
    if(yakusu % i == 0){
      y[cnt] = i;
      cnt++;
      //      if(i != 1){
	y[cnt] = yakusu / i;
	cnt++;
	//      }
    }
  }
  */
  //  qsort(y, cnt, sizeof(long int), compare_int);

  /*
  for(int i= 0; i < cnt; i++){
    //    printf("%ld\n", y[i]);
  }
  */

  /*
  // お互いに素の組合せを数える
  for(long int i = 0; i < cnt; i++){
    for(long int j = i + 1; j < cnt; j++){
      //      printf("y[%ld] = %ld, y[%ld] = %ld\n", i, y[i], j,y[j]);
      if(y[i] % y[j] == 0 && y[j] != 1){
	break;
      }else{
	//	printf("++\n");
	if(j == cnt - 1){
	  ans++;
	  //	  printf("OK++\n");
	}
      }
    }
  }
  */

  // 素因数分解して、その時に出てきた数が何かを求める
  // 1 は必ず割り切れるので、2から計算始める
  // i * i なのは　n が100の時、約数は10 * 10を境に、、、
  long int n = yakusu;
  for(long int i = 2; i * i <= n; i++){
    if(n % i == 0){
      y[i]++;
      ans++;
      while(n % i == 0){
	n /= i;
      }
    }
  }
  // 割り切れなかった数も素数
  if(n != 1){
    y[n]++;
    ans++;
  }
  

  // あ、そっか。答えにはy[]で求めた値は本当に何も使わないのか、、
  
  // 1の分
  ans++;
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 128
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [0] * M
X = [0] * M
for i in range(M):
    P[i], X[i] = map(int, input().split())
sum = sum(T)
# print(sum)
for i in range(M):
    sum2 = sum
    sum2 -= T[P[i]-1]
    sum2 += X[i]
    print(sum2)

Measured memory_bytes: 3064
<?php

$format = '%d %d';

while (true) {
    fscanf(STDIN, '%d %d', $x, $y);
    if (!($x || $y)) { break; }

    $result[] = sprintf($format, min($x, $y), max($x, $y));
}

echo implode(PHP_EOL, $result), PHP_EOL;

Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ESP 1e-9

int main(void){
    ll a;
    cin >> a;
    double b;
    cin >> b;
    int B = b * 100 + ESP;
    ll ans = a * B / 100;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3704
from collections import defaultdict,deque
import math
def main():
    n = int(input())
    d = [int(input()) for i in range(n)]
    dd = defaultdict(int)
    for i in d:
        dd[i]+=1
    tmp = dd.keys()
    print(len(tmp))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9328
#include<bits/stdc++.h>
using namespace std;
#define repl(i,x,n) for(long long i=(long long)(x);i<(long long)(n);i++)
#define rep(i,x,n) for(long i=long(x);i<long(n);i++)
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	long x,y;
  	cin>>x>>y;
  	y*=2;
  	y--;
  	if(x>=y)
      	cout<<"YES";
  	else
      	cout<<"NO";
}

Measured memory_bytes: 256
n,m=map(int,input().split())
A=[[0]*m for i in range(0,n)]
for i in range(0,n):
    A[i]=list(map(int,input().split()))
for i in range(0,n):
    sum=0
    for j in range(0,m):
        sum+=A[i][j]
    A[i].append(sum)
x=[0]*(m+1)
total=0
for j in range(0,m):
    sum=0
    for i in range(0,n):
        sum+=A[i][j]
    x[j]=sum
    total+=sum
x[m]=total
A.append(x)
for i in range(0,n+1):
    print(' '.join(map(str,A[i])))


Measured memory_bytes: 5712
/*input
6 15
6 5
5 6
6 4
6 6
3 5
7 2
*/
 
//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.
 
//code author: iamxlr8
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
int main() 
{
    off;
    ll N,W;
    cin>>N>>W;
    ll w[N+1],v[N+1];
    for(ll i=1;i<=N;i++)
        cin>>w[i]>>v[i];
    vector<ll>dp(W+1,0);
    dp[0]=0;
    for(ll i=1;i<=N;i++){
    	for(ll j=W;j>=w[i];j--){
    		dp[j]=max(dp[j],v[i]+dp[j-w[i]]);
    	}
    }
    cout<<dp[W];
    return 0;
}

Measured memory_bytes: 3976
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>
#include <iomanip>
 
using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr int INF = 1145141919810893;
 
//
struct Edge {
	int next;
	int w = 1;
};
template<class T>
struct Vertex {
	std::vector<Edge>edges;
	T val = {};
};
template<class T>
struct Graph {
	std::vector<Vertex<T>> vertex;
public:
	Graph(size_t n = 0) :vertex(n) {
	}
	void setArray(int u, int v, int w = 1) {
		vertex[u].edges.push_back(Edge{ v ,w });
	}
	void setConnect(int u, int v, int w = 1) {
		setArray(u, v, w);
		setArray(v, u, w);
	}
	T& val(int u) {
		return vertex[u].val;
	}
	void dfsImpl(int pos, int prev, std::function<void(int now, int next, int w)> func) {
		for (auto& e : vertex[pos].edges) {
			if (e.next == prev) continue;
			func(pos, e.next, e.w);
			dfsImpl(e.next, pos, func);
		}
	}
	void dfs(int pos, std::function<void(int now, int next, int w)> func) {
		dfsImpl(pos, -1, func);
	}
	//graph.dfs(0, [](Vertex<int>& now, Vertex<int>& next, int w) {});
	pair<int, int> radiusImpl(int pos) {
		int farestID = -1;
		int far = -1;
		val(pos) = 0;
		dfs(pos, [&](int now, int next, int w) {
			val(next) = 1 + val(now);
			if (val(next) > far) {
				far = val(next);
				farestID = next;
			}
			});
		return { farestID, far };
	}
	int radius() {
		if (vertex.size() <= 1)return 0;
		auto res = radiusImpl(0);
		res = radiusImpl(res.first);
		return res.second;
	}
};
 
//////////////////////////////////
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
 
std::vector<int> divisor(int n) {
	std::vector<int> ret;
	for (int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) {
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}
 
 
////////////////////////
 
 
 
#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}
 
#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}
 
#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}
 
#define LOAD(type,name) type name; \
cin >> name;
 
 
void proc();
 
signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}
 
/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/
 
 
void proc() {
	LOAD(int, A);
	LOAD(int, B);
	//LOADVEC2(int, A, B, N);
	//
	if (A <= 5) {
		cout << 0 << endl;
	}
	else if (A <= 12) {
		cout << B / 2 << endl;
	}
	else {
		cout << B << endl;
	}
}
 
 
#endif

Measured memory_bytes: 256
# D - Five, Five Everywhere

def sieve_of_eratosthenes(n):
    primes = []
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False
    return primes

n = int(input())
A = sieve_of_eratosthenes(55555)

ans = []
for a in A:
    if a%5 == 1:
        ans.append(a)
        if len(ans) == n:
            break

print(' '.join(map(str, ans)))

Measured memory_bytes: 3572
use std::io::*;

fn main() {
  let stdin = stdin();
  for line in stdin.lock().lines() {
    let line = line.unwrap();
    let mut args = line.split_whitespace();
    let a = args.next().unwrap().parse::<i32>().unwrap();
    let op = args.next().unwrap();
    let b = args.next().unwrap().parse::<i32>().unwrap();

    let ans = match op {
      "+" => a + b,
      "-" => a - b,
      "*" => a * b,
      "/" => a / b,
      _ => break
    };
    println!("{}", ans);
  }
}



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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n;
vector<int> g[maxn];
int x,y;
int distx[maxn],disty[maxn];

void dfs1(int at, int p, int d=0) {
  distx[at]=d;
  for (int to: g[at]) {
    if (to == p) continue;
    dfs1(to,at,d+1);
  }
}

void dfs2(int at, int p, int d=0) {
  disty[at]=d;
  for (int to: g[at]) {
    if (to == p) continue;
    dfs2(to,at,d+1);
  }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cin>>n>>x>>y;
  for (int i=0; i<n-1; i++) {
    int u,v; cin>>u>>v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  if (x==y) out(0);

  dfs1(x,-1);
  dfs2(y,-1);

  int res=0;
  for (int i=1; i<=n; i++) {
    if (distx[i]<disty[i]) {
      res=max(res,disty[i]-1);
    }
  }
  out(res);
  
  return 0;
}
// don't forget to read in the input :^)


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

int n, m;
int a[10][10];

int issqr(int k) {
  int s = sqrt(k + 0.5);
  return s * s == k;
}

int sub(int p, int q) {
  int sum = 0;
  for (int j = 0; j < m; ++j) {
    int diff = (a[q][j] - a[p][j]);
    sum += diff * diff;
  }
  return issqr(sum);
}

int main() {
  cin >> n >> m;
  
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (sub(i, j)) ++cnt;
    }
  }
  cout << cnt << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}
const double PI=acos(-1);

signed main(){
	int R;cin>>R;
	cout<<setprecision(20);
	cout<<2*R*PI<<endl;		
    return 0;
}


Measured memory_bytes: 3796
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;
            var C = cin.ReadInt;
            
            WriteLine("{0} {1} {2}",C,A,B);
        }

    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }


        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {

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

	    Result result = execute(sc.nextLine());
        System.out.println(result);
    }

    public static Result execute(String s){
        if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)){
            return Result.Yes;
        }
        return Result.No;
    }

    public static enum Result{
        Yes,
        No;
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h> 
using namespace std; 
#define deb(x) cout <<"\n"<< (#x) << " = " << (x) << "\n"
const long long  INF = 1e18;
const long long mod=1e9+7 ;
void inputoutput()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); 
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	    
}


vector<int> adj[100500];
vector<bool> vis(100500);
vector<int> d(100500);
queue<int> q ;



void bfs(int v)
{
	q.push(v);
	vis[v]=true;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(auto u : adj[x])
		{
			if(!vis[u])
			{
				vis[u]=true;
				q.push(u);
				d[u] = d[v] + 1;
			}
		}
	}
}
void dfs(int v)
{
	vis[v]=true;
	for(auto u : adj[v])
	{
		if(!vis[u])
			dfs(u);
	}
}

void solve()
{
	string s;
	cin>>s;
	if(s[s.size()-1]!='s')
		cout<<s<<"s";
	else
		cout<<s<<"es";

}

int32_t main()
{ 
	inputoutput() ;
	solve();


	return 0;
}


Measured memory_bytes: 6040
// CppPractice.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
	int data[3000];
	int datb[3000];
	int datcount=0;
	int a,b;
	while (true) {
		cin >> a>>b;
		if (a == 0&&b==0) {
			break;
		}
		data[datcount] = min(a,b);
		datb[datcount] = max(a,b);
		datcount++;
	}
	for (int i = 0; i < datcount; i++) {
		cout << data[i] << " " << datb[i]<<endl;
	}
    return 0;
}




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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int a[3];
	cin >> a[0] >> a[1] >> a[2];

	int mn = 1000;
	for(int i = 0; i <= 2; i++){
		for(int j = 0; j <= 2; j++){
			if(i == j) continue;
			for(int k = 0; k<=2; k++){
				if(i == k || k == j) continue;
				mn = min(mn, abs(a[i] - a[j]) + abs(a[j] - a[k]));
			}
		}
	}

	cout << mn << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int N, M, A;
  cin >> N >> M;
  for (int i=0; i<M; i++) {
    cin >> A;
    N -= A;
  }
  if (N<0) {
    N = -1;
  }
  cout << N << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define f(i, n) for (int i = 0; i < n; ++i)

using namespace std;
void solve() {
    int a, b;
    cin >> a >> b;
    bool ans = a <= 8 && b <= 8;
    cout << ((ans) ? "Yay!" : ":(") << nl;
}

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;
import static java.util.Arrays.sort;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = (int)1e9 + 7;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int s = in.nextInt();
        int w = in.nextInt();
        out.println(w >= s ? "unsafe" : "safe");

    }



}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}

Measured memory_bytes: 25604
#include <cstdio>

using namespace std;

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

typedef long long ll;

const int N_MAX = 100000;
const int S_MAX = 10;

//-----------------------------------------------------------------------------
int num_of_bits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}
//-----------------------------------------------------------------------------
const char *MARCH = "MARCH";

int N;
char S[N_MAX][S_MAX + 1];
int cs[5];

void solve() {
  REP(i, N) {
    REP(j, 5) {
      if (S[i][0] == MARCH[j]) {
        cs[j]++;
        break;
      }
    }
  }

  ll ans = 0;
  REP(i, 1 << 5) {
    if (num_of_bits(i) == 3) {
      ll m = 1;
      REP(j, 5) {
        if (i >> j & 1) {
          m *= cs[j];
        }
      }
      ans += m;
    }
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%s", S[i]);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 1280
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

vector<int> vec(1000000);
bool fi,pairwise=true;

void p_factorization(int n){
    for(int i=2;i<=sqrt(n);i++){
        fi=true;
        while(n%i==0){
            if(fi){
                if(vec[i])pairwise=false;
                vec[i]=1;
                fi=false;
            }
            n/=i;
        }
    }
    if(n!=1){
        if(vec[n]){
            pairwise=false;
        }
        else vec[n]=1;
    }
}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,x,tmp;cin>>n;
    cin>>tmp;
    p_factorization(tmp);
    for(int i=1;i<n;i++){
        cin>>x;tmp=__gcd(tmp,x);
        if(!pairwise)continue;
        p_factorization(x);
    }
    if(pairwise)cout<<"pairwise coprime"<<endl;
    else if(tmp==1)cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
}


Measured memory_bytes: 7044
from operator import itemgetter
n = int(input())
arr_ = [[str(i) for i in input().split()] for _ in range(n)]
for i in range(n):
    arr_[i].append(i+1)
    arr_[i][1] = int(arr_[i][1])

arr_.sort(key=itemgetter(1), reverse=True)
arr_.sort(key=itemgetter(0))
for i in range(n):
    print(arr_[i][2])

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
ad = [[] for _ in range(N)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    a -= 1; b -= 1
    ad[a].append((b,c))
    ad[b].append((a,c))

Q,K = map(int,input().split())
K -= 1
query = [[int(e)-1 for e in input().split()] for _ in range(Q)]
dis = [0]*N

def bfs(sv=K):
    dq = deque()
    dq.append((sv,0,-1))
    while dq:
        v,d,pv = dq.popleft()
        for nv,nd in ad[v]:
            if nv == pv:
                continue
            dis[nv] = d+nd
            dq.append((nv,d+nd,v))

bfs()
for x,y in query:
    ans = dis[x] + dis[y]
    print(ans)

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

int main(){
	double a, b;
	while(scanf("%lf %lf", &a, &b) != EOF){
		if(a < 35.5 && b < 71) printf("AAA\n");
		else if(a < 37.5 && b < 77) printf("AA\n");
		else if(a < 40 && b < 83) printf("A\n");
		else if(a < 43 && b < 89) printf("B\n");
		else if(a < 50 && b < 105) printf("C\n");
		else if(a < 55 && b < 116) printf("D\n");
		else if(a < 70 && b < 148) printf("E\n");
		else printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 608
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9+7;

int N;
int P[200010];
int ans;
int m[200010];
int main(){
    cin>>N;
    REP(i,0,N){
        cin>>P[i];
    }
    m[0]=0;
    REP(i,0,N){
        m[P[i]] = m[P[i]-1]+1;
        ans = max(ans, m[P[i]]);
    }

    p(N-ans);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<stack>
using namespace std;
const int maxn=200010;
int main(){
	stack<char> st;
	string s;
	cin>>s;
	int t=1e4;
	int sz=s.size();
	for(int i=0;i<s.size();i++){
		if(st.empty()){
			st.push(s[i]);
			continue;
		}
		if(st.top()=='S'&&s[i]=='T'){
			t--;
			st.pop();
			sz-=2;
		}
		else{
			st.push(s[i]);
		}
		//if(t==0){
		//	break;
		//}
	}
	cout<<sz<<endl;
	return 0;
}

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

typedef long long ll;

 
int main(){
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double ans, theta;
  theta = abs(30*h-11*m/2);
  if(theta>180) theta = 360 - theta;
  theta = theta*M_PI/180;
  ans = a*a + b*b - 2*a*b*cos(theta);
  ans = sqrt(ans);
  printf("%.12lf\n", ans);
  return 0;
}


Measured memory_bytes: 4192
#include <iostream>
#include <iomanip>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
using namespace std;

const long double PI = 3.14159265358979323846;
long double A, B, H, M;
int main() {
	cin >> A >> B >> H >> M;
	long double a = ((60*H) + M)/720 * 2*PI;
	long double b = (M/60) * 2*PI;

	long double rad = abs(a-b);
	long double ans = A*A + B*B - 2*A*B*cos(rad);
	ans = sqrt(ans);
	cout << fixed << setprecision(20) << ans << endl;

    return 0;
}


Measured memory_bytes: 3608
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    A_list = [int(item) for item in input().split()]

    new_list = []

    for item in A_list:
        new_list += [item + i for i in [-1, 0, 1]]

    item_dict = collections.Counter(new_list)
    print(max(item_dict.values()))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 30432
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun sumList(a: Iterable<Long>): List<Long> {
        val result = mutableListOf(0L)
        var i = 0L
        a.forEach {
            i += it
            result.add(i)
        }
        return result
    }

    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val A = LongArray(N + 1) { sc.next().toLong() }
        val B = LongArray(N) { sc.next().toLong() }
        var ans = 0L
        for (i in 0 until N) {
            val d = A[i] - B[i]
            if (d >= 0) {
                A[i] -= B[i]
                ans += B[i]
            } else {
                ans += A[i]
                B[i] -= A[i]
                if (A[i + 1] >= B[i]) {
                    A[i + 1] -= B[i]
                    ans += B[i]
                } else {
                    ans += A[i + 1]
                    A[i + 1] = 0
                }
            }
        }
        pw.println(ans)
    }
}


Measured memory_bytes: 55672
def main():
	N = int(input())
	A = list(map(int,input().split()))

	if 0 in A:
		print(0)
		return 

	prod = 1
	for x in A:
		prod = prod*x
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)

main()

Measured memory_bytes: 21632
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INF 1000000000 // 10^9
#define mod 1000000007
#define EPS 0.000000001 //10^-9
#define rep(i,a,b) for((i)=(a);(i)<=(b);(i++))
#define pb push_back 
using namespace std;
typedef long long ll;
class node
{
public:
    int value;
    node *left;
    node *right;
};
class node* newnode(int value)
{

    node* a=(node*)malloc(sizeof(node));
    a->value=value;
    a->left=NULL;
    a->right=NULL;
    return a;
};

ll power(ll x,ll n)
{
    if(x==0 || x==1||n==0)
        return 1;
    if(n==1)
        return x;
    if(n%2==0)
        return (power(((x%mod)*(x%mod))%mod,n/2)%mod);
    else
        return ((x%mod)*(power(x,n-1)%mod)%mod);
}

int main()
{
    ll n;
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else cout<<"No";
 
}

Measured memory_bytes: 3612
S = input()
T = input()
d_st = {}
d_ts = {}
flag = True
for i in range(len(S)):
    if S[i] not in d_st:
        d_st[S[i]] = T[i]
    else:
        if d_st[S[i]] != T[i]:
            flag = False
            break
    if T[i] not in d_ts:
        d_ts[T[i]] = S[i]
    else:
        if d_ts[T[i]] != S[i]:
            flag = False
            break
    
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3632
import math

l,r = [int(u) for u in input().split(" ")]

if math.floor(l/2019)<math.floor(r/2019):
  print(0)
else:
  a = []
  for i in range(l,r+1):
    p = [((i%2019)*j)%2019 for j in set([u%2019 for u in range(i+1,r+1)])]
    if len(p)>0:
      a.append(min(p))
  print(min(a))

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

int main() {
    int n;
    cin >> n;
    int keta = 0;
    int temp = n;
    while (temp != 0) {
        temp /= 10;
        keta++;
    }
    // cout << keta << endl;
    if (keta == 1) {
        cout << n << endl;
    } else if (keta == 2) {
        cout << 9 << endl;
    } else if (keta == 3) {
        cout << 9 + (n-99) << endl;
    } else if (keta == 4) {
        cout << 909 << endl;
    } else if (keta == 5) {
        cout << 909 + (n-9999) << endl;
    } else {
        cout << 90909 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n = int(input())
t_i,a_i = map(int,input().split())
t = []
a = []
t.append(t_i)
a.append(a_i)
for i in range(1,n):
    t_i,a_i = map(int,input().split())
    t.append(t_i)
    a.append(a_i)
    if t[i-1]>t[i] or a[i-1]>a[i]:
        t_max = t[i-1]//t[i]
        if t[i-1]%t[i]!=0:
            t_max += 1
        a_max = a[i-1]//a[i]
        if a[i-1]%a[i]!=0:
            a_max += 1
        bai = max(t_max,a_max)
        t[i] *= bai
        a[i] *= bai
print(t[-1]+a[-1])

Measured memory_bytes: 9184
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)(v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


#define M 100010


int main(){
    IOS;
 	
	string s,t;cin>>s>>t;
	ll x=0;
	rep(i,0,sz(s))if(s[i]!=t[i])x++;
	cout<<x;
 	
 	
    return 0;
}


Measured memory_bytes: 3736
N = int(input())
A = [(int(input()), 0) for i in range(N)]
B = [(int(input()), 1) for i in range(N)]
Object = sorted(A + B)
mod = 10 ** 9 + 7

ans = 1
memo = [0, 0]
for n, x in Object:
    if memo[1 - x] > 0:
        ans = (ans * memo[1 - x]) % mod
        memo[1 - x] -= 1
    else:
        memo[x] += 1

print(ans)


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



int main()
{
	int A, B;
	cin >> A >> B;
	int count = 0;
	int outlet = 1;
	while (outlet<B)
	{
		--outlet;
		outlet += A;
		count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 3608
var n, m, q;
var p = [];
var r = [];

function init(){
	rep(n, function(i){
		p[i] = i;
		r[i] = 0;
	});
}

function find(i){
	return p[i] === i ? i : p[i] = find(p[i]);
}

function same(i, j){
	return find(i) === find(j);
}

function unite(i, j){
	var a = find(i);
	var b = find(j);

	if(a === b){
		return;
	}

	if(r[a] > r[b]){
		p[b] = a;
	}	
	else{
		p[a] = b;
		if(r[a] === r[b]){
			++r[b];
		}
	}
}

function main(){
	n = scan();
	init();
	m = scan();
	rep(m, function(i){
		unite(scan(), scan());
	});
	q = scan();
	rep(q, function(i){
		print(same(scan(), scan()) ? 'yes' : 'no');
	});
}
 
function rep(a, b, c){
	if(c === undefined){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var input = '';
var input_index = 0;
 
function scan(type){
	if(type === 'string'){
		return input[input_index++];
	}
	else{
		return +input[input_index++];
	}
}
 
function print(val){
	console.log(val);
}
 
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.trim().split(/\s+/);
	main();
});

Measured memory_bytes: 43168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int d = b -a;
		int count =0;

		for(int i=d;i>0;i--) {
			count += i;
		}

		int ans = count-b;
		System.out.println(ans);
	}

}



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

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

int main(){
	int t;
	cin>>t;
	int array[t][3];
	int i;
	for(i=0;i<t;i++)cin>>array[i][0]>>array[i][1]>>array[i][2];
	int dp[t][3];
	for(i=0;i<3;i++)dp[0][i]=array[0][i];
	for(i=1;i<t;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+array[i][0];
		dp[i][1]=max(dp[i-1][2],dp[i-1][0])+array[i][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+array[i][2];
	}
	cout<<max(max(dp[t-1][0],dp[t-1][1]),dp[t-1][2])<<endl;
	return 0;
}

Measured memory_bytes: 2560
N, ma, mb = map(int, input().split())
abc = [(-1, -1, -1)]
for _ in range(N):
    a, b, c = map(int, input().split())
    abc.append((a, b, c))

INF = float("inf")

# dp[n][i][j] :=
# n番目までの薬品の組み合わせで、Aがiグラム, 物質Bがjグラムとなる溶液の最小コスト
# N <= 40, a,b <= 10 なので、 i,j <= 400
dp = [[[INF for _ in range(401)] for _ in range(401)] for _ in range(N + 1)]
dp[0][0][0] = 0

for n in range(1, N + 1):
    a, b, c = abc[n]
    for i in range(401):
        for j in range(401):
            # n番目を買うことが出来る場合(=遷移元が存在する場合)
            # 買わない or 買う
            if i >= a and j >= b:
                dp[n][i][j] = min(dp[n - 1][i][j], dp[n - 1][i - a][j - b] + c)
            # n番目を買うことが出来ない場合(=遷移元が存在しない場合)
            else:
                dp[n][i][j] = dp[n - 1][i][j]

ans = INF
# i == j == 0　は不適、1から始める
for i in range(1, 401):
    for j in range(1, 401):
        # i : j = ma : mb を満たしているかどうか
        if i * mb == j * ma:
            ans = min(ans, dp[N][i][j])

if ans != INF:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 138084
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

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

#define bit(n,k) ((n>>k)&1) //*n no k bit me 1 or 0*/

bool ch(ll k, ll h){
  rep(i,30){
    if(bit(k,i)==0 && bit(h,i)==1){
      return false;
    }
  }
  return true;
}

int main(){
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n),b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }

  ll ans = 0;
  vector<ll> op;
  op.emplace_back(k);
  rep(i,30){
    if(bit(k,i)){
      ll msk = 0;
      REP(j,i+1,30){ msk|=(1<<j); }
      ll m2 = 0;
      rep(j,i){ m2|=(1<<j); }
      op.emplace_back((k&msk)|m2);
    }
  }
  for(auto it:op){
    ll tmp = 0;
    rep(j,n)if(ch(it,a[j])){
      tmp += b[j];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#include <algorithm>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int v[3];
    rep(i,0,3)cin>>v[i];
    sort(v,v+3);
    cout<<v[1]-v[0]+v[2]-v[1]<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	t=1;
	while(t--){
	   int x,y;
	   cin>>x>>y;
	   int flag=0;
	   for(int i=0;i<=x;i++){
	   	  int ans=i*2+(x-i)*4;
	   	  if(y%ans==0&&y/ans<=x)
	   	  {
	   	  	flag=1;
	   	  	break;
		  }
	   }
	   if(flag==1)
	   cout<<"Yes\n";
	   else
	   cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
const int max_n = 1e5;
const ll mod = 998244353;
const ll INF = 1LL<<60;
#define fo(i,n) for( ll int i=0;i<n;++i)
#define fos(j,i,n) for(ll int j=i;j<n;++j)
#define N 100004
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define abs(x) (x<0?(-x):x)
#define dis(k) cout << k << endl
#define forr(i,n) for( ll int i= n-1;i>=0;--i)
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
typedef vector< ll int > vi;
typedef vector< vi > vvi;
typedef pair< ll int,ll int > ii;

int main(){
	fast;
	int t;
	t=1;
	//cin >> t;
	while(t--){
		int n,m;
		cin >> n >> m;
		dis((n*(n-1))/2+(m*(m-1))/2);
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define FF first
#define SS second
#define pii pair<int,int>
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(x) (int)x.size()
#define mp make_pair
#define Mod 1000000007
typedef long long int ll;

// dp[i][j] -> Store the probability of j heads upto i terms

int main(){

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

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// #endif

	int n, i, j;
	cin >> n;

	vector<double> prob(n);
	vector<vector<double>> dp(n+1, vector<double>(n+1));

	for(double &x : prob)
		cin >> x;
	dp[0][0] = 1;
	dp[0][1] = 0;

	for(i = 1; i <= n; i++)
		for(j = 0; j <= i; j++)
			dp[i][j] = dp[i-1][j]*(1-prob[i-1]) + (j > 0 ? dp[i-1][j-1]*prob[i-1] : 0);

	double ans = 0;
		for(j = n/2 + 1; j <= n; j++)
			ans += dp[n][j];

	cout<<fixed << setprecision(10) << ans<<"\n";

}

Measured memory_bytes: 70784
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

int main(){
  ll n;
  cin >> n;
  ll ans=0;
  if(n%2==0){
    cout << n/2-1 << endl;
  }else cout << n/2 << endl;
return 0;}

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

class DICE
{
private:
	vector<vector<int>> dice_tem = { {{ 3,2,6,1,5,4 },{ 2,6,3,4,1,5 },
	{ 5,1,3,4,6,2 },{ 4,2,1,6,5,3 },{ 1,2,3,4,5,6 }} }; //{0}:W {1}:N {2}:S {3}:E {4}:defalut   
	const string dice_rl = "AWWWNWWWNWWWWNWWWSWWWSWWW";
	const int n = 6;
	array<int, 6> dice;
	array<int, 6> dice_i;
	array<int, 6> dice_j;
	int a = 4;
	int num = 0;

	void setup() {
		for (int i = 0; i < n; i++) {
			cin >> dice[i];
			dice_i[i] = dice[i];
		}
	}

public:
	const int dice_suffle_num = dice_rl.length();
	DICE() {
		setup();
	}
	void roll_dice() {
		switch (dice_rl[num])
		{
		case 87: //W
			a = 0;
			break;
		case 78: //N
			a = 1;
			break;
		case 83: //S
			a = 2;
			break;
		case 69: //E
			break;
			a = 3;
		default:
			a = 4;
			break;
		}
		for (int i = 0; i < n; i++) dice_j[i] = dice_i[dice_tem[a][i] - 1];
		for (int i = 0; i < n; i++) dice_i[i] = dice_j[i];
		num++;
		if (num >= dice_suffle_num) num = 0;
	}
	int get_pos(int i) {return dice_i[i];}
	int get_base(int i) {return dice[i];}
};

int main() {
	const int n = 6;
	bool flag = true;
	int num;
	cin >> num;
	vector<DICE> dice(num);
	for (int i = 0; i < num - 1; i++) {
		for (int j = i + 1; j < num; j++) {
			for (int k = 0; k < dice[0].dice_suffle_num; k++) {
				dice[j].roll_dice();
				for (int l = 0; l < n; l++) {
					if (dice[i].get_base(l) != dice[j].get_pos(l)) {
						flag = true;
						break;
					}
					flag = false;
				}
				if (flag == false)break;
			}
			if (flag == false)break;
		}
		if (flag == false)break;
	}
	cout << (flag ?"Yes" :"No") << endl;
	return 0;
}



Measured memory_bytes: 3244
// AOJ 0172: Doctor's Research Rooms
// 2018.1.24 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct { char rm; int light; } Q;
Q q[491520]; int top, end;
Q *used[15][32768];

int rm[15][15], s_rm[15];
int sw[15][15], s_sw[15];

char *msg[7] = {0,
"You can go home in %d steps.\n",
"You can not switch off all lights.",
"Help me!",
"Move to room %d.\n",
"Switch on room %d.\n",
"Switch off room %d.\n" };

typedef struct { char msg, rm; } T;
T res[200]; int sz;

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	while (c < '0') c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int n, m, i, j, s, t, ans;
	int room, light;

	while (n = in()) {
		m = in();
		memset(s_rm, 0, sizeof(s_rm));
		memset(s_sw, 0, sizeof(s_sw));

		for (i = 0; i < m; i++){
			s = in()-1, t = in()-1;
			rm[s][s_rm[s]++] = t;
			rm[t][s_rm[t]++] = s;
		}

		light = 0; for (i = 0; i < n; i++) if (in()) light |= 1 << i;

		for (i = 0; i < n; i++) {
			j = in(); while (j--) sw[i][s_sw[i]++] = in()-1;
			qsort(sw[i], s_sw[i], sizeof(int), cmp);
        }

		memset(used, 0, sizeof(used));
		q[0].rm = 0, q[0].light = light; top = 0, end = 1;
		used[0][light] = q;

		ans = 3;
		while (top < end) {
			s = q[top].rm, t = q[top].light;

			if (s == n-1) {
				if (t == 1<<(n-1)) { ans = 1; break; }
				ans = 2;
			}

			for (i = 0; i < s_sw[s]; i++) if (sw[s][i] != s) {
				light = t ^ (1<<sw[s][i]);
				if (used[s][light] == 0) {
					used[s][light] = q + top;
					q[end].rm = s, q[end++].light = light;
				}
			}

			for (i = 0; i < s_rm[s]; i++) {
				room = rm[s][i];
				if (t & (1<<room)) {
					if (used[room][t] == 0) {
						used[room][t] = q + top;
						q[end].rm = room, q[end++].light = t;
					}
				}
			}

			top++;
		}
 
		if (ans > 1) puts(msg[ans]);
		else {
			Q p = q[top];
			sz = 0;
			while (1) {
				Q nxt = *used[p.rm][p.light];
				if (nxt.rm == p.rm && nxt.light == p.light) break;
				if (p.rm != nxt.rm) res[sz].msg = 4, res[sz++].rm = p.rm;
				else for (i = 0; i < n; i++) if ((p.light & (1<<i)) ^ (nxt.light & (1<<i))) {
					if (p.light & (1<<i)) res[sz].msg = 5; else res[sz].msg = 6;
					res[sz++].rm = i;
					break;
				}
				p = nxt;
			}
			printf(msg[ans], sz);
			while (sz--) printf(msg[res[sz].msg], 1 + res[sz].rm);
		}
    }
    return 0;
}


Measured memory_bytes: 5792
import numpy as np

n, k = map(int, input().split())

a = np.arange(n+1, dtype='int')

b = np.cumsum(a)

s = 0

for i in range(k, n+1):
	s += (b[n] - b[n-i]) - b[i-1] + 1
	s = s % 1000000007

s += 1
s = s % 1000000007
print(s)


Measured memory_bytes: 29680