akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
using namespace std;

int main(void){
	int ans,i,a,z;
	string s;
  	cin>>s;
  	for(i=0;i<s.size();i++){
      if(s[i]=='A'){
        a=i;
        break;
      }
    }
  	for(i=s.size()-1;i>=0;i--){
      if(s[i]=='Z'){
        z=i;
        break;
      }
    }
	cout << z-a+1 << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll a[3];
  cin >> a[0] >> a[1] >> a[2];

  if(a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0){
    cout << 0 << endl;
  }
  else{
    sort(a, a + 3);
    cout << a[0] * a[1] << endl;
  }

  return 0;
}

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

using namespace std;

typedef long long int ll;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
     ll k,n;
     cin >>k>> n;
     ll a[n];
     for(int i=0 ; i<n; i++)
        cin >> a[i];

     vector<ll> v;
     //v.push_back(a[0]-0);
     for(int i=1 ; i<n ; i++)
     {
         v.push_back(a[i]-a[i-1]);
     }
     v.push_back(k-a[n-1] + a[0]);
     sort(v.begin(),v.end());
     ll ans=0;
     for(int i=0 ; i<(v.size()-1) ;i++)
        ans+=v[i];
     cout << ans;

    return 0;
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
using namespace std;
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b,a % b);
}
int combination(int n, int k){
    int spaceOptimize[k+1];
    memset(spaceOptimize, 0, sizeof(spaceOptimize));
    spaceOptimize[0] = 1;
    for(int i=1;i<=n; i++){
        for(int j= min(i,k);j>0;j--){
            spaceOptimize[j] = spaceOptimize[j] + spaceOptimize[j-1];
        }
    }
    return spaceOptimize[k];
}
int count_permutation(int arr[], int n){
    int a[n];
    for(int i=0;i<n;i++){
        a[i] = i+1;
    }
    int count = 0;
    do {
        count++;
        if (equal(a, a + n, arr)){
            return count;
        }
    } while (next_permutation(a, a + n));
    return 0;
}

signed main(){
#ifndef ONLINE_JUDGE
   // freopen("input.txt","r", stdin);
#endif
    fastIO

    int n;
    cin >> n;
    cout << pow(n,3);



    return 0;
}


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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

int main(){
    int n,sum=0;
    cin>>n;

    vector<int>s(n);
    rep(i,n){
        cin>>s[i];
        sum+=s[i];
    }

    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }

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

    rep(i,n){
        if(s[i]%10!=0){
            cout<<sum-s[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;

}


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

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;

int d[310][310];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int h, w; cin >> h >> w;
	rep(i, 10) {
		rep(j, 10) {
			d[i][j] = 1001001001;
		}
		d[i][i] = 0;
	}
	rep(i, 10) {
		rep(j, 10) {
			int c; cin >> c;
			d[i][j] = c;
		}
	}
	rep(k, 10)rep(i, 10)rep(j, 10) {
		d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	}
	ll ans = 0;
	rep(i, h) {
		rep(j, w) {
			int a; cin >> a;
			if (a == -1)continue;
			ans += d[a][1];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
#include <memory>
using namespace std;
typedef long long ll;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

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

    cout << fixed << setprecision(10) << (L / 3.0) * (L / 3.0) * (L / 3.0) << endl;

    return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ( a+b > c+d ){
    cout << "Left" << endl;
  }
  else if ( a+b == c+d ){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
from bisect import bisect_right as br
import sys
sys.setrecursionlimit(100000)
n = int(input())
parent = [[None] * 20 for _ in range(n)]
for i in range(n):
  clst = list(map(int, input().split()))[1:]
  for c in clst:
    parent[c][0] = i

for i in range(1, 20):
  for j in range(n):
    if parent[j][i - 1] != None:
      parent[j][i] = parent[parent[j][i - 1]][i - 1]

height = [None for _ in range(n)]
height[0] = 0

def make_height(x):
  if height[x] != None:return
  if height[parent[x][0]] != None:
    make_height(parent[x][0])
  height[x] = height[parent[x][0]] + 1

for i in range(n):
  make_height(i)

bins = [2 ** i for i in range(20)]

def retro(p, num):
  if num == 0:return p
  ind = br(bins, num) - 1
  return retro(parent[p][ind], num - bins[ind])

def _lca(u, v):
  if u == v:
    return u
  for i in range(1, 20):
    if parent[u][i] == parent[v][i]:
      return _lca(parent[u][i - 1], parent[v][i - 1])

def lca(u, v):
  if height[u] < height[v]:
    v = retro(v, height[v] - height[u])
  if height[u] > height[v]:
    u = retro(u, height[u] - height[v])
  return _lca(u, v)

q = int(input())
for _ in range(q):
  u, v = map(int, input().split())
  print(lca(u, v))



Measured memory_bytes: 39380
import sys

sys.setrecursionlimit(10000000)

N = int(input())
M = [[] for _ in range(N)]
P = [0] * N
V = [0] * N
for _ in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    M[a].append(b)
    M[b].append(a)
C = sorted(map(int, input().split()), reverse=True)

def dfs(n, cur):
    if V[n] == 1:
        return cur
    P[n] = C[cur]
    V[n] = 1
    cur += 1
    for c in M[n]:
        cur = dfs(c, cur)
    return cur

dfs(0, 0)
print(sum(C[1:]))
print(' '.join(map(str, P)))


Measured memory_bytes: 14580
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <iomanip> 
#include <stdio.h>
//end of libraries ;
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define LNF 3999999999999999999
#define INF 999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n;
string ans = "";
int main(){
fcin;
	cin >> n;
	while(n>0){
		// n--;
		string b = ans;
		ans = '`' + (n%26 == 0 ? 26 : n%26);
		ans += b;
		n = n/26 - (n%26 == 0 ? 1 : 0);
	}
	cout << ans << "\n";


}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int n,x,y;
  cin>>n>>x>>y;
  vector<vector<int>> G(n);
  for(int i=0;i<n-1;i++){
    G[i].push_back(i+1);
    G[i+1].push_back(i);
  }
  G[x-1].push_back(y-1);
  G[y-1].push_back(x-1);
  map<int,int> memo;
  for(int i=0;i<n;i++){
    int dist[n];
    for(int j=0;j<n;j++) dist[j]=-1;
    queue<int> que;
    dist[i]=0;
    que.push(i);
    while(!que.empty()){
      int v=que.front();
      que.pop();
      for(auto nv:G[v]){
        if(dist[nv]!=-1) continue;
        dist[nv]=dist[v]+1;
        memo[dist[nv]]++;
        que.push(nv);
      }
    }
  }
  for(int i=1;i<=n-1;i++){
    cout<<memo[i]/2<<endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
 #include <iostream>
 #include <vector>
 using namespace std;
 typedef long long ll;
 const int INF = 1 << 30;
 const ll INFll = 1ll << 60;
 
 int main() {
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   if(a+b > c+d){
 	cout << "Left" << endl;
   }else if(a+b < c+d){
     cout << "Right" << endl;
   }else{
     cout << "Balanced" << endl;
   }
 	return 0;
 }

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int a[3],b,c;
	scanf("%d %d %d", &a[0],&a[1],&a[2]);
	b = 0;
	c = 0;
	for (int i = 0; i < 3; i++) {
		if (b < a[i]) {
			b = a[i];
			c = i;
		}
	}
	b = 0;
	for (int i = 0; i < 3; i++) {
		if (i != c)
			b += a[i];
	}
	printf("%d",b);
}

Measured memory_bytes: 128
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<String> dicSet = new HashSet<String>();
		String order, str;

		for (int i = 0; i < n; i++) {
			order = sc.next();
			str = sc.next();
			if (order.equals("insert")) {
				dicSet.add(str);
			} else if (order.equals("find")) {
				findDic(dicSet, str);
			}
		}
	}

	public static void findDic(HashSet<String> dicList, String str) {
		if (dicList.contains(str)) {
			System.out.println("yes");
		} else {
			System.out.println("no");
		}

	}
}



Measured memory_bytes: 256304
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt", "r", stdin)
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
void read(int& val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int maxn = 1e3+10;

int p[maxn*maxn];
int n;
int f[maxn][maxn];


const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
bool epty[maxn][maxn];


pii tr(int x){
    int nx=x/n,ny=x%n;
    if(ny) nx++;
    else ny=n;
    return {nx,ny};
}
int tr2(pii x){
    return x.first*n+x.second;
}


void init(){
    fo(i,1,n){
        fo(j,1,n){
            f[i][j]=min(min(i-1,n-i),min(j-1,n-j));
            epty[i][j]=1;
        }
    }
}

void dfs(int x,int y){
    int z=f[x][y]+epty[x][y];
    fo(i,0,3){
        int nx=x+dx[i],ny=y+dy[i];
        if(f[nx][ny]>z) {
            f[nx][ny]=z;
            dfs(nx,ny);
        }
    }
}

int main(){
//    op;
    read(n);
    fo(i,1,n*n) read(p[i]);
    init();
    LL ans=0;
    fo(i,1,n*n){
        pii nw=tr(p[i]);
        ans+=f[nw.first][nw.second];
        epty[nw.first][nw.second]=false;
        dfs(nw.first,nw.second);
    }
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 22668
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,a=0,b=0;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
      cin>>arr[i];
      
    }
    sort(arr,arr+n,greater<ll>());
    for(int i=0;i<n;i++)
    {
      //cin>>arr[i];
      if(i%2==0)
      {
        a+=arr[i];
      }
      else
      {
        b+=arr[i];
      }
    }
    cout<<(a-b)<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int PrimeNumbers(int num);
int main(void){
	int sum,num,i;
	char str[100];
	for( ; ; ){
		scanf("%d",&num);
		if(num==0)
			break;
		sum=PrimeNumbers(num);
		printf("%d\n",sum);
	}
	return 0;
}

int PrimeNumbers(int num){
	int c,j,b=1,sum=0,cnt=0;
	start:;
	if(cnt==num)
		return sum;
	b++; 
	if(b==2){
		sum+=b;
		cnt++;
		goto start;
	}
	if(b%2==0)
		goto start;
	c = sqrt(b);
	for(j=3;j<=c;j+=2){
		if(b%j==0){
			goto start;
		}
	}
	sum+=b;
	cnt++;
	goto start;
}

Measured memory_bytes: 600
fn main() {
    proconio::input! {
        k: usize,
    }
    let mut m = std::collections::HashSet::new();
    let mut cur = 7 % k;
    for i in 1.. {
        if cur == 0 {
            println!("{}", i);
            return;
        } else if m.contains(&cur) {
            println!("-1");
            return;
        }
        m.insert(cur);
        cur = (cur * 10 + 7) % k;
    }
}


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

int main()
{
    while (1)
    {
        int n;
        double sum = 0;
        cin >> n;
        if (n == 0)
            break;
        double a[n];
        rep(i, n)
        {
            cin >> a[i];
            sum += a[i];
        }
        double m = sum / n;
        double s = 0;
        rep(i, n)
        {
            s += pow(a[i] - m, 2.0);
        }
        cout << fixed << setprecision(8) << sqrt(s / n) << endl;
    }
}


Measured memory_bytes: 3240
n = int(input())
s1 = input()
s2 = input()

mod = 10**9+7

if s1[0] == s2[0]:
    ans = 3
    bfr = 'T'
    idx = 1
else:
    ans = 6
    bfr = 'Y'
    idx = 2

if n == 1:
    print(ans)
    exit()

while idx <= n-1:
    if s1[idx] == s2[idx]:
        if bfr == 'T':
            ans *= 2
            ans %= mod
        idx += 1
        bfr = 'T'
    else:
        if bfr == 'T':
            ans *= 2
            ans %= mod
        else:
            ans *= 3
            ans %= mod
        idx += 2
        bfr = 'Y'
        
print(ans%mod)

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.length()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>())
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////
	double r,g;
	cin >> r >> g;
	cout << g-r+g << endl;

//////////////////////////////////////////////
}


Measured memory_bytes: 256
n = int(input())
d = [tuple(map(int, input().split())) for _ in range(n)]

flg = False
cnt = 0
for d1, d2 in d:
  if d1 == d2:
    cnt += 1
  else:
    cnt = 0
  if cnt == 3:
    flg = True
if flg:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

namespace std {
  template <>
  class hash<std::vector<int>> {
  public:
    size_t operator()(const std::vector<int>& x) const{
      size_t ret = 0;
      for(size_t i=0; i<x.size(); i++) ret ^= hash<int>()(x[i]);
      return ret;
    }
  };
}

map<vector<int>,map<vector<int>,int>> G;

struct Edge {
  vector<int> v;
  int cost;
  Edge(vector<int> v, int cost):v(v),cost(cost){}
};
bool operator<(const Edge& a, const Edge& b){
  return a.cost > b.cost;
}

int dijkstra(const vector<int>& start, const vector<int>& goal){
  unordered_map<vector<int>,int> trace;
  priority_queue<Edge,vector<Edge>> que;
  que.push(Edge(start, 0));
  while(!que.empty()){
    Edge e = que.top(); que.pop();
    vector<int> dest = {e.v[0], e.v[1]};
    if(trace.count(dest) > 0) continue;
    trace[dest] = 1;
    if(dest == goal) return e.cost;

    //cout << e[0] << " " << e[1] << "\t" << e[2] << endl;
    FOR(it,G[dest]){
      vector<int> pos = it->first;
      int cst = it->second;
      if(trace.count(pos) == 0){
        que.push(Edge({pos[0], pos[1]}, e.cost + cst));
      }
    }
  }
  return -1;
}

int main(){
  int N, M;
  cin >> N >> M;

  vector<pair<int,int>> v[N];
  rep(i,M){
    int p, q, c;
    cin >> p >> q >> c;
    G[{c,p}][{c,q}] = 0; //駅を移動する
    G[{c,q}][{c,p}] = 0; //駅を移動する

    G[{c,p}][{-1,p}] = 0; //改札から出る
    G[{c,q}][{-1,q}] = 0; //改札から出る
    G[{-1,p}][{c,p}] = 1; //改札に入る
    G[{-1,q}][{c,q}] = 1; //改札に入る
  }

  cout << dijkstra({-1,1},{-1,N}) << endl;
  
  return 0;
}


Measured memory_bytes: 234732
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

ll wazu = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (wazu - inv(wazu % x) * (wazu / x)) % wazu;
        if (a >= 0) { return a; }
        else { return wazu + a; }
    }
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    string A, B;
    cin >> A >> B;

    if (A.size() > B.size()) { cout << "GREATER" << endl; }
    else if (A.size() < B.size()) { cout << "LESS" << endl; }
    else {
        if (A > B) { cout << "GREATER" << endl; }
        else if (A < B) { cout << "LESS" << endl; }
        else { cout << "EQUAL" << endl; }
    }
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

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

int main(){
	
	int n,l,r;
	while(cin >> n >> l >> r,n+l+r){
		
		vector<pair<ll,ll>> v;
		REP(i,n){
			int tmp;cin >> tmp;
			v.PB(MP(tmp,i+1));
		}
		
		
		ll ans = 0;
		
		for(int i = l;i <= r;i++){
			bool flag = false;
			
			for(int j = 0;j < n;j++){
				if(i % v[j].FI == 0){
					flag = true;
					if(v[j].SE % 2 != 0)ans++;
					break;
				}
			}
			
			if(!flag && n % 2 == 0)ans++;
		}
		
		cout << ans << endl;
		
	}
	
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    rep(i,n) {
        int a;
        cin >> a;
        q.push(a);
    }
    rep(i,m) {
        int a = q.top();
        q.pop();
        a/=2;
        q.push(a);
    }
    ll sum = 0;
    while(!q.empty()){
        sum += q.top();
        q.pop();
    }
    cout << sum << endl;
    return 0;
}

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

#define endl "\n"
#define si(a) scanf("%d ",&a);
#define si2(a,b) scanf("%d %d ",&a,&b);
#define si3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld ",&a);
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define sf(a) scanf("%f ",&a);
#define sd(a) scanf("%lf ",&a);
#define sc(a) scanf("%c ",&a);
#define ss(a) scanf("%s ",a);
#define sf2(a,b) scanf("%f %f ",&a,&b);
#define sd2(a,b) scanf("%lf %lf ",&a,&b);
#define sz s.size();
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<n;i++)
#define forq(i,q,n) for(int i=q;i<n;i++)
#define form(i,n) for(int i=n;i>=0;i--)
#define forp(i,q,n) for(int i=q;i>=n;i--)
#define fi first
#define se second
#define INF 1000000010
#define MOD 1000000007
#define MAXN
#define LL long long int


using namespace std;

int a, b;


void init(){
	si2(a, b);
	if(a == 1 and b != 1)
	{
		a = 14;
	}
	if (b == 1 and a != 1)
	{
		b = 14;
	}
	if(a < b)
	{
		printf("Bob\n");
	}
	
	else if(a == b)
	{
		printf("Draw\n");
	}
	else if(b < a){
		printf("Alice\n");
	}
}

int main(){
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	init();
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int n;
	vector<int> c;
	vector<int> v;
	int ans = 0, t;

	cin >> n;

	for (int i = 0; i < n; ++i) {
		cin >> t;
		v.push_back(t);
	}
	
	for (int i = 0; i < n; ++i) {
		cin >> t;
		c.push_back(t);
	}

	for (int i = 0; i < n; ++i) {
		if (v[i] > c[i]) {
			ans += v[i] - c[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cerr << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}
constexpr int mxN = 1e5;
int dp[mxN][3];
void solve(){
    int n;
    read(n);
    vector<array<int,3>> v(n);
    REP(i,n){
        int a, b, c;
        read(a, b, c);
        v[i] = {a, b, c};
    }
    dp[0][0] = v[0][0];
    dp[0][1] = v[0][1];
    dp[0][2] = v[0][2];

    for ( int i = 1 ; i < n ; i++){
        for(int j = 0 ; j < 3 ; j++){
            for(int k = 0 ; k < 3; k++){
                if ( k != j){
                    dp[i][j] = max(dp[i-1][k] + v[i][j], dp[i][j]);
                }
            }
        }
    }
    int ans = 0;
    for (int j = 0 ; j < 3 ; j++){
        ans = max(dp[n-1][j],ans);
    }
    cout << ans << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



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

int main(void)
{
    int i, k;
    char s[101];
    cin >> k >> s;
    for (i = 0; s[i] != '\0'; i++)
    {
        if (i < k)
        {
            cout << s[i] << flush;
        }
        else
        {
            cout << "..." << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3644
flatten_A = []

for i in range(3):
    flatten_A.append(list(map(int, input().split())))

N = int(input())
B = [0] * N
for i in range(N):
    B[i] = int(input())

# input ここまで
import itertools
def flatten_list(l):
    return list(itertools.chain.from_iterable(l))

mark_list = [False] * 9

flatten_A = flatten_list(flatten_A)
for b in B:
    if not b in flatten_A: continue
    # 選ばれた数が自分のビンゴに含まれている
    for i in range(9):
        if flatten_A[i] == b:
            mark_list[i] = True

"""
[0, 1, 2], [3, 4, 5], [6, 7, 8]
[0, 3, 6], [1, 4, 7], [2, 5, 8]
[0, 4, 8], [2, 4, 6]
"""
def judge_bingo(l):
    yes = "Yes"
    no = "No"
    if l.count(True) < 3:
        return no
    if l[0]:
        if (l[1] and l[2]) or (l[3] and l[6]) or (l[4] and l[8]):
            return yes
    if l[3] and l[4] and l[5]:
        return yes
    if l[1] and l[4] and l[7]:
        return yes
    if l[2]:
        if l[4] and l[6]: return yes
        if l[5] and l[8]: return yes
    if l[6] and l[7] and l[8]:
        return yes
    return no
        

ans = judge_bingo(mark_list)
print(ans)
# print(A)
# print(flatten_A)
# print(mark_list)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
 
using namespace std;
 
int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int r=0;
  for(int i=0;i<=a;++i){
    for(int j=0;j<=b;++j){
      for(int k=0;k<=c;++k){
      	r+=((i*500+j*100+k*50)==x);
      }
    }
  }
  cout<<r;
  return 0;
}


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

#define ld long double
#define int long long

#define pb push_back
#define F first
#define S second
#define I insert
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()

#define debug1(a) cout<<" "<<#a<<" : "<<a<<"\n"
#define debug2(a,b) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<"\n"
#define debug3(a,b,c) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<"\n"

#define INF (int)100000000000000000
#define PI (double)3.14159265358979
// #define M 421412341324321
#define MOD 1000000007

int a[500005], c[500005];
vector <int> ans;
int cnt = 0;
int block_size = 800;

struct Query {
    int l, r, idx;
    bool operator<(Query other) const
    {
        return make_pair(l / block_size, r) <
               make_pair(other.l / block_size, other.r);
    }
};


void remove(int idx)
{
    c[a[idx]]--;
    if (c[a[idx]]==0)
        cnt--;
}
void add(int idx)
{
    if (c[a[idx]]==0)
        cnt++;
    c[a[idx]]++;
}



signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    int n, q;
    cin>>n>>q;
    ans.resize(q);
    for (int i=0;i<n;++i)
    {
        cin>>a[i];
        c[a[i]] = 0;
    }
    vector <Query> queries(q);

    for (int i=0;i<q;++i)
    {
        int l, r;
        cin>>l>>r;
        l--;
        r--;
        queries[i].l = l;
        queries[i].r = r;
        queries[i].idx = i;
    }

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

    int cur_l = 0;
    int cur_r = -1;
    for (Query q : queries) {
        while (cur_l > q.l) {
            cur_l--;
            add(cur_l);
        }
        while (cur_r < q.r) {
            cur_r++;
            add(cur_r);
        }
        while (cur_l < q.l) {
            remove(cur_l);
            cur_l++;
        }
        while (cur_r > q.r) {
            remove(cur_r);
            cur_r--;
        }
        ans[q.idx] = cnt;
    }
    for (auto j:ans) cout << j << "\n";

    return 0;
} 



Measured memory_bytes: 27220
#include <iostream>
#include <string>

using namespace std;
int main(void){
    int n;
    cin >> n;
    
    unsigned long  sum = 0;
    for (int i=1; i<=n; i++) {
        if (i % 3 != 0 && i % 5 != 0) sum += i; 
    }
    cout << sum << endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int sx,sy,tx,ty;
void second(int x,char dir1){
	for(int i=1;i<=x;i++){
		printf("%c",dir1);
	}
}
int main()
{
	while(~scanf("%d%d%d%d",&sx,&sy,&tx,&ty)){
		int flag1=-1,flag2=-1;
		int x,y;
		if(sx<=tx){
			x=tx-sx;
			if(sx==tx) flag1=0;
			else flag1=1;
			for(int i=1;i<=x;i++){
				printf("R");
			}
		}else{
			x=sx-tx;
			for(int i=1;i<=x;i++){
				printf("L");
			}
		}
		if(sy<=ty){
			y=ty-sy;
			if(sy==ty) flag2=0;
			else flag2=1;
			for(int i=1;i<=y;i++){
				printf("U");
			}
		}else{
			y=sy-ty;
			for(int i=1;i<=y;i++){
				printf("D");
			}
		}
		if(flag1==0&&flag2==1){
			second(y,'D');
			printf("R");
			second(y,'U');
			printf("L");
			printf("L");
			second(y,'D');
			printf("R");
		}else if(flag1==1&&flag2==1){
			second(x,'L');
			second(y,'D');
			printf("D");
			second(x+1,'R');
			second(y+1,'U');
			printf("L");
			printf("U");
			second(x+1,'L');
			second(y+1,'D');
			printf("R");
		}else if(flag1==-1&&flag2==1){
			second(x,'R');
			second(y,'D');
			printf("D");
			second(x+1,'L');
			second(y+1,'U');
			printf("R");
			printf("U");
			second(x+1,'R');
			second(y+1,'D');
			printf("L");
		}else if(flag1==0&&flag2==0){
			printf("\n");
		}else if(flag1==-1&&flag2==0){
			second(x,'R');
			printf("U");
			second(x,'L');
			printf("D");
			printf("D");
			second(x,'R');
			printf("U");
		}else if(flag1==1&&flag2==0){
			second(x,'L');
			printf("U");
			second(x,'R');
			printf("D");
			printf("D");
			second(x,'L');
			printf("U");
		}else if(flag1==0&&flag2==-1){
			second(y,'U');
			printf("R");
			second(y,'D');
			printf("L");
			printf("L");
			second(y,'U');
			printf("R");
		}else if(flag1==1&&flag2==-1){
			second(x,'L');
			second(y,'U');
			printf("U");
			second(x+1,'R');
			second(y+1,'D');
			printf("L");
			printf("D");
			second(x+1,'L');
			second(y+1,'U');
			printf("R");
		}else if(flag1==-1&&flag2==-1){
			second(x,'R');
			second(y,'U');
//			second(x,y,'R','U');
			printf("U");
			second(x+1,'L');
			second(y+1,'D');
			printf("R");
			printf("D");
			second(x+1,'R');
			second(y+1,'U');
			printf("L");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define uu first
#define vv second

using namespace std;

typedef long long ll;

int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    int n;
    long long res = 0;
    cin >> n;
    int *arr = new int[n];
    for (int i = 0;i < n; i++) cin >> arr[i];
    for (int i = 0;i < n-1; i++)
        for (int j = i+1;j < n; j++)
            res += arr[i] * arr[j];
    cout << res << '\n';
    delete []  arr;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200000;
const int mod = 998244353;
int n, k;
ll f[maxn + 50], sm[maxn + 50];
struct node {
	int l, r;
}e[maxn + 50];
bool cmp(node x, node y) {
	return x.l < y.l;
}
int main() {
	cin >> n >> k;
	int i, j;
	for(i = 1; i <= k; ++i) {
		cin >> e[i].l >> e[i].r;
	}
	sort(e + 1, e + 1 + k, cmp);
	f[1] = 1; sm[1] = 1;
	int zuo, you;
	for(i = 2; i <= n; ++i) {
		for(j = 1; j <= k; ++j) {
		//	cerr << j << ' ' << e[j].l << ' ' << e[j].r << endl;
			you = i - e[j].l;
			if(you >= 1) {
				zuo = max(1, i - e[j].r);	
			}
			else break;
			//cerr << i << " " << zuo << " " << you << endl;
			//if(zuo == 0) f[i] = (f[i] + sm[you]) % mod;
			f[i] = (f[i] + sm[you] - sm[zuo - 1]) % mod;
		}
		sm[i] = (sm[i - 1] + f[i]) % mod;
//		cerr << i << ' ' << f[i] << endl;
	}
	cout << (f[n] + mod) % mod; 
	return 0;
}

Measured memory_bytes: 6712
#include <stdio.h>

char s[100001];

int main() {
	scanf("%s", s);
	
	int len = 0;
	while(s[len] != '\0') { len++; }
	
	int b = -2, e = -2;
	for(int i = 1; i < len; i++) {
		if(          s[i - 1] == s[i]) { b = i - 1; e = i; break; }
		if(i >= 2 && s[i - 2] == s[i]) { b = i - 2; e = i; break; }
	}
	
	printf("%d %d\n", b + 1, e + 1);
	
	return 0;
}


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //good luck kittu!
    int n; cin>>n;
    map<string, int> m;
    string s;
    for(int i = 0; i<n; i++){
        cin>>s;
        m[s]++;
    }
    int mf = 0;
    for(auto p : m) mf = max(p.second, mf);
    set<string> x;
    for(auto p : m) if(p.second==mf) x.insert(p.first);

    for(auto p : x) cout<<p<<"\n";
    return 0;
}

Measured memory_bytes: 33280
function Main(input) {
  const inputs = input.split("\n");
  const n = parseInt(inputs[0], 10);
  var nums = new Array(n)
  nums = inputs[1].split(" ");
  const result = 1 / nums.map(num => 1 / parseInt(num, 10))
    .reduce((acc, value) => acc + value);
  console.log(result);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
 
 int x,y;

 cin>>x>>y;

 if(x*4 < y || x*2 >y){
     cout<<"No";
     
 }
 else if(y%2!=0){
     cout<<"No";
 }

 else{
     cout<<"Yes";
 }


}

Measured memory_bytes: 3620
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, m;
  cin >> n >> m;
  vector<ll> x(n);
  rep(i, n) cin >> x[i];
  vector<ll> v[200010];
  rep(i, n)
  {
    v[x[i] % m].push_back(x[i]);
  }
  rep(i, m)
  {
    sort(all(v[i]));
  }
  ll same[200010] = {};
  rep(i, m)
  {
    rep(j, (int)v[i].size() - 1)
    {
      if (v[i][j] == v[i][j + 1])
      {
        same[i]++;
        j++;
      }
    }
  }
  ll ans = 0;
  for (int i = 0, j = m; i <= j; i++, j--)
  {
    if (i == 0 || i == j)
    {
      ans += (ll)v[i].size() / 2;
      continue;
    }
    if (v[i].size() >= v[j].size())
    {
      ll rem = v[i].size() - v[j].size();
      ans += v[j].size();
      ans += min(same[i], rem / 2);
    }
    else
    {
      ll rem = v[j].size() - v[i].size();
      ans += v[i].size();
      ans += min(same[j], rem / 2);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10368
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1
D=collections.defaultdict(int)
n=int(input())
for i in range(n):
    s=input()
    D[s]+=1
m=int(input())
for i in range(m):
    s=input()
    D[s]-=1
print(max(0,max(D.values())))


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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif
    int n;
    cin>>n;
    double a=1.000,b=0.000;
    double arr[n];
    f1(i,0,n)
    {
    	cin>>arr[i];
    	a*=arr[i];
    }
    f1(i,0,n)
    b+=(a/arr[i]);

    cout<<fixed<<setprecision(10)<<a/b;
    return 0;
}

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

int main(){
	string s,s2;
	cin >> s;
	
	s2=s;
	reverse(s2.begin(),s2.end());
	
	if(s==s2) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int n,m;
char tab[50][50],tav[50][50];
bool can=true;
signed main() {
  cin>>n>>m;
  rep(i,n) rep(j,n) cin>>tab[i][j];
  rep(i,m) rep(j,m) cin>>tav[i][j];
  rep(i,n-m+1) {
    rep(j,n-m+1) {
      rep(k,m) {
        rep(l,m) {
          if(tab[k+i][l+j]!=tav[k][l]) {
            can=false;
          }
        }
      }
      if(can) {
        cout<<"Yes"<<endl;
        return 0;
      }
      can=true;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
using namespace std;
typedef pair<ll, ll>P;

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true, fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct etree { ll from, to, cost; };
double pai = 3.141592653589793;
bool comp(const etree& e1, const etree& e2) {
	return e1.cost < e2.cost;
}
#define ALL(x) (x).begin(),(x).end()

int main() {
	ll n, x, ans[200010] = {0};
	cin >> n >> x;
	bool c[200010];
	for (int i = 0;i < 200010;i++) {
		c[i] = true;
	}
	if (n == 2) {
		if (x == 2) {
			cout << "Yes" << endl;
			cout << 1 << endl;
			cout << 2 << endl;
			cout << 3 << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (x == 1 || x == 2 * n - 1) {
			cout << "No" << endl;
			exit(0);
		}
		cout << "Yes" << endl;
		if (x == 2) {
			ans[n - 1] = 1, ans[n] = 2, ans[n - 2] = 4, ans[n + 1] = 3;
			c[1] = c[2] = c[3] = c[4] = false;
		}
		else {
			ans[n - 2] = x - 1, ans[n - 1] = x + 1, ans[n] = x, ans[n + 1] = x - 2;
			c[x - 2] = c[x - 1] = c[x] = c[x + 1] = false;
		}
		int k = 1;
		for (int i = 1;i < 2 * n;i++) {
			if (ans[i] == 0) {
				while (true) {
					if (c[k]) {
						cout << k << endl;
						c[k] = false;
						break;
					}
					else k++;
				}
			}
			else cout << ans[i] << endl;
		}
	}
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector <int> deg(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		deg[a]++;
		deg[b]++;
	}
	for (int i = 0; i < n; i++) {
		if (deg[i] & 1) {
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll, ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second

const int MIN = -1000000;
const int MAX = 1000000;

int main() {
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  // Emily <3
  int k, x;
  cin >> k >> x;
  for (int i = max(MIN, x-k+1); i < min(MAX, x+k); ++i) {
    cout << i << " ";
  } cout << nl;
  
  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#include <climits>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

inline char countup_alphabet(char c, ll count) {
  int cc;
  cc = c+(count%26);
  if ('z'<cc) cc-=26;
  return char(cc);
}

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

  for (size_t i = 0; i < s.size(); i++) {
    if(k<1) break;
    if(i==s.size()-1) s[i] = countup_alphabet(s[i], k%26);
    else if (s[i]!='a' && k>'z'-s[i]) {
      ll diff = 'z'-s[i]+1;
      s[i] = countup_alphabet(s[i], diff);
      k -= diff;
    }
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cctype>
#define reg register
using namespace std;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
signed main(void)
{
	int a,b;
	rd(a);rd(b);
	if(a>=13)
		return printf("%d",b),0;
	if(a>=6&&a<=12)
		return printf("%d",b/2),0;
	puts("0");
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
using namespace std;

int array[50000];

int main()
{
	int n, S;
	
	while (scanf("%d %d", &n, &S), n + S){
		for (int i = 0; i < n; i++){
			scanf("%d", &array[i]);
		}
		
		int num = 0;
		for (int i = 0; i < n - 1; i++){
			for (int j = i + 1; j < n; j++){
				if (array[i] + array[j] > S){
					num++;
				}
			}
		}
		
		printf("%d\n", num);
	}
	
	return 0;
}

Measured memory_bytes: 1064
N = gets.to_i
XYHs = readlines.map{|l| l.split.map(&:to_i)}

xyhs, xy0s = XYHs.partition{|x, y, h| h > 0}
ans = []
[*0 .. 100].product([*0 .. 100]).each do |cx, cy|
  x, y, h = xyhs.first
  ch = h + (x - cx).abs + (y - cy).abs
  ans << [cx, cy, ch] if xyhs.drop(1).all?{|x, y, h| ch == h + (x - cx).abs + (y - cy).abs}
end
ans.select!{|cx, cy, ch| xy0s.all?{|x, y, z| ch - (x - cx).abs - (y - cy).abs <= 0}} if ans.size > 1
puts ans.join(" ")

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long int

using namespace std;
const ll N=100010;

bool compare(pair<ll,ll> a,pair<ll,ll> b)
{
    if(a.second==b.second)
    {
        return a.first<b.first;
    }
    return a.second>b.second;
}

int main()
{
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > ar(n);
    for(ll i=0;i<n;++i)
    {
        cin>>ar[i].first>>ar[i].second;
    }
    sort(ar.begin(),ar.end(),compare);
    set<ll> free;
    for(ll i=0;i<m;++i){free.insert(i);}
    ll ans=0;
    ll status[m]={0};
    for(ll i=0;i<n;++i)
    {
        set<ll> ::iterator it=free.upper_bound(m-ar[i].first);
        if(it!=free.begin())
        {
            advance(it,-1);
            free.erase(it);
            ans+=ar[i].second;
        }
    }
    cout<<ans<<endl;


    return (0);
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000000007
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define Nmax 500005
const long double PI = acos(-1);

int n,m,a,b,c,x,y,sa,sb;
vector<int> v[Nmax];
int uz[Nmax];

bool dfs(int Nod){
    if (Nod == sb){
        return 1;
    }
    uz[Nod] = 1;
    for (auto it : v[Nod]){
        if (uz[it]) continue;
        if (dfs(it)){
            return 1;
        }
    }
    return 0;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i=1;i<=m;i++){
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    for (int i=1;i<=n;i++){
        if (v[i].size() == 2){
            a++;
        }
        else if (v[i].size() == 4){
            sb = sa;
            sa = i;
            b++;
        }
        else if (v[i].size() >= 6 && v[i].size() % 2 == 0){
            c++;
        }
        else{
            cout << "No\n";
            return 0;
        }
    }

    if (c >= 1){
        cout << "Yes\n";
    }
    else{
        if (b>=3){
            cout << "Yes\n";
            return 0;
        }
        else if (b==2){
            int nr = 0;
            for (int i=0;i<=5;i++) if (dfs(sa)) nr++;
            if (nr == 2) cout << "Yes\n";
            else cout << "No\n";
        }
        else{
            cout << "No\n";
        }
    }

    return 0;
}

Measured memory_bytes: 16256