akhauriyash/Code-Regression huggingface dataset:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from math import floor

a, b, n = na()

x = min(b - 1, n)

print(floor(a * x / b) - a * floor(x / b))

Measured memory_bytes: 9248
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
    let d = line;
    let diff = 25 - d;
    let ans = "Christmas";
    
    for (let i = 0; i < diff; i++) {
      ans += " Eve"
    }

    console.log(ans);
});


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll n;
    cin >> n;
    cout << n * (n - 1) / 2 << endl;
}

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


Measured memory_bytes: 3628
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if(a > b){
		fmt.Println("a > b")
	}else if (a < b){
		fmt.Println("a < b")
	}else{
		fmt.Println("a == b")
	}
}


Measured memory_bytes: 1128
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

vector<int> read_vec(int n){
    vector<int> ret(n);
    for (int i = 0; i < n; i++){
        cin >> ret[i];
    }
    return ret;
}

int main() {
    int n, l, sum = 0, min = 1000;
    cin >> n >> l;
    for (int i = 1; i <= n; i++){
        sum = sum + l + i - 1;
    }
    for (int i = 1; i <= n; i++){
        if (abs(l + i - 1) < min){
            min = abs(l + i - 1);
        }
    }
    if (sum >= 0){
        cout << sum - min << endl;
    }else{
        cout << sum + min << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



void solve(){
    ll k,n;
    ll p[200010];
    cin>>n>>k;
    rep(i,n) cin>>p[i];
    double a[200010];
    rep(i,n){
        a[i]=(double)((1+p[i])*p[i])/(double)p[i]/2.0;
    }
    double sum[200010];
    rep(i,n){
        sum[i+1]=sum[i]+a[i];
    }
    double ans=0.0;
    rep(i,n){
        if(i+k>n) break;
        chmax(ans,sum[i+k]-sum[i]);
    }
    cout<<ans<<endl;


}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    
     

    solve(); 


    return 0;
}


Measured memory_bytes: 8468
#include <bits/stdc++.h>
using namespace std;
const int N = 111;
int n, l;
string a[N];

bool cmp(string a, string b) {
    return a + b < b + a;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ljc 998244353 
using namespace std;
ll n,m; 
ll _inv[1010101],fac[1010101],inv[1010101];
inline ll getC(ll n,ll m){
	if (n<m) return 0;
	return fac[n]*_inv[m]%ljc*_inv[n-m]%ljc;
}
inline ll getiC(ll n,ll m){
	if (n<m) return 0;
	return _inv[n]*fac[m]%ljc*fac[n-m]%ljc;
}
signed main(){
	cin>>n>>m;
	if (n<m) swap(n,m);
	fac[0]=inv[0]=inv[1]=_inv[0]=1;
	for (ll i=1;i<=2*n;i++) fac[i]=fac[i-1]*i%ljc;
	for (ll i=2;i<=2*n;i++) inv[i]=(ljc-inv[ljc%i]*(ljc/i)%ljc)%ljc;
	for (ll i=1;i<=2*n;i++) _inv[i]=_inv[i-1]*inv[i]%ljc;
	ll _=0;
	for (int i=1;i<=m;i++){
		_=(_+getC(2*i,i)*getC(n-i+m-i,n-i)%ljc)%ljc;
	}
	_=_*getiC(n+m,m)%ljc*((ljc+1)/2)%ljc;
	cout<<(_+n)%ljc;
	return 0;
}


Measured memory_bytes: 27096
#include <cstdio>
#include <array>
#include <algorithm>

using namespace std;

const int32_t N = 25;
array<int32_t, N> parent, left, right, sibling, degree;

void print_preorder(int32_t id) {
    printf(" %d", id);
    if (left[id] != -1) print_preorder(left[id]);
    if (right[id] != -1) print_preorder(right[id]);
    return;
}

void print_inorder(int32_t id) {
    if (left[id] != -1) print_inorder(left[id]);
    printf(" %d", id);
    if (right[id] != -1) print_inorder(right[id]);
    return;
}

void print_postorder(int32_t id) {
    if (left[id] != -1) print_postorder(left[id]);
    if (right[id] != -1) print_postorder(right[id]);
    printf(" %d", id);
    return;
}

int main() {
    parent.fill(-1);
    left.fill(-1);
    right.fill(-1);
    sibling.fill(-1);
    degree.fill(0);
    int32_t n;

    scanf("%d", &n);
    for (int32_t i = 0; i < n; i++) {
        int32_t id, l, r;
        scanf("%d %d %d", &id, &l, &r);

        if (l != -1) {
            left[id] = l;
            degree[id]++;
            parent[l] = id;
            sibling[l] = r;
        }

        if (r != -1) {
            right[id] = r;
            degree[id]++;
            parent[r] = id;
            sibling[r] = l;
        }
    }

    int32_t id_root = 0;
    while (parent[id_root] != -1) id_root++;

    printf("Preorder\n");
    print_preorder(id_root);
    printf("\n");

    printf("Inorder\n");
    print_inorder(id_root);
    printf("\n");

    printf("Postorder\n");
    print_postorder(id_root);
    printf("\n");

    return 0;
}

Measured memory_bytes: 2760
from collections import deque

N = int(input())
tree = [[] for _ in range(N)]
ans = {}
tmp = []
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    tree[a].append(b)
    tree[b].append(a)
    ans[(a, b)] = 0
    tmp.append((a, b))  # 最後に出力する際に使う, 順番通りに出力する必要があるから。

# print(tree)
visited = [False]*N
colors = [-1]*N  # そのノードに上から刺さっている辺の色 (colors[根のノードのindex]は変わらない)
q = deque([0])  # 始まりのノード
visited[0] = True
while len(q):
    # vは数字, 親のノードのインデックス
    v = q.pop()
    color = 1

    for e in tree[v]:
        if visited[e]:  # 到達済みなら次のノードへ
            continue
        visited[e] = True
        if colors[v] == color:  # 親のノードに刺さっている辺の色が今から塗ろうとしている色と同じなら、変更する
            color += 1
        ans[(v, e)] = color
        colors[e] = color
        color += 1
        q.append(e)

print(max(colors))
for a, b in tmp:
    print(ans[(a, b)])


Measured memory_bytes: 44152
#include<stdio.h>

int main(void)
{
	int i = 0, j = 0, tmp = 0;
	int high[10];

	for(i = 0; i < 10; i++)
	{
		do
		{
			scanf("%d", &high[i]);
		}
		while(10000 < high[i] || high[i] < 0);
	}

	for(i = 0; i < 10; i++)
	{
		for(j = 0; j < 10; j++)
		{
			if(high[i] > high[j])
			{
				tmp = high[i];
				high[i] = high[j];
				high[j] = tmp;
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
  ll n,wt;
  cin>>n>>wt;
  vector<int> w(n),v(n);
  for(int i=0;i<n;i++)
    cin>>w[i]>>v[i];
  vector<vector<ll>> dp(n+1,vector<ll>(1e5+1,1e18));
  dp[0][0]=0;
  for(int i=1;i<=n;i++)
  {
    for(int j=0;j<=1e5;j++)
    {
      dp[i][j]=dp[i-1][j];
      if(j<v[i-1])
        continue;
      dp[i][j]=min(dp[i][j],dp[i-1][j-v[i-1]]+w[i-1]);
    }
  }
  long long ans=0;
  for(int i=1;i<=1e5;i++)
  {
    if(dp[n][i]<=wt)
      ans=i;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 83192
#include <iostream>

using namespace std;

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


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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int[] a = nextInts();
		Arrays.sort(a);
		long ans = 3;
		if(a[0]==a[1]){
			ans--;
		}
		if(a[1]==a[2]){
			ans--;
		}
		System.out.println(ans);

	}

	public static boolean isPalindromicStr(String s) {
		int h = 0;
		int t = s.length() - 1;
		while (h <= t) {
			if (s.charAt(h) != s.charAt(t)) {
				break;
			}
			h++;
			t--;
		}
		if (h > t) {
			return true;
		}
		return false;
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21076
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int d[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int N;
  cin >> N;
  cout << d[N-1] << endl;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  ll a, b; std::cin >> a >> b;
  ll cnt = ( (b-(!(b&1))) - (a+(a&1)) + 1 ) / 2;
  vl vec;
  if (cnt > 0) vec.pb(cnt&1 ? 1 : 0);
  if (a&1) vec.pb(a);
  if (b%2 == 0) vec.pb(b);
  ll ans = 0;
  rep(i, vec.size()) {
    if (i == 0) ans = vec[i];
    else ans ^= vec[i];
  }
  std::cout << ans << "\n";
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll D;
  scanf("%lld",&D);
  cout<<"Christmas";
  for (int i=0; i<25-D; i++) {
    cout<<" Eve";
  }
  cout<<endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  int sum = 0;
  rep(i, n) sum ^= a[i];
  rep(i, n) {
    int ans = sum ^ a[i];
    printf("%d%c", ans, i==n-1?'\n':' ');
  }
}

Measured memory_bytes: 3948
package main

import (
	"fmt"
	"strings"
)

func main() {
	s := map[string]string{}

	for i := 0; i < 3; i++ {
		var input string
		fmt.Scan(&input)
		s[string('A'+rune(i))] = input
	}

	turn := string('A')

	for s[turn] != "" {
		pre := turn
		turn = strings.ToUpper(string(s[turn][0]))

		s[pre] = s[pre][1:]
	}

	fmt.Println(turn)
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define cost first
#define from second.first
#define to second.second
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,i;
	ll a,m[123456],mx[123456],mn[123456],ans=-INFLL;
	priority_queue<ll, vector<ll>, greater<ll> > pqf;
	priority_queue<ll> pql;
	mx[0] = 0ll;
	mx[n] = 0ll;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		pqf.push(a);
		mx[0] += a;
	}
	for(i=0; i<n; ++i){
		cin >> m[i];
	}
	for(i=0; i<n; ++i){
		cin >> a;
		pql.push(a);
		mn[n] += a;
	}
	for(i=0; i<n; ++i){
		mx[i+1] = mx[i];
		if(m[i] > pqf.top()){
			mx[i+1] -= pqf.top();
			pqf.pop();
			mx[i+1] += m[i];
			pqf.push(m[i]);
		}
	}
	for(i=(n-1); i>=0; --i){
		mn[i] = mn[i+1];
		if(m[i] < pql.top()){
			mn[i] -= pql.top();
			pql.pop();
			mn[i] += m[i];
			pql.push(m[i]);
		}
	}
	for(i=0; i<=n; ++i){
		ans = max(ans,mx[i]-mn[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5364
#include<stdio.h>
int gcd(int s,int t){
  if(s<t){
    int w=s;
   	s=t;
    t=w;
  }
  if(s%t!=0)return gcd(t,s%t);
  else return t;
}
int main(void){
int a,b;
  scanf("%d%d",&a,&b);
  int x=gcd(a,b);
  //printf("%d\n",x); 
  long long  ans=(long long)a/x*b;
  printf("%lld",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;


int main(){
  int n; cin >> n;
  string s; cin >> s;
  vi lb(n+1),rw(n+1);
  rep(i,n) {
    if(s[i] == '#') lb[i+1] = lb[i] + 1;
    else lb[i+1] = lb[i];
  }
  rrep(i,n) {
    if(s[i] == '.') rw[i] = rw[i+1] + 1;
    else rw[i] = rw[i+1];
  }

  int ans = 1e9;;
  rep(i,n+1) chmin(ans, lb[i]+rw[i]);
  cout << ans << endl;
}

Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace std;
#define         ll  long long int
#define         ld  double
#define         fast_in_out       ios_base :: sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define         sz    3000



ll vis[sz][sz],n;

ld dp[sz][sz];
ld num[sz];

ld solve()
{
    ll i,j,p;
    ld ans=0.0;
    dp[0][0]=1.0;

    for(i=1;i<=n;i++)
    {
        for(j=0;j<=i;j++)
        {
            if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1.0-num[i]);
            }
            else
            {
                dp[i][j]=dp[i-1][j]*(1.0-num[i])+dp[i-1][j-1]*num[i];
            }
        }
    }
    p=(n+1)/2;

    for(i=p;i<=n;i++)ans+=dp[n][i];

    return ans;

}



int main()
{

    scanf("%lld",&n);

    memset(dp,0,sizeof(dp));
    for(int i=1; i<=n; i++)scanf("%lf",&num[i]);

    ld pp=solve();

    printf("%0.10lf\n",pp);

    return 0;

}




Measured memory_bytes: 71936
#include<iostream>
#include<algorithm>
int main(int argc, char const *argv[]) {
    int N = 0;
    int R[2000000];
    
    std::cin>>N;
    for (int i=0;i<N;++i){
        std::cin>>R[i];
    }
    
     int max = -1000000000;
     int min = 0;
    for(int i = 0;i<N;++i){
        if(i==0){
            min = R[i];
        }else{
            max = std::max(max,R[i]-min);
            min = std::min(min, R[i]);
        }
    }
    std::cout<<max<<std::endl;
    
    return 0;
}

Measured memory_bytes: 3892
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define mod 1000000007

int main () {
    long long n = 0;
    cin >> n;
    char in = 0;
    vector<long long> alph(26);
    for (int i=0; i<n; i++) {
        cin >> in;
        alph.at(in-'a')++;
    }
    long long ans = 1;
    for (long long x : alph) {
        ans *= (x + 1);
        ans %= mod;
    }
    ans--;
    cout << ans << endl;
    return 0;
}


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

using namespace std;
 
#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair
 
#define debug(_x)		cerr << #_x << '=' << (_x) << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << (_x) << ' ' << #_y << '=' << (_y) << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << (_x+1) << ' '; cerr << endl;

#define HERE debug(__LINE__);

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;

#define pow5(x) ((x)*(x)*(x)*(x)*(x))

int32_t main() {
	FAST_IO;
	
	int n;
	cin >> n;
	
	int a[n];
	for (int& x: a) cin >> x;
	
	int p[n];
	for (int i = 0; i < n; i++) {
		p[i] = a[i]+i;
	}
	
	int q[n];
	for (int j = 0; j < n; j++) {
		q[j] = j-a[j];
	}
	
	map<int, int> cnt;
	for (int i = 0; i < n; i++)
		cnt[q[i]]++;
	
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += cnt[p[i]];
	}
	
	cout << ans << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined


Measured memory_bytes: 31048
#include<iostream>

using namespace std;

int main() {
    long long n[50], p;

	n[0] = 1; 
    n[1] = 1; 
    n[2] = 2;

	for (int i = 3; i < 40; i++) {
		n[i] = n[i - 1] + n[i - 2] + n[i - 3];
	}

	while (1) {
		cin >> p;
		if (p == 0){
            break; 
        }
        
		cout << (n[p] + 3649) / 3650 << endl;
	}
}



Measured memory_bytes: 3072
S = input()
T = input()

def f(S):
    idx = []
    dic = []
    for s in S:
        if s in dic:
            idx.append(dic.index(s))
        else:
            idx.append(len(dic))
            dic.append(s)
    
    return idx

s_idx = f(S)
t_idx = f(T)
for i in range(len(S)):
    if s_idx[i] != t_idx[i]:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 6832
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	scanner := NewScanner()
	n, m := scanner.NextInt(), scanner.NextInt()
	edges := make(map[int]map[int]bool)
	for i := 0; i < m; i++ {
		a, b := scanner.NextInt(), scanner.NextInt()
		if e, ok := edges[a]; ok {
			e[b] = true
		} else {
			edges[a] = map[int]bool{b: true}
		}
		if e, ok := edges[b]; ok {
			e[a] = true
		} else {
			edges[b] = map[int]bool{a: true}
		}
	}
	rs := make([]int, n+1)
	q := []int{1}
	for len(q) > 0 {
		i := q[0]
		for k := range edges[i] {
			if rs[k] == 0 {
				rs[k] = i
				q = append(q, k)
			}
		}
		q = q[1:]
	}
	fmt.Println("Yes")
	for i := 2; i < len(rs); i++ {
		fmt.Println(rs[i])
	}
}

type Scanner struct {
	scanner *bufio.Scanner
}

func NewScanner() *Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &Scanner{s}
}

func (s *Scanner) NextWord() string {
	if !s.scanner.Scan() {
		log.Fatal("failed to find the next word")
	}
	return s.scanner.Text()
}

func (s *Scanner) NextInt() int {
	str := s.NextWord()
	i, err := strconv.Atoi(str)
	if err != nil {
		log.Fatalf("failed to parse %s to int", str)
	}
	return i
}


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

int D,M,d,q;
int c[30];
int s[400][30];
int type[400];
int last[29];
ll satis_level[400];

ll calc_score(){
  rep(i,0,400) satis_level[i] = 0;
  rep(j,1,27) last[j]=0;
  ll down_satis;
  rep(i,1,D+1){
    down_satis=0;
    last[type[i]] = i;
    satis_level[i] += s[i][type[i]];
    rep(j,1,27) down_satis += c[j]*(i-last[j]);
    satis_level[i] -= down_satis;
    satis_level[i+1] += satis_level[i];
  }
  return satis_level[D];
}

int main(){
  map<int,int, std::greater<int>> mp;
  cin >> D;
  rep(i,1,27){
    cin >> c[i];
    mp[c[i]]=i;
  }
  rep(i,1,D+1){
    rep(j,1,27){
      cin >> s[i][j];
    }
  }
  
  int j=1;
  for(auto i=mp.begin();j<=D;++i,j++) {
    type[j] = mp[i->first];
  }
  
  ll pre_score,new_score;
  int d,q,pq;
  pre_score = calc_score();
  random_device rnd; 
  mt19937 mt(rnd());
  uniform_int_distribution<> rand_d(1,D); 
  uniform_int_distribution<> rand_q(1,26); 
  rep(i,1,10000){
    d = rand_d(mt);
    q = rand_q(mt);
    pq = type[d];
    type[d] = q;
    new_score = calc_score();
    if(pre_score > new_score) type[d] = pq;
    else pre_score = new_score;
    //cout << pre_score << '\n';
  }
  
  rep(i,1,D+1) cout << type[i] << '\n';
  return 0;
}

Measured memory_bytes: 3676
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = factorization(n)

ans = 0
for i in range(len(a)):
    e = a[i][1]
    j = 1
    while e - j >= 0:
        e -= j
        j += 1
        ans += 1

if n == 1:
    print(0)
else:
    print(ans)


Measured memory_bytes: 63416
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
using namespace std;

//long long A[100000];
//int stand_bit_num[40];

//int t[1000000];
//long long d[100000];

int x[100];
int y[100];

int main(){
   string S;
   cin >> S;
   
   long long ans = 0;
   for(int bit_set = 0; bit_set < (1 << (S.size() - 1)); bit_set++){
       int last_start = 0;
       for(int i = 0; i < S.size() - 1; i++){
           if(((bit_set >> i) & 1) == 1){
               ans += atoll(S.substr(last_start, i + 1 - last_start).c_str());
               last_start = i + 1;
           }
           //cout << ans << endl;
       }
        ans += atoll(S.substr(last_start, S.size() - last_start).c_str());

   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
void output(int H[3][10]){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            printf(" %d",H[i][j]);
        }
        printf("\n");
    }
}
 
 
int main(){
    int H1[3][10],H2[3][10],H3[3][10],H4[3][10],n,h_num,f_num,r_num,div_num;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            H1[i][j] = H2[i][j] = H3[i][j] = H4[i][j] = 0;
        }
    }
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d %d %d %d",&h_num,&f_num,&r_num,&div_num);
        switch(h_num){
        case 1:
            H1[f_num-1][r_num-1] += div_num;
            break;
        case 2:
            H2[f_num-1][r_num-1] += div_num;
            break;
        case 3:
            H3[f_num-1][r_num-1] += div_num;
            break;
        case 4:
            H4[f_num-1][r_num-1] += div_num;
            break;
        }
    }
 
    output(H1);
    printf("####################\n");
    output(H2);
    printf("####################\n");
    output(H3);
    printf("####################\n");
    output(H4);
 
}


Measured memory_bytes: 2672
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashSet, BTreeSet, BinaryHeap, HashMap};
#[allow(unused_imports)]
use std::io::{stdin, stdout, Write, BufReader, BufWriter};
#[allow(unused_imports)]
use std::io::prelude::BufRead;


fn main() {
    let mut heights = vec![vec![vec![std::i64::MAX]; 101]; 101];
    let n = read::<usize>();
    for _ in 0..n {
        let vec = read_vector::<i64>();
        let (x, y, h) = (vec[0], vec[1], vec[2]);
        for i in 0..101 {
            for j in 0..101 {
                if heights[i][j][0] == -1 {
                    continue;
                }
                let height = h + (i as i64 - x).abs() + (j as i64 - y).abs();
                if h == 0 {
                    heights[i][j].push(height);
                } else if heights[i][j][0] == std::i64::MAX {
                    heights[i][j][0] = height;
                } else if heights[i][j][0] != height {
                    heights[i][j][0] = -1;
                }
            }
        }
    }

    let mut cand = vec![];
    for i in 0..101 {
        for j in 0..101 {
            if heights[i][j][0] != -1 {
                cand.push((i, j));
            }
        }
    }

    if cand.len() == 1 {
        let (i, j) = (cand[0].0, cand[0].1);
        println!("{} {} {}", i, j, heights[i][j][0]);
        return;
    }

    for &(i, j) in cand.iter() {
        for k in 1..heights[i][j].len() {
            if k == 1 && heights[i][j][0] == std::i64::MAX {
                heights[i][j][0] = heights[i][j][1];
            } else if heights[i][j][0] > heights[i][j][k] {
                heights[i][j][0] = -1;
            }
        }
    }

    for i in 0..101 {
        for j in 0..101 {
            if heights[i][j][0] != -1 {
                println!("{} {} {}", i, j, heights[i][j][0]);
                return;
            }
        }
    }
}

#[allow(dead_code)]
fn read<T>() -> T where T: std::str::FromStr, T::Err: std::fmt::Debug {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf
        .trim()
        .parse()
        .unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    let mut buf = String::with_capacity(100);
    stdin().read_line(&mut buf).unwrap();
    return buf
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    use std::io::prelude::*;
    let stdin = stdin();
    let mut reader = BufReader::with_capacity(100 * 1024, stdin);
    let mut line = String::with_capacity(100);
    let mut matrix: Vec<Vec<T>> = Vec::new();

    while reader.read_line(&mut line).unwrap() > 0 {
        matrix.push(line
            .trim()
            .split_whitespace()
            .map(|s| s.parse().unwrap())
            .collect());
        line.clear();
    }

    return matrix;
}

Measured memory_bytes: 14588
l1 = input().split()
l2 = input().split()
l3 = input().split()
n = int(input())
b = [input() for _ in range(n)]
if l1[0] in b and l1[1] in b and l1[2] in b:
    print('Yes')
elif l2[0] in b and l2[1] in b and l2[2] in b:
    print('Yes')
elif l3[0] in b and l3[1] in b and l3[2] in b:
    print('Yes')
elif l1[0] in b and l2[0] in b and l3[0] in b:
    print('Yes')
elif l1[1] in b and l2[1] in b and l3[1] in b:
    print('Yes')
elif l1[2] in b and l2[2] in b and l3[2] in b:
    print('Yes')
elif l1[0] in b and l2[1] in b and l3[2] in b:
    print('Yes')
elif l1[2] in b and l2[1] in b and l3[0] in b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

int main(void) {
    li N;
    cin >> N;
    li L[2 * N];
    FOR(i, 0, 2 * N) {
        cin >> L[i];
    }

    sort(L, L + 2 * N);

    li ans = 0;
    FOR(i, 0, N) {
        ans += L[2 * i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{  
    ll a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==a[1]&&a[1]!=a[2])
    {
        cout<<"Yes\n";
        return;
    }
    if(a[0]!=a[1]&&a[1]==a[2])
    {
        cout<<"Yes\n";
        return;
    }
    cout<<"No\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;

int main(){
	long long N; cin >> N;
	string S; cin >> S;
	long long ans = 1, cnt = 1;
	long long p = 1;
	for(int i=1; i<=N; i++) p = (p * i) % mod;
	if(S[0] == 'W' || S[2*N-1] == 'W'){
		cout << 0 << endl;
	}else{
		for(int i=1; i<2*N-1; i++){
			if(cnt % 2 == 0 && S[i] == 'W'){
				ans = (ans * cnt) % mod;
				cnt--;
			}else if(cnt % 2 == 0 && S[i] == 'B'){
				cnt++;
			}else if(cnt % 2 == 1 && S[i] == 'W'){
				cnt++;
			}else if(cnt % 2 == 1 && S[i] == 'B'){
				ans = (ans * cnt) % mod;
				cnt--;
			}
		}
		if(cnt == 1){
			cout << ans * p % mod<< endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int n,k,c; cin >> n >> k >> c;
    string s; cin >> s;
    int now = 0;
    int cnt = 0;
    vector<bool> ok(n,false);
    while(now < n){
        if(s[now] == 'o'){
            ok[now] = true;
            cnt++;
            now += c+1;
        }
        else now++;
    }
    if(cnt == k){
        int last = n-1;
        int now = 1;
        vector<int> v(2*n);
        for(int i = n-1; i >= 0; i--){
            if(s[i] == 'x'){
                if(i != n-1) v[i] = v[i+1];
            }
            else if(i <= last-c-1){
                last = i;
                now++;
                v[i] = now;
            }
            else{
                v[i] = now;
            }
        }
        //rep(i,n) cout << v[i] << " ";
        vector<int> ans;
        int cnt = 0;
        int last2 = -1;
        rep(i,n){
            if(s[i] == 'x') continue;
            int nowans = cnt+(last2 == -1?v[i+1]:v[max(i+1,last2+c+1)]);
            if(nowans < k) ans.push_back(i+1);
            if(ok[i]){
                cnt++;
                last2 = i;
            }
        }
        rep(i,ans.size()) cout << ans[i] << endl;
    }
}



Measured memory_bytes: 6112
n,k=map(int,input().split())
'''
隣り合うボールは同じ色になってはいけない
= 隣り合わなければ同じでもよい

1番目の色はk通り
2番目の色はk-1通りだが
3番目の色もk-1通りとなる(1番目の色がまた使えるので)
'''
print(k*(k-1)**(n-1))


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int x;
  cin >> x;
  cout << 10 - x / 200;
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion



int main() {
	int n; put n;
	int x; put x;
	vi ans; ans.resize(2 * n - 1);
	if (n == 2) {
		if (x == 2) {
			putans("Yes");
			putans(1);
			putans(2);
			putans(3);
		}
		else {
			putans("No");
		}
		goto END;
	}
	if (x == 1 || x ==  2 * n-1) {
		putans("No");
		goto END;
	}
	else {
		vi pusher;
		rep(i, 2*n-1) {
			if(!(i == 0 || i == x-1 || i == 2*n-2))
			pusher.push_back(i + 1);
		}
		fill(all(ans), -1);//void;
		ans[n-1-1] = 2 * n - 1;
		ans[n+1-1] = 1;
		ans[n-1] = x;
		int j = 0;
		rep(i, 2*n-1) {
			if (ans[i] == -1) {
				ans[i] = pusher[j];
				j++;
			}
		}
		putans("Yes");
		rep(i, 2*n-1) {
			putans(ans[i]);
		}
	}
END:
	return 0;
}


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

int n, d;
vector<int> v[100];
int sum[100], ssum[100];

int main(){
	while(true){
		cin >> n >> d;
		if(n == 0 && d == 0) break;
		rep(i,100) v[i].clear();
		rep(i,100) sum[i] = 0;
		int M1 = 0, M2 = 0;
		rep(i,n){
			int m;
			cin >> m;
			rep(j,m){
				int tmp; cin >> tmp;
				v[i].push_back(tmp);
				sum[i] += tmp;
			}
		}
		if(n == 1){
			puts("Yes");
			continue;
		}
		rep(i,n) ssum[i] = sum[i];
		sort(ssum,ssum+n,greater<int>());
		M1 = ssum[0]; M2 = ssum[1];
		bool ok = true;
		while(true){
			bool end = true;
			rep(i,n){
				while(v[i].size() > 0 && sum[i]-v[i][v[i].size()-1] >= M1-d){
					sum[i] -= v[i][v[i].size()-1];
					v[i].pop_back();
					end = false;
				}
			}
			rep(i,n) ssum[i] = sum[i];
			sort(ssum,ssum+n,greater<int>());
			M1 = ssum[0]; M2 = ssum[1];
			if(M1 != M2){
				rep(i,n){
					if(sum[i] == M1){
						if(sum[i]-v[i][v[i].size()-1] >= M2-d){
							sum[i] -= v[i][v[i].size()-1];
							v[i].pop_back();
							end = false;
							M1 = max(M2,sum[i]);
							break;
						}
					}
				}
			}
			if(end) break;
		}
		rep(i,n) if(v[i].size() != 0) ok = false;
		if(ok) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
int main(){
    char a[100][101],b[102][102];
    int h,w;
    cin >> h >> w;
    for(int i=0;i<h;i++){
        cin >> a[i];
    }
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            b[i][j] = '#';
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            b[i + 1][j + 1] = a[i][j];
        }
    }
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            cout << b[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToList();

            var b = new List<int>();
            var l = a.Count % 2 == 0;
            for (var i = 0; i < n; i++)
            {
                if ((i % 2 == 0 && l) || (i % 2 == 1 && !l))
                    b.Add(a[i]);
                else
                    b.Insert(0, a[i]);
            }

            Console.WriteLine(string.Join(' ', b));
        }
    }
}


Measured memory_bytes: 63616
n, k = map(int, input().split())
remain = n % k
def f(x):
    if x == 0:
        return n // k
    return n // k + int(x <= remain)
ret = 0
for a in range(k):
    if (-2 * a) % k == 0:
        ret += f(a) * f(k-a) * f(k-a)
print(ret)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main() {
	string a,b,c;
	cin>>a>>b>>c;
	if (a.back()==b[0]&&b.back()==c[0])
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a <= 0 && b >= 0) printf("Zero\n");
	else if(b < 0 && (b - a) % 2 == 0) printf("Negative\n");
	else printf("Positive\n");
	return 0;
}


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

int main() {

	int N, M, K;
	cin >> N >> M >> K;
	vector<ll> A(200001,0);
	vector<ll> B(200001,0);
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= M; i++) cin >> B[i];
	ll cB = accumulate(B.begin(), B.end(), 0LL);
//	cout << cB << endl;
	int j = M;
	ll cA = 0;
	int ans = 0;
	for(int i = 0; i <= N; i++){
		cA += A[i];
		if (cA > K) break;
		while (cA + cB > K) {
			cB -= B[j];
			j--;
		}
		if (cA + cB <= K) {
			ans = max(ans, i + j);
//			cout << i << "," << j << endl;
		}
	}
	cout << ans << endl;
	return(0);
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) ( ((x)&1)==0?0:1 )
#define SIGN(x) ( ((x) > 0) - ((x) < 0)  )
#define dbg(x) cerr << #x"= " << x << endl

std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    int k,a,b;cin>>k>>a>>b;
    int kk=k;
    while(kk<a) kk += k;
    if (kk<=b) cout << "OK";
    else cout << "NG";
}



Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    int n,q;
    cin >> n;
    long long int total = 0;
    std::vector<int> a;
    std::map<int,int> mp;
    std::map<int,int> sum;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
        mp[tmp]++;
        total += tmp;
        
    }
    /*
    
    for(int i=0; i<n; i++){
        sum[i] = i*mp[i];
        total += sum[i];
    }
    */
    //cout << total << endl;
   
    cin >> q;
    std::vector<int> b,c;
    for(int i=0; i<q; i++){
        int tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        b.push_back(tmp1);
        c.push_back(tmp2);
    }
    
    std::map<int,int>::iterator itr;
    for(int i=0; i<q; i++){
        long long int diff = c[i] - b[i];
        
        long long int tmp = 0;
        long long int cnt = mp[b[i]];
        mp[c[i]] += cnt;
        
        /*
        sum[b[i]] = 0;
        sum[b[i]] = 0;
        */
        total = total + diff*mp[b[i]];
        mp[b[i]] = 0;
        cout << total << endl;
    }
    
}

Measured memory_bytes: 8912