akhauriyash/Code-Regression huggingface dataset:
#!python3

iim = lambda: map(int, input().rstrip().split())

from heapq import heappush, heappop

def resolve():
    V, E = iim()
    inf = float("inf")
    ad = [[inf]*V for i in range(V)]

    for i in range(E):
        s, t, d = iim()
        ad[s][t] = d

    bi = [1<<i for i in range(V)]
    goal = (1<<V) - 1

    dp = dict()
    q = []
    heappush(q, (0, 0, 1))
    ans = inf
    while q:
        cost, v, state = heappop(q)

        vs = (v, state)
        if vs in dp:
            if dp[vs] <= cost:
                continue
        dp[vs] = cost

        if state == goal:
            cost += ad[v][0]
            if cost < ans:
                ans = cost
            continue

        for i in range(V):
            if bi[i] & state:
                continue
            heappush(q, (cost + ad[v][i], i, state | bi[i]))
    print(ans if ans != inf else -1)
    #print(dp[(0, goal)])

if __name__ == "__main__":
    resolve()



Measured memory_bytes: 73528
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    if ((S.at(2)==S.at(3))&&(S.at(4)==S.at(5))){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

using R = long double;
constexpr R pi = acos((R)-1), eps = 1e-10;

int sgn(R a) { return (a > eps) - (a < -eps); }
int sgn(R a, R b) { return sgn(a - b); }
using P = complex<R>;
istream& operator>>(istream& i, P& p) { R x, y; i >> x >> y; p = P(x, y); return i; }
ostream& operator<<(ostream& o, P p) { return o << fixed << setprecision(15) << real(p) << ' ' << imag(p); }
bool cmp(P p, P q) { return 2 * sgn(real(p), real(q)) + sgn(imag(p), imag(q)) < 0; }
bool eql(P p, P q) { return !cmp(p, q) and !cmp(q, p); }
R dot(P p, P q) { return real(conj(p) * q); }
R crs(P p, P q) { return imag(conj(p) * q); }
// -2: back, -1: cw, 0: on, 1: ccw, 2: front
int ccw(P p, P q) {
  int s = sgn(crs(p, q));
  if (s) return s;
  if (dot(p, q) < 0) return -2;
  if (dot(p, q - p) > 0) return 2;
  return 0;
}
int ccw(P o, P p, P q) { return ccw(p - o, q - o); }
struct L {
  P s, t;
  P vec() const { return t - s; }
  R abs() const { return std::abs(vec()); }
  R arg() const { return std::arg(vec()); }
};
int ccw(L s, P p) { return ccw(s.s, s.t, p); }

P proj(P p, L l) {
  P e = l.vec() / l.abs();
  return l.s + dot(p - l.s, e) * e;
}
P refl(P p, L l) { return (R)2 * proj(p, l) - p; }
R distPP(P p, P q) { return abs(q - p); }
R distPL(P p, L l) { return distPP(p, proj(p, l)); }
R distPS(P p, L s) {
  P q = proj(p, s);
  if (!ccw(s, q)) return distPP(p, q);
  return min(distPP(p, s.s), distPP(p, s.t));
}
R distLL(L l, L m) {
  if (sgn(crs(l.vec(), m.vec()))) return 0;
  return distPL(l.s, m);
}
R distLS(L l, L s) {
  if (ccw(l, s.s) * ccw(l, s.t) != 1) return 0;
  return min(distPL(s.s, l), distPL(s.t, l));
}
R distSS(L s, L t) {
  if (ccw(s, t.s) * ccw(s, t.t) <= 0 and ccw(t, s.s) * ccw(t, s.t) <= 0) return 0;
  return min({distPS(s.s, t), distPS(s.t, t), distPS(t.s, s), distPS(t.t, s)});
}
P intxn(L l, L m) {
  assert(sgn(crs(l.vec(), m.vec())));
  return l.s + crs(m.s - l.s, m.vec()) / crs(l.vec(), m.vec()) * l.vec();
}

// BEGIN CUT HERE
struct C { P o; R r; };
V<P> intxnCL(C c, L l) {
  int s = sgn(distPL(c.o, l), c.r);
  if (s > 0) return {};
  P p = proj(c.o, l);
  if (!s) return {p};
  P q = sqrt(c.r * c.r - norm(p - c.o)) * l.vec() / l.abs();
  return {p - q, p + q};
}
// END CUT HERE

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  C c; cin >> c.o >> c.r;
  int q; cin >> q;
  while (q--) {
    L l; cin >> l.s >> l.t;
    auto ps = intxnCL(c, l);
    if (ps.size() < 2) ps.push_back(ps.back());
    sort(begin(ps), end(ps), cmp);
    cout << ps[0] << ' ' << ps[1] << '\n';
  }
}


Measured memory_bytes: 3392
#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define pb(x)                   push_back((x))
#define pb2(x,y)                push_back({x,y})
#define pb3(x,y,z)              push_back({x,y,z})
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x)                  find_by_order(x)
#define ook(x)                  order_of_key(x)
#define all(x)                  (x).begin(),(x).end()
#define FOR(i,n)                for(int i = 1; i<=n; i++)
#define REP(i,n)                for(int i = 0; i<n;  i++)
#define dbg(a)                  cout<<#a <<" --> "<<(a)<<endl;
#define TT                      int TC;  scanf("%d",&TC);  while(TC--)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
using                           namespace std;
using                           namespace __gnu_pbds;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;





main(){
//read;

ll a,b;
cin>>a>>b;
ll ans;

if(a==1 || b==1)    ans = 1;
else
ans = (a*b+1)/2;

cout<<ans;


return 0;
}



Measured memory_bytes: 256
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

map<int, int> mp;

int f(int a){
  if(a%2 == 0) return a/2;
  else return a*3+1;
}

int a[10000001];

int
main(void){  
  ios_base::sync_with_stdio(false);

  int s;
  cin >> s;

  a[0] = s;
  mp[s]++;

  int i = 0;
  while(true){
    a[i+1] = f(a[i]);
    //cout << a[i] << " " << a[i+1] << endl;
    mp[a[i+1]]++;
    if(mp[a[i+1]]>1) break;
    i++;
  }

  cout << i+2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  std::cout << 800*n-200*(n/15) << '\n';
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from math import sqrt
N,P = map(int, input().split())
is_prime = [True]*(10**6+1)
is_prime[0] = is_prime[1] = False
def sieve(n:int):
    """Sieve of Eratoshenes
    return the number of prime number (0, n]"""
    global is_prime
    for i in range(2, n+1):
        if is_prime[i]:
            # 素数の倍数は合成数
            for j in range(i*2, n+1, i):
                is_prime[j] = False

sieve(10**6)
facts = defaultdict(lambda:0)
p = P
for i in range(int(sqrt(P))):
    if not is_prime[i]:
        continue
    if p == 1:
        break
    while p % i == 0:
        p //= i
        facts[i] += 1
if p>0:
    facts[p] += 1
ans = 1
for k,v in facts.items():
    ans *= pow(k, v//N)
print(ans)


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

namespace Atc_0031
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());

            long result = 0;

            for (long i = 1; i <= N; i++)
            {
                if (i.ToString().Length % 2 == 1)
                {
                    result++;
                }
            }

            Console.WriteLine(result);

        }
    }
}


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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e16;
const int MB = 20;
const int MOD = 998244353;
const int maxN = 1e7 + 1;

void solve() {
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}

	int ans = 0;

	for (int maskH = 0; maskH < (1 << h); maskH++) {
		for (int maskW = 0; maskW < (1 << w); maskW++) {
			int res = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (a[i][j] == '#' && !((maskH >> i) & 1) && !((maskW >> j) & 1)) {
						res++;
					}
				}
			}
			if (res == k) ans++;
		}
		
	}
	cout << ans;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

int main(){
    int n; cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int temp = 0,h_max = 0;
    int now = h[0], pre = 0;
    for(int i = 1;i < n;i++){
        pre = now;
        now = h[i];
        if(now <= pre){
            temp++;
        }
        else temp = 0;
        // print(now, pre, temp);
        h_max = max(h_max, temp);
    }
    cout << h_max << endl;
    return 0;
}

Measured memory_bytes: 640
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7,MAX = 1e6+5;
const ll INF = 1e18+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
///////////////////PnC/////////////////////
vl Fac(MAX),Inv(MAX);
void CalcFac()
{
	Fac[0]=Inv[0]=1;
	for(int i=1;i<MAX;i++)
	{
		Fac[i]=(Fac[i-1]*i)%MOD;
		Inv[i]=powN(Fac[i],MOD-2);
	}
}

ll NCR(int n,int r)
{
	if(r>n) return 0;
	return (((Fac[n]*Inv[r])%MOD)*Inv[n-r])%MOD;
}
///////////////////PnC/////////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vi MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	int l,r,d;
	cin>>l>>r>>d;
	cout<<r/d-(l-1)/d<<endl;
}	

Measured memory_bytes: 22924
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    W = [int(i) for i in file().split()]
    left = W[0]
    right = sum(W) - left
    diff = abs(left - right)
    for i in range(1, N-1):
        left += W[i]
        right -= W[i]
        diff = min(diff, abs(left - right))
    print(diff)
    return 0
  
if __name__ == "__main__":
    solve()

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

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

    for (int i = A; i <= B; i++)
    {
        if (i < A + K || i > B - K)
        {
            cout << i << endl;
        }
    }

    return 0;
}

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

int main ()
{
  string str, order;
  string replace, p;
  int n, a, b, i, j;

  cin >> str;
  cin >> n;

  for(i = 0; i < n; i++)
  {
    cin >> order;
    cin >> a >> b;

    if(order == "print")
    {
      for(int j = a; j <= b; j++)
      {
        cout << str[j];
      }
      cout << endl;
    }
    if(order == "reverse")
    {
      char ch[b - a + 1];
      for(j = a; j <= b; j++)
      {
        ch[j - a] = str[j];
      }
      for(j = a; j <= b; j++)
      {
        str[j] = ch[b - j];
      }
    }
    if(order == "replace")
    {
      cin >> p;
      for(j = a; j <= b; j++)
      {
        str[j] = p[j - a];
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		System.out.println((S.startsWith("YAKI"))? "Yes":"No");
		
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define LL long long
#define MOD 1000000007
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  	int x,k;
  	cin>>x>>k;
  	string ans = "No";
  	for(int i=0; i<=x; i++){
		if((2*i + 4*(x-i))==k){
			ans ="Yes";
			break;
        }
    }
  	cout<<ans;
	
}

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

using namespace std;

map<int, int> mp;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    mp[a]++;
  }
  long long ans = 0;
  for (auto it : mp) {
    if (it.first <= it.second)
      ans += it.second - it.first;
    else
      ans += it.second;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4736
#include<stdio.h>

int main(){
  int a[10]={0},b[100]={0},c[1000]={0};
  int n;
  char ch;
  scanf("%d\n",&n);
  for(int i = 0;i < n;i++){
    scanf("%c",&ch);
   	int num = ch-'0';
    for(int j = 0;j < 100;j++){
      if(b[j]){c[j*10+num]=1;}
    }
    for(int j = 0;j < 10;j++){
      if(a[j]){b[j*10+num]=1;}
    }
    a[num] = 1;
  }
  int ct = 0;
  for(int i = 0;i < 1000;i++){
    ct += c[i];
  }
  printf("%d\n",ct);
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        
        while(scan.hasNext())
        {
            int n = scan.nextInt();
            if(n==-1)
                break; 
            long tmp1=0,ans=0,keta=1;
            
            //下位の桁から数値を入れる
            while(n>0)
           {
              tmp1=n%4;               //その桁の値がいくつになるか
                ans=ans+(keta*tmp1);    //桁に合わせて値を入れる
                n=n/4;                  //進数分で割る
                keta=keta*10;           //桁をひとつ増やす
            }
            System.out.println(ans);
            
        }
    }
}

Measured memory_bytes: 21700
#include<bits/stdc++.h>
#define vi vector<int>
using namespace std;
int main(void)
{
   int n;cin>>n;
   struct node{
      int a,b,c;
   };
   vector<struct node>v(n);
   int dp[n][3];

   for(int  i = 0;i<n;i++)
   {
      cin>>v[i].a>>v[i].b>>v[i].c;
   }
   for(int  i = 0;i<n;i++)
   {
       if(i==0)
       {
          dp[i][0] = v[i].a;
          dp[i][1] = v[i].b;
          dp[i][2] = v[i].c;
          continue;
       }
       dp[i][0] = max(dp[i-1][1],dp[i-1][2])+v[i].a;
       dp[i][1] = max(dp[i-1][0],dp[i-1][2])+v[i].b;
       dp[i][2] = max(dp[i-1][0],dp[i-1][1])+v[i].c;   
   }

   cout<<max(max(dp[n-1][1],dp[n-1][2]),dp[n-1][0])<<endl;
}





























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

long long combi(long long n, long long r)
{
    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (combi(n - 1, r - 1) + combi(n - 1, r));
}

int main()
{
	int N, P;
	cin >> N >> P;
	int odd = 0;
	int even = 0;
	for( int i = 0; i < N; i++ ) {
		int A;
		cin >> A;
		if( A % 2 ) odd++;
		else even++;
	}

	long long ans = 0;
	if( P % 2 ) {
		for( int i = 1; i <= odd; i += 2 ) {
			ans += combi(odd, i);
		}
		long long p = 1;
		for( int i = 0; i < even; i++ ) {
			p *= 2;
		}
		ans *= p;
	}
	else {
		for( int i = 0; i <= odd; i += 2 ) {
			ans += combi(odd, i);
		}
		if( ans == 0 ) ans = 1;
		long long p = 1;
		for( int i = 0; i < even; i++ ) {
			p *= 2;
		}
		ans *= p;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3620
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    map<int,int> mp;
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
    }
    for(auto & i : mp){
        if(i.second > 1){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
}

Measured memory_bytes: 10496
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

static inline void MainTask() {
  uint32_t N;
  cin >> N;
  vector<uint32_t> H(N), Res(N);
  ArrayInput(H);
  Res[0] = 0;
  for (uint32_t i = 0; i < N - 1; ++i) {
    if (H[i + 1] <= H[i]) {
      ++Res[i];
      Res[i + 1] = Res[i];
    } else {
      Res[i] = 0;
    }
  }
  cout << *max_element(Res.begin(), Res.end()) << endl;
}
int main() {
  MainTask();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(long (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(long (i)=(a)-1;(i)>=(b);(i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define VI vector<int>
#define VII vector<VI>
#define VL vector<long>
#define VLL vector<VL>
#define VD vector<double>
#define VDD vector<VD>
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<long,long>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define FORE(a,b) for(auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9;
const int MOD=INF+7;

int N,K;
VII G;

//n:現在のノード, r:親ノード, ml:残り経路長
long dfs(int n,int r,int ml){
    if(ml<0) return 0;
    int ret=1;
    FORE(nxt,G[n]){
        if(nxt!=r) ret+=dfs(nxt,n,ml-1);
    }
    return ret;
}

int main(void)
{
    cin>>N>>K;
    G=VII(N);
    REP(i,N-1){
        int a,b; cin>>a>>b;
        a--; b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    long ans=LONG_MAX;
    if(K&1){
        REP(i,N)FORE(j,G[i]){
    //連結している2頂点i,jのうち片方を親ノードとして探索し，それらを足すことで辺を中心とした探索とみなす
            long buf=N-(dfs(i,j,(K-1)/2)+dfs(j,i,(K-1)/2)); //DEBUG(buf)
            ans=min(ans,buf);
        }
    }else{
        REP(i,N) ans=min(ans,N-dfs(i,-1,K/2));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

int main () {
	int n,m;
	cin>>n>>m;
	int s=0;
	for(int i=0;i<m;i++){
		int a;
		cin>>a;
		s+=a;
	}
	if(s>n) cout<<-1;
	else cout<<n-s;



return 0;
}



Measured memory_bytes: 3632
#include <stdio.h>
int main(){

    int m1, m2, d1, d2;
    scanf("%d %d\n", &m1, &d1);
    scanf("%d %d\n", &m2, &d2);
    if (m2 > m1) {printf("1");}
    else if ((m1 == 12)&&(m2==1)) {printf("1");}
    else {printf("0");}
    return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include<set>
#include <vector>
#include<algorithm>
using namespace std;
#define loop(i,n) for(int i = 0; i < (n); i++)
#define loops(i,f,n) for(int i = (f); i < (n); i++)
#define INF 9999999
int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    int sum=0;
    loop(i,n)
    {
        cin>>v[i];
        sum+=v[i];
    }
    if(sum%10!=0)cout<<sum<<endl;
    else{
    bool ans = false;
        sort(v.begin(),v.end());
        loop(i,n)
        {
            int sumt=sum;
            sumt-=v[i];
            if(sumt%10!=0)
            {
            cout<<sumt<<endl;
            ans = true;
            break;
            }
            else continue;
        }
        if(!ans)cout<<0<<endl;
    }
    return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    set<int> s{1, 2, 3};
    s.erase(A);
    s.erase(B);
    cout << *s.begin() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
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; }

int main() {
  lint a, b, c, d;
  scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
 
  lint m0 = max(a*c, a*d);
  lint m1 = max(b*c, b*d);
  lint ans = max(m0, m1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3748
N,K = map(int,input().split())
h = list(map(int,input().split()))
DP = [float('inf') for i in range(N)]
DP[0]=0

for i in range(1,N):
    for j in range(1,min(i+1,K+1)):
        DP[i] = min(DP[i-j]+abs(h[i]-h[i-j]),DP[i])

print(DP[-1])

Measured memory_bytes: 56672
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef long double ld;
typedef std::vector<long double> vld;
typedef std::vector<std::vector<long double>> vvld;
using namespace std;
void yesno(bool state);

void Main(){
    ll N,M,K;
    cin >> N >> M >> K;
    vll A(N),B(M);
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];
    vll a(N+1),b(M+1);
    a[0] = 0,b[0]=0;
    rep(i,N) a[i+1]=a[i]+A[i];
    rep(i,M) b[i+1]=b[i]+B[i];

    ll a_ = std::upper_bound(a.begin(),a.end(),K) - a.begin() - 1;
    ll b_ = std::upper_bound(b.begin(),b.end(),K - a[a_]) - b.begin() - 1;

    ll ans = a_ + b_;
    for(; a_ >= 0; a_--)
        for(; b_ <= M; b_++){
            if(a[a_] + b[b_] > K){
                b_--;
                break;
            }
            else if(ans < a_ + b_)
                ans = a_ + b_;
        }
    
    cout << ans << endl;


}

int main(int argc, char const *argv[])
{
    Main();
    return 0;
}

void yesno(bool state){
    if(state)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 9572
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<int>> c(10,vector<int>(10));
    REP(i,10){
        REP(j,10){
            cin >> c[i][j];
        }
    }
    vector<vector<int>> a(h,vector<int>(w));
    vector<int> cnt(10,0);
    REP(i,h){
        REP(j,w){
            cin >> a[i][j];
            if(a[i][j]>=0){
                cnt[a[i][j]]++;
            }
        }
    }
    vector<int> d(10,INT_MAX/2);
    d[1] = 0;
    priority_queue<int,vector<int>,greater<int>> q;
    q.push(1);
    while(!q.empty()){
        int p = q.top();
        q.pop();
        Rep(i,10){
            int to = i;
            if(i!=p){
                if(d[to]>d[p]+c[to][p]){
                    d[to]=d[p]+c[to][p];
                    q.push(to);
                }
            }
        }
    }
    int res = 0;
    REP(i,10){
        res+=d[i]*cnt[i];
    }
    put(res);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,a,b,c;
  cin >> A >> B;
  a=A+B;
  b=A-B;
  c=A*B;
  if(a>=b && a>=c)
    cout << a << endl;
  else if(b>=a && b>=c)
    cout << b << endl;
  else if(c>=a && c>=b)
    cout << c << endl;
}
  

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

int main(){
    int N;
    cin>>N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin>>vec.at(i);
    }
    int a=0;
    for(int i=0;i<N;i++){
           if(vec.at(i)%2==0){
           a++;

           }
    }
    int b=0;
    for(int i=0;i<N;i++){
       if(vec.at(i)%2==0){
           if(vec.at(i)%3==0||vec.at(i)%5==0){
              b++;
           }
           
       }
    }
    if(a==b){
         cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
string A,B,C;

int dp[100][2];

inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
signed main(){
    while(cin>>A,A!="0"){
        cin>>B>>C;
        reverse(all(A));reverse(all(B));reverse(all(C));

        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        for(int i=0;i<A.size();i++){
            for(int j=0;j<2;j++){
                rep(k,10)rep(l,10){
                    if(i+1==A.size()&&(k==0||l==0))continue;
                    if(A[i]!='?'&&A[i]-'0'!=k)continue;
                    if(B[i]!='?'&&B[i]-'0'!=l)continue;
                    if(C[i]!='?'&&C[i]-'0'!=(k+l+j)%10)continue;
                    add(dp[i+1][(k+l+j)/10],dp[i][j]);
                }
            }
        }
        cout<<dp[A.size()][0]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3108
n = input()

sumP = 0

for i in range(2 ** (len(n)- 1)):   #間の数、植木算の全探索
    plus=[]                         #＋位置のリスト
    for j in range(len(n) - 1):     #今調べるやつがどの位置に+をもつか
        if i >> j & 1 :             #iをj回シフトして、0か1を判定する。1なら、そこに+があるため格納したい
            plus.append(j)          

    middle_index = 0

    for pos in plus:
        sumP += int(n[middle_index:pos + 1])       #前半部分を和
        middle_index = pos + 1
    sumP += int(n[middle_index:])                  #後半部分を和

print(sumP)

Measured memory_bytes: 9120
n=int(input());ans=0
l=[int(input()) for i in range(n)]
if l[0]!=0:
  print(-1);exit()
for i in range(n-1):
  if l[i+1]>l[i]+1:
    print(-1);exit()
for i in range(1,n):
  if l[i]==l[i-1]+1:
    ans+=1
  else:
    ans+=l[i]
print(ans)

Measured memory_bytes: 11052
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc103/tasks/abc103_d

int main() {
    int N, M; cin >> N >> M;
    P ab[M];
    REP(i, M) {
        int a, b; cin >> a >> b;
        ab[i] = {b, a};
    }

    sort(ab, ab+M);

    int now = 0;
    int cnt = 0;
    REP(i, M) {
        int l = ab[i].second;
        int r = ab[i].first;

        if (l >= now) {
            cnt++;
            now = r;
        }
    }

    cout << cnt << "\n";


    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,a,b;
  cin>>n>>a>>b;
  
  ll ans = abs(a-b);
  if(ans%2==1)
    cout<<"Borys"<<endl;
  else
    cout<<"Alice"<<endl;
    
    
}

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

v_array.sort()

# print(v_array)
v_sum = 0
bairitu = 1
for i,v in enumerate(v_array[::-1]):
    if i != N-1:
        bairitu *= 0.5
    v_sum += bairitu * v

print(v_sum)

Measured memory_bytes: 38736
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
const ll N=998244353;
void solve()
{
    ll n;
    cin>>n;
    vl a(n);
    ll xork=0;
    forr(i, n)
    {
        cin>>a[i];
        xork=xork^a[i];
    }
    forr(i, n)
    {
        cout<<(xork^a[i])<<" ";
    }
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 4836
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;


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

    int count = 0;

    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            if (a[i] % 2 == 1) count++;
        }
    }

    cout << count;

    return 0;
}



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

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

using namespace std;

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

  rep(i,1000){
    if(i%111==0 && i>=n){
      cout<<i;
      break;
    }
  }

  return 0;
}

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

    typedef long long int ll;
    #define pb         push_back
    #define mp         make_pair
    #define F          first
    #define S          second
    #define fl(i,a,b)  for(ll i=a;i<b;i++)
    #define pll        pair<ll,ll>
    #define pii        pair<int,int>
    #define all(v)     v.begin(),v.end()
    #define M 1000000007
    #define tr(v, it) for(auto it = v.begin(); it != v.end(); it++)
    using namespace std;



    int main()
    {

        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

          int n;
          cin>>n;
          int arr[n];
          for(int i=0;i <n; i++)
          {
              cin>>arr[i];
          }
          int dp[n];
          dp[0]=0;
          dp[1]=abs(arr[0]-arr[1]);
          for(int i=2; i<n; i++)
          {
              dp[i]=min((dp[i-1]+abs(arr[i]-arr[i-1])), (dp[i-2]+abs(arr[i]-arr[i-2])));
          }
          cout<<dp[n-1];
       return 0;
    }


Measured memory_bytes: 4436
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

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

	string x;
	cin >> x;

	int len=x.size();
	int numofs[len/2];
	int ns=0,nt=0;
	for(int i=0;i<len;i++){
		if(x[i] == 'S')ns++;
		else numofs[nt++] = ns;
	}
	int deltime=0;
	for(int i=0;i<len/2;i++){
		if(numofs[i]-deltime > 0)deltime++;
	}
	cout << max(0,len-2*deltime) << "\n";

	return 0;
}

Measured memory_bytes: 916
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	const int MAX = 100000;//10^5
	vector<bool> prime(MAX+1,true);
	prime[0] = false;
	prime[1] = false;
	for(int i=2;i<=MAX;++i){
		if( prime[i] ){
			for(int j=i+i;j<=MAX;j+=i){
				prime[j] = false;
			}
		}
	}
	//////////////
	vector<int> dp(MAX+1,0);
	for(int i=1;i<=MAX;++i){
		if( (i&1) && prime[i] && prime[(i+1)/2] ){
			dp[i] = 1+ dp[i-1];
		}else{
			dp[i] = dp[i-1];
		}
	}
	int Q;
	cin >> Q;
	while(Q--){
		int L,R;
		cin >> L >> R;
		cout << dp[R]-dp[L-1] << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 1024
#include<cstdio>
#define neko 200010
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~i))
int n,x,m,now;
typedef int arr[neko];
arr book,ans;
int main()
{
	scanf("%d%d",&n,&x),m=n*2-1;
	if(n==1)return printf("Yes\n1\n"),0;
	if(x==1||x==m)return printf("No\n"),0;
	printf("Yes\n");
	int mid=(m+1)>>1;
	if(x<m-1)
	{
		ans[mid]=x,ans[mid+1]=x+2,ans[mid-1]=1,ans[mid-2]=x+1;
		book[1]=book[x]=book[x+1]=book[x+2]=1;
	}
	else
	{
		ans[mid]=x,ans[mid+1]=1,ans[mid-1]=m,ans[mid-2]=x-1;
		book[1]=book[x]=book[m]=book[x-1]=1;
	}now=1;
	f(i,mid+2,m)
	{
		while(book[now])++now;
		ans[i]=now,book[now]=1;
	}now=1;
	f(i,1,mid-3)
	{
		while(book[now])++now;
		ans[i]=now,book[now]=1;
	}f(i,1,m)printf("%d\n",ans[i]);
	return 0;
}

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

int main(){
   int n;
   cin>>n;
   int a[n],c_1=0,c=1,ans=0;
   for(int i=0;i<n;i++){
       cin>>a[i];
    if(a[i]==1) c_1++;
    if(a[i]==c) c++;
    else ans++;
   }
   if(c_1==0) cout<<-1<<endl;
   else{
       cout<<ans<<endl;
   }
     return 0;
}
  


Measured memory_bytes: 1024
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(v)";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var mod = 1e9 + 7;
var fact=[1,1];
var finv=[1,1];
function abmod(){for(var a=arguments,r=a[0],i=1;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}
function modinv(a){for(var b=mod,u=1,v=0,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function nCrmod(n,r){return abmod(fact[n],finv[r],finv[n-r]);}

console.log(main());
function main(){
  var B = o.a();
  var W = o.a();
  var s = B+W;
  fact.length = finv.length = s+1;
  for(var i = 2; i <= s; i++)fact[i] = abmod(fact[i-1], i);
  finv[s] = modinv(fact[s]);
  for(var i = s; i > 2; i--)finv[i-1] = abmod(finv[i], i);
  var ans = Array(s);
  var m = 1, b = 0, w = 0;
  for(var i = 0; i < s; i++){
    if(B <= i){
      if(B === i)b = 1;
      else b *= 2, b += nCrmod(i-1,B-1), b %= mod;
    }
    if(W <= i){
      if(W === i)w = 1;
      else w *= 2, w += nCrmod(i-1,W-1), w %= mod;
    }
    ans[i] = w;
    var t = m - w - b;
    while(t < 0)t += mod;
    ans[i] += abmod(finv[2], t);
    ans[i] = abmod(ans[i],modinv(m));
    m = m * 2 % mod;
  }
  return ans.join("\n");
}

Measured memory_bytes: 37836
N=gets.to_i
A,B=gets.chomp.split.map(&:to_i)
P=gets.chomp.split.map(&:to_i)
cnt = [0,0,0]
P.each do |i|
  if i <= A
    cnt[0] +=1
  elsif i <= B
    cnt[1] +=1
  else
    cnt[2] +=1
  end
end
p cnt.min


Measured memory_bytes: 3836
#include <stdio.h>
#include <stdlib.h>

int min(int a,int b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  int N;
  scanf("%d",&N);

  int W[N];
  for (int i = 0; i < N; i++) {
    scanf("%d",&W[i]);
  }

  int sum[N+1];
  sum[0] = 0;
  for (int i = 0; i < N; i++) {
    sum[i+1] = sum[i]+W[i];
  }

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

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

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
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;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp
const ll mod=1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll h;
    cin >> h;
    ll w;
    cin >> w;
    ll kk;
    cin >> kk;
    ll count=0;
    vvll c(h,vll(w,0));
    rep(i,h){
        rep(j,w){
            char s;cin>>s;
            if(s=='#'){
                c[i][j]=1;
                count++;
            }
        }
    }
    ll ans=0;
    ll hl=pow(2,h);
    ll wl=pow(2,w);
    rep(i,hl){
        rep(j,wl){
            ll ii,jj;
            ii=i;jj=j;
            vb hb(h);
            vb wb(h);
            rep(k,h){
                if(ii%2==1) hb[k]=true;
                ii/=2;
            }
            rep(k,w){
                if(jj%2==1) wb[k]=true;
                jj/=2;
            }
            ll co=0;
            rep(s,h){
                rep(t,w){
                    if(hb[s]==false&&wb[t]==false&&c[s][t]==1) co++;
                }
            }
            if(kk==co) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4064
#include<stdio.h>
#include<string.h>
#define MAX 1001

int LCSLength(char [], char []);

int main()
{
  int i, q, Z[MAX];
  char X[MAX], Y[MAX];

  scanf("%d", &q);
  for(i=0; i<q; i++)
    {
      scanf("%s", X);
      scanf("%s", Y);
      Z[i] = LCSLength(X, Y);
    }

  for(i=0; i<q; i++)
    {
      printf("%d\n", Z[i]);
    }
 
  return 0;
}

int LCSLength(char X[], char Y[])
{
  int i, j, c[MAX][MAX];
  int m = strlen(X);
  int n = strlen(Y);

  for(i=1; i<=m; i++) c[i][0] = 0;
  for(j=0; j<=n; j++) c[0][j] = 0;

  for(i=1; i<=m; i++)
    {
      for(j=1; j<=n; j++)
	{
	  if(X[i-1] == Y[j-1]) c[i][j] = c[i-1][j-1] + 1;
	  else if(c[i-1][j-1] >= c[i][j-1]) c[i][j] = c[i-1][j];
	  else c[i][j] = c[i][j-1];
	}
    }
  
  return c[m][n];
}

Measured memory_bytes: 4524
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#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
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll kai(vector<ll> A, ll key) {
	ll an = 0;
	rep(i, A.size()) {
		an += (A.at(i) - 1) / key;
	}
	return an;
}
// index が条件を満たすかどうか
bool isOK(int index,vector<ll> A, int K) {
	if (kai(A,index) <= K) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(ll MA,vector<ll> A,ll K) {
	int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = MA; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, A,K)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

ll HP[20002];
int main() {
	ll H, N,M=0;
	cin >> H >> N;
	vector<ll> A(N);
	vector<ll> B(N);
	rep(i, N) {
		cin >> A.at(i) >> B.at(i);
		M = max(M, A.at(i));
	}
	rep(i, H+M) {
		HP[i] = 1e9;
	}
	HP[0] = 0;
	rep(i, H+M) {
		rep(j, N) {
			if (i >= A.at(j)) {
				HP[i] = min(HP[i - A[j]] + B[j], HP[i]);
			}
		}
	}
	ll an = 1e9;
	for (ll i = H; i < H + M; i++) {
		an = min(an, HP[i]);
	}
	cout << an << endl;
}


Measured memory_bytes: 3672