akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 1000000000;

ll N;

void input() {
	scanf("%lld", &N);
}

void solve() {
	ll ans = 0;

	ans=(N-1)*(N)/2;

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

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long  ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
//careful not to convert INF to int type.
typedef pair<int, int> P;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rep0(i,n) for(int i=0;i<n;i++)
#define per0(i,n) for(int i=n;i>0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
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 solve() {
    int n; cin >> n;
    vector<vector<int> > abc(n+1);
    abc[0].push_back(0);
    abc[0].push_back(0);
    abc[0].push_back(0);

    rep(i,1,n+1){
        int a, b, c; cin >> a >> b >> c;
        abc[i].push_back(a);
        abc[i].push_back(b);
        abc[i].push_back(c);
    }
    int dp[3][n+10];
    dp[0][0] = 0;
    dp[1][0] = 0;
    dp[2][0] = 0;
    rep(i, 1, n+1){
        dp[0][i] = max(dp[1][i-1] + abc[i][1], dp[2][i-1] + abc[i][2]);
        dp[1][i] = max(dp[0][i-1] + abc[i][0], dp[2][i-1] + abc[i][2]);
        dp[2][i] = max(dp[1][i-1] + abc[i][1], dp[0][i-1] + abc[i][0]);
    }
    int ans = max(dp[0][n], max(dp[1][n], dp[2][n]));
    cout << ans;

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

Measured memory_bytes: 6912
#include <iostream>
#include <cstdio>

int main()
{
	int rectangles = 0;
	int lozenges = 0;
	unsigned int side1, side2, diagonal;
	while (std::scanf("%d,%d,%d", &side1, &side2, &diagonal) == 3) {
		if (side1 + side2 > diagonal) {
			if (side1 * side1 + side2 * side2 == diagonal * diagonal) {
				++rectangles;
			}
			if (side1 == side2) {
				++lozenges;
			}
		}
	}

	std::cout << rectangles << '\n' << lozenges << '\n';

	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n, a, b;
  cin >> n >> a >> b;
  int ans = 0;
  int set;
  set = n / (a + b);
  ans += set * a;
  ans += min(n - set*(a+b),a);
  cout << ans << endl;
}



Measured memory_bytes: 256
import sys

s = input()
for _ in range(5):
    if len(s) == 1:
        print('No')
        sys.exit()
    if len(s) == 0:
        print('Yes')
        sys.exit()
    if s[:2] == 'hi':
        s = s[2:]
    else:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=sc.nextInt();
	}
	int count=0;
	for(int i=0;i<a;i++) {
		if(b[b[i]-1]==i+1) {
			count++;
		}
	}
	System.out.println(count/2);
	}
}

Measured memory_bytes: 50852
#include<bits/stdc++.h>
using namespace std;
void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int main()
{
	//c_p_c();
	int r, g;
	cin >> r >> g;
	cout << 2 * g - r;
}


Measured memory_bytes: 256
n=int(input())

if n<2:
  print(1)
elif 2<=n<4:
  print(2)
elif 4<=n<8:
  print(4)
elif 8<=n<16:
  print(8)
elif 16<=n<32:
  print(16)
elif 32<=n<64:
  print(32)
else:
  print(64)

Measured memory_bytes: 38384
import sys

l = [int(i) - 1 for i in sys.stdin]

N = l[0] + 1

a = l[1:]

done = [False] * N

i = 0

ans = 0

while True:
    if done[i] == False:
        done[i] = True
        ans += 1
        if a[i] == 1:
            break
        i = a[i]
    else:
        ans = -1
        break

print(ans)


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

using namespace std;

#define pb push_back

#define ll long long int

#define max 1000000

int main(){
    
    ll n;
    cin>>n;
    vector<int>v(100005, 0);
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        v[num]++;
    }
    ll sum=0;
    for(int i=0; i<v.size(); i++){
        sum+=(i*v[i]);
    }
    // cout<<sum<<" ";
    ll k;
    cin>>k;
    int ini, f;
    while(k--){
        cin>>ini>>f;
        int curr=v[ini];
        sum = sum + curr*(f-ini);
        v[ini]=0;
        v[f]+=curr;
        cout<<sum<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstring>
#define ll long long
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=200050;
char s[maxn],t[maxn];
int main()
{
	cin>>s;cin>>t;
	ll ans=0;
	int len=strlen(s);
	for(int i=0;i<len;++i)
	  if(s[i]!=t[i]) ans++;
	cout<<ans<<endl;  
}


Measured memory_bytes: 4016
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
const int N = 500007, M = 5000007, INF = 0x3f3f3f3f;


int n,m ;
int head[N], ver[M], nex[M], tot;
int ans[N];

struct node{
    int v, d, c;
}a[N];
int dist[N];
void add(int x, int y){
    ver[tot] = y;
    nex[tot] = head[x];
    head[x] = tot ++ ;
}

void dfs(int x, int color, int deep){
    if(!ans[x])ans[x] = color;
    if(deep == 0 || dist[x] >= deep)return ;
    dist[x] = deep;
    for(int i = head[x]; ~i; i = nex[i]){
        int y = ver[i];
        dfs(y, color, deep - 1);
    }
}

int main(){
    scanf("%d%d", &n,&m);
    memset(head, -1, sizeof head);
    for(int i = 1; i <= m; ++ i){
        int x, y;
        scanf("%d%d",&x, &y);
        add(x, y), add(y, x);
    }
    int q;
    scanf("%d", &q);
    for(int i = 1; i <= q; ++ i)
    scanf("%d%d%d", &a[i].v, &a[i].d, &a[i].c);
    for(int i = q; i >= 1; -- i){
        dfs(a[i].v, a[i].c, a[i].d);
    }
    
    for(int i = 1; i <= n; ++ i)
    printf("%d\n", ans[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 8656
import sys
n = int(input())
x, y = [], []
for _i in range(n):
    s = input()
    p = 0
    m = [0]
    for j in range(len(s)):
        if s[j]=="(":
            p += 1
        else:
            p -= 1
            m.append(p)
    if p > 0:
        x.append([min(m), p])
    else:
        y.append([min(m)-p, -p])

x.sort(reverse=True)
y.sort(reverse=True)
r = 0
for s, t in x:
    if r+s < 0:
        print("No")
        sys.exit()
    r += t
result = 0
for s, t in y:
    if result+s < 0:
        print("No")
        sys.exit()
    result += t
if r-result == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 186972
$h, $w, k = gets.split.map(&:to_i)
grid = []
$h.times { grid << gets.chomp.split("") }

def black_counts(grid, r, c)
  black_count = 0
  $h.times do |r_i|
    $w.times do|c_i|
      black_count += 1 if grid[r_i][c_i] == "#" && r[r_i] == 0 && c[c_i] == 0
    end
  end
  black_count
end

ans = 0
(2 ** $h).times do |r|
  (2 ** $w).times do |c|
    ans += 1 if black_counts(grid, r, c) == k
  end
end
puts ans


Measured memory_bytes: 14272
import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws NumberFormatException,IOException{
        BufferedReader r =
         new BufferedReader(new InputStreamReader(System.in), 1);
          
        String line = r.readLine();    
        String[] w = line.split(" ",0);
        Arrays.sort(w);
        System.out.println(w[0]+" "+w[1]+" "+w[2]);
        r.close();
    }
}

Measured memory_bytes: 24416
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
const int N = 5005;

int main()
{
    string s;
    cin >> s;
    for(ll i=0;i<s.size();i++)   cout<<"x";
}

Measured memory_bytes: 256
using System;
namespace q1
{
  class q2
  {
    static void Main()
    {
      string[] n1 = Console.ReadLine().Split();
      string[] n2 = Console.ReadLine().Split();
      int A = int.Parse(n2[0]);
      int B = int.Parse(n2[1]);
      string U = Console.ReadLine();
      if(n1[0]==U)
      {
        A = A-1;
      }
      else
      {
        B = B-1;
      }
      Console.WriteLine(A+" "+B);
    }
  }
}


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

const int INF = 1e9;
using ll = long long;

int n,m;

vector<pair<ll,ll>> es;

map<ll,ll> s;
int k = 0;
ll id(int v, int c){
    ll x = (ll)v<<32|c;
    if(s.count(x)) return s[x];
    s[x] = k++;
    return s[x];
}

unordered_set<int> cs[100010];

struct edge { int dst, wgt; };

vector<vector<edge>> g;

void ae(int a, int b, int w){
    g[a].push_back({b,w});
    g[b].push_back({a,w});
}

deque<int> q;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    while(cin >> n >> m){
        rep(i,n) cs[i].insert(id(i,0));
        rep(i,m){
            int a,b,c;
            cin >> a >> b >> c;
            --a; --b;
            ll x = id(a,c);
            ll y = id(b,c);
            es.emplace_back(x,y);
            cs[a].emplace(x);
            cs[b].emplace(y);
        }
        int k = 0;
        unordered_map<ll,int> idid;
        for(auto &p : s){
            idid[p.second] = k++;
        }
        g.assign(k,{});
        for(auto &e : es){
            ll a,b;
            tie(a,b) = e;
            int x = idid[a];
            int y = idid[b];
            ae(x,y,0);
        }

        rep(i,n){
            int h = idid[id(i,0)];
            for(auto &c : cs[i]) if(c != h) ae(h,idid[c],1);
        }

        int ans = -2;

        int src = idid[id(0,0)];
        int dst = idid[id(n-1,0)];
        int *dist = new int[k];
        fill(dist, dist+k, INF);
        dist[src] = 0;
        q.push_back(src);
        while(q.size()){
            int v = q.front();
            q.pop_front();

            if(v == dst){
                ans = dist[v];
                break;
            }

            for(auto &e : g[v]){
                if(dist[e.dst] != INF) continue;
                dist[e.dst] = dist[v] + e.wgt;
                if(e.wgt == 0) q.push_front(e.dst);
                else q.push_back(e.dst);
            }
        }

        // rep(i,k) cout << dist[i] << ' ';
        // cout << endl;

        cout << ans/2 << endl;
        delete[] dist;
    }
}


Measured memory_bytes: 117868
n,k = map(int,input().split())
nn = [0]*n
for _ in range(k):
    d = int(input())
    a = [int(i) for i in input().split()]
    for j in a:
        nn[j-1] += 1
c=0
for i in nn:
   if i==0:
       c+=1
print(c)

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

using namespace std;
using ll = long long;
using indx = size_t;

#define endl '\n'
#define get(type, args...) type args; read(args)
#define all(v) v.begin(), v.end()
#define debug(args...) { string _s = #args; \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s); istream_iterator<string> _it(_ss); \
    err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
template <typename... T>
void read(T&... args) {
    ((cin >> args), ...);
}
template <typename T>
void read(vector<T>& v) {
    for (auto& x : v) cin >> x;
}
template <typename... T>
void write(T&&... args) {
    ((cout << args << " "), ...);
    cout << '\n';
}
template <typename T>
void write(vector<T>& v) {
    for (auto x : v) cout << x << " ";
    cout << '\n';
}

int main() {
    string s;
    cin >> s;
    if (s == "ABC")
        write("ARC");
    else
        write("ABC");
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int N;
int a[1000000];
int wa;
int cunt;

int main(){
    for(int i=0;i>=0;){
        wa=0;
        cunt=0;
        cin >> N;
        if(N==0){
            break;
        }
        rep(j,N){
            cin >> a[j];
            wa +=a[j];
        }
        rep(j,N){
            if(a[j]<=wa/N){
                cunt++;
            }
        }
        cout << cunt << endl;
    }

}



Measured memory_bytes: 3084
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cmath>
#include <map>
#include <set>
#include <queue>

int main(void)
{
    // freopen("aaa.in","r",stdin);
    long long n;
    scanf("%lld",&n);
    long long sum = 0;
    long long tmp = 0;
    for (long long i=1;i<=n;i++)
    {
        tmp+=i;
        sum+=tmp;
    }
    for (int i=1;i<n;i++)
    {
        long long x,y;
        scanf("%lld%lld",&x,&y);
        if (x>y) x^=y^=x^=y;
        long long tx = x;
        long long ty = n-y+1;
        sum-=tx*ty;
    }
    printf("%lld\n",sum);
    return 0;
}

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

int main() {
  int n; cin >> n;
  // 与えられた数列の合計値
  ll sum=0;
  // 1~100000までの数が、それぞれ出てくる回数を記録しておく
  vector<int> times(1e5+1,0);
  for(int i=0; i<n; i++) {
    int t; cin >> t;
    sum+=t;
    times[t]++;
  }
  int q; cin >> q;
  vector<int> b(q), c(q);
  for(int i=0; i<q; i++) cin >> b[i] >> c[i];
  // q個のテストケースについてそれぞれ処理
  for(int i=0; i<q; i++) {
    sum+=(c[i]-b[i])*times[b[i]];
    times[c[i]]+=times[b[i]];
    times[b[i]]=0;
    cout << sum << endl;
  }
}


Measured memory_bytes: 4572
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int count =0;
    for (int X=0; X<=K; X++) {
      for (int Y=0; Y<=K; Y++) {
        int Z = S-X-Y;
        if(Z>=0 && Z<=K) count++;
      }
    }  
    System.out.println(count);
  }
}

Measured memory_bytes: 21204
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007LL
#define PI acosl(-1)

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

pair<int, int> dfs(vector<int> adj[], int a, int b)
{
	int white = 1, black = 0;
	for (const auto &u : adj[a])
	{
		if (u != b)
		{
			auto curr = dfs(adj, u, a);
			int temp = white;
			white = (white * curr.second) % mod;
			black = ((temp * curr.first) % mod + (black * (curr.first + curr.second)) % mod) % mod;
		}
	}
	return {white, white + black};
}

void solve()
{
	int n, x, y;
	cin >> n;
	vector<int> adj[n];
	for (int i = 0; i < n - 1; i++)
	{
		cin >> x >> y;
		x--;
		y--;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	auto p = dfs(adj, 0, 0);
	cout << (p.first + p.second) % mod;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}

Measured memory_bytes: 18800
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c;
    cin>>a>>b>>c;
    if(a%2==0||b%2==0||c%2==0){
        cout<<0<<endl;
    }else cout<<min(min(a*b,b*c),a*c)<<endl;
    return 0;
}

Measured memory_bytes: 256
//abc148_b.cpp
//Sun Dec 22 20:45:49 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	for (int i=0;i<n;i++){
		cout << s[i];
		cout << t[i];
	}

	printf("\n");

}

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

using namespace std;
typedef long long ll;

vector<int> e[100000];

int c[100000];
int n,cnt;
bool used[100000];
int d;

int dfs(int p,int cn){
  if(p==n-1){c[p]=1;return cn;}
  used[p]=1;
  int res=0;
  for(int i=0;i<e[p].size();i++)
    if(!used[e[p][i]])res=max(res,dfs(e[p][i],cn+1));
  
  if(res>0)c[p]=1;
  
  return res; 
}

int dfs2(int p){
  int res=0;
  used[p]=1;
  if(c[p])cnt++;

  for(int i=0;i<e[p].size();i++){
    if(used[e[p][i]])continue;
    
    if(!c[e[p][i]])
      res+=dfs2(e[p][i]);
    else if(d>cnt)res+=dfs2(e[p][i]);

  }

  return res+1;  
}

int main(){

  cin>>n;
  for(int a,b,i=0;i<n-1;i++){
    cin>>a>>b;
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  
  d=(dfs(0,1)+1)/2;

  memset(used,0,sizeof(used));
  
  int ans=dfs2(0);

  if(ans>n/2)cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;


  return 0;
}


Measured memory_bytes: 12416
def main():
  s = input()
  n = len(s)
  mod = 10**9+7
  dp = [[0]*13 for _ in range(n+1)]
  dp[0][0] = 1
  d = {(j, k):(10*j+k)%13 for k in range(10) for j in range(13)}
  for i in range(n):
    if s[i] != "?":
      t = int(s[i])
      for j in range(13):
        dp[i+1][d[(j, t)]] += dp[i][j]
        dp[i+1][d[(j, t)]] %= mod
    else:
      for k in range(10):
        for j in range(13):
          dp[i+1][d[(j, k)]] += dp[i][j]
          dp[i+1][d[(j, k)]] %= mod
  print(dp[n][5]%mod)
if __name__ == '__main__':
  main()

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

long Xor(long a) {
	a += 1;
	long res;
	if (a % 4 == 0) res = 0;
	else if ((a + 2) % 4 == 0) res = 1;
	else if ((a + 1) % 4 == 0) res = a;
	else res = a - 1;
	return res;
}

int main() {
	long A, B;
	cin >> A >> B;
	cout << (Xor(A - 1) ^ Xor(B));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define NFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); --i)
#define endl "\n"
#define mp make_pair
#define X first
#define Y second
#define inf 1e9
#define mod 1000000007
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
// #define lli int
typedef long long int lli;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<lli,lli> pll;
typedef vector<lli> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex <long double> complex_t;
const long double PI = acos((long double)-1.0);

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    if ((b-a) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
return 0;}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<ll, ll> p;

vector<ll> uni(100100, -1);

// 頂点aの所属するグループを調べる。
ll root(ll a)
{
  // uni[a]が負の値なら親はa自身
  if (uni[a] < 0) return a;
  // 正の値であれば、親ルートを調べ戻り値で根に直接つなぐ。
  else {
    uni[a] = root(uni[a]);
    return uni[a];
    // return uni[a] = root(uni[a]);
  }
}

// 頂点aとbをつなぐ、もともと同じグループの場合falseを返す。
bool connect(ll a, ll b)
{
  a = root(a);
  b = root(b);
  if (a == b) return false;

  // aを大きなグループにしたいので、逆であれば入れ替える。
  if (uni[a] > uni[b])
  {
    ll hoge = a;
    a = b;
    b = hoge;
  }

  //aとbを結合し、bをaの親とする。
  uni[a] += uni[b];
  uni[b] = a;
  return true;
}

//  頂点a, bが同じグループか
bool isConnect(ll a, ll b)
{
  return root(a) == root(b);
}

// 頂点aを含むグループの頂点数を調べる
ll size(ll a)
{
  return -uni[root(a)];
}

int main(){
  ll n, m;
  cin >> n >> m;
  vector<p> v(m);
  for (ll i = 0; i < m; i++) {
    cin >> v[i].first >> v[i].second;
  }

  vector<ll> ans(m, 0);
  ans[m-1] = (n * (n-1)) / 2;

  for (ll i = m-1; i >= 1; i--) {
    if(root(v[i].first) != root(v[i].second)){
      ans[i-1] = ans[i] - size(v[i].first) * size(v[i].second);
      connect(v[i].first, v[i].second);
    }
    else ans[i-1] = ans[i];
  }

  for(auto a : ans) cout << a << endl;

}


Measured memory_bytes: 4480
#include "bits/stdc++.h"
using namespace std;
    int main(){
    int a, b, cnt;
    cin >> a;
    cin >> b;
    cnt = 0;
    for(int i = 0; i < 2; i++){
        if(a > b){
            cnt += a;
            a--;
        }
        else {
            cnt += b;
            b--;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        init();

        int n = nextInt();
        int[] ls = new int[n];
        for (int i = 0; i < n; i++) {
            ls[i] = 2*nextInt();
        }

        Arrays.sort(ls);
        int triples = 0;
        for (int i = 0; i < ls.length; i++) {
            for (int j = i + 1; j < ls.length; j++) {
                int a = ls[i];
                int b = ls[j];

                int min = Math.abs(a - b) + 1;
                int max = a + b - 1;

                int minIndex = Arrays.binarySearch(ls, min);
                minIndex = -(minIndex + 1);
                minIndex = Math.max(j + 1, minIndex);

                int maxIndex = Arrays.binarySearch(ls, max);
                maxIndex = -(maxIndex + 1);
                maxIndex = Math.min(maxIndex, ls.length);

                if (maxIndex >= minIndex) {
                    triples += (maxIndex - minIndex);
                }
            }
        }

        System.out.println(triples);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}

Measured memory_bytes: 23636
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int h = stdIn.nextInt();
		int w = stdIn.nextInt();

		char[][] map = new char[h][w];

		for(int i = 0; i < h; i++) {
			map[i] = stdIn.next().toCharArray();
		}

		for(int i = 0; i < h; i++) {
			for(int j = 0; j < w; j++) {

				if(map[i][j] == '.') {
					boolean flag = true;
					for(int k = 0; k < h; k++) {//縦方向
						if(map[k][j] != '.'&& map[k][j] !='〇')flag = false;
					}
					if(flag) {
						for(int k = 0; k < h; k++) {
							map[k][j] = '〇';
						}
					}

					boolean flag2 = true;
					for(int k = 0; k < w; k++) {//横方向
						if(map[i][k] != '.' && map[i][k] !='〇')flag2 = false;
					}
					if(flag2) {
						for(int k = 0; k < w; k++) {
							map[i][k] = '〇';
						}
					}
				}
			}
		}

		for(int i = 0; i < h; i++) {
			int index = 0;
			for(int j = 0; j < w; j++) {
				if(map[i][j] =='〇') {
					index++;
					continue;
				}
				System.out.print(map[i][j]);
			}
			if(index == w) {
				index = 0;
				continue;
			}
			System.out.println();
		}


	}

}


Measured memory_bytes: 39168
#include <bits/stdc++.h>
using namespace std;
int main(){string S;cin>>S;int64_t ans=0;vector<int>A(S.size()+1);for(int i=0;i<S.size();i++)if(S.at(i)=='<')A[i+1]=max(A[i+1],A[i]+1);for(int i=S.size()-1;i>=0;i--)if(S.at(i)=='>')A[i]=max(A[i],A[i+1]+1);for(int i=0;i<=S.size();i++)ans+=A[i];cout<<ans<<endl;}

Measured memory_bytes: 5804
#include<iostream>   
#include<string>
#include<vector>
using namespace std; 
 
int main()
{
	int a, b, c, d; 
	cin >> a >> b >> c >> d; 
	if (a*b>=c*d)
	{
		cout << a * b << "\n";
	} 
	else
	{
		cout << c * d << "\n";
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  priority_queue<int> p;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    p.push(a);
  }
  for(int i=0;i<m;i++){
    p.push(p.top()/2);
    p.pop();
  }
  int64_t s=0;
  while(!p.empty()){
    s+=p.top();
    p.pop();
  }
  cout<<s<<endl;
}

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

int main() {

    int N, M;
    cin >> N >> M;

    vector<int> a_vec;
    vector<int> b_vec;

    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a_vec.push_back(a);
        b_vec.push_back(b);
    }

    for (int i = 1; i <= N; i++) {
        int cnt = 0;
        
        for (int j = 0; j < M; j++) {
            if(i == a_vec.at(j) || i == b_vec.at(j)){
                cnt++;
            }

        }
        cout << cnt << endl;

    }



}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
using namespace std;
#define PI 3.14159265359

int main() {
	double r;
	cin >> r;

	double area = PI * r * r;
	double circ = 2 * PI * r;

	cout << fixed << setprecision(6) << area << " " << circ << endl;
	
	return 0;	
}

Measured memory_bytes: 3256
#[allow(dead_code)]
fn main() {
    let (n, m, q) = i::u3();
    let lr = i::uv2(m);
    let pq = i::uv2(q);

    // map[i][j] = iをスタートしてjで終わる列車の本数
    let mut map = vec![vec![0usize; n + 1]; n + 1];
    for i in 0..m {
        let (l, r) = lr[i];
        map[l][r] += 1;
    }

    // 累積和に変換
    for i in 0..n + 1 {
        for j in 1..n + 1 {
            map[i][j] = map[i][j] + map[i][j - 1];
        }
    }

    for i in 0..q {
        let (p, q) = pq[i];
        let mut ans = 0;
        for j in p..(q + 1) {
            ans += map[j][q] - map[j][p - 1];
        }
        println!("{}", ans);
    }
    //dbg!(map);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 13180
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool srt1(pair<ll,ll> a,pair<ll,ll> b)
{
	return a.first+a.second<b.first+b.second;
}
bool srt2(pair<ll,ll> a,pair<ll,ll> b)
{
	return a.first-a.second>b.first-b.second;
}
int main()
{
	ll i,j,k,m,t,n;
	cin>>n;
	vector<pair<ll,ll>> v;
	for(i=0;i<n;i++)
	{
		cin>>j>>k;
		v.push_back({j,k});
	}
	sort(v.begin(),v.end(),srt1);
	ll ans=abs(v[n-1].first-v[0].first)+abs(v[n-1].second-v[0].second);
	sort(v.begin(),v.end(),srt2);
	ll ans2=abs(v[n-1].first-v[0].first)+abs(v[n-1].second-v[0].second);
	ans=max(ans,ans2);
	cout<<ans;
}

Measured memory_bytes: 7404
n, q = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp.split("")
s = s.unshift(" ")
arr = Array.new(n+1,0)
i = 2
ans = 0
while true
    s[i] == "C" && s[i-1] == "A" ? arr[i] = ans + 1 : arr[i] = ans
    break if i == n
    ans = arr[i]
    i += 1
end
q.times do
    l, r = gets.chomp.split(" ").map(&:to_i)
    all = arr[r] - arr[l]
    puts all
end

Measured memory_bytes: 23620
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
    answer();
   }
   static void answer()
     {
       Scanner sc = new Scanner(System.in);
       
       while(true)
       {
         int h = sc.nextInt();
         
         int w = sc.nextInt();
         
         if(h == 0 && w == 0)break;
         
         for(int i = 0; i < h; i ++)
         {
           for(int j = 0; j < w; j ++)
           {
             if(i == 0 || j == 0 || i == h - 1|| j == w - 1)
             {
               System.out.printf("#");
             }
             else System.out.printf(".");
           }
           System.out.println();
         }
         System.out.println();
       }
     }
 }
    


Measured memory_bytes: 56168
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define MAX 200005
lli arr[MAX];
lli suffix[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    map <lli,lli> mp;
    string s;
    cin>>s;
    lli N = s.size();
    suffix[N] = 0;
    mp[0]++;
    lli mod = 1;
    /* Suffix [i+1] = suffix[i] + mod*digit(at i)
        10^(l-1)*digit*10
        10^(l-1)*/
    lli ans = 0;
    for(lli i = N-1; i>=0; i--){
        suffix[i] = suffix[i+1] + mod*(s[i] - '0');
        suffix[i] %= 2019;
        ans += mp[suffix[i]];
        mod = (mod*10)%2019;
        mp[suffix[i]]++;
    }
    cout<<ans<<endl;
}
    

Measured memory_bytes: 5308
#include <bits/stdc++.h>
#define inf (long long)1e9
using namespace std;

long long n, s;
vector<long long> a;

long long solve();

int main() {
  cin >> n >> s;
  a.resize(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = inf, sum = 0, l = 0, r = 0;
  for(l = 0; l < n; ++l) {
    while(r < n && sum < s) sum += a[r++];
    if(sum >= s) ans = min(ans, r - l);
    sum -= a[l];
  }
  return ans == inf ? 0 : ans;
}


Measured memory_bytes: 3616
S = sorted(list(input()))

if len(set(S)) == 26:
    print("None")
    exit()

S = sorted(list(set(S)))

s = list("abcdefghijklmnopqrstuvwxyz")

def list_difference(list1, list2):
    result = list1.copy()
    for value in list2:
        if value in result:
            result.remove(value)

    return result

result = list_difference(s,S)

print(result[0])

Measured memory_bytes: 10584
#include "bits/stdc++.h"
using namespace std;

#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n";
#define all(c)  (c).begin(),(c).end()
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

string s;
string t = "keyence";
int main(){
    cin >> s;
    int n = s.size();
    if(n<7){
        put("No");
        return 0;
    }
    int r=0,l=0;
    REP(i,7){
        if(s[i]==t[i]){
            l=i+1;
        }else{
            //l = i;
            break;
        }
    }
    REP(i,7){
        if(s[n-1-i]==t[6-i]){
            r=i+1;
        }else{
            //r = i;
            break;
        }
    }
    if(l+r>=7){
        put("YES");
    }else{
        put("NO");
    }
    return 0;
}


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


int main() {
    ll x, y; cin >> x >> y;
    cout << (abs(x - y) <= 1 ? "Brown" : "Alice") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if(n<3) {
    cout << 0 << endl;
    return 0;
  }
  int a[n];
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  int ans=0;
  sort(a, a+n);
  for(int i=0; i<n; i++) {
    for(int j=i; j<n; j++) {
      for(int k=j; k<n; k++) {
        if(a[i]<a[j]+a[k]&&a[j]<a[i]+a[k]&&a[k]<a[j]+a[i]&&a[i]!=a[j]&&a[k]!=a[j]&&a[i]!=a[k]) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>

typedef long long ll;

using namespace std;

int main(){
    int N;  cin >> N;
    int a[N];
    ll sum = 0LL;
    for(int i=0; i<N; i++){
        cin >> a[i];
        sum += a[i];
    }

    ll sunuke = 0LL;
    ll ans = (ll) 2e10;
    for(int i=0; i<N-1; i++){
        sunuke += a[i];
        ans = min(ans, abs(sum - 2*sunuke));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i < (n); i++)
#define ANS(ans) cout << ans << endl;


int
main()
{
  int N; cin >> N;
  vector<int> A;
  REP(i, N) { int a; cin >> a; A.emplace_back(a); }

  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  
  vector<int> B;
  B.emplace_back(A.at(0));
  REP1(i, A.size()) B.emplace_back(A.at(i) % A.at(i - 1));

  while (2 <= B.size()) {
    sort(B.begin(), B.end());
    B.erase(unique(B.begin(), B.end()), B.end());

    for (int i = B.size() - 1; i >= 1; i--) {
      if (B.at(i - 1) != 0) B.at(i) = B.at(i) % B.at(i - 1);
    }
  
    if (B.size() == 2 && B.at(0) == 0) break;
  }
  
  if (B.size() >= 2) { ANS(B.at(1)); } else ANS(B.at(0));

  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

int main() {
	int n;cin>>n;
	pll p[N];
	rep(i,n){
		ll x,l;
		cin>>x>>l;
		p[i].first=x+l;
		p[i].second=x-l;
	}
	sort(p,p+n);
	int a=0;
	ll rx=p[0].first;
	for(int i=1;i<n;i++){
		if(rx>p[i].second) a++;
		else rx=p[i].first;
	}
	cout<<n-a<<endl;
}


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

int main(){
    unsigned long N;
    cin >> N;
    queue<long> q;
    vector<long> d(20, -1);
    unsigned long ans{0};
    for(long l = -1, r = 0, A, k = -1; r < N; ++r){
        cin >> A;
        q.push(A);
        for(unsigned long i = 0; i < 20; ++i)if((A >> i) & 1){
            for(k = max(k, d[i]); l < k; ++l){
                auto a = q.front();
                q.pop();
                for(unsigned long j = 0; j < 20; ++j)if((a >> j) & 1)d[j] = -1;
            }
            d[i] = r;
        }
        ans += r - l;
    }
    cout << ans << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
    int x,y,b;
    cin >>x >>y;

    string ans = "No";
    for(int i =0;i<=x;i++){
        b=x-i;
        if(2*i+4*b==y){
            ans = "Yes";
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair

ll dp[3004][3004];

int main(){
	int i,n,j;
	scanf("%d",&n);
	ll a[3005],sum[3005];
	sum[0]=0;
	for(i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1]+a[i];
	}

	for(i=1;i<=n;i++){
		dp[i][i]=a[i];
	}

	for(i=n;i>=1;i--){
		for(j=i+1;j<=n;j++){
			dp[i][j] = max(a[i]+sum[j]-sum[i]-dp[i+1][j],a[j]+sum[j-1]-sum[i-1]-dp[i][j-1]);
		}
	}

	printf("%lld\n",2*dp[1][n]-sum[n] );
	return 0;
}


Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
#define ll                   long long int
#define ld                   long double
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define eb                   emplace_back
#define pb                   push_back
#define pf                   push_front
#define ppf                  pop_front
#define ppb                  pop_back
#define pi                   acos(-1.0)
#define mod                  1000000007
#define eps                  0.0000000001
#define inf                  9000000000000000
#define en                   "\n"

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

    int n; cin>>n;
    if (n>=30) cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3636
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#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>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
char in[10];
int q[110];
int n;
int query(){
	printf("?");
	for(int i=0;i<n;i++){
		printf(" %d",q[i]+1);
	}
	printf("\n");
	fflush(stdout);
	scanf("%s",in);
	if(in[0]=='R')return 0;
	return 1;
}
int ret[210];
long long gcd(long long a,long long b){
	while(a){
		b%=a;swap(a,b);
	}
	return b;
}
int main(){
	long long a,b,c;scanf("%lld%lld%lld",&a,&b,&c);
	int S=gcd(a,c);
	int T=gcd(b,c);

	long long ret=0;
	int H=a/S;
	int W=b/T;
	// printf("%lld %lld %lld\n",T,H,W);
	ret=pw(2,H);
	ret=(ret+pw(2,W))%mod;
	ret=(ret+mod-1)%mod;
	int q=gcd(H,W);
	ret=(ret+pw(2,q))%mod;
	ret=(ret+mod-2)%mod;

	ret=pw(ret,(long long)S*T);
	printf("%lld\n",ret);
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int n = s.length();
    int map[256] = {};
    int flag = 0;
    for(int i = 0; i < n; i++){
        if(map[s[i]] == 1)flag = 1;
        map[s[i]] = 1;
    }
    cout << (flag == 0 ? "yes" : "no");
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, m, n;
  scanf("%lld%lld", &n, &m);
  n = m / 2;
  for(i = 1; i <= n; ++i) printf("%lld %lld\n", i, m + 1 - i);
  n = (m + 1) / 2;
  for(i = 1; i <= n; ++i) printf("%lld %lld\n", i + m, 2 * m + 2 - i);
  return 0;
}

Measured memory_bytes: 1732
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    let mut lumps: Vec<Vec<usize>> = Vec::with_capacity(m);
    for _i in 0..m {
        let mut vec: Vec<usize> = Vec::new();
        let k: usize = iterator.next().unwrap().parse().unwrap();
        for _j in 0..k {
            vec.push(iterator.next().unwrap().parse::<usize>().unwrap() - 1);
        }
        lumps.push(vec);
    }

    let mut p: Vec<usize> = Vec::with_capacity(m);
    for _i in 0..m {
        p.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut ans = 0;
    for i in 0..(2_usize.pow(n as u32)) {
        let pattern = make_pattern(i, n);
        let mut is_ok = true;
        for (j, lump) in lumps.iter().enumerate() {
            let mut count = 0;
            for &l in lump {
                if pattern[l] {
                    count += 1;
                }
            }
            if count % 2 != p[j] {
                is_ok = false;
                break;
            }
        }
        if is_ok {
            ans += 1;
        }
    }

    return ans.to_string();
}

fn make_pattern(i: usize, len: usize) -> Vec<bool> {
    let mut n = i;
    let mut result = Vec::with_capacity(len);
    while n > 0 {
        if n % 2 == 1 {
            result.push(true);
        } else {
            result.push(false);
        }
        n /= 2;
    }
    while result.len() < len {
        result.push(false);
    }
    result
}


Measured memory_bytes: 4352