akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int s, w;

void solve()
{
    cin >> s >> w;
    if(s<=w)
        puts("unsafe");
    else
        puts("safe");
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int isprime(int n){
  int i;
  for(i = 2; i * i <= n; i++){
  if(n % i == 0) return 0;
  }
  return 1;
}

int main(void){
  int n, p1, q1;
  while(1){
    scanf("%d", &n);
    if(n == 0) break;
    while(1){
      if(isprime(n) == 1){
        if(isprime(n - 2) == 1){
          p1 = n - 2;
          q1 = n;
          break;
        }else n--;
      }else n--;
    }
    printf("%d %d\n", p1, q1);
  }
  return 0;
}

Measured memory_bytes: 600
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , sum;
pll p[MAXN];

int main() {
    fast_io;

    cin >> n;
    for(ll i = 0 ; i < n ; i++) cin >> p[i].Y >> p[i].X;
    sort(p , p + n);

    for(ll i = 0 ; i < n ; i++){
        sum += p[i].Y;
        if(sum > p[i].X)    return cout << "No" << endl , 0;
    }
    cout << "Yes" << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 4352
#include <stdio.h>
int main(){
	int n,m;
	bool a[20000];
	scanf("%d",&n);
	for(int i=1;i<20000;i++)a[i]=false;
	a[0]=true;
	for(int i=0;i<n;i++){
		scanf("%d",&m);
		for(int j=2000-m;j>=0;j--)if(a[j])a[j+m]=true;
	}
	scanf("%d",&m);
	for(int i=0;i<m;i++){
		scanf("%d",&n);
		if(a[n])printf("yes\n");
		else printf("no\n");
	}
}

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

int main()
{
    while(1){
    char s;
    scanf("%c" , &s);
    if(s <= 'Z' && s >= 'A'){
            s = (char)(s - ('A' - 'a'));
    }
    else if(s <= 'z' && s >= 'a'){
            s = (char)(s + ('A' -'a')); 
   }
    cout << s;
    if(s == '\n') break;
    }
    
    
return 0;
}


Measured memory_bytes: 3120
// -_-
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for(int i = a; i <= b; i++)
#define ford(i, a, b) for(int i = a; i >= b; i--)
#define mod 1000000007
#define int long long
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<long long , long long> pll;
vector < vector <pii> > adj;
vector <int> flag;
vector <int> a;
int mn;

void dfs (int cur)
{
	flag[cur] = 1;
	for(pii i : adj[cur])
	{
		if(flag[i.fi] == 0)
		{
			a[i.fi] = a[cur] + i.se;
			dfs(i.fi);
		}
		else 
		{
			if(a[i.fi] != a[cur] + i.se)
			{
				cout << "No";
				exit(0);
			}
		}
	}

}
 
signed main() 
{

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

    int n, m, l, r, d;
    cin >> n >> m;

    adj.resize(n+1);
    flag.rz(n+1, 0);
    a.rz(n+1, 0);


    if(m == 0) {cout << "Yes"; return 0;}

    fori(i, 0, m-1)
    {
    	cin >> l >> r >> d;
    	adj[l].pb({r, d});
    	adj[r].pb({l, -d});
    }
    fori(i, 1, n)
    {
    	if(flag[i] == 0) dfs(i);
    }
    cout << "Yes";

	return 0;
}

Measured memory_bytes: 16384
#include<stdio.h>
int main(void)
{
	int n,k,cnt;
	scanf("%d %d",&n,&k);
	cnt=0;
	while(1){
		n=n/k;
		cnt++;
		if(n<=0){
			break;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1680
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

bool Prime[int(1e5 + 5)];
int Sum[int(1e5 + 5)], Q, L, R;

int main(){
  Prime[2] = true;
  for (int i = 3; i < 1e5 + 5; i++){
    Sum[i] = Sum[i - 1];
    if (i % 2 == 0) continue;

    Prime[i] = true;
    for (int j = 2; j * j <= i; j++){
      if (i % j == 0) Prime[i] = false;
    }
    
    if (Prime[i] && Prime[(i + 1) / 2]) Sum[i]++;
  }

  scanf("%d", &Q);
  for (int i = 0; i < Q; i++){
    scanf("%d%d", &L, &R);
    cout << Sum[R] - Sum[L - 1] << endl;
  }
  

  return 0;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

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

    vector<int> d(N);

    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        ++d[a - 1];
        ++d[b - 1];
    }

    bool ans = all_of(d.begin(), d.end(), [](int x) { return x % 2 == 0; });
    cout << (ans ? "YES" : "NO") << "\n";
    return 0;
}


Measured memory_bytes: 640
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}


int main(void) {
	int a, b, k;
	cin >> k >> a >> b;
	for (int i = a; i <= b; ++i) {
		if (i % k == 0) {
			cout << "OK";
			return 0;
		}
	}
	cout << "NG";
}

/*

*/


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

int main(){
  string N;
  cin >> N;
  if((N[0]==N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
int main()
{
    int a[100005];
    int n,L;
    scanf("%d%d",&n,&L);
    int sum=0;
    for(int i=1;i<=n;i++)
	{
		a[i]=L+i-1;
		sum+=a[i];
	}
	int sums=sum;
	int ans;
	int cha=0x3f3f3f3f;
	for(int i=1;i<=n;i++)
	{
		sums=sum;
		sums-=a[i];
		if(abs(sums-sum)<cha)
		{
			ans=sums;
			cha=abs(sums-sum);
		}
	}
	cout<<ans<<endl;
	return 0;

}


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

#define abs(a) (a) < 0 ? (-(a)) : (a)

int main () {
	int X, N;
	scanf("%d", &X);
	scanf("%d", &N);
	int *p = malloc((1 + N) * sizeof(int));
	int dup = 0;
	int min = 100;
	int max = 0;
	for (int i = 1; i <= N; i++) {
		scanf("%d", &p[i]);
		if (p[i] < min)
			min = p[i];
		if (p[i] > max)
			max = p[i];
		if (X == p[i])
			dup = 1;
	}
	if (dup == 0) {
		printf("%d\n", X);
		return 0;
	}

	int i = 1;
	int ans;
	for (;;) {
		if (X - i < min) {
			ans = X - i;
			break;
		} else {
			int found = 0;
			for (int j = 1; j <= N; j++) {
				if ((X - i) == p[j])
					found = 1;
			}
			if (found == 0) {
				ans = X - i;
				break;
			}
		}

		if (X + i > max) {
			ans = X + i;
			break;
		} else {
			int found = 0;
			for (int j = 1; j <= N; j++) {
				if ((X + i) == p[j])
					found = 1;
			}
			if (found == 0) {
				ans = X + i;
				break;
			}
		}
		i++;
	}

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1728
fun main(arg: Array<String>) {
    val (A, B, C, D) = next().map { it - '0' }
    fun sign(a: Int) = if (a < 0) '-' else '+'
    for (bit in 0 until 1.shl(3)) {
        val b = if (bit.shr(0).and(1) == 1) -B else B
        val c = if (bit.shr(1).and(1) == 1) -C else C
        val d = if (bit.shr(2).and(1) == 1) -D else D
        if (A + b + c + d == 7) {
            return println("$A${sign(b)}$B${sign(c)}$C${sign(d)}$D=7")
        }
    }
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(d: Int = 0) = listOfString().map { Integer.parseInt(it) + d }
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 33700
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
bool in_range(int x, int r){
  return (x >= 0 && x < r);
}

void dfs(vector< vector<long long int> > &B, long long int c, int x, int y){
  int w = B.size(), h = B[0].size();
  B[x][y] = -1;
  for(int i = 0; i < 4; ++i){
    int x_ = x + dx[i], y_ = y + dy[i];
    if(in_range(x_,w) && in_range(y_,h) && B[x_][y_] == c){
      dfs(B,c,x_,y_);
    }
  }
}

int main(){
  int n;
  while(cin >> n, n){
    set<int> X, Y;
    vector<int> L(n), T(n), R(n), B(n);
    for(int i = 0; i < n; ++i){
      cin >> L[i] >> T[i] >> R[i] >> B[i];
      X.insert(L[i]);
      X.insert(R[i]);
      Y.insert(T[i]);
      Y.insert(B[i]);
    }
    X.insert(-1);
    X.insert(10000000);
    Y.insert(-1);
    Y.insert(10000000);
    map<int,int> M_x, M_y;
    int id = 0;
    for(auto itr = X.begin(); itr != X.end(); ++itr){
      M_x[*itr] = id;
      ++id;
    }
    id = 0;
    for(auto itr = Y.begin(); itr != Y.end(); ++itr){
      M_y[*itr] = id;
      ++id;
    }
    
    int w = X.size(), h = Y.size();
    vector< vector<long long int> > G(w, vector<long long int>(h,0));
    
    for(int i = 0; i < n; ++i){
      int l = L[i], t = T[i], r = R[i], b = B[i];
      for(int j = M_x[l]; j < M_x[r]; ++j)
        for(int k = M_y[b]; k < M_y[t]; ++k)
          G[j][k] |= (1LL<<i);
    }
    /*
    for(int i = h-1; i >= 0; --i){
      for(int j = 0; j < w; ++j){
        cout << G[j][i] << " | ";
      }cout << endl;
    }
    */
    long long int ans = 0;
    for(int i = 0; i < w; ++i){
      for(int j = 0; j < h; ++j){
        if(G[i][j] != -1){
          ++ans;
          dfs(G,G[i][j],i,j);
        }
      }
    }

    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3972
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define rep1(i, N) for (int i = 1; i <= N; i++)

typedef long long ll;
const ll MOD = 1e9 + 7;

int digit(ll n) {
    int ans = 0;
    while (n > 0) {
        ans++;
        n /= 2;
    }
    return ans;
}

ll cxor(ll n) {// n までの xor の総和
    if (n %4 == 0) return n;
    else if (n %4 == 1) return 1;
    else if (n %4 == 2) return n + 1;
    else return 0;
}

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

    ll ans;
    if (A == 0) ans = cxor(B);
    else ans = cxor(A - 1)^cxor(B);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let n : i64  = read();
    let k : i64 = read();
    let x :i64 = read();
    let y: i64 = read();
    let ans = if n <= k { 
        n * x 
    } else {
        (n - k)*y + k * x
    };
    println!("{}", ans);
}

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

int main(void) {
    char str[16];
    char output[16];
    int i,j,fin = 0;

    fgets(str, 16, stdin);
    for(i=0,j=0;;i++){
        switch(str[i]) {
        case '0':
        case '1':
            output[j++] = str[i];
            break;
        case 'B':
            if(j != 0) {
                output[--j] = '\0';
            }
            break;
        default:
            fin = 1;
            break;
        }

        if(fin) break;
    }
    
    output[j] = '\0';
    printf("%s\n", output);

    return 0;
}

Measured memory_bytes: 128
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
A,B,C,D=map(int,input().split())
aoki=C
takahashi=A
while True:
    aoki = aoki-B
    if aoki<=0:
        print("Yes")
        exit(0)
    takahashi= takahashi-D
    if takahashi<=0:
        print("No")
        exit(0)


Measured memory_bytes: 27052
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//const ll mod=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
ll dp[2005][2005],sum[2005][2005];
int main(){
    int n,m;
    cin>>n>>m;
    V<int> a(n+1,0),b(m+1,0);
    dp[0][0]=1;
    for(int i=0;i<n;i++)cin>>a[i+1];
    for(int i=0;i<m;i++)cin>>b[i+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i!=0&&j!=0&&a[i]==b[j]){
                 (dp[i+1][j+1]+=(dp[i][j]+sum[i][j])%mod)%=mod;
            }
            (dp[i+1][j]+=dp[i][j])%=mod;
            (sum[i][j+1]+=(sum[i][j]+dp[i][j])%mod)%=mod;
        }
        (dp[i+1][m+1]+=dp[i][m+1])%=mod;
    }
    ll ans=0;
for(int i=0;i<=m+1;i++)(ans+=dp[n+1][i])%=mod;
cout<<ans<<endl;
}

Measured memory_bytes: 63104
#include<stdio.h>

int main() {
  int temp;
  int x,y,z;
  scanf("%d %d %d",&x,&y,&z);
  temp = x;
  x = y;
  y = temp;
  temp = x;
  x = z;
  z = temp;
  printf("%d %d %d\n",x,y,z);

  return 0;
}


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

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long


	
void solve(){
	int n;
	cin >> n;
	string s;
	map<string, int> mp;
	for(int i = 0 ; i < n ; i++){
		cin >> s;
		mp[s]++;	
	}
	cout << "AC x " << mp["AC"] << "\n";
	cout << "WA x " << mp["WA"] << "\n";
	cout << "TLE x " << mp["TLE"] << "\n";
	cout << "RE x " << mp["RE"] << "\n";
}

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3668
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = nint();
        int[] A = nints(N);
        int[] max = new int[N];
        final int INF = Integer.MAX_VALUE;
        Arrays.fill(max, 0, N, -INF);
        
        int ans = 0;
        int l = N;
        
        for (int i = 0; i < N; i++) {
            int bound = lowerBound(max, A[i]);
            if (bound == l) {
                ans++;
                l--;
            }
            max[bound-1] = A[i];
        }
        System.out.println(ans);
    }

    //探索したいkey以上で最小のindexを返す。
    public static int lowerBound(int[] a, int obj) {
        int l = 0, r = a.length - 1;
        while (r - l >= 0) {
            int c = (l + r) / 2;
            if (obj <= a[c]) {
                r = c - 1;
            } else {
                l = c + 1;
            }
        }
        return l;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0);
    }

    private static char[][] nchars2(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 50556
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)2e5 + 5;

int arr[MAXN];

bool u[MAXN];

int n, x;

void solve() {                                               
	scanf("%d %d", &n, &x);	             

	if (x == n) {
		printf("Yes\n");

		for (int i = 1; i <= 2 * n - 1; ++i) {
			printf("%d\n", i);
		}

		return;
	}	      
	
	// 4 7 1 2 6 3 5
	//   4 2 2 3

	if (x > 1 && x < n * 2 - 1) {
		arr[n] = x;
		u[x] = 1;

		int pa = n - 2, pb = n - 1;

		if (x == 2) {
			swap(pa, pb);
		}

        for (int i = 0, ptr = 1; i < 2; ++i) {
        	while (u[ptr]) {
        		++ptr;
        	}

        	arr[pa + i * 3] = ptr;
        	u[ptr++] = 1;
        }

        for (int i = 0, ptr = n * 2 - 1; i < 2; ++i) {
        	while (u[ptr]) {
        		--ptr;
        	}

        	arr[pb + i * 3] = ptr;
        	u[ptr--] = 1;
        }       
		
		for (int i = 1, ptr = 1; i <= n * 2 - 1; ++i) {
			if (arr[i]) {
				continue;
			}

			while (u[ptr]) {
				++ptr;
			}

			arr[i] = ptr;
			u[ptr++] = 1;
		}

		printf("Yes\n");

		for (int i = 1; i <= n * 2 - 1; ++i) {
			printf("%d\n", arr[i]);
		}

		return;
	}	       

	printf("No\n");	
}

int main() {    
    int tt = 1;

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

    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, Q, q, s, t, x;
    cin >> n >> Q;
    list<int> v[n];

    rep(i, Q) {
        cin >> q;
        if(q == 0) {
            cin >> t >> x;
            v[t].push_back(x);
        } else if(q == 1) {
            cin >> t;
            vecout(v[t]);
        } else {
            cin >> s >> t;
            v[t].splice(v[t].end(), v[s]);
        }
    }
}



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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main() {
    int N, M;
    cin >> N >> M;
    vector<int> p(N);
    rep(i, N) cin >> p[i], p[i]--;
    UnionFind uf(N);

    rep(i, M) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        uf.unite(x, y);
    }

    int ans = 0;
    rep(i, N) {
        if (uf.same(i, p[i]))ans++;
    }

    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a,b,x;
  cin>>a>>b>>x;
  if(a<=x&&a+b>=x){out("YES");}
  else out("NO");


  return 0;
}


Measured memory_bytes: 256
n = int(input())
friend = list(map(int, input().split()))

friend.sort(reverse = True)

ans = friend[0]
i = 1
ind = 1
while i < n - 1:
    for j in range(2):
        ans += friend[ind]
        i += 1
        if i == n-1: break
    ind += 1
print(ans)

Measured memory_bytes: 94056
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000000;
int main(){
  cout << fixed << setprecision(6);
  int N, K, T, U, V, L;
  cin >> N >> K >> T >> U >> V >> L;
  vector<int> D(N);
  for (int i = 0; i < N; i++){
    cin >> D[i];
  }
  vector<bool> d(L, false);
  for (int i = 0; i < N; i++){
    d[D[i]] = true;
  }
  vector<int> speed(L, U);
  int last = - INF;
  int cnt = 0;
  for (int i = 0; i < L; i++){
    if (d[i]){
      if (cnt < K){
        cnt++;
      } else {
        last = i;
        for (int j = i; j < min(i + T * V, L); j++){
          speed[j] = V;
        }
      }
    }
    if (i >= last + T * V){
      if (cnt > 0){
        cnt--;
        for (int j = i; j < min(i + T * V, L); j++){
          speed[j] = V;
        }
        last = i;
      }
    }
  }
  double ans = 0;
  for (int i = 0; i < L; i++){
    ans += (double) 1 / speed[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
const long long MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main () {

    int n,m;cin>>n>>m;
    int p[100010];
    rep(i,n) {
        cin>>p[i];
        p[i]--;
    }

    UnionFind tree(n);
    rep(i,m) {
        int a,b;cin>>a>>b;
        a--;b--;
        tree.unite(a,b);
    }
    
    int ans=0;
    rep(i,n) {
        if (tree.same(p[i],i)) {
            ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import math
mod = 10**9+7
def inv(x):
	return pow(x,mod-2,mod)


MAX = 10**5*3
facts = [1 for i in range(MAX)]
invs = [1 for i in range(MAX)]


def factorial(x):
	for i in range(1,x):
		facts[i] = (facts[i-1] * i)% mod
		invs[i] = inv(facts[i])

factorial(MAX)
def nCr(n,r):
	return facts[n]*invs[r] * invs[n-r] % mod

h,w,th,ty = map(int,raw_input().split())

ans = 0

for i in range(ty+1,w+1):
	
	ans += (nCr(h-th-1 + i-1,i-1)%mod * nCr(th-1 + w-i,w-i)%mod)%mod

print ans%mod

Measured memory_bytes: 31532
//    .------------------------------------------------------------.
//    |     ___   ___   _____     _     ___   ___    ___   ___     |
//    |    | _ \ | __| |_   _|   /_\   | _ \ |   \  | __| |   \    |
//    |    |   / | _|    | |    / _ \  |   / | |) | | _|  | |) |   |
//    |    |_|_\ |___|   |_|   /_/ \_\ |_|_\ |___/  |___| |___/    |
//    |                                                            |
//    |              ___    ___    ___    ___   ___                |
//    |             / __|  / _ \  |   \  | __| | _ \               |
//    |            | (__  | (_) | | |) | | _|  |   /               |
//    |             \___|  \___/  |___/  |___| |_|_\               |
//    |                                                            |
//    |------------------------------------------------------------|
//    |                      .------------.                        |
//    |                      | KerakTelor |                        |
//    |                      |------------|                        |
//    |                      | 2019-11-07 |                        |
//    |                      '------------'                        |
//    '------------------------------------------------------------'

#include <bits/stdc++.h>

#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("tune=native")

#define fi first
#define se second

using namespace std;

using ll=long long;
using ld=long double;

template<class T>
using vec=vector<T>;
template<class T>
using v2d=vector<vector<T>>;
template<class T>
using prq=priority_queue<T>;
template<class T>
using rpq=priority_queue<T,vector<T>,greater<T>>;

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    vec<int> x(n),dp(k+1);
    dp[0]=1;
    for(auto &i:x)
        scanf("%d",&i);
    for(int i=1;i<=k;++i)
    {
        bool fnd=0;
        for(auto &j:x)
            if(j<=i&&dp[i-j])
                fnd=1;
        dp[i]=!fnd;
    }
    printf("%s\n",dp[k]?"Second":"First");
}



Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
const int Maxn=200005;
ll a[Maxn];
int par[Maxn];
vector <ll> v[Maxn];
ll ans,cnt;
int n,m;
int find(int x)
{
	if (par[x]==x) return x;
	return par[x]=find(par[x]);
}
int main()
{
	cin>>n>>m;
	rep(i,n) cin>>a[i];
	rep(i,n) par[i]=i;
	rep(i,m)
	{
		int x,y;
		cin>>x>>y;
		par[find(x)]=find(y);
	}
	rep(i,n)
	{
		v[find(i)].push_back(a[i]);
	}
	vector <ll> p;
	rep(i,n)
	{
		if (v[i].empty()) continue;
		cnt++;
		sort(v[i].begin(),v[i].end());
		ans+=v[i][0];
		for (int j=1;j<v[i].size();j++)
		{
			p.push_back(v[i][j]);
		}
	}
	if (cnt==1)
	{
		cout<<0<<endl;
		return 0;
	}
	sort(p.begin(),p.end());
	rep(i,2*(n-m-1)-cnt)
	{
		if (p.size()<=i)
		{
			cout<<"Impossible\n";
			return 0;
		}
		ans+=p[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 9600
#include <vector>
#include <cassert>

template<typename T, typename F, typename Z>
struct segment_tree {
    int n;
    F f;
    Z zero;
    std::vector<T> data;
    segment_tree(int n, F f, Z zero) : n(n), f(f), zero(zero), data(n << 1, zero()) {}
    template<typename I> segment_tree(I begin, I end, F f, Z zero)
        : n(end - begin), f(f), zero(zero), data(n << 1) {
        std::copy(begin, end, data.begin() + n);
        for (int i = n - 1; i > 0; i--) { data[i] = f(data[i << 1 | 0], data[i << 1 | 1]); }
    }
    void set(int i, const T &x) {
        assert(0 <= i && i < n);
        data[i += n] = x;
        while (i >>= 1) { data[i] = f(data[i << 1 | 0], data[i << 1 | 1]); }
    }
    T operator[](int i) const { return data[i + n]; }
    T get_sum(int l, int r) const {
        assert(0 <= l && l < n);
        assert(0 < r && r <= n);
        T a = zero(), b = zero();
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) { a = f(a, data[l++]); }
            if (r & 1) { b = f(data[--r], b); }
        }
        return f(a, b);
    }
};

#include<bits/stdc++.h>
using namespace std;

int main() {
    int n, q;
    cin >> n >> q;
    auto f = [](int a, int b) { return a + b; };
    auto zero = []() { return 0; };
    segment_tree<int, decltype(f), decltype(zero)> st(n + 1, f, zero);
    for (int i = 0; i < q; i++) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) { st.set(x, st[x] + y); }
        else if (com == 1) { cout << st.get_sum(x, y + 1) << endl; }
    }
}


Measured memory_bytes: 3552
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#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 ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    string S;
    cin >> S;

    ll P = 2019, N = (ll)S.length();
    
    vector<long long> val(P, 0);
    long long tenfactor = 1;
    long long cur = 0;
    val[cur]++;
    for (int i = 0; i < N; ++i) {
        cur = (cur + (S[N-i-1]-'0') * tenfactor) % P;
        tenfactor = (tenfactor * 10) % P;
        val[cur]++;
    }
    long long res = 0;
    for (int p = 0; p < P; ++p) res += val[p] * (val[p] - 1) / 2;
    cout << res << endl;;

    return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int D,G;
  cin >> D >> G;
  vector<P> v(11);
  REP(i,D) cin >> v[i].first >> v[i].second;

  int c_min=INF;
  
  REP(mask,1 << D){
    int p_sum=0;//問題数
    int c_sum=0;//特点
    int rest_max = -1;
    REP(i,D){
      //bitが立っているならば，+する
      if(mask >> i & 1){
        p_sum += v[i].first;
        c_sum += (i+1)*100 * v[i].first + v[i].second;
      }
      else{
        rest_max = i;
      }
    }
    if(c_sum < G){
      int s1 = 100*(rest_max + 1);
      int need = ( G - c_sum + s1 -1)/s1;
      if(need >= v[rest_max].first) continue;
      p_sum += need;
    }
    c_min = min(c_min,p_sum);
  }
  cout << c_min << endl;
}

Measured memory_bytes: 256
n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.append(int(input()))

for i in range(1, d + 1):
    for j in range(n):
        if i % a[j] == 1 or a[j] == 1:
            s += 1
print(s + x)


Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int S,h,m,s;
	scanf("%d",&S);
	s=S%3600%60;
	m=(S-s)%3600/60;
	h=(S-m)/3600;
	
	printf("%d:%d:%d\n",h,m,s);

	return 0;
}


Measured memory_bytes: 2124
package main

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Sum of product of pairs
	var N int
	fmt.Scanf("%d", &N)

	sc.Split(bufio.ScanWords)
	A := make([]int, N)
	sum := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	var S int
	for i := N - 1; 0 <= i; i-- {
		S += A[i]
		S = S % (int(math.Pow10(9)) + 7)
		sum[i] = S
	}

	//fmt.Println(sum)
	//sum += A[i]
	//sum = sum % (int(math.Pow10(9)) + 7)
	var ans int
	for i := 0; i < N-1; i++ {
		//sum -= A[i]
		//if sum < 0 {
		//	sum += int(math.Pow10(9)) + 7
		//}
		ans += A[i] * sum[i+1]
		ans = ans % (int(math.Pow10(9)) + 7)
	}

	fmt.Println(ans)

}


Measured memory_bytes: 7612
n,k = map(int,input().split())
a = [0] + list(map(int,input().split()))

ans = 0
if(a[1] != 1):
    ans += 1

links_c = [set() for _ in range(n+1)]
for i,ai in enumerate(a[2:],2):
    links_c[ai].add(i)

depth = [-1] * (n+1)
depth[1] = 0
stack = [1]
ts = [(0,1)]
while(stack):
    next = []
    while(stack):
        i = stack.pop()
        for j in links_c[i]:
            depth[j] = depth[i] + 1
            ts.append((depth[j],j))
            next.append(j)
    stack = next[::]

while( ts[-1][0] > k ):
    di,i = ts.pop()
    if( depth[i] <= k ):
        continue

    for j in range(k-1):
        i = a[i]

    ans += 1
    links_c[a[i]].remove(i)
    stack = [i]
    while(stack):
        next = []
        while(stack):
            i = stack.pop()
            depth[i] = 1
            for j in links_c[i]:
                next.append(j)
        stack = next[::]

print(ans)

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


def dfs(ret, cur, f1, f2, f3):
    if N < cur:
        return ret
    ret += 1 if f1 and f2 and f3 else 0
    ret = dfs(ret, cur * 10 + 7, True, f2, f3)
    ret = dfs(ret, cur * 10 + 5, f1, True, f3)
    ret = dfs(ret, cur * 10 + 3, f1, f2, True)
    return ret


def main():
    print(dfs(0, 0, False, False, False))
    return


main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cctype>

using namespace std;
typedef string::const_iterator State;

class Zone
{
public:
    int value;
    vector<Zone> zones;

    Zone() :value(-1) {}
    Zone(int v) :value(v) {}

    int best()
    {
        if(value != -1) return value / 2 + 1;

        vector<int> needs;

        for(auto zone : zones) {
            needs.push_back(zone.best());
        }

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

        return accumulate(needs.begin(), needs.begin() + needs.size() / 2 + 1, 0);
    }
};

Zone read(State& it)
{
    if(isdigit(*it)) {
        int n = 0;

        for(; isdigit(*it); it++) {
            n *= 10;
            n += *it - '0';
        }

        return n;
    } else {
        Zone zone;

        while(*it == '[') {
            it++;
            zone.zones.push_back(read(it));
            it++;
        }

        return zone;
    }
}

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

    for(int i = 0; i < n; i++) {
        string line;
        cin >> line;
        State it = line.begin();
        cout << read(it).best() << endl;
    }
}

Measured memory_bytes: 1540
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define MOD 1000000007;

typedef long long ll;



template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<1000000007>;

int main() {
    int n; cin >> n;
  	vector<int> c(n);for(int i=0;i<n;++i) cin >> c[i];
  	sort(all(c));
    vector<mint> fact(2000005);
  	vector<mint> pt(2000005);
    fact[0] = 1;
  	pt[0] = 1;
    for (int i = 1; i < fact.size(); ++i) {
        fact[i] = fact[i - 1] * i;
    }
    for (int i = 1; i < fact.size(); ++i) {
        pt[i] = pt[i - 1] * mint(2);
    }
    const auto comb = [&fact](int n, int r) {
        return fact[n] / fact[r] / fact[n - r];
    };
  	mint ans = 0;
  	for(int i=0;i<n;i++) ans = ans + pt[2*n-2] * mint(c[i]) * (n-i+1);
  	cout << ans.a << endl;
    return 0;
}


Measured memory_bytes: 16640
#include<cstdio>
#include<iostream>
using namespace std;
char a[5]; 
int main(){
cin>>a;
if(a[0]=='S'&&a[1]=='U')printf("7");
if(a[0]=='S'&&a[1]=='A')printf("1");
if(a[0]=='F'&&a[1]=='R')printf("2");
if(a[0]=='T'&&a[1]=='H')printf("3");
if(a[0]=='W'&&a[1]=='E')printf("4");
if(a[0]=='T'&&a[1]=='U')printf("5");
if(a[0]=='M'&&a[1]=='O')printf("6");



}

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

using namespace std;


int main()
{
    size_t a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    size_t X = min(x, y);
    size_t Y = max(x, y);
    size_t A = x <= y ? a : b;
    size_t B = x <= y ? b : a;

    std::vector<size_t> cands{
        A * X + B * Y,
        2 * c * X + B * (Y - X),
        2 * c * Y
    };

    cout << *min_element(cands.begin(), cands.end()) << endl;

    return 0;
}


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

typedef long long LL;
const int MAXN=205;
const double eps=1e-7;

LL n,m;

LL f(LL n,LL m){
    if (m==0) return -n;
    LL ret=(n/m)*m*2;
    LL nxt=f(m,n%m);
    return ret+nxt;
}

int main(){
    scanf("%lld%lld",&n,&m);
    LL ans=n+f(n-m,m);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)
#define Sort(a) sort(a.begin(),a.end())

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	ll n,m;cin>>n>>m;
	ll t=m;
	ll ans1=min(n,m/2);
	m-=2*ans1;
	ans1+=m/4;
	
	ll ans2=t/4;
	t%=4;
	ans2+=min(n,t/2);
	
	cout<<max(ans1,ans2);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    string s;
    cin>>s;
    int l=s.size();
    for(int i=0;i<l;i++){
        if(s.at(i)!=s.at(l-1-i)){
            cout<<"No"<<endl;
            return 0;
        }
    }
    for(int i=0;i<(l-1)/2;i++){
        if(s.at(i)!=s.at((l-1)/2-1-i)){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

}

Measured memory_bytes: 256
import numpy as np

N, Y = map(int, input().split())
res = Y - 1000*N
b = -1
for a in range(N+1):
    cand = 9000*a + np.linspace(0, 4000*(N-a), N-a+1)
    if (cand == res).sum() > 0:
        b = np.where(cand==res)[0][0]
        c = N-a-b
        break
if b == -1:
    print(-1, -1, -1)
else:
    print(a, b, c)


Measured memory_bytes: 14452
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int n,a,b ;
	cin >> n >> a >> b ;
	string s ; cin >> s ;
	int rank = 0 ;
	int over = 0 ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='c'){
			cout << "No" << endl ;
		}else if(s.at(i)=='b'){
			rank++ ;
			over++ ;
			if(rank<=a+b&&over<=b) cout << "Yes" << endl ;
			else{
				cout << "No" << endl ;
				rank-- ;
			}
		}else{
			rank++ ;
			if(rank<=a+b) cout << "Yes" << endl ;
			else{
				cout << "No" << endl ;
				rank-- ;
			}
		}
	}
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define ll long long

const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int n; cin >> n;
  rep(i,n){
    int in; cin >> in;
    if(in % 2 == 0){
      if((in % 3 ) && (in % 5)){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
}


Measured memory_bytes: 256