akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using ll=long long;
void construct_sa(string S, vi &sa){
    int N=S.size();
    vi rank(N+1);
    for (int i = 0; i <= N; i++){
        sa[i]=i;
        rank[i]=i<N ? S[i] : -1;
    }
    vi tmp(N+1);
    for (int k = 1; k <=N ; k*=2){
        auto compare_sa=[&rank,k,N](auto const& l, auto const& r){
            if(rank[l]!=rank[r])return rank[l]<rank[r];
            else{
                int ri= l+k<=N ? rank[l+k] : -1;
                int rj= r+k<=N ? rank[r+k] : -1;
                return ri<rj;
            }
        };
        sort(sa.begin(),sa.begin()+N+1,compare_sa);
        tmp[sa[0]]=0;
        for (int i = 1; i <=N ; i++){
            tmp[sa[i]]=tmp[sa[i-1]] + (compare_sa(sa[i-1],sa[i]) ? 1 : 0);
        }
        for (int i = 0; i <=N ; i++){
            rank[i]=tmp[i];
        }
    }
}
void construct_lcp(string S, vi &sa, vi &lcp){
    int N=S.size();
    vi rank(N+1);
    for (int i = 0; i <=N ; i++)rank[sa[i]]=i;
    int h=0;
    lcp[0]=0;
    for (int i = 0; i < N; i++){
        int j=sa[rank[i]-1];
        if(h>0)h--;
        for (; j+h<N && i+h<N; h++){
            if(S[j+h]!=S[i+h])break;
        }
        lcp[rank[i]-1]=h;
    }
}
int main() {
    int N; cin>>N;
    string S; cin>>S;
    vi sa(N+1),lcp(N+1);
    construct_sa(S,sa);
    construct_lcp(S,sa,lcp);
    int ans=0;
    for (int i = 0; i <= N; i++){
        for (int j = i+1; j <= N; j++){
            ans=max(ans,min(min(lcp[i],abs(sa[i]-sa[j])),N/2));
            if(lcp[i]>lcp[j])break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3732
#include <iostream>

using namespace std;

int findSumOfDigits (int n){
  int sum =0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main (){
  int N;
  cin >> N;
  
  int sum = findSumOfDigits(N);
  
  if((N % sum) == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"AA Baju Smit------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 1000003
#define ciN cin
////////////////////////////////////////////////////////////////
//Ha Moj Ha///
////////////////////////////////////////////////////////////////

void jabru() {
	int n; ciN >> n;
	if (n >= 30)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}




////////////////////////////////////////////////////////////////
//Bas aabaju nai javanu///
////////////////////////////////////////////////////////////////

int main() {
	//int t; cin >> t;
	//while (t--)
	jabru();

	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//Kai baju bhai???


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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    void Calc()
    {
        cin = new Scanner();

        int k = cin.nextInt();
        int s = cin.nextInt();

        int ans = 0;

        int max = k;

        if (s < k)
        {
            max = s;
        }

        for (int i = 0; i <= max; ++i)
        {
            int yzTmp = s - i;

            // yとzを足してyzTmpになる組み合わせの数
            if (yzTmp > max * 2) { continue; }

            for (int j = 0; j <= Math.Min(yzTmp, max); ++j)
            {
                if (yzTmp - j > max) { continue; }
                ++ans;
            }
        }


        Console.WriteLine(ans);
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<ctime>
#include<random>
#include<algorithm>
#define ll long long
using namespace std;

int n;
ll k;
ll a[120000];
ll s[50][2];
ll pow2[60];
ll allS[60];
ll f[60];
bool flag[60];

void init()
{
    pow2[0]=1;
    for (int i=1; i<=55; ++i)
        pow2[i]=pow2[i-1]*2;
}


ll dp(int loc)
{
    if (loc<0) return 0;
    if (flag[loc]) return f[loc];
    flag[loc]=1;
    if ((pow2[loc]&k)==0)
        f[loc]=(s[loc][0]+dp(loc-1));
    if ((pow2[loc]&k)>0)
        f[loc]=max(s[loc][1]+dp(loc-1),s[loc][0]+((loc==0)?0:allS[loc-1]));
    return f[loc];
}


int main()
{
    init();
    scanf("%d",&n);
    scanf("%lld",&k);
    for (int i=0; i<n; ++i)
        scanf("%lld",&a[i]);
    for (int i=0; i<n; ++i)
    {
        for (int j=0; j<50; ++j)
        {
            if ((pow2[j]&a[i]))
                s[j][0]+=pow2[j];
            else
                s[j][1]+=pow2[j];
        }
    }
    for (int i=0; i<50; ++i)
    {
        if (i>0) allS[i]=allS[i-1];
        allS[i]+=max(s[i][0],s[i][1]);
    }
    cout<<dp(49)<<endl;
    return 0;
}


Measured memory_bytes: 1024
import Data.List.Split

toInt :: String -> Int
toInt = read ::String -> Int

countDigits :: Int -> Int -> Int
countDigits n k 
  | n == 0 = 0
  | otherwise = 1 + countDigits (div n k) k

main = do
  s <- getLine
  let l = splitOn " " s
  let n = toInt (l!!0)
  let k = toInt (l!!1)
  putStrLn $ show $ countDigits n k


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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

ll f(pii a, pii b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}

int main() {
  ll H, W, D;
  cin >> H >> W >> D;

  vvi A(H, vi(W));
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }

  ll Q;
  cin >> Q;

  vi L(Q), R(Q);
  for (ll i = 0; i < Q; i++) {
    cin >> L[i] >> R[i];
  }

  unordered_map<ll, pii> m1;
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      m1[A[i][j]] = make_pair(i, j);
    }
  }

  unordered_map<ll, ll> m2;
  for (ll i = 0; i < D; i++) {
    for (ll j = (i == 0 ? D : i); j <= H * W; j += D) {
      if (j <= D) {
        m2[j] = 0;
      } else {
        m2[j] = m2[j - D] + f(m1[j], m1[j - D]);
      }
    }
  }

  for (ll i = 0; i < Q; i++) {
    cout << m2[R[i]] - m2[L[i]] << endl;
  }
}

Measured memory_bytes: 12452
import Control.Monad
import Data.List

isOverlapped :: [Int] -> [Int] -> Bool
isOverlapped [from1, to1] [from2, to2] = not isNotOverlapped
  where isNotOverlapped = (to2 <= from1) || (to1 <= from2)

toOverlapped :: [Int] -> [Int] -> [Int]
toOverlapped [from1, to1] [from2, to2] = [max from1 from2, min to1 to2]

toBridges :: [Int] -> [[Int]] -> [[Int]]
toBridges bridge [] = [bridge]
toBridges bridge (r:rs)
  | isOverlapped bridge r = toBridges (toOverlapped bridge r) rs
  | otherwise             = bridge:toBridges r rs

sortRequests :: [[Int]] -> [[Int]]
sortRequests list = sortBy ordering list
  where ordering = (\[from1, to1] [from2, to2] -> compare (from1, to1) (from2, to2))

solve :: [[Int]] -> [[Int]]
solve (r:rx) = toBridges r rx

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  requests <- replicateM m $ map read . words <$> getLine
  let result = solve $ sortRequests requests
  print $ length result

Measured memory_bytes: 92540
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <cstdio> 
#define N 100000+5
using namespace std; 
int main(){
	char s[N];
	cin >> s;
	int ans=0;
	for(int i=1; i<strlen(s); i++){
		if(s[i] != s[i-1]){
			ans++;
		}
		else{
			continue;
		}
	} 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define com(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define pri(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<endl;
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
    boost;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x = a*c;
    ll y = a*d;
    ll z = b*c;
    ll w = b*d;
    cout<<max({x,y,z,w})<<"\n";
}

Measured memory_bytes: 3644
from collections import deque
s=deque(input())
q=int(input())
flag = True

for i in range(q):
    query=input().split()
    if query[0] == "1":
        flag = not flag
    elif query[1] == "1" and flag or query[1] == "2" and not flag :
         s.appendleft(query[2])
    else:
        s.append(query[2])

if not flag:
    s.reverse()

print("".join(s))


Measured memory_bytes: 8564
#define C
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
#if C
        var N = long.Parse(ReadLine());
        var ABCDE = new long[5];
        for (int i = 0; i < 5; i++)
        {
            ABCDE[i] = long.Parse(ReadLine());
        }
        WriteLine((N + ABCDE.Min() - 1) / ABCDE.Min()+4);
        return;
#else
        var XYZK = ReadLine().Split().Select(int.Parse).ToArray();
        var X = XYZK[0];
        var Y = XYZK[1];
        var Z = XYZK[2];
        var K = XYZK[3];
        var A = ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
        var B = ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
        var C = ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
        var i = 0;
        var j = 0;
        var k = 0;
        var b = true;
        while (K != 0)
        {
            WriteLine(A[i] + B[j] + C[k]);
            var m = long.MaxValue;
            var c = 'd';
            if (i + 1 < X)
            {
                if (A[i] - A[i + 1] < m)
                {
                    m = A[i] - A[i + 1];
                    c = 'a';
                }
            }
            if (j + 1 < Y)
            {
                if (B[j] - B[j + 1] < m)
                {
                    m = B[j] - B[j + 1];
                    c = 'b';
                }
            }
            if (k + 1 < Z)
            {
                if (C[k] - C[k + 1] < m)
                {
                    m = C[k] - C[k + 1];
                    c = 'c';
                }
            }
            if (c == 'a') i++;
            else if (c == 'b') j++;
            else k++;
            K--;
        }
#endif
    }
}


Measured memory_bytes: 13268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * Frog Going Straight
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		line = br.readLine();

		int D, L;
		D = parseInt(line.substring(0, line.indexOf(' ')));
		L = parseInt(line.substring(line.indexOf(' ') + 1));

		System.out.println(D / L + (D % L));
	}
}

Measured memory_bytes: 24432
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define INF 0x3f3f3f3f

typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<double,double> pdd;
ll n,p,k;
ll l[100005];
int main()
{
  IOS;
    while(cin>>n)
    {
        rep(i,n) cin>>l[i];
        sort(l,l+n);
        ll ans=0;
        rep(i,n)
        {
            for(int j=i+1;j<n;j++)
            {
                for(int k=j+1;k<n;k++)
                {
                    if(l[i]+l[j]>l[k]) ans++;
                }
            }
        }
        cout<<ans<<"\n";
    }

    return 0;
}



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

int main(){
  int n;
  cin >> n;
  double count = 0;
  for(int i = 0; i < n; i++){
    double a;
    cin >> a;
    count += 1 / a;
  }
  cout << 1 / count << endl;
}

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

using ll = long long;
using VI = vector<ll>;
using VVI = vector<VI>;

void compress(VI &v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}

ll idx(VI &v, ll i) { return lower_bound(v.begin(), v.end(), i) - v.begin(); }

int main() {
  ll n, m;
  cin >> n >> m;
  VI p(m), ps(m), y(m), ys(m);

  for (int i = 0; i < m; i++) {
    cin >> p[i] >> y[i];
    ps[i] = p[i];
    ys[i] = y[i];
  }

  compress(ps);
  compress(ys);
  VVI tbl = VVI(ps.size() + 1);

  for (int i = 0; i < m; i++) {
    ll tp = idx(ps, p[i]);  // [ps.begin, ps.end] <=> 0〜ps.size()
    tbl[tp].push_back(y[i]);
  }
  for (auto &&pp : ps) {
    ll tp = idx(ps, pp);
    sort(tbl[tp].begin(), tbl[tp].end());
  }

  for (int i = 0; i < m; i++) {
    ll tp = idx(ps, p[i]);
    auto itr = lower_bound(tbl[tp].begin(), tbl[tp].end(), y[i]);
    ll ty = (itr - tbl[tp].begin()) + 1;
    printf("%06lld%06lld\n", p[i], ty);
  }
  return 0;
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int K, X;
    cin >> K >> X;
    int left = max(-1000000, X - K + 1);
    int right = min(1000000, X + K - 1);
    for(int i = left; i <= right; i++) {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main(){
    string s;
    cin>>s;
    int ans=0, now=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            now++;
            chmax(ans, now);
        }else{
            now=0;
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int cnt[32];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		int c;scanf("%d",&c);
		for(int j=0;j<c;j++){
			int d;scanf("%d",&d);d--;
			cnt[d]++;
		}
	}
	int ret=0;
	for(int i=0;i<b;i++)if(cnt[i]==a)ret++;
	printf("%d\n",ret);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<long long>v,init;
    for(int i=1;i<=n;i++){
        long long x;
        cin>>x;
        init.push_back(x);
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    long long x=v[n/2-1];
    for(int i=0;i<init.size();i++){
        if(init[i]<=x)
            cout<<v[n/2]<<endl;
        else
            cout<<x<<endl;
    }
}

Measured memory_bytes: 7012
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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;
}

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;

    vector<int> ans(N, 0);

    for (int p = 1; p <= N; p++) {
        // cout << "=== " << p << " ===" << endl;
        vector<int> dist(N + 1, -1);
        queue<int> q;
        q.push(p);
        dist[p] = 0;

        while (!q.empty()) {
            int i = q.front();
            q.pop();

            // cout << i << endl;

            int d = dist[i];

            if (i - 1 >= 1 && dist[i - 1] == -1) {
                q.push(i - 1);
                dist[i - 1] = d + 1;
            }

            if (i + 1 <= N && dist[i + 1] == -1) {
                q.push(i + 1);
                dist[i + 1] = d + 1;
            }

            if (i == X && dist[Y] == -1) {
                q.push(Y);
                dist[Y] = d + 1;
            }
            if (i == Y && dist[X] == -1) {
                q.push(X);
                dist[X] = d + 1;
            }
        }

        for (int i = 1; i <= N; i++) {
            ans[dist[i]]++;
        }
    }

    for (int i = 1; i <= N - 1; i++) {
        cout << ans[i]/2 << endl;
    }

    return 0;
}


Measured memory_bytes: 888
n = int(input())
s = input()
start = ["WW","SS","WS","SW"]
for i in start:
    now = i
    for j in range(2,n):
        if now[j-1] == "S":
            if s[j-1] == "o":
                if now[j-2] == "S":
                    now += "S"
                elif now[j-2] == "W":
                    now += "W"
            elif s[j-1] == "x":
                if now[j-2] == "S":
                    now += "W"
                elif now[j-2] == "W":
                    now += "S"
        elif now[j-1] == "W":
            if s[j-1] == "o":
                if now[j-2] == "S":
                    now += "W"
                elif now[j-2] == "W":
                    now += "S"
            elif s[j-1] == "x":
                if now[j-2] == "S":
                    now += "S"
                elif now[j-2] == "W":
                    now += "W"
    if now[0] == "S":
        if s[0] == "o":
            if now[1] != now[-1]:
                continue
        elif s[0] == "x":
            if now[1] == now[-1]:
                continue
    elif now[0] == "W":
        if s[0] == "o":
             if now[1] == now[-1]:
                 continue
        elif s[0] == "x":
            if now[1] != now[-1]:
                continue
            
    if now[-1] == "S":
        if s[-1] == "o":
            if now[0] == now[-2]:
                print(now)
                exit()
        elif s[-1] == "x":
            if now[0] != now[-2]:
                print(now)
                exit()
    elif now[-1] == "W":
        if s[-1] == "o":
            if now[0] != now[-2]:
                print(now)
                exit()
        elif s[-1] == "x":
            if now[0] == now[-2]:
                print(now)
                exit()
print(-1)

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;
	string s;
	cin >> s;
	if (n%2 == 0 && s.substr(0, n/2) == s.substr(n/2)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    static final int INF = Integer.MAX_VALUE / 2;
    static int V = 10;
    static int[][] c = new int[V][];

    public static void main(String[] args) {
        int H = in.i();
        int W = in.i();
        Arrays.setAll(c, i -> in.ii(V));
        int[][] d = WarshallFloyd();

        int ans = 0;
        for (int i = 0, N = H * W; i < N; i++) {
            int a = in.i();
            if (a > -1) {
                ans += d[a][1];
            }
        }

        out.println(ans);
    }

    static int[][] WarshallFloyd() {
        int[][] d = c;

        for (int k = 0; k < V; k++) {
            for (int i = 0; i < V; i++) {
                for (int j = 0; j < V; j++) {
                    int t = d[i][k] + d[k][j];
                    if (t < d[i][j]) {
                        d[i][j] = t;
                    }
                }
            }

        }
        return d;
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 36352
N = int(input())
DP = [[0]*4 for _ in range(N)]
MOD = 10**9+7
for i in range(N):
    if i == 0:
        DP[i][0] = 8
        DP[i][1] = 1
        DP[i][2] = 1
        DP[i][3] = 0
        continue
    DP[i][0] = (DP[i-1][0] * 8) % MOD
    DP[i][1] = (DP[i-1][1] * 9) %MOD + (DP[i-1][0]) % MOD
    DP[i][2] = (DP[i-1][2] * 9) % MOD + ( DP[i-1][0]) % MOD
    DP[i][3] = (DP[i-1][3] * 10)% MOD + DP[i-1][1] % MOD+ DP[i-1][2] % MOD

print(DP[-1][3]%MOD)

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

int main() {
    int H,W;
    cin >> H >> W;

    vector<string> str(H);
    for (int i=0;i<H;i++) cin>>str.at(i);
    
    for (int i=0;i<W+2;i++) cout << '#';
    cout << endl;
    for (int i=0;i<H;i++){
        cout << '#' << str.at(i) << '#' << endl;
    }
    for (int i=0;i<W+2;i++) cout << '#';
    cout << endl;
}


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

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    vector<int> A(N+1); repp(i,0,N) cin >> A[i];
    vector<int> O(N+1);

    repp(i,0,N) {
        O[A[i] - 1] = i; 
    }
    repp(i,0,N) {
        if (i > 0) cout << ' ';
        cout << O[i] + 1;
    }
    cout << endl;

}


Measured memory_bytes: 1664
N = int(input())
A = [int(s) for s in input().split(" ")]

sum = 0
m = 1e10  # 絶対値の最小値
negativeCount = 0
for i in range(N):
    sum += abs(A[i])
    m = min(m, abs(A[i]))
    if A[i] < 0:
        negativeCount += 1

if negativeCount % 2 == 1:
    sum -= m * 2

print(sum)

Measured memory_bytes: 14224
import math
from functools import lru_cache

K = int(input())
ans = 0

@lru_cache(maxsize=1000)
def main(K):
    g=0
    for i in range(1,K+1):
        for j in range(1,K+1):
            for k in range(1,K+1):
                g += math.gcd(math.gcd(i, j), k)
    return (g)
 
print(main(K))

Measured memory_bytes: 9580
#include<iostream>
using namespace std;
int main(){
    while(1){
        int x,y;
        cin >>x>>y;
        if(x==0 && y==0)break;
        for(int i=1;i<=x;i++){
            for(int j=1;j<=y;j++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3112
from itertools import count

n = int(input())

prime_factor = {}
while n % 2 == 0:
    prime_factor[2] = prime_factor.get(2, 0) + 1
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        prime_factor[f] = prime_factor.get(f, 0) + 1
        n //= f
    else:
        f += 2
if n != 1:
    prime_factor[n] = prime_factor.get(n, 0) + 1

res = 0
for v in prime_factor.values():
    for i in count(1):
        if i > v:
            break
        res += 1
        v -= i

print(res)


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

bool is_prime(ll n){
    for(ll i = 2; i*i <= n; i++){
        if(n%i == 0)return false;
    }
    return n != 1;
}

int main(){
    ll x;
  	cin>>x;
    ll p = x;
    while(!is_prime(p))p++;

    cout<< p <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int k;cin>>k;
    while(k>0){
        if(a>=b){

            b*=2;
            k-=1;
            continue;
        }
        else if(b>=c){
            c*=2;
            k-=1;
            continue;
        }
        else{
            cout<<"Yes"<<endl;
            return 0;

        }
    }
    if(a<b&&b<c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


}

Measured memory_bytes: 3628
#include <cstdio>

using namespace std;

int main() {
  long long h, n;
  long long N;
  scanf("%lld", &N);
  long long ansh, ansn, answ;
  for (h = 1; h <= 3500; h++) {
    for (n = h; n <= 3500; n++) {
      if (4*h*n - N*h - N*n <= 0) {
	continue;
      }
      if ((N*h*n) % (4*h*n - N*h - N*n) != 0) {
	continue;
      }
      ansh = h;
      ansn = n;
      answ = (N*h*n) / (4*h*n - N*h - N*n);
      break;
    }
  }
  printf("%lld %lld %lld", ansh, ansn, answ);
  return 0;
}


Measured memory_bytes: 256
//--------------------------------------------------------------------------------
// Code By:
//					######                  #               ######
//					##   #                  #               #
//					#####      ##       #####      ##       #   ###
//					##   #              #   #               #   # #
//					##    #	            #####               ##### #
//---------------------------------------------------------------------------------

#include<bits/stdc++.h>
using namespace std;

                             /* ----------------------------- START of Template ---------------*/
#define ll long long int
#define FOR(x,to) for(x=0;x<(to);x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<long long int> >
#define vll vector<long long int>
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SZ(X) ((int)(X).size())
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second

void getZarr(string str, vll &Z)
{
    ll n = str.length();
    ll L, R, k;
    L = R = 0;
    for (ll i = 1; i < n; ++i)
    {
        if (i > R)
        {
            L = R = i;
            while (R<n && str[R-L] == str[R])
                R++;
            Z[i] = R-L;
            R--;
        }
        else
        {
            k = i-L;
            if (Z[k] < R-i+1)
                Z[i] = Z[k];
            else
            {
                L = i;
                while (R<n && str[R-L] == str[R])
                    R++;
                Z[i] = R-L;
                R--;
   } } }}
vector<ll>isprime;
void seive(ll size){
	isprime.resize(size+1,1);
	ll i,j;
	isprime[0]=0;
	isprime[1]=0;
	for(i=2;i*i<=size;i++){
		if(isprime[i]){
			for(j=2;j*i<=size;j++)isprime[i*j]=0;
		}
	}
}
ll power(ll x,unsigned ll y, ll m){
	if(y==0)return 1;
	ll p=power(x,y/2,m);
	p=(p*p)%m;
	if(y%2!=0)p=(p*x)%m;
	return p;
}
ll modinverse(ll a,ll m){
	return power(a,m-2,m);
}


                       /* ----------------------          End Of Template --------------------------------*/

ll findans(){
	ll n,k,i;
	cin>>n>>k;
	vll v(n);
	for(i=0;i<n;i++)cin>>v[i];
//	for(i=0;i<k;i++)
	ll l=0,r=k-1;
	for(i=k;i<n;i++){
		ll a=v[l++];
		ll b=v[i];
		if(b>a)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;



}

int main(){
	ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll t,i;
//	cin>>t;
t=1;
	for(i=0;i<t;i++){
		findans();
	}
return 0;
}





Measured memory_bytes: 4780
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  cout << A * B << endl;
  return 0;
}


Measured memory_bytes: 3652
/*
 * 2613.cc: Unordered Operators
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int ON = 3;

typedef long long ll;
const ll LMINF = 1LL << 63;

/* typedef */

/* global variables */

int prs[ON];

/* subroutines */

int op_pr(char c) {
  switch (c) {
  case '*': return prs[0];
  case '+': return prs[1];
  case '-': return prs[2];
  }
  return -1;
}

ll num(string &s, int &pos) {
  ll n = 0;
  while (pos < s.size() && s[pos] >= '0' && s[pos] <= '9')
    n = n * 10 + s[pos++] - '0';
  return n;
}

ll expr(string &s, int &pos, int p = 0) {
  if (p >= ON) {
    if (s[pos] == '(') {
      pos++; // '('
      ll e = expr(s, pos, 0);
      pos++; // ')'
      return e;
    }

    return num(s, pos);
  }

  ll e0 = expr(s, pos, p + 1);
  while (pos < s.size() && op_pr(s[pos]) == p) {
    char op = s[pos++]; // '*', '+', '-'
    ll e1 = expr(s, pos, p + 1);

    switch (op) {
    case '*': e0 *= e1; break;
    case '+': e0 += e1; break;
    case '-': e0 -= e1; break;
    }
  }

  return e0;
}

/* main */

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

  ll maxe = LMINF;

  for (;;) {
    int pos = 0;
    ll e = expr(s, pos);
    if (maxe < e) maxe = e;

    int k = 0;
    while (k < ON) {
      if (++prs[k] < ON) break;
      prs[k++] = 0;
    }
    if (k >= ON) break;
  }

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

Measured memory_bytes: 1188
S = input()
Q = int(input())

tep = 1
top = ""
bottom = ""
for t in range(Q):
    query = [i for i in input().split()]
    if query[0]=="1":
       tep =tep * (-1) 
    if query[0]=="2":
        F = int(query[1])
        C = query[2]
        if F==1:
            if tep ==1:
                top = C + top
            else:
                bottom = bottom + C
        if F==2:
            if tep ==-1:
                top = C + top
            else:
                bottom = bottom + C


ans = top + S + bottom
if tep==1:
    print(ans)

else:
    print(ans[::-1])


Measured memory_bytes: 4592
/*AOJ 0027*/

#include<iostream>
using namespace std;

int main(){

	int day[12]={31,29,31,30,31,30,31,31,30,31,30,31};

	int sum = 0;

	int month=0,date = 0;

	while(cin>>month){
		cin>>date;

		if(month == 0){
			break;
		}
		sum = 0;

		for(int i=0;i<month;i++){
			if(month != i+1){
				sum+= day[i];
			}
		}
		sum += date;
		
		if(sum%7==1){
			cout<<"Thursday"<<endl;
		}
		else if(sum%7 == 2){
			cout<<"Friday"<<endl;
		}
		else if(sum%7 == 3){
			cout<<"Saturday"<<endl;
		}
		else if(sum%7 == 4){
			cout<<"Sunday"<<endl;
		}
		else if(sum%7 == 5){
			cout<<"Monday"<<endl;
		}
		else if(sum%7 == 6){
			cout<<"Tuesday"<<endl;
		}
		else{
			cout<<"Wednesday"<<endl;
		}
	}

	
	return 0;
}

Measured memory_bytes: 0
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
 
p = [K-Q]*N
for i in range(Q):
  p[A[i]-1] += 1
  
for i in range(N):
  if p[i] > 0: print('Yes')
  else: print('No')

Measured memory_bytes: 15268
import sys

N = int(input())
W = list(map(int, input().split()))
S1=S2=0
abstack=65535
count=0

while count!=(N-1):
    for x in range(0, count+1):
        S1+=W[x]

    for y in range(count+1, N):
        S2+=W[y]

    if(abstack>abs(S1-S2)):
        abstack=abs(S1-S2)

    S1=S2=0
    count+=1

print(abstack)

Measured memory_bytes: 3064
#include<iostream>
#include <cmath>
using namespace std;
int main()
{
    long long n;
    cin >> n;
    if(n%2==1){
        cout << 0;
    }else{
        long long ans = 0;
        long long po = 2;
        for(int i=1;i<=26;i++){
            po = po * 5;
            ans += n/po;
        }
        cout << ans;
    }
    
    
    
}

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

using namespace std;

using Graph = vector<vector<int> >;

vector<int> seen;

int main()
{
	string S;
	long long K;

	cin >> S >> K;

	long long N = S.length();
	vector<long long> cnt(N+1);
	long long c1, c2, c3, c4;
	int first = -1;
	int last = N;
	int only = 1;

	cnt[0] = 1;
	for (int ni = 1; ni < N; ni++) {
		if (S[ni] == S[ni - 1]) {
			cnt[ni] = cnt[ni - 1] + 1;
		}
		else {
			if (first == -1) {
				first = ni - 1;
			}
			cnt[ni] = 1;
			last = ni;
			only = 0;
		}
	}

	if (only) {
		long long ans = (N * K) / 2;
		cout << ans;
		return 0;
	}


	if (S[0] != S[N - 1]) {
		c1 = 0;
		c2 = 0;
		c3 = 0;
		c4 = 0;
		for (int ni = 0; ni < N; ni++) {
			if (cnt[ni] > 1 && cnt[ni] > cnt[ni + 1]) {
				c2 += cnt[ni] / 2;
			}
		}
	}
	else {
		c1 = cnt[first] / 2;

		c2 = 0;
		for (int ni = first + 1; ni < last; ni++) {
			if (cnt[ni] > 1 && cnt[ni] > cnt[ni + 1]) {
				c2 += cnt[ni] / 2;
			}
		}

		c3 = (cnt[first] + cnt[N - 1]) / 2;

		c4 = cnt[N - 1] / 2;
	}


	long long ans = c1 + c2 * K + c3 * (K - 1) + c4;

	//printf("%.9f", ans);
	std::cout << ans;

	return 0;
}



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

typedef long long ll;

ll inf = 1e9+7;
ll fact[200010] = {0};
ll inv[200010] = {0};

ll mult(ll n, ll m){
	if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (t*n)%inf;
	}
}

void factorial(ll N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			fact[i] = 1;
			inv[i] = 1;
		}
		else{
			fact[i] = (i*fact[i-1])%inf;
			inv[i] = mult(fact[i],inf-2);
		}
	}
}

ll comb(ll n,ll k){
	if(n<k) return 0;
	if(n<0 || k<0) return 0;
	else return (((fact[n]*inv[k])%inf)*inv[n-k])%inf;
}

ll hcomb(ll n,ll k){
	if(n==0 && k==0) return 1;
	return comb(n+k-1,k);
}

int N,M,K;
ll X[200010],Y[200010];

int main(){
    cin >> N >> M >> K;
    factorial(N*M);
    ll ans = 0;
    for(ll i=1;i<=N;i++){
        for(ll j=1;j<=M;j++){
            ll dx = N-i,dy = M-j;
            (ans += (dy+1)*dx*(dx+1)/2+(dx+1)*dy*(dy+1)/2)%=inf;
            (ans += dy*dx*(dx+1)/2+dx*dy*(dy+1)/2)%=inf;
        }
    }
    cout << (comb(N*M-2,K-2)*ans)%inf << endl;
}

Measured memory_bytes: 4480
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<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...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n,m;
int x[4];
map<int,int> mp;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    rep(i,1,m+1){
        int a,b;
        cin >> a >> b;
        if(mp[a] && x[a]!=b){
            cout << -1;
            return 0;
        }
        else{
            x[a]=b;
            mp[a]++;
        }
    }
    if(x[1]==0 && n==1){
        cout << 0;
        return 0;
    }
    if(x[1]==0 && n>1 && mp[1]){
        cout << -1;
        return 0;
    }
    if(x[1]==0) x[1]=1;
    for(int i=1; i<=n; i++) cout << x[i];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int x, y;
	cin >> x >> y;
	if(y & 1) cout << "No" << endl;
	else {
		y /= 2;
		int b = y - x;
		int a = x - b;
		if(a >= 0 && b >= 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
}





Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define DEC(i, s) for (int i = (s); i >= 0; i--)

#define SIZE(v) (int)((v).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())

int psize;
int prime[1000010];
bool bprime[1000010];
int Eratosthenes(int n) {
  psize = 0;
  memset(bprime, true, sizeof(bprime));
  bprime[0] = bprime[1] = false;
  for (int i = 2; i <= n; i++) {
    if (!bprime[i]) { continue; }
    prime[psize++] = i;
    for (int j = i + i; j <= n; j += i) {
      bprime[j] = false;
    }
  }
  return psize;
}

int main() {
  Eratosthenes(1000000);
  int a, d, n;
  while (scanf("%d %d %d", &a, &d, &n), a|d|n) {
    int cnt = 0;
    if (bprime[a]) { cnt++; }
    while (cnt != n) {
      a += d;
      if (bprime[a]) { cnt++; }
    }
    printf("%d\n", a);
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int triple_max(int x, int y, int z){
    int ans = x;
    if (y > x && y > z) ans = y;
    else if (z > x && z > y) ans = z;

    return ans;
}

int main(){
    //input
    unsigned int h, w;
    cin >> h >> w;
    vector<string> pic;
    pic.resize(h);
    for (unsigned int i = 0; i < h; ++i) {
        cin >> pic.at(i);
    }

    //output '#'
    for (unsigned int j = 0; j < w + 2; ++j) {
        if (j != w + 1) cout << '#';
        else cout << '#' << endl;
    }
    //output '#' and pic
    for (unsigned int k = 0; k < h; ++k) {
        cout << '#' << pic.at(k) << '#' << endl;
    }
    //output '#'
    for (unsigned int j = 0; j < w + 2; ++j) {
        if (j != w + 1) cout << '#';
        else cout << '#' << endl;
    }


    return 0;
}



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

using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> p(n);
	for(int& x : p) {
		cin >> x;
	}
	
	vector<int> left(n), right(n);
	stack<int> stk;
	for(int i = 0; i < n; i++) {
		while(stk.size() && p[i] > p[stk.top()]) {
			stk.pop();
		}
		
		left[i] = stk.empty() ? -1 : stk.top();
		stk.push(i);
	}
	
	stk = stack<int>();
	for(int i = n-1; i >= 0; i--) {
		while(stk.size() && p[i] > p[stk.top()]) {
			stk.pop();
		}
		
		right[i] = stk.empty() ? n : stk.top();
		stk.push(i);	
	}
	
	int B = 1;
	while(B < n) {
		B *= 2;
	}
	
	vector<int> tree(2*B);
	
	for(int i = 0; i < n; i++) {
		tree[i+B] = p[i];
	}
	
	for(int i = B-1; i > 0; i--) {
		tree[i] = max(tree[2*i], tree[2*i+1]);
	}
	
	auto get_max = [&](int L, int R) {
		L += B, R += B;
		int ans = 0;
		while(L <= R) {
			if(L % 2 == 1) ans = max(ans, tree[L++]);
			if(R % 2 == 0) ans = max(ans, tree[R--]);
			L /= 2, R /= 2;
		}
		return ans;
	};
	
	ll ans = 0;
	
	for(int i = 0; i < n; i++) {
		int L = left[i], R = right[i];
		if(L == -1 && R == -1) {
			continue;
		}
		
		//$ ll cur = 0;
		if(L != -1) {
			int lo = -1, hi = L-1;
			while(lo < hi) {
				int mid = lo + (hi-lo+1)/2;
				if(get_max(mid, L-1) > p[i]) {
					lo = mid;
				} else {
					hi = mid-1;
				}
			}
			
			ans += 1LL * p[i] * (L - lo) * (R - i);
			//$ cur += 1LL * p[i] * (L - lo) * (R - i);
		}
		
		if(R != n) {
			int lo = R+1, hi = n;
			while(lo < hi) {
				int mid = lo + (hi - lo)/2;
				if(get_max(R+1, mid) > p[i]) {
					hi = mid;
				} else {
					lo = mid + 1;
				}
			}
			
			ans += 1LL * p[i] * (hi - R) * (i - L);
			//$ cur += 1LL * p[i] * (hi - R) * (i - L);
		}
		
		//$ cerr << i << ' ' << cur << endl;
	}
	
	cout << ans << endl;
}


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

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

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main() {
  int N, M;
  cin >> N >> M;

  vl H(N);
  vector<vi> edge(N);

  REP(i, N) cin >> H[i];

  REP(i, M) {
    int a, b;
    cin >> a >> b;
    --a, --b;

    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  int ans = 0;
  REP(node_id, N) {
    // if(H[node_id]==-1)continue;
    int ch = H[node_id];
    bool ok = true;
    for (auto neighbor_id : edge[node_id]) {
      if (ch <= H[neighbor_id]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 9064