akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int);
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fastpow(ll, ll, ll);
ll slowpow(ll, ll, ll);
ll _gcd(ll, ll);
ll _lcm(ll, ll);
ll extgcd(ll, ll, ll&, ll&);
ll _inv(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    int n = si(), m = si();
    priority_queue<int> Q;
    for (int i = 0; i < n; ++i)
    {
        int a = si();
        Q.push(a);
    }

    while (m)
    {
        int a = Q.top();
        Q.pop();
        --m;
        Q.push(a >> 1);
    }

    ll res = 0;
    while (!Q.empty())
    {
        res += Q.top();
        Q.pop();
    }
    pl(res);

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fastpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slowpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll _gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

ll _lcm(ll a, ll b)
{
    return a / _gcd(a, b) * b;
}

ll extgcd(ll a, ll b, ll& k, ll& l)
{
    if (b == 0)
    {
        k = 1; l = 0;
        return a;
    }
    ll res = extgcd(b, a % b, l, k);
    l -= a / b * k;
    return res;
}

ll _inv(ll a, ll p)
{
    return fastpow(a, p - 2, p);
}


Measured memory_bytes: 1020
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

a, b, c = readmi()
print(max(c - (a - b),0))


Measured memory_bytes: 7752
<?php
  
  $tmp = explode(" ", trim(fgets(STDIN)));

  $n = $tmp[0];
  $k = $tmp[1];

  $count = 0;
  $h = explode(" ", trim(fgets(STDIN)));
  for($i=0; $i<$n; $i++){
    if($h[$i]>=$k){
      $count++;
    }
  }

  echo $count;

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

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

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


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

template<class Z> Z ext_gcd(Z a, Z b, Z& x, Z& y) {
  Z u = y = 0, v = x = 1; 
  while (b) {
    Z q = a / b;
    swap(a -= q * b, b);
    swap(x -= q * u, u);
    swap(y -= q * v, v);
  }
  return a;
}
template<class Z> pair<Z, Z> bezout(Z a, Z b, Z c) {
  Z x, y, d = ext_gcd(a, b, x, y);
  if (c % d) return {0, 0};
  Z q = c / (a + b) / b;
  Z r = c / d % b * x % b;
  Z mn = numeric_limits<Z>::max();
  for (int i = -1; i <= 1; ++i) {
    Z nx = (q + i) * b + r;
    Z ny = (c - a * nx) / b;
    if (abs(ny - nx) < mn) {
      mn = abs(ny - nx);
      x = nx, y = ny;
    }
  }
  return {x, y};
}

template<class Z> map<Z, int> factorize(Z n) {
  map<Z, int> res;
  for (Z i = 2; i * i <= n; ++i) while (n % i == 0) ++res[i], n /= i;
  if (n != 1) ++res[n];
  return res;
}

lint tmod(lint a, lint p) { return (a %= p) < 0 ? a + p : a; }
lint mod_pow(lint a, lint n, lint p) {
  assert(n >= 0);
  a = tmod(a, p);
  lint res = 1;
  while (n) {
    if (n & 1) (res *= a) %= p;
    (a *= a) %= p;
    n >>= 1;
  }
  return res;
}

lint solve(lint a, lint m) {
  a %= m;
  lint pw = 1;
  for (int i = 1; i < 100; ++i) {
    (pw *= a) %= m;
    if (pw == i % m) return i;
  }
  lint phi = m;
  for (const auto& e : factorize(m)) {
    phi /= e.first;
    phi *= e.first - 1;
  }
  lint x = solve(a, __gcd(phi, m));
  lint i = bezout(phi, m, tmod(mod_pow(a, x, m) - x, m)).first;
  if (i < 0) i += m;
  return x + phi * i;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int q; cin >> q;
  while (q--) {
    lint a, m; cin >> a >> m;
    lint x = solve(a, m);
    cout << x << '\n';
    assert(mod_pow(a, x, m) == x % m);
    // cerr << mod_pow(a, x, m) << ' ' << x % m << '\n';
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, y;
  cin >> n >> y;
  y /= 1000;
  int h = y % 5;
  y -= h;
  n -= h;
  for (int i = 0; i * 10 <= y; i++) {
    if (((y - n) - 9 * i) % 4 == 0) {
      int a = ((y - n) - 9 * i) / 4;
      int b = n - i - a;
      if (a >= 0 && b >= 0) {
        printf("%d %d %d", i, a, b+h);
        return 0;
      }
    }
  }
  printf("%d %d %d", -1, -1, -1);
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut s = String::new();
    let _ = std::io::stdin().read_to_string(&mut s).unwrap();
    let mut splits = s.trim().split_whitespace();

    let n = splits.next().unwrap().parse::<usize>().unwrap();

    let mut ans : f64 = 0.0;

    for _ in 0..n {
        ans += 1.0 / splits.next().unwrap().parse::<usize>().unwrap() as f64;
    }

    println!("{:?}", 1.0 / ans);

}

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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second

#define pow10(n) stoll("1"+string(n,'0'))

#define debug(x) cout << ">>> " << #x << ": " << x << '\n'

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

void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    ll n; cin >> n;
    ll nodes = 0;
    for(ll i=1; i<=n; ++i)
        nodes += i * (n-i+1);
    ll edges = 0;
    for(ll i=1; i<=n-1; ++i) {
        int u, v; cin >> u >> v;
        if(u > v) swap(u, v);
        edges += u * (n-v+1);
    }
    cout << nodes - edges;
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	final boolean DEBUG = false;

	int h, w, c;
	int[] colors;
	int[][] tmp;
	int[] dy = { 1, 0, -1, 0 };
	int[] dx = { 0, 1, 0, -1 };
	int bColor, aColor;
	int sum;

	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			h = scan.nextInt();
			w = scan.nextInt();
			c = scan.nextInt();
			if (h + w + c == 0)
				return;

			int[][] panel = new int[h][w];
			tmp = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++)
					panel[i][j] = scan.nextInt();
			}
			colors = new int[6];
			int ans = 0;
			for (int i = 1; i <= 6; i++) {
				for (int j = 1; j <= 6; j++) {
					for (int k = 1; k <= 6; k++) {
						for (int l = 1; l <= 6; l++) {
							colors[0] = i;
							colors[1] = j;
							colors[2] = k;
							colors[3] = l;
							colors[4] = c;
							for (int _i = 0; _i < h; _i++) {
								for (int _j = 0; _j < w; _j++)
									tmp[_i][_j] = panel[_i][_j];
							}
							paint();
							sum = 0;
							count(0, 0);
							ans = Math.max(ans, sum);
						}
					}
				}
			}
			System.out.println(ans);
		}
	}
	void paint() {
		for (int i = 0; i < 5; i++) {
			bColor = tmp[0][0];
			aColor = colors[i];
			if (bColor == aColor)
				continue;
			dfs(0, 0);
		}
	}
	void dfs(int y, int x) {
		if (DEBUG)
			System.out.println(y + " " + x);
		if (y < 0 || x < 0 || y >= h || x >= w)
			return;
		if (tmp[y][x] != bColor)
			return;
		tmp[y][x] = aColor;
		for (int i = 0; i < 4; i++)
			dfs(y + dy[i], x + dx[i]);
	}
	void count(int y, int x) {
		if (y < 0 || x < 0 || y >= h || x >= w)
			return;
		if (tmp[y][x] != c)
			return;
		tmp[y][x] = 0;
		sum++;
		for (int i = 0; i < 4; i++)
			count(y + dy[i], x + dx[i]);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}



Measured memory_bytes: 53408
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn gcd(a: u64, b: u64) -> u64 {
    assert!(a != 0 || b != 0);
    if a == 0 {
        b
    } else {
        gcd(b % a, a)
    }
}
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

fn main() {
    input!{
        n: usize,
        t: [u64; n],
    }
    let mut ans = 1u64;
    for i in 0..n {
        ans = lcm(t[i], ans);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007ll
using namespace std;
int n;
ll k;
struct MAT{
    ll a[55][55];
};
MAT mul(MAT &a,MAT &b){
    MAT c;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j){
            c.a[i][j]=0;
            for(int k=1;k<=n;++k)(c.a[i][j]+=a.a[i][k]*b.a[k][j])%=orz;
        }
    }
    return c;
}
int main(){
    cin>>n>>k;
    MAT x,ans;
    memset(ans.a,0,sizeof(ans.a));
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j)cin>>x.a[i][j];
        ans.a[i][i]=1;
    }
    while(k){
        if(k&1)ans=mul(x,ans);
        k>>=1,x=mul(x,x);
    }
    ll out=0;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j)out+=ans.a[i][j];
    }
    cout<<out%orz<<endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

typedef long long ll;

int main() {
	char s[1005], t[1005];
	scanf("%s", s);
	scanf("%s", t);
	
	int lens = 0, lent = 0;
	while (s[lens] != '\0')
	{
		lens++;
	}
	while (t[lent] != '\0')
	{
		lent++;
	}
	int d_min = 10000;
	for (int head = 0; head < lens - lent + 1; head++) {
		int diff = 0;
		for (int i = 0; i < lent; i++) {
			if (s[head + i] != t[i]) diff++;
		}
		if (diff < d_min) d_min = diff;
	}
	printf("%d", d_min);
	
	
	return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


vector<int> G[1<<17];

int main(){
    int n,m;cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a,b;cin >> a >> b;
        a--,b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    queue<P> q;
    vector<int> dp(n,INF);
    q.push(mp(0,0));
    dp[0] = 0;
    while(not q.empty()){
        P p = q.front(); q.pop();
        if(dp[p.fs] < p.sc) continue;
        int u = p.fs, c = p.sc;
        dp[p.fs] = p.sc;
        for(auto g:G[u]){
            if(u == g) continue;
            if(chmin(dp[g], c + 1)){
                q.push(mp(g, c + 1));
            }
        }
    }
    vector<int> ans(n,-1);
    for (int i = 1; i < n; i++) {
        bool f = false;
        for(auto g:G[i]){
            if(dp[g] == dp[i] - 1){
                f = true;
                ans[i] = g + 1;
                break;
            }
        }
        if(not f){
            puts("No");
        }
    }
    puts("Yes");
    for (int i = 1; i < n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 11968
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        n: f32,
        d: i32,
    }
    let ans = n / (d * 2 + 1) as f32;
    println!("{}", ans.ceil());
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
int sum[222];

//int dp[1111111][222];
int dp[2][1111111];

/*
int solve(int s,int i,int f){
  //if(!s) return 0;
  if(i >= m) return s;
  if(dp[s][i])return dp[s][i];

  int ret = 1 << 28;
  if(!((sum[i] + 1) % f)){
    for(int j = 0;s - sum[i] * j >= 0 ; j++){
      ret = min(ret,solve(s - sum[i] * j,i + 1,f) + j);
    }
  }
  ret = min(ret,solve(s,i + 1,f));

  return dp[s][i] = ret;
}
*/
int solve(int s,int f){
  if(!s) return 0;
  if(dp[f-1][s]) return dp[f-1][s];

  int ret = 1 << 28;
  for(int i = 0; s >= sum[i]; i++){
    if(!((sum[i] + 1) % f)){
      ret = min(ret,solve(s - sum[i],f) + 1);
    }
  }
  return dp[f-1][s] = ret;
}

int main(void){
  sum[0] = 1;
  for(int i = 1; sum[i-1] <= 1000000; i++){
    sum[i] = sum[i-1] * (i + 3) / i;
  }
  for(int i = 1; i < 1000000; i++){
    solve(i,1);
    solve(i,2);
  }
  //puts("ok");
  while(1){
    scanf("%d",&n); if(!n) break;
    printf("%d %d\n",dp[0][n],dp[1][n]);
  }
}

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

int main()
{
	vector<int>p1, p2;
	int num;
	cin >> num;
	for (int i = 0;i < num;i++)
	{
		int n;
		cin >> n;
		p1.push_back(n);
	}
	int num2;
	cin >> num2;
	for (int i = 0;i < num2;i++)
	{
		int n;
		cin >> n;
		p2.push_back(n);
	}
	vector<int>::iterator one = p1.begin();
	vector<int>::iterator two = p2.begin();
	int flag = 0;
	while (one != p1.end() && two != p2.end())
	{
		if (*one == *two)++one, ++two;
		else if (*two > * one)
		{
			flag = 1;
			cout << 1 << endl;
			break;
		}
		else
		{
			flag = 1;
			cout << 0 << endl;
			break;
		}
	}
	if (flag == 0)
	{
		if (one == p1.end() && two == p2.end())cout << 0 << endl;
		else if (one == p1.end() && two != p2.end())cout << 1 << endl;
		else cout << 0 << endl;

	}

}


Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cassert>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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; }

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

// greatest common divisor
long long gcd(long long a, long long b) {
  long long r = 1;
  while (r != 0) {
    r = a%b; a = b; b = r;
  }
  return a;
}

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

  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

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

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

  int ans = 0;
  for(int i=0; i<n; i++) {
    int now;
    if (i==0) {
      now = rsum[1];
    } else if (i==n-1) {
      now = lsum[n-2];
    } else {
      now = gcd(lsum[i-1], rsum[i+1]);
    }
    chmax(ans, now);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
pub 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()
}

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let st: Vec<String> = read_vec();
    let ab: Vec<u32> = read_vec();
    let u: String = read();
    if st[0] == u {
        println!("{} {}", ab[0] - 1, ab[1]);
    } else {
        println!("{} {}", ab[0], ab[1] - 1);
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();
		int a;	int b;	int c;	int d;	int e;
		int SUM;
		if(A % 10 == 0){
			a = 10;
		}
		else {
			a = A % 10;
		}
		if (B % 10 == 0){
			b = 10;
		}
		else {
			b = B % 10;
		}
		if (C % 10 == 0){
			c = 10;
		}
		else {
			c = C % 10;
		}
		if (D % 10 == 0){
			d = 10;
		}
		else {
			d = D % 10;
		}
		if (E % 10 == 0){
			e = 10;
		}
		else {
			e = E % 10;
		}
		int A2 = A + 10 - a;
		int B2 = B + 10 - b;
		int C2 = C + 10 - c;
		int D2 = D + 10 - d;
		int E2 = E + 10 - e;
		if(0 < a && a < b && a < c && a < d && a < e) {
			SUM = A + B2 + C2 + D2 + E2;
		}
		else if(0 < b && b < a && b < c && b < d && b < e) {
			SUM = A2 + B + C2 + D2 + E2;
		}
		else if(0 < c && c < b && c < a && c < d && c < e) {
			SUM = A2 + B2 + C + D2 + E2;
		}
		else if(0 < d && d < b && d < c && d < a && d < e) {
			SUM = A2 + B2 + C2 + D + E2;
		}
		else {
			SUM = A2 + B2 + C2 + D2 + E;
		}
		System.out.print(SUM);
	}
}

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

int main() {
    int n;
    int b, f, r, v;
    int room[4][3][10]= {{{}}};
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        room[b-1][f-1][r-1] += v;
    }

    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 10; k++) {
                cout << " " << room[i][j][k];
            }
            cout << endl;
        }
        if(i < 3) {
            cout << "####################" << endl;
        }
    }

    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	string s;
	cin >> s;

	int n = s.size();
	vector<char> wox;
	rep(i, n){
		if(s[i] != 'x') wox.push_back(s[i]);
	}

	bool isPalindrome = true;
	int m = wox.size();
	for(int i = 0; i < m-1-i;i++){
		if(wox[i] != wox[m-1-i]){
			isPalindrome = false;
			break;
		}
	}

	if(!isPalindrome){
		cout << -1 << endl;
		return 0;
	}

	int ans = 0;
	int l = 0;
	int r = n-1;
	while(l < r){
		if(s[l] == 'x' && s[r] != 'x'){
			ans++;
			l++;
		}else if(s[l] != 'x' && s[r] == 'x'){
			ans++;
			r--;
		}else{
			l++;
			r--;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 592
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    s1 = []
    s2 = []
    all_area = 0
    
    for i, c in enumerate(input()):
        if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
    print(all_area)
    ret = [len(s2)]
    for w in s2:
        ret.append(w[1])
    print(" ".join(map(str, ret)))



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

int main() {
	
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
 	
	string s1, s2;
	cin >> s1 >> s2;

	int ans = 0;

	for(int i = 0; i < s1.length(); i++) {
		if(s1[i] == s2[i]) ans++;
	}

	cout << ans;
	
	return 0;
}

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

char field[8][9];
struct P { int x, y; };
P pat[7][3] = {
	{{1,0}, {0,1}, {1,1}},
	{{0,1}, {0,2}, {0,3}},
	{{1,0}, {2,0}, {3,0}},
	{{-1,1}, {0,1}, {-1,2}},
	{{1,0}, {1,1}, {2,1}},
	{{0,1}, {1,1}, {1,2}},
	{{1,0}, {-1,1}, {0,1}},
};

bool ok(int x, int y) {
	if (x<0 || x>=8 || y<0 || y>=8) return false;
	return (field[y][x] == '1');
}

int main() {
	while (scanf("%s", &field[0]) == 1) {
		for (int i = 1; i < 8; i++)
			scanf("%s", &field[i]);

		int x0, y0;
		for (int i = 0; i < 8*8; i++) {
			int x = i%8, y = i/8;
			if (ok(x, y)) {
				x0 = x, y0 = y;
				break;
			}
		}

		char kind;
		for (int i = 0; i < 7; i++) {
			if (!ok(x0+pat[i][0].x, y0+pat[i][0].y)) continue;
			if (!ok(x0+pat[i][1].x, y0+pat[i][1].y)) continue;
			if (!ok(x0+pat[i][2].x, y0+pat[i][2].y)) continue;
			kind = 'A' + i;
			break;
		}

		cout << kind << endl;
	}
	return 0;
}

Measured memory_bytes: 0
A, B, N = map(int, input().split())

ans = 0
i = 1
while True:
    i += max(1, (B-1)//A+1)
    if i > N:
        break
    tmp = ((A*i)//B) - (A*(i//B))
    if tmp > ans:
        ans = tmp
    else:
        break
        
print(ans)

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

int main(){
  int n;
  cin >> n;
  if (n <= 111) cout << 111 << endl;
  else if (n <= 222) cout << 222 << endl;
  else if (n <= 333) cout << 333 << endl;
  else if (n <= 444) cout << 444 << endl;
  else if (n <= 555) cout << 555 << endl;
  else if (n <= 666) cout << 666 << endl;
  else if (n <= 777) cout << 777 << endl;
  else if (n <= 888) cout << 888 << endl;
  else if (n <= 999) cout << 999 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int o = n/10;
  int p = n%10;
  string ans = "No";
  if(o == 9 || p == 9){
    ans = "Yes";
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import sys 

s = sys.stdin.readline().strip()
K = int(sys.stdin.readline())
c = []
for i in s:
        c.append(ord(i)-ord('a'))

i =0
while i< len(c):
        path2a = (26-c[i] ) % 26
        if path2a <= K:                                                                                                                                                                                                               
                K -= path2a
                c[i] = 0 
        i+=1
c[-1] = (c[-1]+ K) %26 

res = ""
for i in c:
        res += chr(i+ord('a'))

sys.stdout.write( res)

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
  
	char ch;
	cin >> ch;

	if (ch >= 'A' && ch <= 'Z')
		cout << "A";
	else cout << "a";
}



Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

vector<bool> used;
vector<vector<int> > graph, graph_rev;
vector<int> topology;
void dfs (int st) {
    if (used[st]) return;
    used[st] = true;
    for (int i : graph[st]) {
        eprintf("%d->%d\n", st, i);
        graph_rev[i].push_back(st);
        dfs(i);
    }
    // parent[st] = par;
    topology.push_back(st);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    used.resize(n); graph.resize(n); graph_rev.resize(n);
    rep (i, n - 1 + m) {
        int a, b; cin >> a >> b; a--; b--;
        graph[a].push_back(b);
        // graph_rev[b].push_back(a);
    }
    rep (i, n) dfs(i);
    for (int i : topology) eprintf("%d ", i); eprintf("\n");
    for (auto i : graph_rev) {
        eprintf("("); for (int j : i) eprintf("%d,", j); eprintf(")");
    } eprintf("\n");
    vector<P> nodes;
    rep (i, n) nodes.emplace_back(topology[i], n - 1 - i);
    sort(all(nodes));
    for (P p : nodes) eprintf("%d ", p.second); eprintf("\n");
    rep (i, n) {
        if (i == topology.back()) cout << "0\n";
        else {
            int parent = graph_rev[i][0], best = nodes[graph_rev[i][0]].second;
            repp (j, 1, graph_rev[i].size()) {
                if (chmax(best, nodes[graph_rev[i][j]].second)) parent = graph_rev[i][j];
            }
            cout << parent + 1 << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 16248
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }

  while (a % b != 0) {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll A, B;

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

  ll ans = lcm(A, B);

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

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 1e9;
    for (int i = -100; i <= 100; ++i) {
        int s = 0;
        for (int j = 0; j < n; ++j) {
            s += (a[j] - i) * (a[j] - i);
        }
        ans = min(ans, s);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
#define forn(i,p,n); for(long long i=p;i<n;++i)
#define pb push_back

void solve(){
	ll n, cap;
	cin >> n >> cap;
	vector<ll> w(n);
	vector<ll> v(n);
	forn(i,0,n){
		cin >> w[i];
		cin >> v[i];
	}
	ll dp[n+1][cap+1];
	forn(i,0,n+1){
		forn(j,0,cap+1){
			if(i==0 || j==0)
				dp[i][j] = 0;
			else if(w[i-1]<=j){
				dp[i][j] = max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]);
			}
			else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	cout<<dp[n][cap];
	return ;
}

int main()
{
	fast;
	// int test;
	// cin >> test;
	// while(test--){
		solve();
	// 	cout<<"\n";
	// }
}

Measured memory_bytes: 82576
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<utility>
using namespace std;

int main(){
    int d;
    string ans;
    cin >> d;
    cout <<(d==25?"Christmas":d==24?"Christmas Eve":d==23?"Christmas Eve Eve":"Christmas Eve Eve Eve")<< endl;
}

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

#define int long long

const int N = 1e3 + 10, mod = 1e9 + 7;
int n, ans = 1, mark[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for (int i = 2; i <= n; i++)
		if (!mark[i]) {
			int cnt = 0;
			for (int j = i; j <= n; j += i) {
				int tmp = j;
				while (tmp % i == 0)
					tmp /= i, cnt++;
				mark[j] = 1;
			}
			ans = (ans * (cnt + 1)) % mod;
		}
	cout << ans << endl;	
}

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

using namespace std;


int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    bool ok = true;
    if(a > b) {
        ok = false;
    }
    if(a != b && n == 1) {
        ok = false;
    }
    if(!ok) {
        cout << 0 << "\n";
        return 0;
    }
    long long mini = a * (n - 1) + b;
    long long maxi = b * (n - 1) + a;
    cout << maxi - mini + 1 << "\n";
}

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

int n,m;
string s[301];
int degl[601][301];
int degr[601][301];

int funkr(int x0,int y0,int x1,int y1){
    if(x0<0||y0<0){
        int t=min(x0,y0);
        x0-=t;
        y0-=t;
    }
    if(x1>=n||y1>=m){
        int t=max(x1+1-n,y1+1-m);
        x1-=t;
        y1-=t;
    }
    if(x0>x1) return 0;
    return degr[n-x1+y1][min(x1,y1)+1]-degr[n-x1+y1][min(x0,y0)];
}
int funkl(int x0,int y0,int x1,int y1){
    y1=m-1-y1;
    y0=m-1-y0;
    if(x0<0||y0<0){
        int t=min(x0,y0);
        x0-=t;
        y0-=t;
    }
    if(x1>=n||y1>=m){
        int t=max(x1+1-n,y1+1-m);
        x1-=t;
        y1-=t;
    }
    if(x0>x1) return 0;
    return degl[n-x1+y1][min(x1,y1)+1]-degl[n-x1+y1][min(x0,y0)];
    
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cout<<fixed<<setprecision(20);
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++){
        for(int k=0;k<min(n,m);k++){
            if(i+k>=n||k>=m) break;
            if(s[i+k][k]=='#') degr[n-i][k+1]=degr[n-i][k]+1;
            else degr[n-i][k+1]=degr[n-i][k];
        }
    }
    for(int i=1;i<m;i++){
        for(int k=0;k<min(n,m);k++){
            if(k>=n||i+k>=m) break;
            if(s[k][k+i]=='#') degr[n+i][k+1]=degr[n+i][k]+1;
            else degr[n+i][k+1]=degr[n+i][k];
        }
    }
    for(int i=0;i<n;i++){
        for(int k=0;k<min(n,m);k++){
            if(i+k>=n||k>=m) break;
            if(s[i+k][m-1-k]=='#') degl[n-i][k+1]=degl[n-i][k]+1;
            else degl[n-i][k+1]=degl[n-i][k];
        }
    }
    for(int i=1;i<m;i++){
        for(int k=0;k<min(n,m);k++){
            if(k>=n||i+k>=m) break;
            if(s[k][m-1-(k+i)]=='#') degl[n+i][k+1]=degl[n+i][k]+1;
            else degl[n+i][k+1]=degl[n+i][k];
        }
    }
  //  for(int i=0;i<n+m;i++){
  //      for(int k=0;k<min(n,m)+1;k++){
 //           cout<<degl[i][k]<<" ";
 //       }
 //       cout<<endl;
 //   }
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s[i][j]=='#'){
                for(int k=1;;k++){
                    if(i-k<0||j-k<0) break;
                    if(s[i-k][j-k]=='#'){
                     //   cout<<i-k<<" "<<j-k<<" "<<i<<" "<<j<<" "<<i<<" "<<j-2*k<<" "<<i+k<<" "<<j-k<<" "<<" "<<funkr(i,j-2*k,i+k,j-k)<<endl;
                        ans+=funkr(i,j-2*k,i+k,j-k);
                        ans+=funkr(i-2*k,j,i-k,j+k);
                    }
                }
                for(int k=1;;k++){
                    if(i-k<0||j+k>=m) break;
                    if(s[i-k][j+k]=='#'){
                        ans+=funkl(i-2*k+1,j-1,i-k-1,j-k+1);
                        ans+=funkl(i+1,j+2*k-1,i+k-1,j+k+1);
                    }
                }
            }
        }
    }
    cout<<ans;
    return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;

  t.pop_back();

  if (t == s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound2
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
const int block_size = 256;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ld eps = 1e-9;
const int inf = mod;
const db PI = atan(1)*4;
template<typename T>
inline int sign(const T&a){if(a<0)return -1;if(a>0)return 1;return 0;}


template<typename T> inline void in(T &x){
    x = 0; T f = 1; char ch = getchar();
    while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
    while (isdigit(ch))  {x = x * 10 + ch - '0'; ch = getchar();}
    x *= f;
}

int n,m;
deque<int>ans;
const int maxn = 500000;
bool used[maxn];
int main(){
	cin>>n>>m;
	n*=2;n--;
	if(m==1||m==n){
		cout<<"No";
	}else{

		if(m==2){
			if(n == 3){
				cout<<"Yes\n1\n2\n3\n"<<endl;
				return 0;
			}
			ans.PB(4);
			ans.PB(2);
			ans.PB(1);
			ans.PB(3);
			REP(i,1,5)used[i] = 1;
		}else{
			ans.PB(m-2);
			ans.PB(m+1);
			ans.PB(m);
			ans.PB(m-1);
			REP(i,m-2,m+2)used[i] = 1;
		}
		int right = 0;
		REP(i,1,n+1){
			if(used[i])continue;
			if(right){
				ans.PB(i);
			}else{
				ans.PF(i);
			}
			right^=1;
		}	cout<<"Yes"<<endl;
	for(auto i:ans)cout<<i<<endl;

	}
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
using namespace std;
using ll=long long;
int main(){
  string s;
  cin >> s;
  if(s=="ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;


int main(){
  int N; cin >> N;
  cout << 800 * N - 200 * (N / 15) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3


def nC2(x):
    if x == 1 or x == 0:
        return 0
    else:
        return x * (x - 1) // 2

(N, M) = map(int, input().split(" "))

result = nC2(N) + nC2(M)
print(result)


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

const int V = 100000;
LL n, W, w[100], v[100], dp[V + 1001], INF = 1e12;

int main() {
	cin >> n >> W;
	inc(i, n) { cin >> w[i] >> v[i]; }
	
	incII(j, 0, V) { dp[j] = INF; }
	dp[0] = 0;
	
	inc(i, n) {
	decII(j, 0, V) {
		setmin(dp[j + v[i]], dp[j] + w[i]);
	}
	}
	
	LL ans = 0;
	incII(j, 0, V) { if(dp[j] <= W) { ans = j; } }
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
    int N;
    double A[100];
    double sum = 0.0;
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<N;i++){
        sum += 1/A[i];
    }
    cout << 1/sum;
    
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
int x;
int y;
scanf("%d %d",&x,&y);

while(x !=0 || y != 0){
if (x<=y){
printf ("%d %d\n",x,y);
}else{
printf ("%d %d\n",y,x);
}
scanf("%d %d",&x,&y);
}
return 0;
}


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

int main(){
    int n, s;
    long long dp[11][1001];

    for(int i=0; i < 11; i++)for(int j=0; j < 1001; j++) dp[i][j] = 0;

    dp[0][0] = 1;
    for(int i=0; i < 101; i++){
        for(int j=9; j >= 0; j--){
            for(int k=0; i+k < 1001; k++){
                dp[j+1][k+i] += dp[j][k];
            }
        }
    }

    while(cin >> n >> s, n+s){
        cout << dp[n][s] << endl;
    }
}

Measured memory_bytes: 1240
import java.util.*;
class Main{
public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int k =reader.nextInt();
  String s =reader.next();
  if(k>=s.length())
  {
    System.out.println(s);
  }
  else{

  String x=s.substring(0,k);

System.out.println(x+"...");
}


}
}

Measured memory_bytes: 38664
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf=1e9+7;
signed main(){
    int n;
    string s,t;
    cin>>n>>s;
    int ans=0;
    while(cin>>t){
        bool ok=0;
        for(int i=0;i<100;i++){
            for(int j=1;i+j*(s.size()-1)<t.size();j++){
                bool ng=0;
                for(int k=0;k<s.size();k++)
                    if(s[k]!=t[i+j*k])
                        ng=1;
                if(!ng)
                    ok=1;
            }
        }
        if(ok)
            ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3156
inf = 1001001001
n = int(input())
lis = list(map(int, input().split()))
lis.sort()
lis.append(inf)
ans = 0
for i in range(n-2):
    a = lis[i]
    for j in range(i + 1, n-1):
        b = lis[j]
        l = j
        r = n
        while r > l+1:
            mid = (l+r) // 2
            if lis[mid] < a + b:
                l = mid
            else:
                r = mid
        ans += l - j
print(ans)

Measured memory_bytes: 42732
K, N = list(map(int, input().split()))
A = [0] * N
A = list(map(int, input().split()))

sorted_A = sorted(A)
sorted_A = [i - sorted_A[0] for i in sorted_A]

dis = []
for i in range(len(sorted_A)-1):
    dis.append(abs(sorted_A[i] - sorted_A[i+1]))

last_dis = abs(sorted_A[-1] - sorted_A[0])

if(last_dis >= K/2):
    last_dis = K - last_dis

dis.append(last_dis)

print(K - max(dis))

Measured memory_bytes: 27980
#include <iostream>
using namespace std;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  char turn = 'a';
  int a_st = 0,b_st = 0, c_st = 0;
  while(true){
    if(turn == 'a'){
      if(a_st == a.size()){
        cout << "A" << endl;
        break;
      }
      turn = a[a_st];
      a_st++;
    } else if(turn == 'b'){
      if(b_st == b.size()){
        cout << "B" << endl;
        break;
      }
      turn = b[b_st];
      b_st++;
    } else {
      if(c_st == c.size()){
        cout << "C" << endl;
        break;
      }
      turn = c[c_st];
      c_st++;
    }
  }
  return 0;
}

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

char a[100][100], b[102][102];

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> ans(N+1, 0);
  int a,b;
  rep(i, M){
    cin >> a >> b;
    ans[a]++;
    ans[b]++;
  }
  for (int i = 1; i < N+1; i++)
  {
    cout << ans[i] << endl;
  }
  
}


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

int main(){
	int x;
	cin >> x;
	long long ans,ans1,ans2;

	ans1 = x/500;
	ans2 = (x%500)/5;
	ans = ans1*1000 + ans2*5;

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,a,b;
int min(int x,int y)
{
	return x<y?x:y;
}
int main ()
{
	scanf("%d%d%d",&n,&a,&b);
	printf("%d\n",min(n*a,b));
	return 0;
} 

Measured memory_bytes: 256