akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(5e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int h, w, c[10][10], ans=0;
    cin >> h >> w;
    REP(i,10)REP(j,10)cin >> c[i][j];
    REP(k,10)REP(i,10)REP(j,10) c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
    REP(i,h*w){
        int a;
        cin >> a;
        if(a>=0)ans += c[a][1];
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>c[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	sort(c,c+n);
	long long l,r,ans=0;
	for (int i = 0; i < n; ++i)
	{
		l = lower_bound(a,a+n,b[i])-a;
		r = upper_bound(c,c+n,b[i])-c;
		ans += (l)*(long long)(n-r);
	}
	cout<<ans<<endl;
	return 0;	
}

Measured memory_bytes: 1408
import java.util.Scanner;

class Cube{
    int[] f;
    Cube(int[] Dice){
        f = new int[6];
        for(int i=0;i<6;i++){
            f[i] = Dice[i];
        }
    }
    
    void roll_z(){
        roll(1,2,4,3);
    }
    void roll_y(){
        roll(0,2,5,3);
    }
    void roll_x(){
        roll(0,1,5,4);
    }
    void roll(int i,int j,int k,int l){
        int t = f[i];
        f[i] = f[j];
        f[j] = f[k];
        f[k] = f[l];
        f[l] = t;
    }
    int getRight(int f0, int f1){
        
        for(int i=0;i < 6;i++){
            for(int j=0;j < 4; j++){
                if(f[0] == f0 && f[1] == f1) return f[2];
                roll_z();
            }
            if(i % 2 == 0)roll_y();
            else roll_x();
        }
        
        return -1;
    }
}

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int[] dice = new int[6];
        
        for(int i=0;i<6;i++){
            dice[i] = sc.nextInt();
        }
        
        Cube CB = new Cube(dice);
        
        int q = sc.nextInt();
        
        for(int i=0;i<q;i++){
            
            int Up = sc.nextInt();
            int Front = sc.nextInt();
            
            int ans = CB.getRight(Up , Front);
            
            System.out.println(ans);
        }
    }
}
                


Measured memory_bytes: 26420
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int main()
{
    int a,b;
    cin >> a  >> b;
    if (a <= 8 && b <= 8) {
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;++i)
  {
    int num;cin>>num;
    if(num%2==0)
    {
		if(num%3!=0 && num%5!=0)
        {
          cout<<"DENIED";return 0;
        }
    }
  }
  cout<<"APPROVED";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
  int am, pm, i;
  char cl[20];
 
  for(i=0;i<9;i++)
    {
      scanf("%s %d %d", &cl, &am, &pm);
      printf("%s %d %d\n", cl, am+pm, am*200+pm*300);
    }
  return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";
#ifndef ONLINE_JUDGE
#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);
#else
#define freopen ios_base::sync_with_stdio(0);cin.tie(0); //Alperen_T
#endif

int main(){
	freopen

	int s, w;
	cin >> s >> w;
	if(w >= s){
		cout << "unsafe";
	}
	else{
		cout << "safe";
	}
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> p(n+1);
  rep(i, n){
    int a, b;
    cin >> a >> b;
    if(i != 0) p.at(i+1) = b;
    else{
      p.at(0) = a;
      p.at(1) = b;
    }
  }
  vector<vector<ll>> dp(n, vector<ll>(n, 0));
  rep2(l, 1, n){
    rep(i, n - l){
      int j = i + l;
      dp.at(i).at(j) = LLONG_MAX;
      rep2(k, i, j){
        ll add = dp.at(i).at(k) + dp.at(k+1).at(j) + p.at(i) * p.at(k+1) * p.at(j+1);
        dp.at(i).at(j) = min(dp.at(i).at(j), add);
      }
    }
  }
  // rep(i, n){
  //   rep(j, n){
  //     printf("%9d ", (int)dp.at(i).at(j));
  //   }
  //   cout << endl;
  // }
  cout << dp.at(0).at(n-1) << endl;
  return 0;
}


Measured memory_bytes: 3180
def sft(n, num, add):
    int_sft = int(num+add)
    if int_sft > n:
        return True
    else:
        l.append(int_sft)
        sft(n, num+add, "3")
        sft(n, num+add, "5")
        sft(n, num+add, "7")

l=[]
n = int(input())
sft(n, "", "3")
sft(n, "", "5")
sft(n, "", "7")
le = []
for i in range(len(l)):
    c3 = str(l[i]).count("3")
    c5 = str(l[i]).count("5")
    c7 = str(l[i]).count("7")
    if c3 > 0 and c5 > 0 and c7 > 0:
        le.append(l[i])
print(len(list(set(le))))

Measured memory_bytes: 7088
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    str S,T,U="";cin>>S>>T;
    U=T;U.erase(T.size()-1);
    if(S.size()+1==T.size()&&U==S){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}


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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;

	cout << 180 * (n - 2) << endl;

	return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void dump(int[][] F) {
    foreach (ref L; F) L.writeln;
    writeln;
}

void main() {
    static const C = 100000;
    int N, M, S;
    int dfs() {
        int x = N * N;
        int[][] dp = new int[][](M + 1, S + 1);
        foreach (i; 0 .. M + 1) dp[i][] = -1;
        dp[0][0] = 1;
        for (int i = x; i >= 0; i--) {
            for (int u = 0; u < M; u++) {
                for (int s = 0; s <= S; s++) {
                    if (s + i > S) break;
                    if (dp[u][s] < 0) continue;
                    if (dp[u + 1][s + i] < 0) dp[u + 1][s + i] = 0;
                    dp[u + 1][s + i] += dp[u][s];
                    dp[u + 1][s + i] %= C;
                }
            }
        }
        return dp[M][S];
    }
    while (scanf("%d %d %d\n", &N, &M, &S), N || M || S) {
        int x = N * N;
        M -= x;
        S -= (x + 1) * x / 2;
        dfs.writeln;
    }
}

Measured memory_bytes: 16592
#include <iostream>
using namespace std;
 
int main(void) {
    int c1, c5, c10, c50, c100, c500;
    cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
    if (((c1*1) + (c5*5) + (c10*10) + (c50*50) + (c100*100) + (c500*500)) < 1000) {
        cout << "0" << endl;
    }
    else {
        cout << "1" << endl;
    }
}


Measured memory_bytes: 3104
n,k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
s = Array.new(n+1,0)
t = Array.new(n+1,0)
for i in 0..n-1
    s[i+1] = s[i]+a[i]
    t[i+1] = t[i]
    t[i+1] += a[i] if a[i] > 0
end

ans = 0
for i in 0..n-k
    res = t[i]+t[-1]-t[i+k]
    res += s[i+k]-s[i] if s[i+k]-s[i] > 0
    ans = res if ans < res
end
puts ans

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 10;
vector<int> g[N];
int dp[N];

int solve(int node)
{
    int &ans = dp[node];
    if(ans != -1)
      return ans;
    ans = 0;
    for(auto &x: g[node])
      ans = max(ans, 1 + solve(x));
    return ans;
}

int main()
{
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for(int i = 0; i < m; i++)
  {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
  }
  memset(dp, -1, sizeof(dp));
  int ans = 0;
  for(int i = 1; i <= n; i++)
    ans = max(ans, solve(i));
  cout << ans;
  return 0;
}


Measured memory_bytes: 7552
#include<iostream>
#include<vector>
#define ll long long int
using namespace std;
int main()
{
	ll n,m,i;
	cin>>n>>m;
	vector<ll>a(n);
	ll sum=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	ll cnt=0;
	for(i=0;i<n;i++)
		if(sum/(4.0*m)<=a[i])cnt++;
	if(cnt>=m)cout<<"Yes";
	else cout<<"No";
}

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

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

#define fs first
#define sc second

inline double distance(P a, P b) {
    return sqrt((a.fs-b.fs) * (a.fs-b.fs) + (a.sc-b.sc) * (a.sc-b.sc));
}

vector<C> p;
int memo[1001];

int dfs(int c, const vector<int> &inner) {
    int &ret = memo[c];
    if (ret >= 0) return ret;
    ret = 0;
    for (auto x : inner) {
        // circle c contains ciecle x ?
        if (distance(p[c].fs, p[x].fs) + p[x].sc + 1e-8 < p[c].sc)
            ret = max(ret, dfs(x, inner));
    }
    return ++ret;
}

int main() {
    int n;
    while (cin >> n, n) {
        P s, t;
        cin >> s.fs >> s.sc >> t.fs >> t.sc;

        p = vector<C>(n);
        vector<int> cs, ct;
        for (int i = 0; i < n; i++) {
            double x, y, r; cin >> x >> y >> r;
            p[i] = {{x, y}, r};

            bool bcs = false, bct = false;
            if (distance(p[i].fs, s) < r) bcs = true;
            if (distance(p[i].fs, t) < r) bct = true;
            if (bcs != bct) {
                if (bcs) cs.push_back(i);
                if (bct) ct.push_back(i);
            }
        }

        int ans = 0;
        memset(memo, -1, sizeof(memo));
        for (int si : cs) for (int ti : ct) {
            if (distance(p[si].fs, p[ti].fs) < p[si].sc + p[ti].sc + 1e-8) continue;
            ans = max(ans, dfs(si, cs) + dfs(ti, ct));
        }
        for (int si : cs) ans = max(ans, dfs(si, cs));
        for (int ti : ct) ans = max(ans, dfs(ti, ct));
        cout << ans << endl;
    }
}



Measured memory_bytes: 3144
#include<iostream>
#include<string.h>
#include<cstdio>
#define NN 1000

using namespace std;

int main(){
  int i,j,n,go[NN],ggo[NN],sum[NN],kane1[NN],kane2[NN],kei[NN];
  char clas[NN][NN];
  
  
  
  

  
  for(i=0;i<9;i++){
  cin >> clas[i]  >> go[i] >> ggo[i];
    sum[i]=go[i]+ggo[i]; //nyuujougoukei
    kane1[i]=go[i]*200;
    kane2[i]=ggo[i]*300;
    kei[i]=kane1[i]+kane2[i];
  }

  for(i=0;i<9;i++){
    cout << clas[i]<< " " << sum[i] << " "<< kei[i] << endl;
  }
  
  
  
  

}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
const int N = 1e6+5;
string s,t;
int a,b;
string u;
int main(){
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if(u == s) a--;
	else if(u == t) b--;
	cout << a <<" " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define inf 200000000
const int maxnodes=1005;
#define ll long long
#define N 301
#define EPS 0.01
#define ld long double



int32_t main()
{
    IOS;

    
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0;i < n;i++)
        cin >> v[i];
    if(n == 1)
    {
        cout << v[0];
        return 0;
    }
    double ans = 0;
    for(int i = 0;i < n;i++)
        ans += (double) 1 / (double) v[i];
    cout << fixed << setprecision(6);
    cout << (double) (1) / (double) (ans);
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
	long long n, i, a[110], x, y, j, s, t;
	scanf("%lld", &n);
	for (i=0, x=-110, y=110; i<n; i++)
	{
		scanf("%lld", &a[i]);
		if (a[i]>x)
		{
			x=a[i];
		}
		if (a[i]<y)
		{
			y=a[i];
		}
	}
	for (i=y, t=100000000000000000; i<=x; i++)
	{
		for (j=0, s=0; j<n; j++)
		{
			s+=(a[j]-i)*(a[j]-i);
		}
		if (s<t)
		{
			t=s;
		}
	}
	printf("%lld\n", t);
	return 0;
}


Measured memory_bytes: 128
// ABC078_C
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll all, TLE;
    cin >> all >> TLE;
    
    // calculation
    ll other = (all - TLE) * 100;
    ll sum_TLE = 1900*TLE;
    cout << pow(2, TLE)*(other + sum_TLE) << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N, K, S;
  cin>>N>>K>>S;

  vector<Int> ans;
  for(Int i=0;i<K;i++) ans.push_back(S);
  for(Int i=0;i<N-K;i++) {
    int v = S/2+1;
    if(v == S) v++;
    ans.push_back(v);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
//#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << endl
using namespace std;
int input() {
	int r;
	cin >> r;
	//scanf("%lld", &r);
	return r;
}
signed main() {
	int h, w, n; cin >> n >> w >> h;
	cout << (n - w + 1) * (n - h + 1) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
  
  char s[5];
  scanf("%s",&s);
  
  for (int i=0; i<3; i++)
    if (s[i+1]==s[i]) {
      printf("Bad");
      return 0;
    }
  
  printf("Good");
  return 0;
}


Measured memory_bytes: 128
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define SIZE 1000100
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define int long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
const int mod = 998244353;
int n, inv[SIZE] = { 0,1 }, cnt[SIZE], tp, maxx = 0, ans[SIZE], res = 0;
signed main() {
	io(); cin >> n;
	rep(i, 1, n) {
		cin >> tp;
		cnt[tp]++;
		maxx = max(maxx, tp);
	}
	rep(i, 2, maxx) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	for (int i = maxx; i; --i) {	//求出gcd为i的所有pair的乘积之和
		int s1 = 0, s2 = 0;
		for (int j = i; j <= maxx; j += i) {
			s1 = (s1 + cnt[j] * j % mod) % mod;
			s2 = (s2 + cnt[j] * j % mod * j % mod) % mod;
		}
		ans[i] = (s1 * s1 % mod - s2 + mod) % mod;
		// s1 - s2 的作用是使得gcd为j的pair对数为 cnt * (cnt - 1)
		for (int j = i + i; j <= maxx; j += i) {
			ans[i] = (ans[i] - ans[j] + mod) % mod;
			//去重，删除gcd为ik (k > 1)的pair
		}
	}
	rep(i, 1, maxx) {	//计算 ans[i] / i % mod
		res = (res + ans[i] * inv[i] % mod) % mod;
	}
	cout << res * inv[2] % mod; //枚举了两遍gcd，res / 2
}

Measured memory_bytes: 23680
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  string w;
  cin >> w;
  vector<int> a(26,0);
  for(int i=0;i<w.size();i++){
    a.at(w.at(i)-'a')++;
  }
  bool flag=true;
  for(int i=0;i<26;i++){
    if(a.at(i)%2!=0)  flag=false;
  }
  if(flag)  cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  ll h, w;
  cin >> h >> w;
  if(h == 1 || w == 1){
    cout << 1 << "\n";
    return 0;
  }
  cout << (h * w + 1) / 2 << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <iomanip>
#include <cmath>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long 
//#define int long long
#define ld long double
#define vi deque<int>
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define iii pair<int,ii>
#define il pair<int,ll>
#define pll pair<ll,ll>
#define _path pair<ll,pair<ll,int> > 
#define vv deque
//#define endl '\n'
#define mp make_pair

using namespace std;

const int MAXN = 100000+5;
const int LOGN = 18;
const int INF = 1e9;

int _next[LOGN][MAXN];

void solve(){
	int n;
	cin >> n;
	int arr[n];
	FOR(i,n)cin >> arr[i];
	int L;cin >> L;
	int lst = n-1;
	for(int i = n-1;i>=0;i--){
		if(i == n-1)_next[0][i] = INF;
		else{
			while(arr[lst] - arr[i] > L)lst--;
			_next[0][i] = lst;
		}
	}
	FOR(i,LOGN){
		if(i == 0)continue;
		FOR(j,n){
			int it = _next[i-1][j];
			if(it == INF)_next[i][j] = INF;
			else _next[i][j] = _next[i-1][it];
		}
	}
	int q;
	cin >> q;
	while(q--){
		int a,b;
		cin >> a >> b;a--;b--;
		if(a > b)swap(a,b);
		if(a == b){
			cout << 0 << endl;
			continue;
		}
		int sum =  0;
		for(int i = LOGN-1;i>=0;i--){
			if(_next[i][a] < b)a = _next[i][a],sum += (1 << i);
		}
		sum ++ ;
		cout << sum << endl;
	}
}


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

Measured memory_bytes: 11024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/* Coding space */
string str;
void calc(int calc_pra){
  int ans = str[0] - '0';
  rep(i,3){
    if(calc_pra&(1<<i)) ans += str[i+1] -'0';
    else ans -= str[i+1] - '0'; 
  }
  if(ans == 7){
  rep(i,3){
    cout << str[i];
    if(calc_pra&(1<<i)) cout << '+';
    else cout << '-'; 
  }
  cout << str[3]<<"=7" << endl;
  exit(0);
  }
}

int main(){
  cin >> str;
  rep(i,INF) calc(i);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        return;

    }

    public static string Solve()
    {
        long MOD = 1000000007;
        long ans = 0;

        int N = ReadInt();
        string S = Read();

        int[] cnt = new int[27];
        for(int i=0;i<N;i++)
        {
            cnt[S[i] - 'a']++;
        }
        //Console.WriteLine(string.Join(", ",cnt));
        ans = 1;
        for(int i=0;i<27;i++)
        {
            ans = (ans * (cnt[i] + 1)) % MOD;
        }
        ans--;
        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 11232
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 2e5 + 5;
 
int n;
int a[N], b[N], c[N], d[N];
 
int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
		c[i] = a[i];
		d[i] = b[i];
	}
	sort(c + 1, c + n + 1);
	sort(d + 1, d + n + 1);
	if(n % 2 == 1)
	{
		int idx = (n + 1) / 2;
		cout << d[idx] - c[idx] + 1;
	}
	else
	{
		int idx = n / 2;
		cout << (d[idx] + d[idx + 1] - c[idx] - c[idx + 1] + 1) << endl;
	}
	return 0;
}

Measured memory_bytes: 9904
use std::io;
use std::cmp;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let N: i32 = iter.next().unwrap().parse().unwrap();
    let M: i32 = iter.next().unwrap().parse().unwrap();
    let X: i32 = iter.next().unwrap().parse().unwrap();
    let Y: i32 = iter.next().unwrap().parse().unwrap();

    let mut maxX: i32 = X;
    let mut minY: i32 = Y;

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    for i in 0..N as i32 {
        let x: i32 = iter.next().unwrap().parse().unwrap();
        maxX = cmp::max(maxX, x);
    }

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    for i in 0..M as i32 {
        let y: i32 = iter.next().unwrap().parse().unwrap();
        minY = cmp::min(minY, y);
    }

    println!("{}", if maxX >= minY { "War" } else { "No War" });
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

using namespace std;

int main() {
    int n; cin >> n;
    vector<string> vec(n);
    for (int i = 0; i < n; i++)
    {
        cin >> vec[i];
        sort(vec[i].begin(), vec[i].end());
    }
    sort(vec.begin(), vec.end());

    long long int ans = 0;
    long long int i = 0;
    long long int j = 0;
    long long int k = 2;

    while (j < n)
    {
        while (j < n && vec[i] == vec[j])
        {
            j++;
        }
        //cout << i << " " << j << endl;
        ans += (j - i) * (j - i - 1) / k;
        i = j;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 7296
using System;

namespace AtCoderConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // 標準入力から1行ずつ取得
            int n = int.Parse(Console.ReadLine());

            string input1 = Console.ReadLine();
            string input2 = Console.ReadLine();

            string[] num1str = input1.Split(' ');
            string[] num2str = input2.Split(' ');

            int[] num1 = new int[n];
            int[] num2 = new int[n];

            for(int i = 0; i < n; i++)
            {
                num1[i] = int.Parse(num1str[i]);
                num2[i] = int.Parse(num2str[i]);
            }

            int max = 0;
            for(int i = 1; i <= n; i++)
            {
                int s = Sum(num1, i) + RevSum(num2, n - i + 1);
                if (max < s)
                {
                    max = s;
                }
            }

            // 標準出力に出力
            Console.WriteLine(max);
        }

        // 逆順の和を求める 最後からn個の和
        static int RevSum(int[] array, int n)
        {
            Array.Reverse(array);
            int sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum += array[i];
            }
            Array.Reverse(array);
            return sum;
        }

        // 昇順の和を求める
        static int Sum(int[] array, int n)
        {
            int sum = 0;
            for(int i = 0; i < n; i++)
            {
                sum += array[i];
            }
            return sum;
        }
    }
}


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

using namespace std;

#define pb push_back
#define mk make_pair
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> ii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

int main (void) {
	ios_base::sync_with_stdio(false);

	int n, a, b;	cin >> n >> a >> b;

	if ((b - a)%2)
		cout << "Borys" << endl;
	else
		cout << "Alice" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int H, A, i, ans=1;
	scanf("%d %d", &H, &A);
	for (i = 0; i < 10000; i++) {
		H = H - A;
		if (H <= 0) {
			break;
		}
		ans++;
	}
  
	printf("%d",ans);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    ll a;
    double b;
    cin >> a >> b;
    //切り捨てられて実際よりも小さい値となるのを防ぐ
    //ll b_ = (ll)(b * 100 + 0.5);
    //切り捨てではなく四捨五入は(l)lroundを使う
    ll b_ = (ll)llround(b * 100);

    ll c = a * b_ / 100;

    cout << c;

}

Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main(){
    for (; ;) {
        int n, r;
        cin >> n >>r;
        if (n==0&&r==0) {
            break;
        }
        vector<int> yama(n);
        for (int i=0; i<n; i++) {
            yama[i]=n-i;
        }
        for (int i=0; i<r; i++) {
            int p ,c;
            cin >> p >> c;
            vector<int> temp(c);
            for (int j=0;j<c; j++) {
                temp[j]=yama[p-1+j];
            }
            for (int j=p-2; j>=0;j--) {
                yama[c+j]=yama[j];
            }
            for (int j=0; j<c; j++) {
                yama[j]=temp[j];
            }
            }
        cout <<yama[0]<<endl;
}
}

Measured memory_bytes: 1196
#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <memory>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <ctime> 
#include <stack>
#include <iostream>
#include <fstream>

#define mp make_pair
#define pb push_back

using ll = long long;
using ld = long double;

using namespace std;

const int MAXN = 200001;

int w[MAXN];

int main() {
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(20);
	ll a, b, c;
	cin >> a >> b >> c;
	ll s = a + b + c;
	for (int iter = 0; iter < 1000000; iter++) {
		if ((a & 1) || (b & 1) || (c & 1)) {
			cout << iter << endl;
			return 0;
		}
		a = (s - a) / 2;
		b = (s - b) / 2;
		c = (s - c) / 2;
	}
	cout << -1 << endl;
	return 0;
}

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

int main(){
    string S, T;
    cin >> S >> T;
    int S_cumulative_sum[S.size() + 1];
    int T_cumulative_sum[T.size() + 1];
    S_cumulative_sum[0] = 0;
    T_cumulative_sum[0] = 0;
    for(int i = 0; i < S.size(); i++){
        S_cumulative_sum[i + 1] = S_cumulative_sum[i] + (S[i] == 'B') + 1;
    }
    for(int i = 0; i < T.size(); i++){
        T_cumulative_sum[i + 1] = T_cumulative_sum[i] + (T[i] == 'B') + 1;
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if((S_cumulative_sum[b] - S_cumulative_sum[a - 1]) % 3 == (T_cumulative_sum[d] - T_cumulative_sum[c - 1]) % 3){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}


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

using namespace __gnu_pbds;
using namespace std;
using namespace std::chrono;

#define ll long long
#define ld long double
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MOD1 998244353
#define MOD2 1000000007

#ifdef LL
const ll INF = 1e18;
#else 
const ll INF = 1e9;
#endif

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

high_resolution_clock::time_point setTime() { return high_resolution_clock::now(); }
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);} //Just add this as a third argument to sort() while sorting an array of pairs; NO NEED FOR ANY ARGUMENTS;
template <typename T>
T fact(T a, T mod){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=mod;} return res; }
template <typename T>
ll powmod(T a,T b,ll m){ ll ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T>
ll power(T a, T b){ ll ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}
template <typename T>
T max3(T a, T b, T c) { return max((max(a,b), max(b,c))); }
template <typename T>
T min3(T a, T b, T c) { return min((min(a,b), min(b,c))); }
template <typename T>
T mid3(T a, T b, T c) { return a+b+c-max3(a,b,c)-min3(a,b,c); }
template <typename T>
T mid(T a, T b) { return min(a,b)+((max(a,b)-min(a,b))/2); }
template <typename T>
T gcd(T a,T b){ return (b?__gcd(a,b):a); }
template <typename T>
T lcm(T a, T b){ return (a*(b/gcd(a,b))); }
template <typename T>
T cl(T a, T b){ return (a+b-1)/b; }
template <typename T>
T to_upper(T s){ return transform(s.begin(), s.end(), s.begin(), ::toupper); }
template <typename T>
T to_lower(T s){ return transform(s.begin(), s.end(), s.begin(), ::tolower); }

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    auto startTime = setTime();

    int n,w;
    cin>>n>>w;

    int u[n],v[n];
    for(int i=0;i<n;i++)
    {
        cin>>u[i]>>v[i];
    }

    ll dp[n+1][w+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++) dp[i][j]=0;
    }

    ll mx=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(j>=u[i-1])
            {
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-u[i-1]]+v[i-1]);
            }
            else
            {
                dp[i][j] = dp[i-1][j];
            }
            mx = max(mx,dp[i][j]);
        }
    }
    cout<<mx<<endl;

    auto stopTime = setTime();
    auto duration = duration_cast<microseconds>(stopTime - startTime);
    //cout<<"Program ran for "<<(ld)duration.count()/1e6<<" "<<"seconds"<<endl;
}


Measured memory_bytes: 82492
#include <iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    for (int i=0; i<s.size(); i++) {
        if (i%2 == 0) {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int N;
vector<vector<int>> G;
int A[101000] = {INF};
int T[101000] = {INF};
int used_a[101000] = {-1};
int used_t[101000] = {-1};

void dfs_a(int node, int depth) {
    used_a[node] = 1;
    A[node] = depth;
    for (auto i : G[node]) {
        if (used_a[i] != 1) {
            dfs_a(i, depth + 1);
        }
    }
}

void dfs_t(int node, int depth) {
    used_t[node] = 1;
    T[node] = depth;
    for (auto i : G[node]) {
        if (used_t[i] != 1) {
            dfs_t(i, depth + 1);
        }
    }
}

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

    cin >> N;
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G.resize(N); // adjacency list

    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs_a(v, 0);
    dfs_t(u, 0);

    int ans = 0;
    REP(i, N) {
        if (A[i] > T[i]) {
            chmax(ans, A[i] - 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(ll i=0;i<N;++i)
const ll INF = 1LL<<60;

int main(){
    ll N,M; cin >> N >> M;
    if(N < M) swap(N,M);
    ll ans = N * M - 2 * (N - 2) - 2 * M;
    if(M == 1){
        ans = N - 2;
        if(N == 1) ans = 1;
        else if(N == 2) ans = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=1e7+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }



void solve() {
    int x,y;
    cin>>x>>y;
    
    int f=0;
    
    rep1(i,0,x) {
		  int yo=i*2+(x-i)*4;
		  if(yo==y) f=1;
		}
		
		if(f) cout<<"Yes\n";
        else cout<<"No\n";
       					   
 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define RN cout << "\r\n";
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

// combination
const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// gcd, lcm
//ll gcd(ll a, ll b, vector<vector<ll>>& memo) {
//    if (memo[a][b]) {
//        return memo[a][b];
//    }
//    if (b == 0) {
//        memo[a][b] = a;
//        return a;
//    }
//    memo[a][b] = memo[b][a % b];
//    return gcd(b, a % b, memo);
//}
ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
//ll lcm(ll a, ll b) {
//    return a / gcd(a, b) * b;
//}


int main() {
//    vector<vector<ll>> memo;
//    memo = vector<vector<ll>>(1000000000, vector<ll>(1000000000, 0));
    ll n, x, first, ans;
    cin >> n >> x >> first;
    ans = abs(x - first);
    x = first;
    REP(i, n - 1) {
        ll y;
        cin >> y;
        ans = gcd(ans, abs(x - y));
        x = y;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int N, K;
    scan(N, K);

    auto x = new int[](N), y = new int[](N);

    iota(N).each!(i => scan(x[i], y[i]));

    auto xa = x.dup(), ya = y.dup();
    xa.sort();
    ya.sort();

    long ans = 1L * (xa[$ - 1] - xa[0]) * (ya[$ - 1] - ya[0]);

    foreach (xi ; 0 .. N) {
        foreach (xj ; xi + 1 .. N) {
            foreach (yi ; 0 .. N) {
                foreach (yj ; yi + 1 .. N) {
                    int xl = xa[xi], xr = xa[xj];
                    int yb = ya[yi], yt = ya[yj];

                    int cnt;
                    foreach (l ; 0 .. N) {
                        if (xl <= x[l] && x[l] <= xr && yb <= y[l] && y[l] <= yt) cnt++;
                    }

                    if (cnt >= K) {
                        ans = min(ans, 1L * (xr - xl) * (yt - yb));
                    }
                }
            }
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define rep(a,n,b) for(int  i=a;i<n;i+=b)
#define rrep(a,n,b) for(int i=n;i>=a;i-=b)
#define iter(obj) for(auto x : obj) 
#define pb(i) push_back(i)
#define ff first
#define ss second
#define pchr(flag) cout<<(flag ? "YES" : "NO")
#define ll long long int
#define input freopen("input.txt","r",stdin)
#define op freopen("output.txt","w",stdout);
#define fastio std::ios::sync_with_stdio(false)
using namespace std;
const int N = 2e5+7;
const int MOD  = 1000000007;
const float PI = 3.1415926535;
//33333333333;
int prime[N];
int arr[N];
void SieveOfEratosthenes(int n) 
{ 
     for (int p=2; p*p<=n; p++) {
        if (prime[p] == 0)  {
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 1; 
        } 
    } 
} 
int main() 
{ 
	// input;
	fastio;
	int a,b;
	cin>>a>>b;
	arr[a]  = 1;
	arr[b]  = 1;
	rep(1,4,1) {
		if(!arr[i])  {
			cout<<i;
			return 0;
		}
	}
 }
 


Measured memory_bytes: 256
import java.util.Scanner;
class Main {
public static void main(String...args){
Scanner in = new Scanner(System.in);
while(in.hasNext()) {
double[] s = new double[10];
double a=in.nextDouble();
double ans=s[0]=a;
for(int i=1;i<10;i++){
if(i%2!=0) s[i]=s[i-1]*2;
else s[i]=s[i-1]/3;
ans+=s[i];
}
System.out.println(ans);
}
}
}

Measured memory_bytes: 19288
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
using namespace std;

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

int main(){
    int a,b,c; cin >> a >> b >> c;
  	int ans;
 	if(a > b && a > c) ans = (b * c) / 2;
  else if(b > a && b > c) ans = (a * c) / 2;
  else ans = (a*b) / 2;
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
import math
MAX = 123456
def sieve (n):
	prime = [0,0]
	prime += [1 for i in range(n-1)]
	ub = math.sqrt(n) + 1
	d = 2
	while d <= ub:
		if prime[d] == 0:
			d += 1
			continue
		prod = 2
		while d * prod <= n:
			prime[d*prod] = 0
			prod += 1
		d += 1
	return prime
prime = sieve(2 * MAX)
while 1:
	n = int(raw_input())
	if n == 0:
		break
	print sum(prime[n+1:2*n+1])

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

int main() {
  int N; cin >> N;
  vector<tuple<string, int, int>> list;
  for (int i = 1; i <= N; i++) {
    string S;
    int P;
    cin >> S >> P;
    P *= -1;
    list.push_back(tie(S, P, i));
  }
  sort(list.begin(), list.end());
  for (int i = 0; i < N; i++) {
    cout << get<2>(list.at(i)) << endl;
  }
}

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

n, k = [int(x) for x in input().split()]
xy = []
for _ in range(n):
    xy.append([int(x) for x in input().split()])
ans = float('inf')
xy.sort()
for i in range(n):
    left = xy[i][0]
    y = [xy[i][1]]
    for j in range(i + 1, n):
        right = xy[j][0]
        y.append(xy[j][1])
        y.sort()
        if j - i + 1 < k:
            continue
        for p in range(len(y)):
            bottom = y[p]
            for q in range(len(y)):
                if q - p + 1 < k:
                    continue
                top = y[q]
                ans = min(ans, (right - left)*(top - bottom))
print(ans)


Measured memory_bytes: 41964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }


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

ll lcm(ll a, ll b){
	ll t = gcd(a, b);
	return a / t * b;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<ll> t(n);
	rep(i,n) cin >> t.at(i);
	ll ans = t.at(0);
	rep(i,n){
		ans = lcm(ans, t.at(i));
	}
	cout << ans << endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

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

  n--;
  k--;

  int ans = (n%k == 0) ? n/k : n/k+1;

  cout << ans << endl;
}

Measured memory_bytes: 640