akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	n, _ := strconv.Atoi(input())
	wLimit, _ := strconv.Atoi(input())
	w := make([]int, n+1)
	v := make([]int, n+1)
	for i := 1; i <= n; i++ {
		w[i], _ = strconv.Atoi(input())
		v[i], _ = strconv.Atoi(input())
	}

	vSum := 0
	for i := 1; i <= n; i++ {
		vSum += v[i]
	}
	dp := make([][]int, n+1)
	for i := 0; i <= n; i++ {
		dp[i] = make([]int, vSum+1)
	}

	inf := 2 << 30
	for i := 1; i <= vSum; i++ {
		dp[0][i] = inf
	}
	for i := 1; i <= n; i++ {
		for j := 1; j <= vSum; j++ {
			if j < v[i] {
				dp[i][j] = dp[i-1][j]
			} else {
				dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+w[i])
			}
		}
	}

	ans := 0
	for i := 0; i <= vSum; i++ {
		if dp[n][i] <= wLimit {
			ans = max(ans, i)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 82560
N = int(input())
num_list = [int(item) for item in input().split()]


def merge(A, left, mid, right):

    L = A[left : mid] + [100**5]
    R = A[mid: right] + [100**5]
 
    cnt = 0
    i, j = 0, 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        # print(A, left, mid, right)
    return cnt


def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right)//2
        cnt_L = mergeSort(A, left, mid)
        cnt_R = mergeSort(A, mid, right)
        return merge(A, left, mid, right) + cnt_L + cnt_R
    return 0


res_cnt = mergeSort(num_list, 0, N)
print(*num_list)
print(res_cnt)


Measured memory_bytes: 61648
#include <iostream>
using namespace std;
int main() {
    int n, m, sn=0;
    cin >> n;
    m = n;
    while(m>0) {
        sn+=m%10;
        m/=10;
    }
    if(n%sn) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
int main(){
 
string a;
string b;
cin >> a;
cin >> b;
 
int count = 0;
int i;
for(i=0;i<a.size();i++){
  if(a[i] == b[i]){
  	count++;
  }
}
 
cout << count;
}

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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int x;
  vector<int> sum(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> x;
    x %= k;
    sum[i + 1] = (sum[i] + x) % k;
  }
  unordered_map<int, int> m;
  long long res = 0;
  for (int i = 0; i <= n; i++) {
    sum[i] = ((sum[i] - i) % k + k) % k;
    if (i >= k) m[sum[i - k]]--;
    res += m[sum[i]];
    m[sum[i]]++;
  }
  cout << res << '\n';
  return 0;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (1<<(4*4-1))
#define MOD 1000000007

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

   int N,M;
   cin>>N>>M;
   vector<pii>e(M);
   for(int i=0;i<M;i++){
      int a,b;
      cin>>a>>b;
      a--,b--;
      e[i].second = a;
      e[i].first = b;
   }

   sort(e.begin(),e.end());
   int t=-1,ans=0;
   for(int i=0;i<M;i++){
      if(t <= e[i].second){
         ans++;
         t = e[i].first;
      }
   }
   cout<<ans<<endl;
   return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n); for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
typedef pair<int, int> P;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}
ll cnt=0;
ll N;
vl a={3,5,7};
vi cs(1000);
bool isgood(ll num){
  rep(i,10)cs[i]=0;
  while(num>0){
    cs[num%10]++;
    num /=10;
  }
  if(cs[3]>0&&cs[5]>0&&cs[7]>0)return true;
  else return false;
}
void dfs(ll t){
  if(t>N)return;
  if(isgood(t))cnt++;
  rep(i,3){    
    dfs(t*10+a[i]);
  }
}

//cout<<""<<endl;
int main(){
  cin>>N;
  dfs(0);
 
  cout<<cnt<<endl;
}


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

int main(void)
{
    std::cout << std::fixed << std::setprecision(10);
    double L;
    cin >> L;

    double A, B, C;
    A = L / 3;
    B = L / 3;
    C = L / 3;

    double ans = A * B * C;
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    ll N;
    cin >> N;
    ll p[N];
    REP(i, 0, N) {
        cin >> p[i];
    }
    sort(p, p + N);
    ll ans = 0;
    REP(i, 0, N) {
        if (i != N - 1) {
            ans += p[i];
        } else {
            ans += p[i] / 2;
        }
    }
    cout << ans << endl;
}

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


int sum = 0;
int main(){
	cin.sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
	}
	int diff = 0;
	for(int i = 0; i < n; i++){
		if(i % 2){
			diff -= a[i];
		} else {
			diff += a[i];
		}
	}
	if(n % 2 == 0){
		cout << (sum + max(diff, -diff)) / 2 << " " << (sum - max(diff, -diff)) / 2 << '\n';
		return 0;
	}
	if(diff >= 1000){
		cout << (sum + diff) / 2 << " " << (sum - diff) / 2 << '\n';
		return 0;
	}
	int s = 0; // yes
	int e = 1000; // no
	while(s + 1 < e){
		int d = (s + e) / 2;
		vector<int> r;
		r.push_back(a[0]);
		for(int i = 1; i < n; i += 2){
			if(r[r.size() - 1] < d || a[i] <= r[r.size() - 1]){
				r[r.size() - 1] += a[i+1] - a[i];
			} else {
				r.push_back(a[i]);
				r.push_back(a[i+1]);
			}
		}
		if(r[r.size() - 1] >= d){
			s = d;
		} else {
			e = d;
		}
	}
	cout << (sum + max(diff, (-diff + 2 * s))) / 2 << " " << (sum - max(diff, (-diff + 2 * s))) / 2 << '\n';
	return 0;
}


Measured memory_bytes: 3572
(defparameter +char-a+ (char-code #\a))

(defun solve (s)
  (when (equal s "zyxwvutsrqponmlkjihgfedcba")
    (return-from solve -1))
  (let ((used (make-array 26 :initial-element nil)))
    (loop for x across s
          do (setf (aref used (- (char-code x) +char-a+)) t))
    (if (= (length s) 26)
      (loop for i from 24 downto 0
            if (< (char-code (char s i)) (char-code (char s (1+ i))))
            return (concatenate 'string (subseq s 0 i) (string (code-char (reduce #'min (remove-if (lambda (x) (<= x (char-code (char s i)))) (map 'list #'char-code (subseq s i 26))))))))
      (concatenate 'string s (string (code-char (+ +char-a+
                                           (loop for i below 26 unless (aref used i) return i))))))))

(princ (solve (read-line)))

Measured memory_bytes: 17508
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// main function
int main()
{
	ll N = 0;
	ll K = 0;
	cin >> N >> K;

	if (ceil((float)N / 2) >= K) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define files_ds(name) name!=""?freopen(name".dat","r",stdin),freopen(name".sol","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

main()
{
    #ifdef I_love_Maria_Ivanova
        files("barik");
        freopen("debug.txt","w",stderr);
    #else
        files("");
        files_ds("");
    #endif

    int n;
    cin>>n;
    vi a(n);
    for (int i=0;i<n;i++){
        cin>>a[i];
        a[i]--;
    }
    int ans=0;
    for (int i=0;i<n;i++){
        if (a[i]==i){
            if (i!=n-1){
                ans++;
                swap(a[i],a[i+1]);
            }
            else{
                swap(a[i],a[i-1]);
                assert(a[i-1]!=i-1);
                ans++;
            }
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL<<60;
long long n, k;
vector<long long> a;

void solve() {
    sort(a.begin(), a.end());
    long long left = -INF, right = INF;
    while (right - left > 1)
    {
        long long x = (right + left) / 2;
        long long S = 0, T = 0;
        for (int i = 0; i < n; i++)
        {
            if(a[i] > 0) {
                long long l = -1, r = n;
                while (r - l > 1)
                {
                    long long m = (l + r) / 2;
                    if(a[i] * a[m] <= x) l = m;
                    else r = m;
                }
                S += r;
            }
            else if(a[i] < 0) {
                long long l = -1, r = n;
                while (r - l > 1)
                {
                    long long m = (l + r) / 2;
                    if(a[i] * a[m] <= x) r = m;
                    else l = m;
                }
                S += n - r;
            }
            else if(x >= 0) S += n;
            if(a[i] * a[i] <= x) T++;
        }
        long long num = (S - T) / 2;
        if(num >= k) right = x;
        else left = x;
    }
    cout << right << endl;
}
int main() {
    cin >> n >> k;
    a.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<map>

int main(void){
	int N,M;
	std::cin >> N >> M;
	
	std::multimap<int, int> war;
	for (int i=0;i<M;i++) {
		int tmpA,tmpB;
		std::cin >> tmpA >> tmpB;
		war.insert(std::make_pair(tmpB,tmpA));
	}
	
	int ans=0;
	int i=0;
	for (auto itr=war.begin();itr!=war.end();itr++) {
		//std::cout << itr->second << ":" << itr->first << '\n';
		if (itr->second>i) {
			ans++;
			i=itr->first-1;
		}
	}
	
	std::cout << ans << '\n';
	
	return 0;
}

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

public class Hello
{
    public static void Main()
    {
        hoge();
        System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var a = vars[0];
        var b = vars[1];
        var c = vars[2];
        vars = System.Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var k = vars[0];

        for(int i = 0; i  < k + 1; i++)
        {
            if(a < b && b < c)
            {
                Console.WriteLine("Yes");
                return;
            }
            if(a >= b)
            {
                b *= 2;
            }else if(b >= c)
            {
                c *= 2;
            }
        }
        Console.WriteLine("No");
    }
}

Measured memory_bytes: 28284
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin>>S;
  int ago;
  vector<string>day={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  for(int i=0;i<day.size();i++){
    if(S==day.at(i)){
      ago=(day.size())-i;
      cout<<ago<<endl;
      return 0;
    }
  }
}

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

int main(){
	int MAX=0;
	int n,m;
	cin>>n;
	string b[n];
	for(int i=0;i<n;i++) cin>>b[i];
	cin>>m;
	string r[m];
	bool a[n+m]={};
	for(int i=0;i<m;i++) cin>>r[i];
	string s[n+m];
	for(int i=0;i<n;i++) s[i]=b[i];
	for(int i=0;i<m;i++) s[i+n]=r[i];
	for(int i=0;i<n;i++){
		int x=1;
		if(a[i]) continue;
		for(int j=i+1;j<n+m;j++){
			if(s[i]==s[j]){
				a[i]=1;
				if(j<n) x++;
				else x--;
			}
		}
		MAX=max(MAX,x);
	}
	cout<<MAX;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    ll n = s.size() + 1;
    vector<P> cnt;
    int l = 0;
    int r = 0;
    for(char c : s){
        if(c == '<'){
            if(r != 0){
                cnt.push_back(make_pair(l, r));
                l = 0;
                r = 0;
            }
            l++;
        }else{
            r++;
        }
    }
    if(l != 0 || r != 0)cnt.push_back(make_pair(l, r));
    ll ans = 0;
    for(P p : cnt){
        ll a = p.first;
        ll b = p.second;
        if(a < b)swap(a, b);
        ans += a * (a + 1) / 2 + b * (b - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5116
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

const int64_t MAX_X = static_cast<int64_t>(1e9);

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(6
)");
#endif
    int64_t X;
    in >> X;
    int64_t ans = 0;
    int64_t sum = 0;
    for (int i = 1; i <= MAX_X; ++i) {
        sum += i;
        if (X <= sum) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;

  if (S.substr(0,N/2) == S.substr(N/2,N)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


bool used[1111], b[1111][1111];
ll idx[1111];

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



  cin >> n;
  vll a[1111];
  FOR(i, 1, n + 1) {
    rep(j, n - 1) {
      cin >> tmp;
      a[i].pb(tmp);
    }
  }
  ans = 1;
  queue<ll> q;
  FOR(i, 1, n + 1) q.push(i);
  while (!q.empty()) {
    ll cur = q.front();
    q.pop();
    ll to = a[cur][idx[cur]];
    if (b[to][cur]) {
      idx[cur]++;
      if (used[cur] || used[to]) {
        ans++;
        FOR(i, 1, n + 1) used[i] = false;
      }
      used[cur] = true;
      used[to] = true;
      if (idx[cur] < n - 1) q.push(cur);
      if (idx[to] < n - 1) q.push(to);
    }
    else {
      b[cur][to] = true;
      idx[cur]++;
    }

  }
  bool ok = true;
  FOR(i, 1, n + 1) if (idx[i] != n - 1) ok = false;
  if (!ok) cout << "-1" << endl;
  else cout << ans << endl;


  return 0;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string x;
    cin>>x;
    if(x[2]==x[3] && x[4]==x[5])
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
h, _w = gets.split.map(&:to_i)
dp = Array.new(10) { Array.new(10) { Float::INFINITY } }
10.times { |e| dp[e][e] = 0 }
ans = 0

10.times do |i|
  gets.split.map(&:to_i).each_with_index { |e, j| dp[i][j] = e }
end

10.times do |k|
  10.times do |i|
    10.times { |j| dp[i][j] = [dp[i][j], dp[i][k] + dp[k][j]].min }
  end
end

h.times do
  gets.split.map(&:to_i).each do |e|
    next if e == -1

    ans += dp[e][1]
  end
end

puts ans

Measured memory_bytes: 14436
import sys
sys.setrecursionlimit(10**9)

INF = 10**15

N = int(input())
As = list(map(int, input().split()))
adjL = [[] for _ in range(N)]
for _ in range(N-1):
    U, V = map(int, input().split())
    U, V = U-1, V-1
    adjL[U].append(V)
    adjL[V].append(U)

useds = [False] * N
sizes = [0] * N
dp0 = [[] for _ in range(N)]
dp1 = [[] for _ in range(N)]

def dfs(v):
    useds[v] = True
    sizes[v] = 1
    dp0[v] = [As[v] if As[v] > 0 else INF]
    dp1[v] = [As[v] if As[v] < 0 else INF]
    for v2 in adjL[v]:
        if useds[v2]: continue
        dfs(v2)
        merged0 = [INF] * (sizes[v]+sizes[v2])
        merged1 = [INF] * (sizes[v]+sizes[v2])
        for i in range(sizes[v]):
            for j in range(sizes[v2]):
                merged0[i+j] = min(merged0[i+j], dp0[v][i]+dp0[v2][j])
                merged1[i+j] = min(merged1[i+j], dp0[v][i]+dp1[v2][j])
                merged1[i+j] = min(merged1[i+j], dp1[v][i]+dp0[v2][j])
                merged1[i+j] = min(merged1[i+j], dp1[v][i]+dp1[v2][j])
                if dp0[v2][j] != INF:
                    merged0[i+j+1] = min(merged0[i+j+1], dp0[v][i])
                if dp1[v2][j] < 0:
                    merged0[i+j+1] = min(merged0[i+j+1], dp0[v][i])
                if dp0[v2][j] != INF:
                    merged1[i+j+1] = min(merged1[i+j+1], dp1[v][i])
                if dp1[v2][j] < 0:
                    merged1[i+j+1] = min(merged1[i+j+1], dp1[v][i])
        sizes[v] += sizes[v2]
        dp0[v] = merged0
        dp1[v] = merged1

dfs(0)

for i, (v0, v1) in enumerate(zip(dp0[0], dp1[0])):
    if v0 != INF or v1 < 0:
        print(i)
        break


Measured memory_bytes: 278660
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char x[10010];
	long long a,t=26,c=0,start,cha,i=0;//c代表长度 
	scanf("%lld",&a);
	while(a>i){
		i+=t;
		t*=26;
		c++;
	}
	start=i-(t/26)+1;
	for(int n=0;n<c;n++) x[n]=97;
	cha=a-start;
	//cout<<"i c start cha"<<endl<<i<<" "<<c<<" "<<start<<" "<<cha<<endl;
	int n=0;
	while(cha>0){
	//	cout<<cha<<' '<<cha%26<<endl;
		x[n]+=(cha%26);
		cha/=26;
		n++;
	}
	for(int n=c-1;n>=0;n--) cout<<x[n];
}



Measured memory_bytes: 3700
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
    int n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}
 
int cmp(int *a, int *b) { return *a - *b; }
int min_cost_sort(int n, int *w, int min, int max)
{
    int i, s, t, t1, t2, m, an, cur, ans;
    int *a, *v;
    char *f;
 
    a = malloc(n<<2), f = malloc(n), v = malloc((max+1)<<2);
    memcpy(a, w, n<<2), memset(f, 0, n);
 
    qsort(a, n, sizeof(int), cmp);
    for (i = 0; i < n; i++) v[a[i]] = i;
 
    ans = 0;
    for (i = 0; i < n; i++) {
        if (f[i]) continue;
        cur = i, s = 0, m = max, an = 0;
        while (1) {
            f[cur] = 1, an++, t = w[cur];
            if (t < m) m = t;
            s += t, cur = v[t];
            if (f[cur]) break;
        }
        t1 = s+(an-2)*m, t2 = m+s+(an+1)*min;
        ans += (t1 < t2)? t1: t2;
    }
    free(a), free(f), free(v);
    return ans;
}
 
int w[1002];
 
int main()
{
    int n, i, _w, min, max;
 
    n = in();
    min =  0x10101010;
    max = -0x10101010;
    for (i = 0; i < n; i++) {
        w[i] = _w = in();
        if (_w < min) min = _w;
        if (_w > max) max = _w;
    }
    printf("%d\n", min_cost_sort(n, w, min, max));
    return 0;
}



Measured memory_bytes: 2096
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
#import time
#start = time.time()

#s = input().split()
#t = [int(p) for p in s]
K = int(input())

#10桁まで生成する
l_1 = [] #1桁を格納するリスト

num_list = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
index_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

for i in range(1, len(num_list)):
    l_1.append(num_list[i])

#print('l_1:{}'.format(l_1))

def plus_keta(l):
    #前の桁数のリストを受け取って、もう一桁増やしたリストを返す
    list_return = []
    for i in range(len(l)):
        last_number = l[i][-1]
        #print(last_number)
        if(last_number == '0'):
            list_return.append(l[i] + num_list[0])
            list_return.append(l[i] + num_list[1])
        elif(last_number == '9'):
            list_return.append(l[i] + num_list[8])
            list_return.append(l[i] + num_list[9])
        else:
            last_number_index = eval(last_number)
            list_return.append(l[i] + num_list[last_number_index-1])
            list_return.append(l[i] + num_list[last_number_index])
            list_return.append(l[i] + num_list[last_number_index+1])
    return list_return



#plus_keta(l_1)
l_2 = plus_keta(l_1)
#print('l_2:{}'.format(l_2))
l_3 = plus_keta(l_2)
#print('l_3:{}'.format(l_3))
l_4 = plus_keta(l_3)
#print('l_4:{}'.format(l_4))
l_5 = plus_keta(l_4)
#print('l_5:{}'.format(l_5))
l_6 = plus_keta(l_5)
#print('l_6:{}'.format(l_6))
l_7 = plus_keta(l_6)
#print('l_7:{}'.format(l_7))
l_8 = plus_keta(l_7)
#print('l_8:{}'.format(l_8))
l_9 = plus_keta(l_8)
#print('l_9:{}'.format(l_9))
l_10 = plus_keta(l_9)
#print('l_10:{}'.format(l_10))

l = []
l.extend(l_1)
l.extend(l_2)
l.extend(l_3)
l.extend(l_4)
l.extend(l_5)
l.extend(l_6)
l.extend(l_7)
l.extend(l_8)
l.extend(l_9)
l.extend(l_10)
#print(l)
#print(l[100000-1])
print(int(l[K-1]))
#print('time:{}'.format(time.time()-start))

'''
s = ''
for i in range(len(n)):
    s += n[i]
print(s)
print(eval(s) - 3)
''' 
'''
def gen_lun(n):
    #nは桁数
    #nは2以上の整数を入れる（10まで）
    for i in range(1, len(num_list)):
        print(i)
'''

#gen_lun(2)


Measured memory_bytes: 21012
#include <iostream> 
#include <cmath>
#include <iomanip>
#include<stdio.h>
using namespace std; 
int main()
{
  int H,n,A[100000],sum,i;
  cin>>H>>n;
  sum=0;
  for(i=0;i<n;i++)
  {
    cin>>A[i];
    sum=sum+A[i];
    
    if(sum>=H){
        cout<<"Yes";
        return 0;
        
    }
  }
  cout<<"No";
}

Measured memory_bytes: 640
x, n = map(int, input().split())
if n > 0:
    p = list(map(int, input().split()))
    for i in range(n + 1):
        if (x - i) not in p:
            print(x - i)
            break
        
        if (x + i) not in p:
            print(x + i)
            break
    
else:
    print(x)

Measured memory_bytes: 9184
#include<stdio.h>
#include<string.h>
int main(void){
  char a[99];
  int i,n,count=0,j;
  scanf("%s",a);
  n=strlen(a);
  for(i=0;i<n;i++){
    if(a[i]!=a[n-1-i]) count=1;
  }
  for(i=0;i<(n-1)/2;i++){
    if(a[i]!=a[((n-1)/2)-1-i]) count=1;
  }
  for(i=((n+3)/2)-1,j=0;i<n;j++,i++){
    if(a[i]!=a[n-1-j]) count=1;
  }
  if(count==0) {
    printf("Yes");
  }else{
    printf("No");
  }
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>

int main(){
    int a,b,c,k;
    scanf("%d %d %d %d", &a,&b,&c,&k);
    int i=0;
    while(i<=k+1){
        if(a>=b){
            b *= 2;
            i++;
        }
        else if(b>=c){
            c *= 2;
            i++;
        }
        else break;
    }
    if(i<=k) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 1728
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int a = sc.nextInt();
        // スペース区切りの整数の入力
        int b = sc.nextInt();
        // 文字列の入力
        int t = sc.nextInt();
        // 出力
        System.out.println(t / a * b);

    }

}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
int i,j,n,a[200000],m=200001,c;
int main(){
  for(cin>>n;i<n;i++){
    cin>>a[i];
    m=min(m,a[i]);
    if(m>=a[i])c++;
  }
  cout<<c;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
}

Measured memory_bytes: 3648
#pragma region Include/Defines
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <queue>
#include <time.h>

using namespace std;
typedef long long lli;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<pii> vpii;
typedef vector <pll> vpll;
typedef long double ld;
#define all(a) std::begin(a), std::end(a)

const int INF = 0x3f3f3f3f;
const lli LINF = 0x3f3f3f3f3f3f3f3f;

template<typename T, typename T2> inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }
template<typename T, typename T2> inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }

#ifdef _DEBUG
#define epr(...) fprintf(stderr,__VA_ARGS__)
#else
#define epr(...) 
#endif
#pragma endregion


int n, k;
void clear() {
}

void read() {
}

void solve() {
	lli res = 0;
	int n0 = n / k;
	res += 1ll * n0 * n0 * n0;
	if (k % 2 == 0) {
		int nk2 = (n + k / 2) / k;
		res += 1ll * nk2 * nk2 * nk2;
	}
	printf("%lld\n", res);
}

int main() {
#ifdef _LOCAL_VAN
	freopen("in.txt", "r", stdin);
#endif
	while (scanf("%d%d", &n, &k) == 2) {
		clear();
		read();
		solve();
#ifndef _LOCAL_VAN
		return 0;
#endif
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long sum=0;
		int[] x=new int[100000000];
		for(int i=0;i<n;i++){
			int r=sc.nextInt();
			x[r]++;
			sum+=r;
		}
		
		int t=sc.nextInt();
		while(t-->0){
			int a=sc.nextInt();
			int b=sc.nextInt();
			x[b]+=x[a];
			sum+=(b-a)*x[a];
			x[a]=0;
			System.out.println(sum);
		}

	}
}

Measured memory_bytes: 448652
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X= min(A,B,C,D,E)

time = 0
if N%X !=0:
    time += N//X +5
else:
    time += N//X+4
print(time)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

ll dp[5005][5005], p[5005][5005], n, a, b, loc[5005];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> a >> b;
	for (int i = 0; i < n; ++i) {
		cin >> p[n-1][i];
		p[n-1][i]--;
	}
	loc[0] = 0;
	for (int i = n-1; i >= 1; --i) {
		int ct = 0;
		for (int j = 0; j < i+1; ++j) {
			if (p[i][j] != i) {
				p[i-1][ct] = p[i][j];
				++ct;
			} else
				loc[i] = j;
		}
		/* for (int j = 0; j < i; ++j)
			cout << p[i-1][j] << ' ';
		cout << endl; */
	}

	for (int i = 0; i < n; ++i)
		for (int j = 0; j <= i; ++j) {
			//last j guys have free left moves
			if (i == 0) {
				dp[i][j] = 0;
				continue;
			}
			dp[i][j] = (1LL<<60);
			if (loc[i] >= i+1-j) {
				dp[i][j] = min(dp[i][j], dp[i-1][j-1]);
				dp[i][j] = min(dp[i][j], a + dp[i-1][j-1]);
			}
			else {
				dp[i][j] = min(dp[i][j], dp[i-1][i-loc[i]]+b*(i-j-loc[i]));
				dp[i][j] = min(dp[i][j], a + dp[i-1][j]);
			}
		}
	cout << dp[n-1][0] << endl;
}

Measured memory_bytes: 389760
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
min = 0
cnt_2 = 0
lists = list(range(N + 1))
for i in range(X, N + 1):
    for j in range(len(A)):
        if i == 0 or i == N or i == X:
            continue
        elif i == A[j]:
            cnt += 1
for m in range(X, -1, -1):
    for n in range(len(A)):
        if m == 0 or m == N or m == X:
            continue
        elif m == A[n]:
            cnt_2 += 1
if cnt > cnt_2:
    min = cnt_2
elif cnt_2 > cnt:
    min = cnt
print(min)


Measured memory_bytes: 3064
def Inn(s):
    for i in range(len(s)):
        if i%2 == 0:
            if s[i] not in ['R', 'U', 'D']:
                return "No"
        else:
            if s[i] not in ['L', 'U', 'D']:
                return "No"
    return "Yes"

s = input()
print(Inn(s))

Measured memory_bytes: 2940
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    int N, K;
    cin >> N >> K;
    int m = N/2 + N%2;
    if (m >= K)cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

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

  vector<int> a(N);

  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  int Alice = 0;
  int Bob = 0;

  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      Alice += a.at(i);
    } else {
      Bob += a.at(i);
    }
  }
  
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b,c = I()
print("bust" if a+b+c >=22 else "win")


Measured memory_bytes: 10496
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;



int main()
{
double x1,x2,y1,c1,y2,c2,y,x;
while((scanf("%lf %lf %lf %lf %lf %lf",&x1,&x2,&y1,&y2,&c1,&c2))!=EOF)
{
x=((c1*y1-x2*c2)/(x1*c1-x2*y2));
y=((-(y2*y1)+x1*c2)/(x1*c1-x2*y2));
if(x==0)
{
x=0;
}
if(y==0)
{
y=0;
}
printf("%.3lf %.3lf\n",x,y);
}
return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n;
ll l[2020];
ll binary_search(ll i, ll j, ll lb, ll ub){
    while(ub-lb>1){
        ll mid=(lb+ub)/2;
        if(l[mid] < l[i]+l[j]) lb=mid;
        else ub=mid;
    }

    return lb;
}
int main() {
    cin>>n;
    REP(i, 0, n) cin>>l[i];

    sort(l, l+n);

    ll ans=0;
    REP(i, 0, n-2){
        REP(j, i+1, n-1){
            ll k=binary_search(i, j, j+1, n-1);

            if(j+1 < n-1){
                if(l[k+1] < l[i]+l[j]){
                    ans+=(k+1-j);
                }
                else if(l[k] < l[i]+l[j]){
                    ans+=(k-j);
                }
                else{
                    ans+=(k-1-j);
                }
            }
            else{
                if(l[k] < l[i]+l[j]){
                    ans++;
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[100010],ac[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;

int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>aa[i];
    c=0;
    for(int i=1;i<n;i++){
        c+=min(m,aa[i]-aa[i-1]);
    }
    C c+m E;
}

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

int main()
{
    int n,q;
    cin>>n;
    vector<int> v(n+1,0);
    for(int i=1;i<=n;i++)
        cin>>v[i];
    int sum=accumulate(v.begin(),v.end(),0);
    cin>>q;
    for(int i=0;i<q;i++)
    {
        int idx,val;
        cin>>idx>>val;
        cout<<sum+val-v[idx]<<endl;
    }
}


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

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;

  int X = (N + A - 1) / A * B;
  int Y = (N + C - 1) / C * D;

  cout << min(X, Y) << endl;

  return 0;
}


Measured memory_bytes: 3108
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>

#define m(a,b) memset(a,b,sizeof(a));
#define cpy(a,b) memcpy(a,b,sizeof(b));

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int maxn = 1e5 + 5;
const int inf = 1 << 30;

int n, m, ans = 0;
int main(){
	scanf("%d%d", &n, &m);
	if(n > 8 || m > 8) printf(":(\n");
	else printf("Yay!\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define rep(i,a,b) for(register int i=(a);i<(b);++i)
#define pb push_back
#define mx(a,b) (a>b?a:b)
#define mn(a,b) (a<b?a:b)
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;
using namespace std;

namespace IO
{
	const uint32 Buffsize=1<<15,Output=1<<24;
	static char Ch[Buffsize],*S=Ch,*T=Ch;
	inline char getc()
	{
		return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
	}
	static char Out[Output],*nowps=Out;
	
	inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

	template<typename T>inline void read(T&x)
	{
		x=0;static char ch;T f=1;
		for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
		for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
		x*=f;
	}

	template<typename T>inline void write(T x,char ch='\n')
	{
		if(!x)*nowps++='0';
		if(x<0)*nowps++='-',x=-x;
		static uint32 sta[111],tp;
		for(tp=0;x;x/=10)sta[++tp]=x%10;
		for(;tp;*nowps++=sta[tp--]^48);
		*nowps++=ch;
	}

	inline void readmd(int&x)
	{
		x=0;static char ch;
		for(ch=getc();!isdigit(ch);ch=getc());
		for(;isdigit(ch);ch=getc())x=(x*10ll+(ch^48))%998244353;
	}
}
using namespace IO;

void file()
{
	FILE*DSD=freopen("water.in","r",stdin);
	FILE*CSC=freopen("water.out","w",stdout);
}

const int MAXN=1e5+7;

static int A,B,Q;

static ll a[MAXN],b[MAXN];

inline void init()
{
	read(A),read(B),read(Q);
	Rep(i,1,A)read(a[i]);
	Rep(i,1,B)read(b[i]);
}

inline void solve()
{
	register ll x,pr1,pr2,sf1,sf2;

	a[A+1]=b[B+1]=1e11,a[0]=b[0]=-1e11;

	++A,++B;

	Rep(i,1,Q)
	{
		read(x);
		pr1=*(upper_bound(a,a+A+1,x)-1);
		pr2=*(upper_bound(b,b+B+1,x)-1);
		sf1=*lower_bound(a,a+A+1,x);
		sf2=*lower_bound(b,b+B+1,x);

		register ll sm=min(sf1-pr2+min(x-pr2,sf1-x),sf2-pr1+min(x-pr1,sf2-x));

		write(min(sm,min(x-min(pr1,pr2),max(sf1,sf2)-x)));
	}
	flush();
}

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

Measured memory_bytes: 5376
#include <stdio.h>
int main(){
  bool flag=0;
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a+b==c) flag=1;
  if(a+c==b) flag=1;
  if(b+c==a) flag=1;
  
  if(flag==1) printf("Yes\n");
  else printf("No\n");
}

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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	ll a, b, k;
	cin >> a >> b >> k;
	a = a - k;
	if(a < 0) {
		b += a;
		a = 0;
	}
	cout << max(a, 0LL) << " " << max(b, 0LL);
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 3608
n, y = map(int, input().split())
i = 0
flag = False
r = "-1 -1 -1"
while i <= n:
    j = 0
    while i+j <= n:
        if 10000*i+5000*j+1000*(n-i-j) == y:
            r = "{0} {1} {2}".format(i,j,(n-i-j))
            flag = True
        j += 1
    if flag: break
    i += 1
print(r)

Measured memory_bytes: 3060
def resolve():
    # 整数 1 つ
    n = input()
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    r=""
    for i in range(1, len(n)+1):
        if i % 2 == 1:
            r = r + n[i-1]

    print(r)

resolve()

Measured memory_bytes: 133512
#[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! {
        a: usize,
        b: usize,
    }
    let result = if (a == 1 && b == 2) || (a == 2 && b == 1) {
        3
    } else if (a == 1 && b == 3) || (a == 3 && b == 1) {
        2
    } else {
        1
    };
    println!("{}", result);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
#define MAXN 100000
#define LL long long
#define DB double
#define FR first
#define SE second
int N,K;
int main()
{
    scanf("%d%d",&N,&K);
    printf("%s",(K<=(N+1)/2)?"YES":"NO");
}

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

int main()
{
    int n,a=0,b=0,c=0,d=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        if(s=="AC") a++;
        if(s=="WA") b++;
        if(s=="TLE") c++;
        if(s=="RE") d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
}

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

int main() {
	int H, W;
	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0) break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i == 0 || j == 0 || i ==H-1 || j ==W-1) {
					cout << "#";
				}
				else {
					cout << ".";
							}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
	int n,m,co,minn,nn,m1,m2,chn,chk;
	int c[10002]={};
	int nu[10002]={};
	while(1){
		cin >> n;
		if(n==0){return 0;}
		c[0]=0;nu[0]=1;
		m=0;
		for(int i=0;i<n;i++){
			cin >> co;
			if(c[m]==co){
				nu[m]++;
			}else{
				//cout << c[m] <<":"<< nu[m] << " ";
				m++;
				c[m]=co;
				nu[m]=1;
			}
		}
				//cout << c[m] <<":"<< nu[m] << endl;
		c[m+1]=0;nu[m+1]=1;
		
		minn=n;
		for(int i=1;i<=m;i++){
			nn=n;chn=0;
			if(nu[i]==1&&c[i-1]==c[i+1]){
				m1=i-1;m2=i+1;chk=0;
				chn=1+nu[i-1]+nu[i+1];
			}else{
				if(nu[i]==3){
					m1=i;m2=i;chk=-1;
					chn=4;
				}
			}
			while(c[m1]==c[m2] && chn>=4){
				nn-=chn;
				m1=m1-1;m2=m2+1;
				chn=nu[m1]+nu[m2]+chk;
				chk=0;
			}
			if(minn>nn){minn=nn;}
		}
		cout << minn << endl;
	}
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int MOD = 1e9 + 7;
inline int mul (int a, int b) {
    return ((ll)a * b) % MOD;
}
inline int binpow (int a, int n) {
    int ans = 1;
    for (; n; n >>= 1ll) {
        if (n & 1ll) ans = mul(ans, a);
        a = mul(a, a);
    }
    return ans;
}
inline int inv (int x) {
    return binpow(x, MOD - 2);
}
vector <int> f;
inline int C (int n, int k) {
    return mul(f[n], mul(inv(f[k]), inv(f[n - k])));
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k;
    string s;
    cin >> k >> s;
    int n = (int)s.length();
    int ans = 0;
    f.assign(n + k + 1, 0);
    f[0] = 1;
    for (int i = 1; i <= n + k; i++) {
        f[i] = mul(f[i - 1], i);
    }
    for (int i = n; i <= n + k; i++) {
        int st1 = i - n, st2 = n + k - i;
        ans = (ans + mul(mul(binpow(25, st1), binpow(26, st2)), C(i - 1, n - 1))) % MOD;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 19888
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	string w;
	cin >> w;
	int memo[26] = { 0 };
	REP(i, w.size()) memo[w[i] - 'a']++;
	REP(i, 26) {
		if (memo[i] % 2) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int n; cin >> n;
    int a = 0, b = 0;
    a = n % 10;
    b = n / 10;
    if (a == 9 || b == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256