akhauriyash/Code-Regression huggingface dataset:
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            //var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();

            var count = 0;

            for(var i = 1; i < n; i++)
            {
                for(var j = i; j <= n / i; j++)
                {
                    if(n - i * j > 0)
                    {
                        count++;
                        if(i != j)
                        {
                            count++;
                        }
                    }
                }
            }

            WriteLine(count);
        }
    }
}


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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int main(){
	int n;string s,t;cin>>n>>s>>t;
	rep(i,n){
		cout<<s[i]<<t[i];
	}
	cout<<endl;
}

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

int main(){
  string S;
  cin >> S;
  int N=S.size();
  bool a=false;
  int A=-1,B=-1;
  for(int i=0;i<N-1;i++){
    if(S.at(i)==S.at(i+1)){
      A=i+1,B=i+2;
    }
  }
  for(int i=0;i<N-2;i++){
    if(S.at(i)==S.at(i+2)){
      A=i+1,B=i+3;
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 3660
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

vector<int>T;

int main() {

	int N, C, K;

	scanf("%d %d %d", &N, &C, &K);

	int i;

	for (i = 0; i < N; i++) {
		int a;
		scanf("%d", &a);
		T.push_back(a);
	}
	sort(T.begin(), T.end());

	int now = 0;
	int ans = 0;
	while (1) {
		if (now > N - 1) { break; }
		int start = T[now];
		for (i = 1; i < C; i++) {
			if (now + i > N - 1) { break; }
			if (T[now + i] > start + K) { break; }
		}
		ans++;
		now += i;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 892
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int a, b, c;
    while(cin >> a >> b >> c){
        if(a < b && b < c) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}








int main(){
    int N; std::cin >> N;
    std::vector<int> A(N);
    std::vector<long long> S(N+1);
    for(int i(0); i < N; ++i){
        std::cin >> A[i];
        S[i+1] = (S[i] + A[i]) % MOD;
    }
    long long ans(0);
    for(int i(0), i_len(N-1); i < i_len; ++i){
        (ans += A[i] * (S[N] - S[i+1])) %= MOD;
        if(ans < 0) ans += MOD;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 5552
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdio>

using namespace std;
typedef long long ll;

ll n,a[100010]={0},num[2][100010]={0};
ll ans=0;

ll gcd(ll x,ll y){
    if(x<y)return gcd(y,x);
    if(y==0)return x;
    return gcd(y,x%y);
}


signed main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>a[i];
    }

    num[0][0]=a[0],num[1][n-1]=a[n-1];
    for(int i=1;i<n;++i){
        num[0][i]=gcd(num[0][i-1],a[i]);
    }
    for(int i=n-2;i>=0;--i){
        num[1][i]=gcd(num[1][i+1],a[i]);
    }

    ans=max(num[1][1],num[0][n-2]);
    for(int i=1;i<n-1;++i){
        ans=max(ans,gcd(num[0][i-1],num[1][i+1]));
    }

    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h> 
#define N 100000
using namespace std;
char s[N|1];
int n,a,b,c;
int main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++) {
		if(s[i]=='a')
			a++;
		if(s[i]=='b')
			b++;
		if(s[i]=='c')
			c++;
	}
	if(max(a,max(b,c))-min(a,min(b,c))<=1)
		puts("YES");
	else	puts("NO");
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

int main(void)
{
    ll n;
    scanf("%ld",&n);

    ll ans=INT64_MAX;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            ans = min(ans,i+(n/i)-2);
        }
    }
    
    printf("%ld\n", ans);
    return 0;
}


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

#define pb push_back
#define loop(i,l,r) for(int i = (l); i < (r); i++)
#define rloop(i,r,l) for(int i = (r-1); i >= (l); i--)
#define refloop(x, v) for(auto& x : (v))
#define exists(m,e) if((m).find(e) != (m).end())
#define nexists(m,e) if((m).find(e) == (m).end())
#define sortaka(v) sort((v).begin(), (v).end())
#define rsort(v) sort((v).rbegin(), (v).rend())
#define lower_bound_index(v, x) (lower_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] >= x
#define upper_bound_index(v, x) (upper_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] > x
#define scanint(x) scanf("%d", &(x))
#define scanfloat(x) scanf("%f", &(x))
#define scanll(x) scanf("%lld", &(x))
#define scanchar(x) scanf("%c", &(x))
#define scanstring(x) scanf("%s", &(x))
#define printint(x) printf("%d", x)
#define printfloat(x) printf("%.9f", x)
#define printll(x) printf("%lld", x)
#define printchar(x) printf("%c", x)
#define printstring(x) printf("%s", x)
#define printintnewline(x) printf("%d\n", x)
#define printfloatnewline(x) printf("%.9f\n", x)
#define printllnewline(x) printf("%lld\n", x)
#define printcharnewline(x) printf("%c\n", x)
#define printstringnewline(x) printf("%s\n", x)
#define square(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))

typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long, long long>> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef vector<string> vs;
typedef vector<vector<pair<int, int>>> vvpii;
typedef vector<vector<pair<long long, long long>>> vvpll;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef long long ll;

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

    int x; cin >> x;
    cout<<(x+1)%2;
}

Measured memory_bytes: 3628
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
C = input()
c = Counter(C)
R = c["R"] * "R" + c["W"] * "W"
# print(R)
r = c["R"]
w = c["W"]
# print(C[:r], C[r:])

a = Counter(C[:r])["W"] # make R
b = Counter(C[r:])["R"]

ans = min(max(a, b), r, w)
print(ans)

Measured memory_bytes: 11020
use std::io::*;

fn read() -> String {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char) 
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
    
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let s = read();
  let l = s.len();
  let mut c = 0;
  
  for i in 0..l {
    let t = s.chars().nth(i).unwrap();
    let u = s.chars().nth(l - i - 1).unwrap();
    if t != u { c += 1; }
  }
  
  println!("{}", c / 2);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
int main(){
    int a,b;
    cin>>a>>b;
    if(a>=13) cout<<b<<endl;
    else if(a<=5) cout<<0<<endl;
    else cout<<b/2<<endl;
}

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

namespace ABC115 {
	class ABC115_C {
		private const int MAX = 100000;
		private static int[] _H = new int[MAX];
		private static int _N;
		private static int _K;

		static void Main(string[] args) {
			var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			_N = line[0];
			_K = line[1];
			for (int i = 0; i < _N; i++)
				_H[i] = int.Parse(Console.ReadLine());
			Console.WriteLine(GetMinDiff());
		}

		 private static int GetMinDiff() {
			Array.Sort(_H); Array.Reverse(_H);
			int min = int.MaxValue;
			for (int i = 0; i <= _N - _K; i++) {
				min = Math.Min(min, _H[i] - _H[i + _K - 1]);
			}
			return min;
		}
	}
}


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

bool ok(int a){
    int i = 1;
    while(i*i < a)  i++;
    return i*i == a;
}

int main(){
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int sum = 0;
            for(int k = 0; k < d; k++){
                sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            if(ok(sum)) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, x, y, z;
vi a, b, c;
int dp[100001][3];

int main(){
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);
  cin.sync_with_stdio(0); cin.tie();
  cin.exceptions(cin.failbit);

  cin >> n;
  rep(i, 1, n){
  	cin >> x >> y >> z;
  	a.pb(x); b.pb(y); c.pb(z);
  }
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  rep(i, 1, n-1){
  	dp[i][0]=max(dp[i-1][1], dp[i-1][2])+a[i];
  	dp[i][1]=max(dp[i-1][0], dp[i-1][2])+b[i];
  	dp[i][2]=max(dp[i-1][0], dp[i-1][1])+c[i];
  }
  cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);
}

Measured memory_bytes: 5648
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	char s[10];
	scanf("%s", s);
	sort(s, s + 4);
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define N 999999
int p[(N+1)/2];int m[N+1];void k(){int i,j,e=1;for(i=3;i<N+1;i++){for(j=0;p[j]*p[j]<=i;j++){if(i%p[j]==0){goto tag;}}p[e]=i;e++;tag:m[i]=e;}}using namespace std;main(){int n;p[0]=2;m[1]=0;m[2]=1;k();while(cin>>n){cout<<m[n]<<endl;}}

Measured memory_bytes: 5376
N, M = gets.split.map(&:to_i)
as, bs = [], []
M.times do |i|
    as[i], bs[i] = gets.split.map(&:to_i)
end

sum = 0
M.times do |i|
    nas = as.dup
    nas.delete_at(i)
    nbs = bs.dup
    nbs.delete_at(i)
    group = [1]
    loop do
        added = false
        nas.length.times do |i|
            if group.include?(nas[i]) || group.include?(nbs[i])
                group.push(nas[i]) unless group.include?(nas[i])
                group.push(nbs[i]) unless group.include?(nbs[i])
                nas[i] = nil
                nbs[i] = nil
                added = true
            end
        end
        nas.compact!
        nbs.compact!
        if group.length == N
            break
        end
        unless added
            sum += 1
            break
        end
    end
end

print sum

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define N 32768
#define M 0x3B9ACA07LL
long long a[N]={},b[N],c[N]={},d[N];
#define REP(i,n)for(int i=0;i<n;i++)
int main(){
int n,k; std::cin>>n>>k;
for(int i=1;i<N;i++)a[i]=std::min(i,n),b[i]=n/i;
REP(j,k-1){
for(int i=1;i<N;i++)c[i]=(c[i-1]+b[i])%M;
d[N-1]=c[n/(N-1)];
for(int i=N-2;i>=1;i--)d[i]=(d[i+1]+a[i]*(n/i-n/(i+1)))%M;
std::swap(a,c);
std::swap(b,d);
}
std::cout<<b[1];
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;

ll Len[51], Pat[51]; //長さとパティの数

ll f(ll k, ll x) { //レベルk, 下からx
	if (x == Len[k]) return Pat[k];

	ll ans = 0;
	x--;

	//下のk-1
	if (x > 0) {
		ll l = min(x, Len[k - 1]);
		ans += f(k - 1, l);
		x -= l;
	}

	//真ん中
	if (x > 0) {
		ans++;
		x--;
	}

	//上のk-1
	if (x > 0) {
		ll l = min(x, Len[k - 1]);
		ans += f(k - 1, l);
		x -= l;
	}

	return ans;
}

int main() {
	ll n, x;
	cin >> n >> x;

	Len[0] = Pat[0] = 1;
	for (int i = 1; i <= n; i++) {
		Len[i] = Len[i - 1] * 2 + 3;
		Pat[i] = Pat[i - 1] * 2 + 1;
	}

	cout << f(n, x) << en;
}

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

typedef long long ll;
#define mod 1000000007
ll power(ll x,ll n)
{
    if(n==0)    return 1;
    if(n==1)    return x;
    if(n%2==0)
    {
        ll t=power(x,n/2)%mod;
        return (t%mod*t%mod)%mod;
    }
    else
    {
        return (x*power(x,n-1)%mod)%mod;
    }
}
ll fact(ll n,ll r)
{
    ll x=1,y=1;
    if(n-r<r)
    {
        r=n-r;
    }
    for(ll i=0;i<r;i++)
    {
        x=(x*(n-i))%mod;
        y=(y*(i+1))%mod;
    }
    return (x%mod*power(y,mod-2)%mod)%mod;
}
int main() 
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=0;
    //cout<<fact(n,a);
    ans=(power(2,n)-1-fact(n,a)-fact(n,b))%mod;
    if(ans<0)
    {
        cout<<ans+mod<<endl;
    }
    else
    {
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	b = readline() |> split |> parseMap
	k = 0
	for i in 1:n
		k += max(ceil(Int,(b[i]-a[i])/2),0)
	end
	println(k<=sum(b)-sum(a)?"Yes":"No")
end

main()

Measured memory_bytes: 114944
N,C=map(int,input().split())
D=[list(map(int,input().split())) for i in range(C)]
c=[list(map(int,input().split())) for i in range(N)]

res=[[] for i in range(3)]
for mod in range(3):
    for color in range(C):
        dif=0
        for i in range(N):
            for j in range(N):
                if (i+j+2)%3==mod:
                    dif+=D[c[i][j]-1][color]
        res[mod].append([dif,color])
for i in range(3):
    res[i].sort()
ans=10**10
for i in range(3):
    for j in range(3):
        for k in range(3):
            if((res[0][i][1]!=res[1][j][1])and(res[1][j][1]!=res[2][k][1])and(res[2][k][1]!=res[0][i][1])):
                ans=min(ans,res[0][i][0]+res[1][j][0]+res[2][k][0])
print(ans)

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

using namespace std;

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

    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'R') ++ans;
    }
    if(s == "RSR"){
        cout << 1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;


int main()
{
	int A, B, M; cin >> A >> B >> M;
	vector<int> a(A), b(B);
	vector<vector<int>> c(M,vector<int>(3));
	
	rep(i, A)
		cin >> a[i];
	rep(i, B)
		cin >> b[i];
	rep(i, M)
	{
		rep(j, 3)
			cin >> c.at(i).at(j);
	}

	vector<int> ans(M);
	rep(i, M)
		ans[i] = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2];
	sort(all(a));
	sort(all(b));
	sort(all(ans));
	int MIN = a[0] + b[0];
	cout << min(MIN, ans[0]) << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    string s, t;
    cin >> s >> t;
    if (s == t.substr(0, s.length())) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main() {
	int i;
	long long a, b,m,N,H,sum;
	m = 0;
	sum = 0;
	vector<long long> B;
	cin >> N, cin >> H;
	for (i = 0; i < N; i++) {
		cin >> a, cin >> b;
		if (a > m)m = a;
		B.push_back(b);
	}
	i = 0;
	sort(B.begin(), B.end(), greater<long long>());
	while (H > 0) {
		if (B[i] > m) {
			H -= B[i];
			sum += 1;
		}
		else {
			sum += H / m;
			if (H%m != 0)sum += 1;
			H = 0;
		}
		i++;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		//System.out.println("??\???>>");

		Scanner scan = new Scanner(System.in);

		int intA = scan.nextInt();
		int intB = scan.nextInt();

		if(intA == intB ){
			System.out.println("a == b");
		}else if(intA < intB){
			System.out.println("a < b");
		}else {
			System.out.println("a > b");
		}

	}

}

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); int m = sc.nextInt();
        int [][] a = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++) a[i][j] = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int [] index = new int[n];
        boolean [] in = new boolean[m + 1];
        Arrays.fill(in, true);
        int sports = m;
        while (sports > 0) {
            int bestSport = -1; int people = 0;
            int [] ct = new int[m + 1];
            for (int i = 0; i < n; i++) {
                ++ct[a[i][index[i]]];
            }
            for (int i = 1; i <= m; i++) {
                if (ct[i] > people) {
                    bestSport = i;
                    people = ct[i];
                }
            }
            res = Math.min(res, people);
            in[bestSport] = false;
            for (int i = 0; i < n; i++) {
                while (index[i] < m && !in[a[i][index[i]]]) ++index[i];
            }
            --sports;
        }
        out.println(res);
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 43088
#include <bits/stdc++.h>
using namespace std;
int a[110];
int main(void)
{
    int n,d,x;
    cin>>n>>d>>x;
    int sum=0;
    for(int i=0;i<n;++i)
    {
        cin>>a[i];
        sum+=((d-1)/a[i]+1);
    }
    cout <<sum+x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<int>;
using A = array<int, 2>;
constexpr int MOD{1000000000 + 7};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr array<int, 4> dx{1, 0, -1, 0};
constexpr array<int, 4> dy{0, 1, 0, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int div_roundup(int a, int b)
{
    return (a + b - 1) / b;
}
// vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
// ***************************************************************************
void solve()
{
    int n;
    cin >> n;
    vector<int> d(n);
    for (int &x : d)
        cin >> x;

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

    int l = d[n / 2-1];
    int r = d[n / 2];

    cout << r - l << endl;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(0);

    solve();
}


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

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

    cin >> N;
    cin >> K;
    cin >> S;

    S[K - 1] = tolower(S[K - 1]);

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int s, w;
  cin >> s >> w;
  if(s <= w){
    cout << "unsafe" << endl;
  }else{
    cout << "safe" << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
import java.io.*;
import java.math.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws Exception {
		new Main().solve();
	}
	void solve() throws Exception {
		FastScanner in = new FastScanner(System.in);

		int N = in.nextInt();
		int[] cnt = new int[256];
		int[] c = new int[256];
		Arrays.fill(cnt, Integer.MAX_VALUE / 10);
		for (int i = 0; i < N; i++) {
			String s = in.next();
			Arrays.fill(c, 0);
			for (int jj = 0; jj < s.length(); jj++) {
				c[s.charAt(jj)]++;
			}
			for (int jj = 0; jj < c.length; jj++) {
				cnt[jj] = Math.min(cnt[jj], c[jj]);
			}
		}

		String ret = "";
		for (int i = 0; i < cnt.length; i++) {
			for (int jj = 0; jj < cnt[i]; jj++) {
				ret += (char) i;
			}
		}
		System.out.println(ret);

	}

	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	class FastScanner {

		private InputStream _stream;
		private byte[] _buf = new byte[1024];
		private int _curChar;
		private int _numChars;
		private StringBuilder _sb = new StringBuilder();

		FastScanner(InputStream stream) {
			this._stream = stream;
		}

		public int read() {
			if (_numChars == -1) throw new InputMismatchException();
			if (_curChar >= _numChars) {
				_curChar = 0;
				try {
					_numChars = _stream.read(_buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (_numChars <= 0) return -1;
			}
			return _buf[_curChar++];
		}

		public String next() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			_sb.setLength(0);
			do {
				_sb.appendCodePoint(c);
				c = read();
			} while (!isWhitespace(c));
			return _sb.toString();
		}

		public int nextInt() {
			return (int) nextLong();
		}
		public long nextLong() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sgn;
		}

		public boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//


Measured memory_bytes: 20820
#include <iostream>
#include <unordered_map>

using namespace std;

typedef long long ll;

ll N, M;
ll A[100010];
ll ASUM[100010];
ll dp[100010];
unordered_map<ll,ll> map;

int main() {
   ll count=0;
   cin >> N >> M;
   for (ll i=1;i<=N;i++) {
      cin >> A[i];
      ASUM[i] = A[i] + ASUM[i-1];
      map[ASUM[i] % M] = map[ASUM[i] % M] + 1;
      if (ASUM[i] % M == 0) {
	 count++;
      }
   }
   for (auto iter=map.begin(); iter != map.end(); ++iter) {
      ll val = iter->second;
      count += val * (val - 1) / 2;
   }
   cout << count << endl;
   return 0;

}


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

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

    int n = sc.nextInt();
    long t = sc.nextLong();

    long total = 0;
    long prev = sc.nextLong();

    long cur = 0;
    for(int i = 1; i < n; i++){
      cur = sc.nextLong();
      total += Math.min(t, cur - prev);
      prev = cur;
    }
    System.out.println(total + t);
  }
}


Measured memory_bytes: 62424
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

ll lcm(ll x, ll y) {
    ll GCD = gcd(x, y);
    ll ans = x / GCD * y;
    return ans;
}

ll lcm(vector<ll> x) {
    ll ans = x[0];
    if (x.size() == 1) {
        return ans;
    }
    FOR(i, 1, x.size()) { ans = lcm(ans, x[i]); }
    return ans;
}

ll gcd(vector<ll> x) {
    if (x.size() == 1)
        return x[0];
    ll ans = x[0];
    FOR(i, 1, x.size()) { ans = gcd(ans, x[i]); }
    return ans;
}

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

    int N;
    cin >> N;
    vector<ll> T(N);
    REP(i, N) cin >> T[i];

    auto ans = lcm(T);

    cout << ans << endl;

    return 0;
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int K = stdIn.nextInt();
		long[] flag = new long[200001];
		Arrays.fill(flag, 0);
		
		for(int i = 0; i < N; i++) {
			int A = stdIn.nextInt();
			flag[A]++;
		}
		
		Arrays.sort(flag);
		long ans = 0;
		for(int i = 0; i < 200001-K; i++) {
			ans += flag[i];
		}
		
		System.out.println(ans);

	}

}

Measured memory_bytes: 66096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <fstream>
#include <cmath>
#include <limits>
#include <chrono>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
#include <cassert>
#pragma warning (disable: 4996)
using namespace std;

using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

struct UnionFind {
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    if (n < 0)return 0;
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

ll merge_cnt(vector<ll>& a) {
    int n = a.size();
    if (n <= 1) { return 0; }

    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin() + n / 2);
    vector<ll> c(a.begin() + n / 2, a.end());

    cnt += merge_cnt(b);
    cnt += merge_cnt(c);

    int ai = 0, bi = 0, ci = 0;
    while (ai < n) {
        if (bi < b.size() && (ci == c.size() || b[bi] <= c[ci])) {
            a[ai++] = b[bi++];
        }
        else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}

int main() {
    ll n;
    cin >> n;
    vector<bool> z(n,false);
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        if (a == b)z[i] = true;
    }
    string ans = "No";
    for (int i = 0; i < n - 2; i++) {
        if (z[i] && z[i + 1] && z[i + 2])ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
import numpy as np

H, W = (int(x) for x in input().split())

a = []
for i in range(H):
    a.append(input())

for i in range(0, H + 2):
    for j in range(0, W + 2):
        if (i == 0) | (j == 0) | (i == (H + 1)) | (j == (W + 1)):
            print("#", end='')
        elif j == 1:
            print(a[i - 1], end='')

        if j == (W + 1):
            print("")


Measured memory_bytes: 27200
// abc065_b
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char *argv[])
{
  int n,current,cnt=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;++i) {
    cin >> a.at(i);
  }
  current = 1;

  while(current != 2 && cnt < n) {
    current = a.at(current-1);
    cnt++;
  }

  if(cnt >= n) {
    cout << -1 << endl;
  } else {
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    private static BigInteger MOD = BigInteger.valueOf(998244353);

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            final int tmp = scanner.nextInt();
            if (i == 0 && tmp != 0) {
                System.out.println(0);
                return;
            } else if (i != 0 && tmp == 0) {
                System.out.println(0);
                return;
            }

            array[tmp]++;
        }

        int last = n - 1;
        for (; last >= 0; last--) {
            if (array[last] != 0) {
                break;
            }
        }

        BigInteger answer = BigInteger.ONE;
        long pre = 1;
        for (int i = 1; i <= last; i++) {
            if (array[i] == 0) {
                System.out.println(0);
                return;
            }
            answer = answer.multiply(originalPow(pre, array[i])).mod(MOD);
            pre = array[i];
        }

        System.out.println(answer);
    }

    private static BigInteger originalPow(final long a, final long b) {
        BigInteger result = BigInteger.ONE;
        for (long i = 0; i < b; i++) {
            result = result.multiply(BigInteger.valueOf(a)).mod(MOD);
        }

        return result;
    }
}


Measured memory_bytes: 63000
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
llo n,m;
llo it[5001];
llo dp[5001][5001];
llo mod=1000000007;
llo par[5001];
llo si[5001];
llo find(llo no){
	if(par[no]==no){
		return no;
	}
	par[no]=find(par[no]);
	return par[no];
}
llo pre[5002];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	m=0;
	for(llo i=0;i<n;i++){
		par[i]=i;
		si[i]=1;
	}
	pre[0]=1;
	for(llo i=1;i<n+2;i++){
		pre[i]=(pre[i-1]*(n-1))%mod;
	}

	llo co=0;
	vector<llo> kk;
	llo tot=0;
	for(llo i=0;i<n;i++){
		cin>>it[i];
		if(it[i]==-1){
			m+=1;
			kk.pb(i);
		}
		else{
			llo x=find(i);
			llo y=find(it[i]-1);
			if(x!=y){
				par[x]=y;
				si[y]+=si[x];
				co+=1;
			}
			else{
				tot+=1;
			}
		}
	}
	llo ans=pre[m]*n;
	ans%=mod;

//	cout<<ans<<endl;
	for(llo i=0;i<tot;i++){
		ans=(ans-pre[m]+mod)%mod;
	}
	vector<llo> mm;
	for(auto i:kk){
		mm.pb(si[find(i)]);
	//	cout<<mm.back()<<" ";
	}
	//cout<<endl;
	//cout<<ans<<endl;
	for(llo i=0;i<mm.size();i++){
		for(llo j=0;j<i+1;j++){
			if(i==0){
				dp[i][j]=mm[i];
				continue;
			}
			dp[i][j]=dp[i-1][j];
			if(j>0){
				dp[i][j]+=dp[i-1][j-1]*mm[i];
			}
			else{
				dp[i][j]+=mm[i];
			}
			dp[i][j]%=mod;
		}
	}
	llo ko=1;
	for(llo i=1;i<mm.size();i++){
		ko*=i;
		ko%=mod;

		dp[mm.size()-1][i]%=mod;
		ans=(ans-(ko*((dp[mm.size()-1][i]*pre[mm.size()-i-1])%mod)%mod)+mod)%mod;
	//	cout<<i+1<<","<<dp[mm.size()-1][i]<<endl;
	//	cout<<pre[mm.size()-i-1]<<endl;
	}
	for(llo i=0;i<mm.size();i++){
		ans-=(((mm[i]-1)*(pre[mm.size()-1]))%mod);
	//	cout<<(mm[i]-1)<<":"<<pre[mm.size()-1]<<endl;
		ans+=mod;
		ans%=mod;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 120408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int A = 3e2 + 2;
const int mod = 1e9 + 7;
int n, m, l;
vector<pair<int, int>> v[A];
pair<int, int> weight[A][A]; // cnt, fuel
void run_d(int src) {
    for (int i = 1; i <= n; i++) {
        weight[src][i].F = 2e9;
        weight[src][i].S = -1;
    }
    priority_queue<pair<pair<int, int>, int>> pq;
    pq.push({{0, l}, src}); // -, +
    weight[src][src].F = 0;
    weight[src][src].S = l;
    while(!pq.empty()) {
        int node = pq.top().S;
        int cnt = -pq.top().F.F;
        int fuel = pq.top().F.S;
        pq.pop();
        if (weight[src][node].F < cnt || (weight[src][node].F == cnt && weight[src][node].S > fuel))
            continue;
        for (auto i : v[node]) {
            int to = i.F, len = i.S;
            if (fuel < len) {
                if ((weight[src][to].F > weight[src][node].F + 1) ||
                    (weight[src][to].F == weight[src][node].F + 1 && weight[src][to].S < l - len)) {
                    pq.push({{-weight[src][node].F - 1, l - len}, to});
                    weight[src][to].F = weight[src][node].F + 1;
                    weight[src][to].S = l - len;
                }
            }
            else {
                if ((weight[src][to].F > weight[src][node].F) ||
                    (weight[src][to].F == weight[src][node].F && weight[src][to].S < fuel - len)) {
                    pq.push({{-weight[src][node].F, fuel - len}, to});
                    weight[src][to].F = weight[src][node].F;
                    weight[src][to].S = fuel - len;
                }
            }
        }
    }
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> m >> l;
    for (int i = 0; i < m; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        if (l < c) continue;
        v[x].pb({y, c}), v[y].pb({x, c});
    }
    for (int i = 1; i <= n; i++)
        run_d(i);
    int q;
    cin >> q;
    while(q--) {
        int x, y;
        cin >> x >> y;
        cout << (weight[x][y].F == 2e9 ? -1 : weight[x][y].F) << '\n';
    }
    return 0;
}


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

int main() {
	int n, last = INT_MIN, ans = 0, cnt = 0;
	cin >> n;

	vector<int> nums(n);
	for (auto& num : nums) {
		cin >> num;
		cnt = num > last ? 0 : cnt + 1;
		ans = max(ans, cnt);
		last = num;
	}

	cout << ans;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int q = sc.nextInt();
		int total = 0;
		int count = 0;

		ArrayList<Integer> time = new ArrayList<>();
		ArrayList<String> name = new ArrayList<>();

		for (int i = 0; i < n; i++) {
			name.add(sc.next());
			time.add(sc.nextInt());
		}

		while (time.size() != 0) {
			if (time.get(count) <= q) {
				total += time.get(count);
				System.out.printf("%s %d\n", name.get(count), total);
				time.remove(count);
				name.remove(count);
				count = count >= name.size() ? 0 : count;
			} else {
				total += q;
				time.set(count, time.get(count) - q);
				count = ++count >= name.size() ? 0 : count;

			}

		}

	}
}


Measured memory_bytes: 105448
#include<bits/stdc++.h>
using namespace std;
bool ask(int x,int y){
	cout<<"? "<<x<<' '<<y<<endl;
	char s;
	cin>>s;
	if(s=='Y'){
		return true;
	}
	return false;
}
int solve(vector<int> cand){
	if(cand.size()==1){
		return cand[0];
	}
	if(cand.size()==0){
		return -1;
	}
	vector<int> temp;
	int ncand=-1;
	if(cand.size()&1){
		ncand=cand.back();
		cand.pop_back();
	}
	for(int i=0;i+1<cand.size();i+=2){
		if(ask(cand[i],cand[i+1])){
			temp.push_back(cand[i+1]);
		}
	}
	int cac=solve(temp);
	if(cac!=-1){
		return cac;
	}
	else{
		return ncand;
	}
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,a,b,ans;
	cin>>a>>b;
	if(a<=b){
		cout<<"Impossible"<<endl;
		return 0;
	}
	n=a+b;
	vector<int> temp;
	for(i=0;i<n;i++){
		temp.push_back(i);
	}
	ans=solve(temp);
	assert(ans!=-1);
	string s;
	for(i=0;i<n;i++){
		if(ans==i){
			s.push_back('1');
			continue;
		}
		if(ask(ans,i)){
			s.push_back('1');
		}
		else{
			s.push_back('0');
		}
	}
	cout<<"! "<<s<<endl;
}

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

#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
// #define iter(a) __typeof(a.begin())
#define FOR(it, a) for (auto it = a.begin(); it != a.end(); ++it)
#define F first
#define S second
#define SZ(a) static_cast<int>((a).size())
#define sz(a) SZ(a)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).begin(), (a).end()
using namespace std;

typedef int64_t ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef uint64_t ull;

#ifdef ONLINE_JUDGE
#define PR(...) (void(0))
#else
#define PR(...) \
  do { cerr << "line : " << __LINE__ << ", " << endl;  \
    pr(#__VA_ARGS__, __VA_ARGS__); } while (0)

template<class T>
void pr(const string& name, T t) {
  cerr << name << ": " << t << endl;
}
template<typename T, typename ... Types>
void pr(const string& names, T t, Types ... rest) {
  auto p = names.find(',');
  cerr << names.substr(0, p) << ": " << t << ", ";
  pr(string(names, p + 1), rest ...);
}
#endif

template<class T, class U> ostream& operator<<(
    ostream& o, const pair<T, U>& v) {
  return o << "(" << v.F << ", " << v.S << ")";
}
template<class T> ostream& operator<<(
    ostream& o, const vector<T>& v) {
  o << "{"; rep(i, SZ(v)) o << (i?", ":"") << v[i]; return o << "}"; }
template<class T, class U> ostream& operator<<(
    ostream& o, const map<T, U>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T, class U> ostream& operator<<(
    ostream& o, const unordered_map<T, U>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T> ostream& operator<<(ostream& o, const set<T>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T> string to_s(const T& v) {
  ostringstream is; is << v; return is.str(); }

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

#define endl '\n'

int main(int argc, char *argv[])
{
  int n, x;
  cin >> n >> x;
  if (n * 2 - 1 == x || x == 1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  set<int> out;
  for (int i = 0; i < 2 * n - 1; ++i) {
    out.insert(i + 1);
  }

  vector<int> ans(n * 2 - 1);
  ans[n - 2] = x - 1;
  ans[n - 1] = x;
  ans[n] = x + 1;
  if (x - 2 >= 1) ans[n + 1] = x - 2;
  else if(n - 3 >= 0) ans[n - 3] = x + 2;

  for (int i = 0; i < n * 2 - 1; ++i) {
    out.erase(ans[i]);
  }

  for (int i = 0; i < n * 2 - 1; ++i) {
    if (!ans[i])
      ans[i] = *out.begin();
    cout << ans[i] << endl;
    out.erase(ans[i]);
  }

}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
 
 
  int main(){
    lint n;
    cin>>n;
    lint a[n];
    rep(i,n)cin>>a[i];
    lint ans=0;
    rep(i,n){
        if((i+1)%2==1&&a[i]%2==1)ans++;
    }
    cout<<ans<<endl;
     }
     
 

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int D;
    cin >> D;

    if (D == 25) {
        cout << "Christmas" << endl;
    } else if (D == 24) {
        cout << "Christmas Eve" << endl;
    } else if (D == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if (D == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }

    return 0;
}


Measured memory_bytes: 256