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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

int ans = 0;

class DSU {
private:
    vector<int> parents;
    vector<int> sizes;
public:
    DSU(int n) {
        parents.resize(n+1);
        for(int i = 1; i <= n; ++i) parents[i] = i;
        sizes.resize(n+1);
        for(int i = 1; i <= n; ++i) sizes[i] = 1;
    }

    int root(int i) {
        while(parents[i] != i) {
            parents[i] = parents[parents[i]];
            i = parents[i];
        }
        return i;
    }

    bool find(int a, int b) {
        return root(a) == root(b);
    }

    void join(int a, int b) {
        int root_a = root(a);
        int root_b = root(b);
        if(root_a == root_b) return;
        
        int sza = sizes[root_a];
        int szb = sizes[root_b];

        ans += sza*szb;
        
        if(sizes[root_a] < sizes[root_b]) {
            parents[root_a] = parents[root_b];
            sizes[root_b] += sizes[root_a];
        } else {
            parents[root_b] = parents[root_a];
            sizes[root_a] += sizes[root_b];
        }
    }
};


int32_t main() {

    int n, m; cin >> n >> m;
    vector<pair<int, int>> edges(m);
    for(int i = 0; i < m; ++i) {
        cin >> edges[i].first >> edges[i].second;
    }

    DSU dsu(n);

    vector<int> connections(m+1, 0);
    for(int i = m-1; i >= 0; --i) {
        int x, y;
        tie(x, y) = edges[i];
        dsu.join(x, y);
        connections[i] = ans;
    }

    int cur = 0;
    for(int i = 0; i < m; ++i) {
        cur += connections[i]-connections[i+1];
        cout << cur << endl;
    }
    
    return 0;
}


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

using namespace std;

bool helper(string &is){
    if(is.substr(0,is.size()/2) == is.substr(is.size()/2)){
        return true;
    }

    return false;
}

int main()
{
    ios::sync_with_stdio(false);

    string is;
    cin>>is;

    for(int i = 1; i <= is.size(); ++i){
        string s = is.substr(0, is.size()-i);
        if(s.size()%2 != 0){
            continue;
        }

        if(helper(s)){
            cout<<s.size()<<endl;
            break;
        }
    }


    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define F first
#define S second
#define pb push_back
#define sz(x) ((int)(x).size())

inline int in(){ int x, y; y = scanf("%d", &x); return x; }

const int N = 1000*100 + 100;

int deg[N]; 
vector<int> c[N]; 

int par[N];

int dfind(int u) { 
    return par[u] == -1 ? u : par[u] = dfind(par[u]); 
}

void dmerge(int u, int v) { 
    u = dfind(u), v = dfind(v); 
    if( u == v ) return; 
    par[u] = v; 
}


int main(){
    memset(par, -1, sizeof par); 
    ios::sync_with_stdio(false); cin.tie(0); 

    int n, m; 
    cin >> n >> m;

    for(int i =0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--; 
        deg[u]++; 
        deg[v]++; 
        c[u].pb(i);
        c[v].pb(i); 
    }

    for(int i =0; i < n; i++) 
        if( deg[i] % 2 || n <= 3 ) { 
            cout << "No" << endl;
            return 0; 
        }

    sort(deg, deg + n, greater<int>()); 

    if( deg[0] >= 6 || deg[2] >= 4  ) { 
        cout << "Yes" << endl;
    } else { 
        if( deg[0] == 4 && deg[1] == 4 ) { 
            for(int i = 0; i < n; i++) 
                if( sz(c[i]) == 2 ) 
                    dmerge( c[i][0], c[i][1] ); 
            for(int i = 0; i < n; i++) 
                if( sz(c[i]) == 4 ) { 
                    set<int> tmp ; 
                    for(auto x : c[i]) 
                        tmp.insert( dfind(x)); 
                    if( sz(tmp) == 4 ) { 
                        cout << "No" << endl;
                        return 0; 
                    }
                }
            cout << "Yes" << endl;
            return 0;
        }

        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
using namespace std;
int main()
{
    string n;
    cin >> n;
    bool ok = false;
    for(char c : n)
    {
        if(c == '7')
            ok = true;
    }
    if(ok)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3072
N = int(input())

m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(N):
  s = input()
  if s[0] == 'M':
    m += 1
  elif s[0] == 'A':
    a += 1
  elif s[0] == 'R':
    r += 1
  elif s[0] == 'C':
    c += 1
  elif s[0] == 'H':
    h += 1

comb = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h

print(comb)

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <map>

using namespace std;

typedef pair<int, int> P;

int B[101][101];

bool bfs(int w, int h, int xs, int ys, int xg, int yg);

int main(int argc, char** argv)
{
	int w, h;
	int xs, ys;
	int xg, yg;
	int n;
	int c, d, x, y;

	while( 1 )
	{
		cin >> w;
		cin >> h;
		if(w==0 && h==0) break;
		
		cin >> xs;
		cin >> ys;
		cin >> xg;
		cin >> yg;
		cin >> n;

		for(int i=0; i<n; i++)
		{
			cin >> c; cin >> d; cin >> x; cin >> y;
			if(d==0)
			{
				for(int dx=0; dx<4; dx++)
				{
					for(int dy=0; dy<2; dy++)
					{
						B[x+dx][y+dy] = c;
					}
				}
			}
			else
			{
				for(int dx=0; dx<2; dx++)
				{
					for(int dy=0; dy<4; dy++)
					{
						B[x+dx][y+dy] = c;
					}
				}
			}
		}

		cout << (bfs(w, h, xs, ys, xg, yg) ? "OK" : "NG") << endl;
	}

	return 0;
}

bool bfs(int w, int h, int xs, int ys, int xg, int yg)
{
	int x, y, c, xx, yy;
	int offset[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
	queue<P> q;
	P p;

	c = B[xs][ys];
	B[xs][ys] = 0;
	p.first = xs, p.second = ys;
	
	q.push(p);
	while(!q.empty())
	{
		p = q.front();
		q.pop();
		x = p.first;
		y = p.second;
		if(x==xg && y==yg) return true;
		B[x][y] = 0;

		for(int i=0; i<4; i++)
		{
			xx = x + offset[i][0];
			yy = y + offset[i][1];
			if(x>=1 && y>=1 && x<=w && y<=h)
			{
				if(B[xx][yy] == c)
				{
					p.first = xx;
					p.second = yy;
					q.push(p);
				}
			}
		}
	}

	return false;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    string n;
    cin >> n;
    long long ans = 0;
    for(long long i = 0; i < n.length(); i++){
        ans+=n[i]-'0';
        ans=ans%9;
    }
    if(ans == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3720
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最小公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最大公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a[200000];
    REP(i,n+1)cin >> a[i];
    ll ans = 0;
    REP(i,n){
      ll b;
      cin >> b;
      ans += min(b,a[i]+a[i+1]);
      //cout << a[i] << " " << a[i+1] << endl;
      a[i+1] -= max((ll)0,b-a[i]);
      a[i+1] = max((ll)0,a[i+1]);
    }
    cout << ans << endl;
}


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

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define kk(n)    ff(k, n)
#define xx(n)    ff(x, n)
#define yy(n)    ff(y, n)
#define ii(n)    ff(i, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define kkk(a, b) fff(k, a, b)
#define xxx(a, b) fff(x, a, b)
#define yyy(a, b) fff(y, a, b)
#define iii(a, b) fff(i, a, b)
#define bb begin()
#define ee end()
#define uu first
#define vv second
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#define zz(array, byte)   memset(array, byte, sizeof(array));

using LL = long long;
using DD = long double;
using pii = pair<int, int>;



const LL  INFLL  = 0x7f7f7f7f7f7f7f7fLL;
const int INFint = 0x7f7f7f7f;  //Works with memset(..).
 
     

void pruneFrom(int p, vector<vector<int> > &children, vector<int> &pruned) {
    vector<int> q(1, p);
    ii (len(q)) {
        pruned[q[i]] = 1;
        kk (len(children[q[i]]))
            if (!pruned[children[q[i]][k]])
                q.append(children[q[i]][k]);
    }
}


int main() {
    ios_base::sync_with_stdio(false);     cin.tie(NULL);
    //cout << '\n';
    cout.precision(16);
    
    int N, K;
    cin >> N >> K;
    vector<int> as(N);
    ii (N) {
        cin >> as[i];
        --as[i];
    }

    int rr = (as[0] != 0);
    vector<vector<int> > children(N);
    vector<int> dists(N, -1);
    dists[0] = 0;
    iii (1, N) {
        vector<int> line;
        int v = i;
        while (dists[v] == -1) {
            line.append(v);
            v = as[v];
        }
        kk (len(line)) {
            dists[line[k]] = dists[v] + len(line) - k;
        }
        if (len(line) >= 1)
            children[v].append(line[len(line)-1]);
        kk (len(line)-1) {
            children[line[k+1]].append(line[k]);
        }
    }

    vector<pii> by_decreasing_dist(N-1);
    ii (N-1)
        by_decreasing_dist[i] = pp(-dists[i+1], i+1);
    sort(all(by_decreasing_dist));

    vector<int> pruned(N, 0);
    ii (N-1) {
        int h = by_decreasing_dist[i].vv;
        //printf("%d dist %d\n", h, dists[h]);
        if (pruned[h] || dists[h] <= K) continue;

        int p = h;
        kk (K-1)
            p = as[p];
        ++rr;
        pruneFrom(p, children, pruned);
    }

    cout << rr << '\n';
    

    return 0;
}



Measured memory_bytes: 8408
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		String O=in.nextLine(),E=in.nextLine();
		
		for(int i=0;i<O.length();i++) {
			System.out.print(O.charAt(i));
			if(i<E.length())System.out.print(E.charAt(i));
		}
		System.out.println();
	}

}


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

int main() {
    ll a;
    string hoge;
    cin >> a >> hoge;
    ll b = (hoge[0]-'0')*100 +(hoge[2]-'0')*10 + (hoge[3]-'0');
    cout << (b*a)/100 << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    int N;
    cin >> N;

    int h[N];
    rep(i, N) cin >> h[i];

    int DP[100009];
    DP[0] = 0;
    DP[1] = abs(h[1] - h[0]);
    int a, b;
    for (int i = 1; i < N; i++) {
        a = abs(h[i+1] - h[i-1]) + DP[i-1];
        b = abs(h[i+1] - h[i]) + DP[i];
        DP[i+1] = min(a, b);
    }

    cout << DP[N-1] << endl;
}

Measured memory_bytes: 4256
<?php
$s = trim(fgets(STDIN));
if($s === "SUN") {
    $nextSun = 7;
} elseif($s === "MON") {
    $nextSun = 6;
} elseif($s === "TUE") {
    $nextSun = 5;
} elseif($s === "WED") {
    $nextSun = 4;
} elseif($s === "THU") {
    $nextSun = 3;
} elseif($s === "FRI") {
    $nextSun = 2;
} elseif($s === "SAT") {
    $nextSun = 1;
}
echo $nextSun . PHP_EOL;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin >> c;
    if (c >= 'a' && c <= 'z')
    {
        cout << "a\n";
    }
    else
    {
        cout << "A\n";
    }
    return 0;
}

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

mint fact(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		for(;k<=n;k++) memo[k]=memo[k-1]*k;
	}
	return memo[n];
}

mint fact_inverse(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		memo[n]=inverse(fact(n));
		for(int i=n;i>k;i--) memo[i-1]=memo[i]*i;
	}
	return memo[n];
}

mint choose(int n,int k,int type=0){
	if(k<0 || n<k) return 0;
	if(type==0){
		return fact(n)*fact_inverse(k)*fact_inverse(n-k);
	}
	else{
		if(k>n-k) k=n-k;
		mint res=fact_inverse(k);
		rep(i,k) res*=n-i;
		return res;
	}
}


template<class T>
vector<pair<T,int>> run_length_encoding(const vector<T>& a){
	vector<pair<T,int>> res;
	int n=a.size(),pre=0;
	rep(i,n) if(i==n-1 || a[i]!=a[i+1]) res.emplace_back(a[i],i-pre+1), pre=i+1;
	return res;
}

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	sort(a.begin(),a.end());

	mint ans=0;
	int small=0;
	for(auto p:run_length_encoding(a)){
		int large=n-p.second-small;
		ans+=(choose(p.second+small,k)-choose(small,k))*p.first;
		ans-=(choose(p.second+large,k)-choose(large,k))*p.first;
		small+=p.second;
	}
	printf("%d\n",ans.to_int());

	return 0;
}


Measured memory_bytes: 2292
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[][] a = new int[n][2];
        for(int i = 0; i < n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        int[][] b = new int[n][2];
        for(int i = 0; i < n; i++) {
            b[i][0] = sc.nextInt();
            b[i][1] = sc.nextInt();
        }

        Arrays.sort(a, (x, y) -> x[0] == y[0] ? x[1] - y[1] : x[0] - y[0]);
        Arrays.sort(b, (x, y) -> x[0] == y[0] ? x[1] - y[1] : x[0] - y[0]);

        boolean[] selected = new boolean[n];
        int cnt = 0;
        int maxY = -1;
        int maxIdx = -1;
        for(int i = 0; i < n; i++) { // blue
            maxY = -1;
            maxIdx = -1;
            for(int j = 0; j < n; j++) { // red
                if(b[i][0] <= a[j][0]) break;
                if(!selected[j] && b[i][0] > a[j][0] && b[i][1] > a[j][1] && a[j][1] > maxY) {
                    maxY = a[j][1];
                    maxIdx = j;
                }
            }
            if(maxIdx != -1) {
                cnt++;
                selected[maxIdx] = true;
            }
        }
        System.out.println(cnt);
    }
}   

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

int N, K;
vector<vector<int> > B(4020, vector<int>(4020, 0));
vector<vector<int> > W(4020, vector<int>(4020, 0));
vector<vector<int> > Bs(4020, vector<int>(4020, 0));
vector<vector<int> > Ws(4020, vector<int>(4020, 0));

int bcsum(int x1, int y1, int x2, int y2) {
    return Bs[y1][x1] - Bs[y1][x2] - Bs[y2][x1] + Bs[y2][x2];
}

int wcsum(int x1, int y1, int x2, int y2) {
    return Ws[y1][x1] - Ws[y1][x2] - Ws[y2][x1] + Ws[y2][x2];
}

int main() {
    cin >> N >> K;
    int K2 = K * 2;
    for(int i = 0; i < N; i++) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        x %= K2;
        y %= K2;
        if(c == 'B') {
            B[y][x]++;
            B[y+K2][x]++;
            B[y][x+K2]++;
            B[y+K2][x+K2]++;
        } else {
            W[y][x]++;
            W[y+K2][x]++;
            W[y][x+K2]++;
            W[y+K2][x+K2]++;
        }
    }

    for(int y = 0; y < K2 * 2; y++) {
        for(int x = 0; x < K2 * 2; x++) {
            Bs[y+1][x+1] = B[y][x] + Bs[y+1][x] + Bs[y][x+1] - Bs[y][x];
            Ws[y+1][x+1] = W[y][x] + Ws[y+1][x] + Ws[y][x+1] - Ws[y][x];
        }
    }


    int ans = -1e9+1;
    for(int y = 0; y < K2; y++) {
        for(int x = 0; x < K2; x++) {
            int x2 = x + K;
            int y2 = y + K;
            int sum = bcsum(x, y, x2, y2) + bcsum(x2, y2, x2 + K, y2 + K);
            sum += wcsum(x, y2, x2, y2 + K) + wcsum(x2, y, x2 + K, y2);
            ans = max(ans, sum);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 253440
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define PI 3.141592653589793238462643383279


void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
int compare_int(const void *a, const void *b){
	return *(int*)b - *(int*)a;	//でかい順
}

int main(void){
	int n, m;
	scanf("%d %d", &n, &m );
	int x[m];
	for(int i=0; i<m;i++)	scanf("%d", &x[i]);
	qsort(x, m, sizeof(int), compare_int); 
	int max = x[0], min = x[m-1];
  	int ans;
	if(n<m){
		int kankaku[m-1];
		for(int i=0;i<m-1;i++){
			kankaku[i]=abs(x[i]-x[i+1]);
		}
		qsort(kankaku, m-1, sizeof(int), compare_int);
	
		ans = max - min;
		for(int i=0; i<n-1;i++){
			ans -= kankaku[i];
		}
	}else	ans=0;
	printf("%d", ans);
	
	return 0;
}

Measured memory_bytes: 1268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  bitset<1000000000> A;
  rep(i,0,N){
    int X;
    cin>>X;
    A.flip(X-1);
    }
  cout<<A.count();
  }


Measured memory_bytes: 122368
// luogu-judger-enable-o2
#include<bits/stdc++.h>

using namespace std;
char s;
int str[110][110];
int n,m;
int main()
{
 cin>>n>>m;
 for(int i=1;i<=n;i++)
 {
    for(int j=1;j<=m;j++)
    {
    cin>>s;
    if(s=='#')str[i][j]=1;
    }
 }
 for(int i=1;i<=n;i++)
 {
    for(int j=1;j<=m;j++)
    {
    if(str[i][j]==0)
    {
    cout<<str[i+1][j+1]+str[i+1][j-1]+str[i+1][j]+str[i][j+1]+str[i][j-1]+str[i-1][j+1]+str[i-1][j]+str[i-1][j-1];
    }
    else cout<<"#";
    }
    cout<<endl;
 }
 return 0;
}

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

ABC = set(map(int, input().split()))

if len(ABC) == 2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5936
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}

ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}
ll primefactor(ll x){
  ll nn = x;
  ll res=0;
  for(ll i=2;i*i<=nn;++i){
    if(nn%i==0) res++;
    while(nn%i==0){
      nn /= i;
    }
  }
  if(nn!=1) res++;
  return res;
}

int main()
{
  ll a,b;cin >> a >> b;
  ll g = gcd(a,b);
  ll num = primefactor(g);
  cout << num+1 << "\n";
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
D = list(map(int, input().split()))

if D[0] != 0:
    print(0)
    exit(0)
D.sort()

if D[1] == 0:
    print(0)
    exit(0)

for i in range(0, N-1):
    if abs(D[i] - D[i+1]) > 1:
        print(0)
        exit(0)

cnt = [0 for _ in range(N)]

for i in range(0, N):
    cnt[D[i]] += 1

ans = 1

for i in range(0, N-1):
    if cnt[i+1] == 0:
        break
    ans *= pow(cnt[i], cnt[i+1])
    ans %= 998244353

print(ans)


Measured memory_bytes: 14396
#include<stdio.h>
int main(void)
{
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	if(n*a<b){
		printf("%d\n",n*a);
	}
	else{
		printf("%d\n",b);
	}
	return 0;
}


Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    vi water(f+1);
    water[0] = 1;
    rep(i, f) {
        if(!water[i]) continue;
        if(i+a*100 <= f) water[i+a*100] = 1;
        if(i+b*100 <= f) water[i+b*100] = 1;
    }

    vi sugar(f+1), sss;
    sugar[0] = 1;
    rep(i, f) {
        if(!sugar[i]) continue;
        if(i+c < f) sugar[i+c] = 1;
        if(i+d < f) sugar[i+d] = 1;
        sss.push_back(i);
    }

    P ans = P(-1, -1);
    rep(i, f+1) {
        if(!water[i] or !i) continue;
        //cout << i << endl;
        if(ans.first == -1) {
            ans.first = i;
            int num = f-i;
            if(num > i/100*e) {
                num = i/100*e;
            }
            auto itr = upper_bound(all(sss), num); 
            if(itr == sss.begin()) itr++;
            ans.second = *(itr-1);
            //cout << num << ' ' << i << endl;
        } else {
            int num = f-i;
            if(num > i/100*e) {
                num = i/100*e;
            }
            auto itr = upper_bound(all(sss), num);
            if(itr == sss.begin()) itr++;
            num = *(itr-1);
            if((num+i)*ans.second < (ans.first+ans.second)*num) {
                ans = P(i, num);
            }
        }
    }

    cout << ans.first+ans.second << ' ' << ans.second << endl;
}

Measured memory_bytes: 3652
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
sum=0
for i in range(n+1):
    sum+=abs(a[i+1]-a[i])
for i in range(1,n+1):
    p=a[i-1]
    x=a[i]
    f=a[i+1]
    if p<=x<=f or f<=x<=p:
        print(sum)
    elif p<=f<=x or x<=f<=p:
        print(sum-2*abs(x-f))
    else:
        print(sum-2*abs(x-p))

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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int X = inputs.nextInt();
		int Y = inputs.nextInt();
		if((Y-2*X)%2==0) {
			int b = (Y-2*X)/2;
			int a = X-b;
			if(a<0||b<0) {
				System.out.println("No");
			}
			else if(2*a+4*b==Y)
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 35708
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s,t;
    cin >> s >> t;
    intl len = s.length();
    intl l = t.length();
    rep(i,len){
        cout << s[i];
        if(i < l)cout << t[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,a,i;
	long long int max=-1000000,min=1000000,sum=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(min>=a){
			min=a;
		}
		if(max<=a){
			max=a;
		}
		sum+=a;
	}
	printf("%lld %lld %lld\n",min,max,sum);
	return 0;
}

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



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

  while(1){
    int n, m;
  
    cin>>n>>m;
    if(n == 0 && m == 0) break;
    vector<int> A(n);
    cin>>A;
  
    int ans = -1;
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++){
	if(A[i] + A[j] <= m) ans = max(ans, A[i] + A[j]);
      }

    if(ans == -1) cout<<"NONE"<<endl;
    else cout<<ans<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3144
S=input()
S1=S[:2]
S2=S[2:]
if 0 < int(S1) <= 12 and 0< int(S2) <= 12:
  print('AMBIGUOUS')
elif 0 < int(S1) <= 12:
  print('MMYY')
elif 0 < int(S2) <= 12:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3060
using System;

class Queue
{
    private string name;
    private int time;
    private int max = 100005;
    public Queue() {
        name = "null";
        time = 0;
    }
    public string nameop
    {
        get {
            return name;
        }
        set {
            name = value;
        }
    }
    public int timeop
    {
        get {
            return time;
        }
        set {
            time = value;
        }
    }
    public void enqueue(ref Queue[] queue, Queue data, ref int head, ref int tail) {
        
        queue[tail] = data;
        tail = (tail + 1) % max;
    }
    public Queue dequeue(ref Queue[] queue, ref int head, ref int tail) {
        Queue x = queue[head];
        head = (head + 1) % max;
        return x;
    }
    
}
class B {
    public static void Main() {
        int n, q, counttime=0;
        string[] nq = Console.ReadLine().Split(' ');
        n = int.Parse(nq[0]);
        q = int.Parse(nq[1]);
        string[][] data=new string[n][];
        Queue work = new Queue();
        Queue[] queue = new Queue[100005];
        int head = 0, tail = n;
        for (int i = 0; i < n; i++) {
            queue[i] = new Queue();
            data[i] = Console.ReadLine().Split(' ');
            queue[i].nameop = data[i][0];
            queue[i].timeop = int.Parse(data[i][1]);
        }
        while (head != tail) {
            work = work.dequeue(ref queue, ref head, ref tail);
            int mint = q<work.timeop ? q:work.timeop;
            work.timeop -= mint;
            counttime += mint;
            if (work.timeop > 0) {
                queue[tail] = new Queue();     
                work.enqueue(ref queue, work, ref head, ref tail);
            } else {
                Console.WriteLine("{0} {1}", work.nameop, counttime);
            }
        }
    }
}


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

#define N 100

static int d[ N ];
static int n;

static unsigned long long int k_operafan[ N ][ N * 9 ];

static unsigned long long int
dpFSA (
  const int r,
  const int k
  )
{
  if ( r == n
    && k == d[ n ] ) return ( 1 );
  if ( r == n
    || k < 0
    || k > 20 )      return ( 0 );

  if ( ~k_operafan[ r ][ k ] ) ;
  else
  {
    k_operafan[ r ][ k ] = dpFSA ( r + 1, k - d[ r ] )
                         + dpFSA ( r + 1, k + d[ r ] );
  }

  return ( k_operafan[ r ][ k ] );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  scanf ( "%d", &n );
  for ( i = 0; i < n; ++i )
  {
    scanf ( "%d", &d[ i ] );
  } --n;

  memset ( k_operafan, -1, sizeof ( k_operafan ) );
  printf ( "%llu\n", dpFSA ( 1, d[ 0 ] ) );

  return ( 0 );
}

Measured memory_bytes: 0
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
using namespace std;
long long n,a=2;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
    	a=(a+1)*2;
    }
    cout<<a;
    return 0; 
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

//模拟字典，n为总共指令数，insert插入， find查找，有则输出yes，没有no
//
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Set<String> set = new HashSet<>();
		String s1;
		String s2;
		for (int i = 0; i < n; ++i) {
			s1 = scan.next();
			s2 = scan.next();
			//System.out.println("1" + s1);
			//System.out.println("2" + s2);
			if (s1.equals("insert"))
				set.add(s2);
			if (s1.equals("find"))
				if (set.contains(s2))
					System.out.println("yes");
				else
					System.out.println("no");
				
		}
		//System.out.println(set);
	}
}



Measured memory_bytes: 253764
n, l = gets.split(' ')

N = n.to_i
L = l.to_i
abs_min = 9999999999999999999
ret_val = 0
(0..(N-1)).each do |i|
  sum = 0
  sum_normal = 0
  (0..(N-1)).each do |sum_i|
    sum = sum + sum_i + L unless sum_i == i
    sum_normal = sum_normal + sum_i + L
  end
  if (sum - sum_normal).abs < abs_min
    ret_val = sum
    abs_min = (sum - sum_normal).abs
  end
end

puts ret_val

Measured memory_bytes: 1788
#include<stdio.h>

int main(void){
  int a,b,c,d,e,k;
  scanf("%d\n%d\n%d\n%d\n%d\n%d\n",&a,&b,&c,&d,&e,&k);
  if(e-a>k){
    printf(":(\n");
  }else{
    printf("Yay!\n");
  }
  return 0;
}
  

Measured memory_bytes: 1620
n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
 
a,b = [0],[0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])
 
ans,j = 0,m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47520
n = int(input())
al = list(map(int,input().split()))
q = int(input())

from collections import defaultdict
dic = defaultdict(int)

ans = 0
for a in al:
    dic[a] += 1
    ans += a


for _ in range(q):
    b,c = map(int,input().split())
    ans += dic[b] * (c - b)
    dic[c] += dic[b]
    dic[b] = 0
    print(ans)








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

using namespace std;

#define int long long

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

#ifdef DBG
#define log(item) cout << #item << " " << item << endl
#define loga(array, val) cout << #array << #val << " " << array [ val ] << endl
#else
#define log(item)
#define loga(array, val)
#endif

typedef vector<int> VI;
typedef pair<int, int> PII;

//-------------------

int N, M;
vector<int> A;

int comp(PII a, PII b){
    return a.second > b.second;
}

signed main(){
    cin >> N >> M;

    REP(i, N){
        int a;
        cin >> a;
        A.push_back(a);
    }

    sort(A.begin(), A.end());

    vector<PII> query;

    REP(i, M){
        int b, c;
        cin >> b >> c;
        query.push_back({b, c});
    }
    sort(query.begin(), query.end(), comp);

    int sum = 0;
    int a = 0;
    int c = 0;
    int ans = 0;
    REP(i, N){
        if(sum == 0){
            if(a < M){
                sum += query[a].first;
                c = query[a].second;
                a++;
            }
            else c = 0;
        }
        log(i);
        log(c);
        log(A[i]);
        ans += max(c, A[i]);
        sum--;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3188
#![allow(unused_imports)]
use proconio::input;
use std::cmp;

#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        H: [i64; N],
    }

    let mut dp = vec![0; N];
    dp[1] = (H[0] - H[1]).abs();

    for i in 2..N {
        dp[i] = cmp::min(
            dp[i - 2] + (H[i] - H[i - 2]).abs(),
            dp[i - 1] + (H[i] - H[i - 1]).abs(),
        );
    }

    println!("{}", dp[N - 1]);
}


Measured memory_bytes: 3936
N, K = gets.chomp.split.map(&:to_i)
N.freeze
K.freeze
p = gets.split.map(&:to_i)  # スペースで区切られた複数の整数
p.sort!

ans = 0
for num in 0..K-1 do
  ans = ans + p[num]
end
puts ans

Measured memory_bytes: 14268
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int no;
    string s;
    int p;
};
bool operator <(node a,node b)
{
    if(a.s==b.s)return a.p<b.p;
    return a.s>b.s;
}
int main()
{
    priority_queue<node>qu;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        node r;
        cin>>r.s>>r.p;
        r.no=i;
        qu.push(r);
    }
    for(int i=1;i<=n;i++)
    {
        node g=qu.top();
        qu.pop();
        printf("%d\n",g.no);
    }
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, K;
ll V[100];

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

    std::cin >> N >> K;

    for(int i=0;i<N;++i){
        std::cin >> V[i];
    }

    ll mx = 0;

    for(int i=0;i<=std::min(K, N);++i){
        for(int j=0;j<=std::min(K - i, N - i);++j){
            int k = K - (i + j);

            ll score = 0;
            std::vector<ll> neg;

            for(int l=0;l<i;++l){
                score += V[l];

                if(V[l] < 0){
                    neg.emplace_back(V[l]);
                }
            }

            for(int l=N-j;l<N;++l){
                score += V[l];

                if(V[l] < 0){
                    neg.emplace_back(V[l]);
                }
            }

            std::sort(neg.begin(), neg.end());

            score -= std::accumulate(neg.begin(), neg.begin() + std::min<int>(k, neg.size()), 0ll);

            // std::cout << i << ", " << j << ", " << score << std::endl;

            mx = std::max(mx, score);
        }
    }

    std::cout << mx << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	cout << (n + 1) / 2 << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n,x; cin >> n >> x;

    int m=n*2-1;

    if(n==2 && x==2){
        cout << "Yes" << endl;
        cout << 1 << endl;
        cout << 2 << endl;
        cout << 3 << endl;

        return 0;

    }else{
        if(x>2 && m-x>=1){
            cout << "Yes" << endl;
            std::vector<int>  arr(m,0);

            arr[m/2]=x;
            arr[m/2-1]=x-1;
            arr[m/2+1]=x+1;
            arr[m/2+2]=x-2;

            std::vector<int> rest;
            rep(i,m){
                if((i+1)>x+1 || (i+1)<x-2) rest.push_back(i+1);
            }

            int j = 0;
            rep(i,m){
                if(arr[i]==0) arr[i] = rest[j++];
            }

            rep(i,m) cout << arr[i] << endl;
            return 0;

        } else if(x>1 && m-x>=2){
            cout << "Yes" << endl;
            std::vector<int>  arr(m,0);

            arr[m/2]=x;
            arr[m/2-1]=x+1;
            arr[m/2+1]=x-1;
            arr[m/2+2]=x+2;

            std::vector<int> rest;
            rep(i,m){
                if((i+1)>x+2 || (i+1)<x-1) rest.push_back(i+1);
            }

            int j = 0;
            rep(i,m){
                if(arr[i]==0) arr[i] = rest[j++];
            }

            rep(i,m) cout << arr[i] << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

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

long long dp[51][2560]={0};
int main(){
    int N,A;
    cin >> N >> A;

    dp[0][0]=1;
    for(int i=1;i<=N;i++){
        int x;
        cin>>x;
        for(int j=i-1;j>=0;j--){
            for(int k=0; k<=2501;k++){
                dp[j+1][k+x] += dp[j][k];
            }
        }
    }


    long long totalWays = 0;
    for(int i=1; i<=N; i++){
        totalWays += dp[i][i*A];
    }

    cout << totalWays << '\n';

}


Measured memory_bytes: 4164
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int x, y;
  cin >> x >> y;

  int ans = 0;
  if(x == 1) ans += 300000;
  if(x == 2) ans += 200000;
  if(x == 3) ans += 100000;

  if(y == 1) ans += 300000;
  if(y == 2) ans += 200000;
  if(y == 3) ans += 100000;

  if(x == 1 && y == 1) ans += 400000;

  cout << ans << endl;

  return 0;
}

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

int main()
{
int a;
int b;
int c;
int d;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;

	if( abs( a - c ) <= d )
		cout << "Yes" << endl;
	else if( abs( a - b ) <= d && abs( b - c ) <= d )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}






Measured memory_bytes: 384
#include <stdio.h>
#define abs(x) ((x) > 0 ? (x) : -(x))

int
main(int argc, char *argv[])
{
  int n, l;
  scanf("%d %d", &n, &l);

  int p = 0;

  for(int i = 0; i < n; i++){
    p += (l + i);
  }

  int k; int temp; int min = 1000000; int ans;
  for(int i = 0; i < n; i++){
    temp = p - (l + i);
    if(min > abs(p - temp)){
      min = abs(p - temp);
      ans = temp;
    }
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

// Binary Indexed Tree (Fenwick Tree)
template<typename T> // T: type of cost
struct BIT {
    int n;
    std::vector<T> d;
    BIT(int n=0):n(n),d(n+1) {}
    //配列のインデックスiの要素d[i]に対して、xを加算する。
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) {
            d[i] += x;
        }
    }
    //配列においてインデックスがi以下の要素d[j]たちの和を計算して返す。
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
            x += d[i];
        }
        return x;
    }
};

int main(){
  using namespace std;
  int n, q;
  cin>>n>>q;
  int c[n];
  REP(i, n) cin>>c[i];
  int l[q], r[q];
  REP(i, q){
    cin>>l[i]>>r[i];
    l[i]--; r[i]--;
  }
  
  vector<int> prev(n + 1, -1);
  vector<int> points[500'010];
  REP(i, n){
    if(prev[c[i]] < 0){
      prev[c[i]] = i;
      continue;
    }
    points[prev[c[i]]].push_back(i);
    prev[c[i]] = i;
  }
  
  typedef pair<int, int> P;
  vector<P> queries[500'010];
  REP(i, q) queries[l[i]].push_back(P(r[i], i));
  
  BIT<int> btree(500'010);
  int ans[q];
  for(int x = 500'000; x >= 0; x--){
    for(int y: points[x]) btree.add(y);
    for(P query: queries[x]){
      int y = query.first;
      int i = query.second;
      ans[i] = (y - x + 1) - btree.sum(y);
    }
  }
  REP(i, q) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 63888
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;

void main()
{
    /// ABC089_D
    string s = readln.chomp;
    writeln((s.canFind('a') && s.canFind('b') && s.canFind('c')) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
 
    string s;
    cin>>s;
    stack<int> m;
    for(int i=0;i<s.size();i++){
        int l;
        if(s[i]=='0'){l=0;}else{l=1;}
        if(m.empty()){
            m.push(l);
        }else{
            if(l!=m.top()){
                m.pop();
            }else{
                m.push(l);
            }
        }
    }
    cout<<s.size()-m.size()<<endl;
    
return 0;
}


Measured memory_bytes: 768