akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
        main.solve();
//        System.out.println(main.solve());
    }
    void solve() throws IOException{
        long n = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
        long t = n/(a+b);
        long r = n%(a+b);
        long ans = t*a+Math.min(r,a);
        System.out.println(ans);
    }
}



Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var s = cin.next();

            var cc = s.ToCharArray();
            var ans = new char[cc.Length];
            for (int i = 0; i < cc.Length; i++)
            {
                int tmp = ((int)cc[i] + n);
                if(tmp >= 91)
                {
                    tmp = tmp % 91 + 'A';
                }

                ans[i] = (char)tmp;
            }
            var ss = new string(ans);
            Console.WriteLine(ss);
        }
    }

    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 int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            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 long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            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;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13168
#include<bits/stdc++.h>
/*#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>*/

typedef long long ll ;
typedef double db;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define sf(a)		 scanf("%d",&a)
#define sfl(a)		scanf("%lld",&a)
#define sff(a,b)	 scanf("%d %d",&a,&b)
#define sffl(a,b)	scanf("%lld %lld",&a,&b)
#define pb(a)         push_back(a)
#define loop0(i,n)          for(int i=0;i<n;i++)
#define loop1(i,n)          for(int i=1;i<=n;i++)
#define loopab(a,b)       for(int i=a;i<=b;i++)
#define gcd(a, b)     __gcd(a, b)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
//#define abs(x)		fabs(x)
#define pcase(z,x)     cout<<"Case "<<z<<": "<<x<<"\n"
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;

int main()
{
	ll n,k,x;
	cin>>n>>k;
	x = n%k;
	if(abs(x-k)<x)cout<<abs(x-k)<<nw;
	else cout<<x<<nw;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
int main(){
	string S;
	cin >> S; 
	int count = 0; 
	int N = S.size(); 
	for(int i = 0; i < N; i++){
		if(i % 2 == 0 && S.at(i) == '0') count ++; 
		else if(i % 2 == 1 && S.at(i) == '1') count ++; 
	}
	cout << min(count, N - count) << endl; 
}

Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        M: usize,
        A: [usize1; M],
    }

    let costs = [2i32, 5, 5, 4, 5, 6, 3, 7, 6];
    let digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];

    A.sort_by(|a, b| b.cmp(a));

    let mut dp: Vec<i32> = vec![0; N+1];
    dp[0] = 0;

    for n in 1..N+1 {
        dp[n] = -1000;
        for a in A.iter() {
            if n as i32 - costs[*a] >= 0 {
                dp[n] = max(dp[n], dp[n - costs[*a] as usize] + 1);
            }
        }
    }

    let mut n = N;
    while n > 0 {
        for a in A.iter() {
            if n as i32 - costs[*a] >= 0 {
                if dp[n] - 1 == dp[n - costs[*a] as usize] {
                    print!("{}", digits[*a]);
                    n -= costs[*a] as usize;
                    break;
                }
            }
        }
    }
    print!("\n");
}

fn max(a: i32, b: i32) -> i32 {
    if a > b {
        a
    } else {
        b
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	vector<int>V(6);
	rep(i, 6) {
		cin >> V[i];
	}
	vector<int>A(4);
	rep(i, 6) {
		A[V[i] - 1]++;
	}
	sort(A);
	if (A[0] == 1 && A[1] == 1 && A[2] == 2 && A[3] == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


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


class Graph {
    int V;
    vector<list<int>> edges;
    public:
    Graph(int nodes){
        V = nodes;
        edges.resize(nodes + 1);
    }
    void addEdge(int from, int to){
        edges[from].push_back(to);
    }
    int min_dist(int &fin, int i, map<int ,bool> &special, vector<bool> &check){
        check[i] = true; 
        multiset<int> ms;     
        int k;
        for(auto it = edges[i].begin(); it != edges[i].end(); it++){
            if(check[*it] == true)
                continue;
            k = min_dist(fin, *it, special, check);
            if(k != 0)
                ms.insert(k);
        }
        for(auto it = ms.begin(); it != ms.end(); it++){
            fin += (*it);
            //cout << *it << " ";
        }
        //cout << endl;
        if(ms.size() % 2 == 0){
            if(special[i])    
                return 1;
            return 0;
        }
        else{
            if(special[i])
                return 0;
            auto it = ms.begin();
            fin -= (*it);
            return (*it) + 1;
        }
    }
    int max_comp(){
        int mx = INT_MIN;
        vector<bool> check(V + 1, false);

        for(int i = 1; i <= V; i++){
            if(!check[i]){
                int count = 0;
                DFS_util(check, i, count);
                if(count > mx){
                    mx = count;
                }
            }
        }
        return mx;
    }
    void DFS_util(vector<bool> &check, int i, int &count){
        check[i] = true;
        count++;
        for(auto it = edges[i].begin(); it != edges[i].end(); it++){
            if(!check[*it]){
                DFS_util(check, *it, count);
            }
        }
        return;
    }
};


int main(){
    int t = 1;
    //cin >> t;
    while(t--){
        int n, m;
        cin >> n >> m;
        Graph g(n);
        int from, to;
        for(int i = 0; i < m; i++){
            cin >> from >> to;
            g.addEdge(from, to);
            g.addEdge(to, from);
        }
        cout << g.max_comp() << endl;
    }
    return 0;
}







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

int main() {
  int n,s;
  cin >> n;
  for(int i=0 ;i<n ;i++){
    for(int j=0 ;j<n ;j++){
      s = 4*i + 7*j;
      if(s == n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
from sys import stdin

S = stdin.readline().rstrip()
countlist = []

count = 0
for s in S:
    if s == "A" or s == "C" or s == "G" or s == "T":
        count += 1
    else:
        countlist.append(count)
        count = 0
countlist.append(count)
print(max(countlist))

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
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;
}

int main(){
    int N;cin>>N;
    vector<string>S(N);
    vector<vector<int>>ans(N,vector<int>(26,0));
    vector<int>A(26,50);
    rep(i,N){
        string T;
        cin>>T;
        sort(T.begin(),T.end());
        S[i]=T;
    }
    rep(i,N){
        rep(j,S[i].size()){
            ans[i][S[i][j]-'a']++;
        }
    }
    rep(i,26){
        rep(j,N){
            A[i]=min(A[i],ans[j][i]);
        }
    }
    rep(i,26){
        rep(j,A[i]){
            cout<<char('a'+i);
        }
    }
    cout<<""<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const int maxn=1e5+5;
ll k,dlt[maxn],x[maxn];
int n,m;
int ans[maxn],a[maxn],tmp[maxn];
int main(){
	read(n);
	rep(i,1,n)read(x[i]);
	rep(i,2,n)dlt[i]=x[i]-x[i-1];
	read(m);read(k);
	rep(i,1,n)a[i]=ans[i]=i;
	rep(i,1,m){
		int x;read(x);
		swap(a[x],a[x+1]);
	}
	while(k){
		if(k&1)rep(i,2,n)ans[i]=a[ans[i]];
		rep(i,2,n)tmp[i]=a[a[i]];
		rep(i,2,n)a[i]=tmp[i];
		k>>=1;
	}
	rep(i,2,n)x[i]=x[i-1]+dlt[ans[i]];
	rep(i,1,n)printf("%lld.0\n",x[i]);
	return 0;
}

Measured memory_bytes: 4224
from collections import Counter
def main():
    N = int(input())
    s = [input() for i in range(N)]

    t = Counter(s)
    T = t.most_common()

    m = T[0][1]
    c = []
    for w, n in T:
        if n == m:
            c.append(w)
        else:
            break

    c.sort()
    print("\n".join(c))



if __name__ == "__main__":
    main()


Measured memory_bytes: 50284
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>

int main(void){
 std::vector<int> A;
 int a,N;
 int max=-1;
 std::cin>>N;
 for(int i=0; i<N; i++){
  std::cin>>a;
  A.push_back(a);
 }

 for(int i=0; i<N-1; i++)
  for(int j=i+1; j<N; j++)
   max=std::max(max,abs(A[i]-A[j]));

 std::cout<<max<<std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int n; cin>>n;
    vector<int> a(n+1), b(n);
    for(int i=0; i<=n; i++) cin>>a[i];
    for(int i=0; i<n; i++) cin>>b[i];

    ll ans = 0;
    for(int i=0; i<n; i++){
        int val = min(a[i], b[i]);
        a[i] -= val;
        b[i] -= val;
        ans += val;
        int val2 = min(a[i+1], b[i]);
        a[i+1] -= val2;
        ans += val2;
    }

    cout << ans << endl;
}

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

int main(){
	int H,W;
	while(1){
		cin>>H>>W;
		if(H==0 && W==0)break;
		char ct[H][W];
		int flg[H][W];
		int error=0;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>ct[i][j];
				flg[i][j]=0;
			}
		}
		int nowX=0,nowY=0,ansX=0,ansY=0;
		while(1){
			if(flg[nowY][nowX]==1){
				cout<<"LOOP"<<endl;
				error=1;
				break;
			}
			flg[nowY][nowX]=1;
			if(ct[nowY][nowX]=='>'){
				nowX++;
			}else if(ct[nowY][nowX]=='<'){
				nowX--;
			}else if(ct[nowY][nowX]=='^'){
				nowY--;
			}else if(ct[nowY][nowX]=='v'){
				nowY++;
			}else if(ct[nowY][nowX]=='.'){
				ansX=nowX;
				ansY=nowY;
				break;
			}
		}
		if(error!=1){
			cout<<nowX<<" "<<nowY<<endl;
		}
	}
	return 0;
}

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


int main(void) {

	int r,D;
	int x[11];
	int tempx;


	scanf("%d %d %d", &r,&D, &tempx);


	x[0] = tempx;

	for (int i = 1; i <= 10; i++) {
		x[i] = r * x[i - 1] - D;
		printf("%d\n", x[i]);
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,x;
  cin>>N>>x;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  int sum=0;
  for(int i=0;i<N;i++){
    if(x>=vec.at(i)){
      sum+=1;
      x-=vec.at(i);
    }
  }
  if(sum==N&&x>0) cout<<N-1<<endl;
  else cout<<sum<<endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

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

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

  vector<int> l(n+2), r(n+2);
  l[0] = 0;
  REP(i, 1, n) l[i] = gcd(a[i], l[i-1]);
  r[n+1] = 0;
  REPR(i, n, 1) r[i] = gcd(a[i], r[i+1]);

  int ans = 0;
  REP(i, 1, n) ans = max(ans, gcd(l[i-1], r[i+1]));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import Data.Tuple (swap)

main :: IO ()
main = do
  [n, m] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    parents :: [(Int, Int)] -> VU.Vector Int
    parents = VU.accum (flip const) (VU.replicate n n)
  abs <- sequence . replicate m $ unsafeListToPair . map (pred . unsafeTextToInt) . T.words <$> T.getLine :: IO [(Int, Int)]
  let
    edges = (++) <$> id <*> map swap $ abs :: [(Int, Int)]
    adjacency = fromEdgesToAdjacencyVectorN n edges :: V.Vector [Int]
    tree = fromAdjacencyVectorToSimpleGraph adjacency 0 :: Tree Int
    queue = (tree, n) : walk (pred n) (IS.singleton 0) queue :: [(Tree Int, Int)]
      where
        walk :: Int -> IntSet -> [(Tree Int, Int)] -> [(Tree Int, Int)]
        walk 0 _ _ = []
        walk l s (((Node i ts), _) : tps) = map (flip (,) i) ts' ++ walk (l - IS.size s') (IS.union s s') tps
          where
            ts' = filter (flip IS.notMember s . extract) ts :: [Tree Int]
            s' = IS.fromList . map extract $ ts' :: IntSet
  T.putStrLn . T.pack $ "Yes"
  VU.mapM_ print . VU.map succ . VU.tail . parents . map ((,) <$> extract . fst <*> snd) $ queue

fromEdgesToAdjacencyVectorN :: Int -> [(Int, Int)] -> V.Vector [Int]
fromEdgesToAdjacencyVectorN n = V.accum (flip (:)) (V.replicate n [])
{-# INLINE fromEdgesToAdjacencyVectorN #-}

fromAdjacencyVectorToSimpleGraph :: V.Vector [Int] -> Int -> Tree Int
fromAdjacencyVectorToSimpleGraph adjacency root = Node root (map (f root) (adjacency V.! root))
  where
    f :: Int -> Int -> Tree Int
    f p i = Node i (map (f i) . filter (/= p) $ adjacency V.! i)
{-# INLINE fromAdjacencyVectorToSimpleGraph #-}

data Tree a = Node a [Tree a]

extract :: Tree a -> a
extract (Node x _) = x

unsafeListToPair :: [Int] -> (Int, Int)
unsafeListToPair [x, y] = (x, y)
{-# INLINE unsafeListToPair #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


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

using namespace std;
using namespace __gnu_pbds;

#define lint                     long long 
#define setbits(x)              __builtin_popcountll(x)
#define zrbits(x)               __builtin_ctzll(x)
#define zlbits(x)               __builtin_clzll(x)
#define parsbits(x)             __builtin_parityll(x)
#define mem(a, b)               memset(a, (b), sizeof(a))
#define MOD                     1000000007
#define inf                     1e17 
#define neginf                  -1e17 
#define sp(x,y)                 fixed<<setprecision(x)<<y
#define testcase(t)             lint t; cin>>t; while(t--)
#define power(a,b)              (double)pow((double)a,(double)b)
#define FOR(i,n)                for(lint i=0;i<n;i++)
#define gcd(a,b)                __gcd(a,b)
#define PI                      3.1415926535
#define pb                      push_back
#define ss                      second
#define ff                      first
#define umap                    unordered_map           
#define ummap                   unordered_multimap
#define uset                    unordered_set
#define umset                   unordered_multiset

             
typedef unsigned long long   ull;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
         
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    #ifndef ONLINE_JUDGE
  //  freopen("C:\\Users\\pranjal bhatt\\Desktop\\code contests\\input1.txt", "r", stdin);
    //freopen("C:\\Users\\pranjal bhatt\\Desktop\\code contests\\output1.txt", "w", stdout);
    //#endif
}

lint me(lint x, lint y, lint p)  
{  
    lint res = 1;     
     
    x = x % p; 
           
    if (x == 0) return 0; 
          
    while (y > 0)  
    {  
                
        if (y & 1)  
        res = (res*x) % p;  
          
                  
        y = y>>1;  
        x = (x*x) % p;  
    }  
    return res;  
}

    /*---------------------------SOLUTION---------------------------------*/

void solve()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    umap<char,lint> hash;
    lint n=s.length();
    for(lint i=0;i<n;i++)
    {
        hash[s[i]]++;
    }
    for(auto h:hash)
    {
        if(h.ss%2!=0)
        {
            cout<<"No\n";
            return;
        }
    }   
    cout<<"Yes\n";     

}


int main()
{
    c_p_c();
    lint flg99=0;
    if(flg99==1)
    {
        testcase(t)
        {
             solve();
        }
    }
    else
    {
        solve();
    }
    return 0;
            
}
                
            
                

                

                



Measured memory_bytes: 3656
def main():
  s1,s2,s3 = map(str,input().split())
  ans = False
  if s1[len(s1)-1] == s2[0]:
    if s2[len(s2)-1]==s3[0]:
      ans = True
  print("YES" if ans else "NO")
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N;

	public static void main(String[] arg) {
		N = sc.nextInt();
		int[] a = new int[N];
		int[] ord = new int[N];
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
			ord[i] = i + 1;
		}
		Ar st = new Ar(a);
		Ar ed = new Ar(ord);
		if (st.equals(ed)) {
			System.out.println(0);
			return;
		}
		HashSet<Ar> forward = new HashSet<Ar>();
		HashSet<Ar> backward = new HashSet<Ar>();
		ArrayList<Ar> curFor = new ArrayList<Ar>();
		ArrayList<Ar> curBac = new ArrayList<Ar>();
		forward.add(st);
		backward.add(ed);
		curFor.add(st);
		curBac.add(ed);
		for (int i = 0;; ++i) {
			ArrayList<Ar> nextFor = new ArrayList<Ar>();
			ArrayList<Ar> nextBac = new ArrayList<Ar>();
			for (Ar ar : curFor) {
				for (int j = 0; j < N; ++j) {
					for (int k = 2; j + k <= N; ++k) {
						rev(ar.a, j, k);
						Ar na = new Ar(ar.a);
						rev(ar.a, j, k);
						if (backward.contains(na)) {
							System.out.println(i * 2 + 1);
							return;
						}
						if (forward.contains(na)) {
							continue;
						}
						forward.add(na);
						nextFor.add(na);
					}
				}
			}
			if (i == 4) {
				System.out.println(10);
				return;
			}
			for (Ar ar : curBac) {
				for (int j = 0; j < N; ++j) {
					for (int k = 2; j + k <= N; ++k) {
						rev(ar.a, j, k);
						Ar na = new Ar(ar.a);
						rev(ar.a, j, k);
						if (forward.contains(na)) {
							System.out.println(i * 2 + 2);
							return;
						}
						if (backward.contains(na)) {
							continue;
						}
						backward.add(na);
						nextBac.add(na);
					}
				}
			}

			curFor = nextFor;
			curBac = nextBac;
		}
	}

	static void rev(int[] a, int s, int l) {
		for (int i = 0; i < l / 2; ++i) {
			int tmp = a[s + i];
			a[s + i] = a[s + l - 1 - i];
			a[s + l - 1 - i] = tmp;
		}
	}

	static class Ar {
		int[] a;

		Ar(int[] ar) {
			this.a = ar.clone();
		}

		public int hashCode() {
			return Arrays.hashCode(a);
		}

		public boolean equals(Object obj) {
			if (this == obj) return true;
			if (obj == null) return false;
			Ar other = (Ar) obj;
			return Arrays.equals(a, other.a);
		}
	}

}

Measured memory_bytes: 163360
import math
import sys


scan = sys.stdin.readline


def comb(n, k):
    return math.factorial(n) // (math.factorial(k) * math.factorial(n - k)) if n >= k else 0


def main():
    n, m = map(int, scan().rstrip().split())

    comb_even = comb(n, 2)
    comb_odd = comb(m, 2)

    print(comb_even + comb_odd)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

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

    int N;
    cin >> N;
    vector<P> data;
    vector<int> a(N);
    for(int i = 0; i < N; ++i){
        int h;
        cin >> h;
        data.emplace_back(h, i);
    }
    for(int i = 0; i < N; ++i)  cin >> a[i];
    sort(data.begin(), data.end());

    SegmentTree<ll> dp(N, [](ll a, ll b){return max(a, b);}, 0LL);
    for(auto& p : data){
        int i = p.second;
        dp.update(i, dp.query(0, i) + a[i]);
    }
    cout << dp.query(0, N) << endl;
}

Measured memory_bytes: 9800
N = int(input())
S = input()

def check(L):
  a = set()
  for i in range(N - (L * 2) + 1):
    a.add(S[i:i+L])
    if S[i+L:i+L+L] in a:
      return True
  return False

left = 0
right = N // 2 + 1
while right - left > 1:
  mid = left + (right - left) // 2
  if check(mid):
    left = mid
  else:
    right = mid
print(left)

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

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    char tmp='A';
    int ans=0;
    rep(i,n){
        if(tmp!=s[i]){
            ans++;
            tmp=s[i];
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09 + 7;

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

  char a, b;
  cin >> a >> b;

  if(a == b) cout << "H" << endl;
  else cout << "D" << endl;
}


Measured memory_bytes: 256
R, G, B, N = map(int, input().split())
mr, mg, mb = N//R, N//G, N//B

ans = 0
for r in range(mr+1):
    for g in range(mg+1):
        val = N - r*R - g*G
        if val >= 0 and val % B == 0:
            ans += 1
print(ans)

Measured memory_bytes: 40812
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll int 
#define pi 3.1415926536
using namespace std;
const ll N=55;
ll n,k,m,h,x,y,z,w,mini,maxi=INT_MAX,prev,res;
ll a[N],b[N],c[N],d[N],v[N];
void chk(ll i,ll vr)
{
	if(i==n+1)
	{
		ll ans=0;
		for(ll j=0;j<h;j++)
		{    x=b[j];
			 y=a[j];
			if(v[x]-v[y]==c[j])
			ans+=d[j];
		}
		res=max(res,ans);
		return;
	}
	for(ll j=vr;j<=m;j++)
	{
		v[i]=j;
		chk(i+1,j);
	}
}
void solve()
{
 cin>>n>>m>>h;
 for(ll i=0;i<h;i++)
 cin>>a[i]>>b[i]>>c[i]>>d[i];
 chk(1,1);
 cout<<res;
}
  
int main()
{
  fast
  //for(ll i=0;i<=9;i++)
  //cal(1,3234566667,i);
  //sort(v.begin(),v.end());
  //pre();
ll t=1;
//cin>>t;
//SieveOfEratosthenes();
//cout<<"ok";
while(t--)
{ //cout<<"ok";

solve();
 //cout<<ma<<endl;
}
return 0;}
/*
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}
vector<ll> fact(N+1);
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=N;i++)
	fact[i]=fact[i-1]*i,fact[i]%=hell;
	
}
*/

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

#define vi vector<int>
#define all(v) v.begin(), v.end()
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define pp pop_back
#define forn(i,n) for(int i=0;i<n;i++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
int main()
{
    IOS
    int i,j,k,n;
    string s;
    cin>>s;
    if(s[0]=='R'){
        if(s[1]=='R' && s[2]=='R'){
            cout<<3;
        }
        else if(s[1]=='R'){
            cout<<2;
        }
        else{
            cout<<1;
        }
    }
    else if(s[1]=='R'){
        if(s[2]=='R'){
            cout<<2;
        }
        else{
            cout<<1;
        }
    }
    else if(s[2]=='R'){
        cout<<1;
    }
    else{
        cout<<0;
    }
    cout<<endl;
}


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

struct card{ 
    char mark; 
    int value; 
};

int main(void){
    string A1[100],A2[100],tmp2,tmp4;
    card C1[100],C2[100],tmp1,tmp3;
    int n,minj;
    bool flag = true;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> A1[i];
        A2[i] = A1[i];
        C1[i].mark = A1[i][0];
        C1[i].value = A1[i][1];
        C2[i].mark = A2[i][0];
        C2[i].value = A2[i][1];
    }
    
    while(flag){
        flag = false;
        for (int j = n - 1; j >= 1; j--){
            if (C1[j].value < C1[j-1].value){
                tmp1 = C1[j];
                C1[j] = C1[j-1];
                C1[j-1] = tmp1;
                tmp2 = A1[j];
                A1[j] = A1[j-1];
                A1[j-1] = tmp2;
                flag = true;
            }
        }
    }
    for (int i = 0; i <= n-1; i++){
        minj = i;
        for (int j = i; j <= n-1; j++){
            if (C2[j].value < C2[minj].value){
                minj = j;
            }
        }
        tmp3 = C2[i];
        C2[i] = C2[minj];
        C2[minj] = tmp3;
        tmp4 = A2[i];
        A2[i] = A2[minj];
        A2[minj] = tmp4;
    }
    for (int i = 0; i < n; i++){
        cout << A1[i];
        if (i != n - 1){
            cout << " ";
        }
    }
    cout << endl;
    cout << "Stable" << endl;
    for (int i = 0; i < n; i++){
        cout << A2[i];
        if (i != n - 1){
            cout << " ";
        }
    }
    cout << endl;
    for (int i = 0; i < n; i++){
        if (A1[i] != A2[i]){
            cout << "Not stable" << endl;
            return 0;
        }
    }
    cout << "Stable" << endl;
    return 0;
}


Measured memory_bytes: 3228
#include<stdio.h>
#define D 100

int sS(int A[],int N){
  int a,b,c,d=0,e;
  for(a=0;a<N-1;a++){
    e = a;
    for(b = a;b<N;b++) {
      if(A[b]<A[e]) e = b;
    }
    c = A[a];A[a] = A[e];A[e] = c;
    if(a!= e) d++;
  }
  return d;
}




int main(){
  int A[D],a,b,N;

  scanf("%d",&N);
  if(N<0||N>100) return 0;

  
  for(a = 0;a<N;a++)
    scanf("%d",&A[a]);

  b = sS(A,N);

  for(a = 0;a<N;a++){
    if(a>0) printf(" ");
    printf("%d",A[a]);
  }
  printf("\n");
  printf("%d\n",b);

  return 0;
}


Measured memory_bytes: 2080
import java.util.Scanner;

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int Q = in.nextInt();
      String S = in.next();
      int[] countAC = new int[N];

      for (int i  = 1; i < S.length(); ++i) {
        countAC[i] = countAC[i - 1];

        if (S.charAt(i - 1) == 'A' && S.charAt(i) == 'C') {
          ++countAC[i];
        }
      }

      while (Q-- > 0) {
        int l = in.nextInt() - 1;
        int r = in.nextInt() - 1;

        System.out.println(countAC[r] - countAC[l]);
      }
    }
  }
}

Measured memory_bytes: 69436
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    string s, t;
    cin >> s >> t;
    ll n = s.size(), m = t.size();
    bool f = false;
    for(ll i = n - m; i >= 0; i--){
        bool ok = true;
        REP(j, m){
            if(s[i + j] == '?') continue;
            if(s[i + j] != t[j]){
                ok = false;
                break;
            }
        }
        if(ok){
            REP(j, m){
                s[i + j] = t[j];
            }
            f = true;
            break;
        }
    }
    if(!f){
        cout << "UNRESTORABLE"<< endl;
        return 0;
    }
    REP(i, n){
        if(s[i] == '?') s[i] = 'a';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  ll N;
  cin >> N;

  ll a = 2;
  ll b = 1;
  REP(i,N-1){
    ll c = a+b;
    a = b;
    b = c;
  }
  cout << b << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        int sum = 0;
 
        for(int i = 1; i <= M; i++) {
            sum += in.nextInt();
        }
        if(N < sum) {
            System.out.println(-1);
        } else {
            System.out.println(N-sum);
        }
    }
}

Measured memory_bytes: 46280
#include <bits/stdc++.h>
#define MAXN 200005
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define KONJ 42-42
using namespace std;

ll n;

void print(int arr[MAXN][MAXN], int r, int s) {
	cout << "\nTEST:\n";
	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < s; j++) {
			cout << arr[i][j] << " ";
		}
		cout << "\n";
	}
	cout << "\n";
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> n;
	cout << (n * (n - 1)) / 2;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[100005];
int main()
{
	int n,m,wa=0,ac=0,x;
	cin>>n>>m;
	string s;
	for(int i=0;i<m;i++)
	{
		cin>>x>>s;
		if(x>n)
		continue;
		if(s=="AC"&&a[x]>=0)
		{
			wa+=a[x];
			a[x]=-1;
			ac++;
		}
		else if(s=="WA"&&a[x]>=0)
		{
			a[x]++;
		}
	}
	cout<<ac<<" "<<wa;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x1,y1,x2,y2,i;
    cin>>x1>>y1>>x2>>y2;
    for(i=0; i<(y2-y1); i++)
        cout<<'U';
    for(i=0; i<(x2-x1); i++)
        cout<<'R';
    for(i=0; i<(y2-y1); i++)
        cout<<'D';
    for(i=0; i<(x2-x1); i++)
        cout<<'L';
    cout<<'L';
    for(i=0; i<(y2-y1+1); i++)
        cout<<'U';
    for(i=0; i<(x2-x1+1); i++)
        cout<<'R';
    cout<<"DR";
    for(i=0; i<(y2-y1+1); i++)
        cout<<'D';
    for(i=0; i<(x2-x1+1); i++)
        cout<<'L';
    cout<<"U"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
using namespace std;

int inf=214748364,n,k,ans=inf,d[4000];
vector<int>g[4000];
queue<int>q;

void bfs(){

	while(!q.empty()){
		int ver=q.front();
		for(int j=0;j<g[ver].size();j++){
			if(d[ver]+2<d[g[ver][j]]){
				d[g[ver][j]]=d[ver]+2;
				q.push(g[ver][j]);
			}
		}
		q.pop();
	}
	return;
}

int solvertex(int x){
	while(!q.empty()){
		q.pop();
	}
	q.push(x);
	for(int i=0;i<n;i++)
		d[i]=inf;
	d[x]=0;
	bfs();
	int res=0;
	for(int i=0;i<n;i++)
		if(d[i]>k)res++;
	return res;
}

int solvedge(int u,int v){
	while(!q.empty()){
		q.pop();
	}
	q.push(u);
	q.push(v);

	for(int i=0;i<n;i++)
		d[i]=inf;
	d[u]=1;
	d[v]=1;
	bfs();
	int res=0;
	for(int i=0;i<n;i++)
		if(d[i]>k)res++;
	return res;
}

int main(){
	cin>>n>>k;
	for(int i=1;i<n;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(int i=0;i<n;i++)
		ans=min(ans,solvertex(i));
	for(int i=0;i<n;i++)
		for(int j=0;j<g[i].size();j++)
			if(i<g[i][j])
		    ans=min(ans,solvedge(i,g[i][j]));
	cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int w, a, b;
    cin >> w >> a >> b;
    if (b > a){
        if (b - w - a > 0) out(b-w-a);
        else out(0);    
    }
    else {
        if (a - w - b > 0) out(a-w-b);
        else out(0);
    }
    
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

MOD = 10 ** 9 + 7
def dfs(v, pv):
    white, black = 1, 1
    for nv in edge[v]:
        if nv == pv: continue
        rw, rb = dfs(nv, v)
        white *= rw + rb
        white %= MOD
        black *= rw
        black %= MOD
    return white, black

N = int(input())
edge = [[] for _ in range(N)]

for i in range(N-1):
    x, y = map(lambda x:int(x)-1, input().split())
    edge[x].append(y)
    edge[y].append(x)

print(sum(dfs(0, -1)) % MOD)


Measured memory_bytes: 944804
///------------------  CODE FOR FUN -------------------
#include <bits/stdc++.h>
#define FOR(i,j,k) for(int i = j; i <= k; i ++)
#define FORD(i,j,k) for(int i = j; i >= k; i --)
#define mp make_pair
//#define f first
//#define s second
//#define int long long
using namespace std;

const int MOD=1e9+7;
const int N = 200005;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    #define task""
//    freopen(task".inp","r",stdin);
//    freopen(task".out","w",stdout);
    int X, Y;
    cin >> X >> Y;
    if(Y % 2)
    {
        cout << "No";
        return 0;
    }
    if(Y >= X * 2 && Y <= X * 4) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int N,ans;
    cin>>N;
	for(int i=2;i<=N;i++)
	{
		int num=1;
		for(int j=2;j<=i;j++)
		    if(i%j==0&&j%2!=0) num++;
		if(num==8) ans++;
	}
	cout<<ans<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    long long a=1,b=1;
    for(int i=0;i<n;i++)
    {
        long long x,y;
        cin>>x>>y;
        long long c1=(a+x-1)/x;
        long long c2=(b+y-1)/y;
        long long c=max(c1,c2);
        a=x*c;
        b=y*c;
    }
    cout<<a+b<<endl;
    return 0;
}


Measured memory_bytes: 256
// C - GCD on Blackboard
#include <bits/stdc++.h>
using namespace std;

int gcd(int a, int b){
	if(a<b) swap(a,b);
	while(b){int r =a%b; a=b; b=r;}
	return a;
}

int main(){
	int N; cin>>N;
	vector<int> A(N), L(N), R(N);

	for(int n=0; n<N; ++n) cin>>A[n];
	for(int n=0; n<=N-1-1; ++n) L[n+1] = gcd(L[n], A[n]);
	for(int n=N-1-1; n>=0; --n) R[n] = gcd(R[n+1], A[n+1]);

	int maxi = 0;
	for(int n=0; n<N; ++n) maxi = max(maxi, gcd(L[n], R[n]));
	cout<< maxi <<endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,ll>;
using Map = map<char,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

ll MOD=1000000007;


int main(){
    ll N;
    cin >> N;
    ll next1=0,next2=0,next3=0;
    ll ans=1;
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        if(a==next1){
            if(next1!=next2){}
            else if(next2!=next3){ans*=2;}
            else{ans*=3;}
            next1++;
        }
        else if(a==next2){
            if(next2!=next3){}
            else{ans*=2;}
            next2++;
        }
        else if(a==next3){next3++;}
        else {cout<<0<<endl; return 0;}
        ans%=MOD;
    ;}
    cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, int num=0){
  if(num == 0) num = (int)v.size();
  if(is_reverse) for(int i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<" ";}
  else for(int i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<" ";}
  cout << endl;
}

template <typename T>
void print_pairvec(const vector<T> &v, int num=0){
  if(num == 0) num = (int)v.size();
  cout << endl;
  for(int i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
}


template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
	string  S;
	int K;
	cin >> S >> K;

	// vector<string> tmp;
	// tmp.push_back("aaa");
	// tmp.push_back("a");
	// tmp.push_back("b");
	// tmp.push_back("bbb");
	// sort(tmp.begin(), tmp.end());
	// for(int i=0; i<(int)tmp.size(); i++) cout << tmp[i] << endl;

	vector<string> subs;
	int N = S.size();
	for(int i=1; i<=5; i++){
		for(int j=0; j<N+1-i; j++){
			subs.push_back(S.substr(j,i));
		}
	}
	
	sort(subs.begin(), subs.end());
	// cout << "  subs: "; print_vec(subs);
	// cout << subs[K-1] << endl;

	map<string, int> mp;
	for(string s: subs){
		if(mp[s] != 0) mp[s]++;
		if(mp.size() == K){
			cout << s << endl;
			return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 4328
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
using namespace std;

#define ll long long
#define F(i,a,b) for(int i=a;i<=b;++i)
#define R(i,a,b) for(int i=a;i<b;++i)
#define Rof(i,a,b) for (int i=(a),_##i=(b); i>=_##i; i--)
#define rek(i,a,b) for (int i=(a),_##i=(b); i>=_##i; i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(b))
#pragma comment(linker, "/STACK:102400000,102400000")
inline void read(int &x){x=0; char ch=getchar();while(ch<'0') ch=getchar();while(ch>='0'){x=x*10+ch-48; ch=getchar();}}

char s[200200];
int x,y,len;

int main()
{
    while(scanf("%s",s)==1)
    {
        len=strlen(s);
        for(int i=0;s[i]!='\0';++i) if(s[i]=='A') {x=i;break;}
        for(int i=len-1;i>=0;--i) if(s[i]=='Z') {y=i;break;}
        printf("%d\n",y-x+1);
    }
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int dp[301][301];
int color[300][301];
int cost01[301][301];

int solvecost(int w0, int w1, int x) {

	if (w0 == 0 || w1 == 0)return 0;
	if (cost01[w0][w1] != -1)return cost01[w0][w1];

	cost01[w0][w1] = (color[w0 - 1][x] == color[w1 - 1][x + 1] ? 1 : 0) + solvecost(w0 - 1, w1 - 1, x);
	return cost01[w0][w1];
}

int solve(int w0, int w1, int x) {

	if (w0 == 0 || w1 == 0)return 0;
	if (dp[w0][w1] != -1)return dp[w0][w1];

	dp[w0][w1] = solvecost(w0, w1, x) + min(solve(w0 - 1, w1, x), solve(w0, w1 - 1, x));

	return dp[w0][w1];
}

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

	int H, W;
	cin >> H >> W;
	rep(i, H) {
		string s;
		cin >> s;
		rep(j, W)color[i][j] = s[j] - 'a';
	}
	int ans = 0;

	rep(x, W - 1) {
		rep(i, 301)rep(j, 301)dp[i][j] = -1;
		rep(i, 301)rep(j, 301)cost01[i][j] = -1;

		ans += solve(H, H, x);
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2432