akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
using namespace std;
typedef pair <int, int> pii;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	string s, t;
	//long long n, A[1000000000];
	long long n, m;
	//int   y[100001], z[100001], x[10001] = {};
	pii y[100001];
	//pair<int, float> pii[100001];
	cin >> n;
	cin >> m;
	for (a = 0; a < m; a++)
	{
		cin >>b;
		cin >>c;
		y[a] = pii(b, c);
	}
	sort(y, y + m);
	//int temp;
	//for (i = 0; i < m - 1; i++) {
	//	for (j = m - 1; j > i; j--) {
	//		if (y[j - 1] > y[j]) {
	//			temp = y[j];        /* 交換する */
	//			y[j] = y[j - 1];
	//			y[j - 1] = temp;

	//			temp = z[j];        /* 交換する */
	//			z[j] = z[j - 1];
	//			z[j - 1] = temp;
	//		}
	//	}
	//}
	//cin >> a;
	//cin >> b;
	//cin >> c;
	//cin >> d;
	//for (a = 0; a < m; a++)
	//{
	//	cout << y[a].first << endl;

	//}for (a = 0; a < m; a++)
	//{
	//	cout << y[a].second << endl;

	//}
	//m = 0;
	b = 100000000;
	c = 0;
	for (a = 0; a < m; a++)
	{
		c = y[a].second;
		//cout << c << endl;

		b = min(b,c);
		
		if (y[a].first >= b)
		{
			d++;
			b = 100000000;
			a--;
		}
	}
	//for ( a = 1; a <= n; a++)
	//{
	//	for ( b = 0; b < m; b++)
	//	{
	//		if (a==y[b])
	//		{
	//			//c = 1;
	//			y[b] = 0;
	//			x[e] = b;
	//			e++;
	//			
	//		}
	//		if (a==z[b]&&y[b]==0)
	//		{
	//			while (e!=0)
	//			{
	//				e--;
	//				y[x[e]] = 0;
	//				z[x[e]] = 0;
	//			}
	//			/*for ( c = 0; c < m; c++)
	//			{
	//				if (y[c]==0)
	//				{
	//					y[c] = -1;
	//					z[c] = -1;
	//				}
	//			}*/
	//			d++;
	//		}
	//	}
	//}
	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	cout << d+1 << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

//すべて半閉区間で扱う
struct cBIT {
  vector<ll> v;
  ll n;
  cBIT(ll n) : n(n), v(n) {}
  void add(ll i, ll x) {
    i++;
    while (i <= n) {
      v[i - 1] += x;
      i += i & -i;
    }
  }
  ll sum(ll i) {
    ll r = 0;
    while (i >= 1) {
      r += v[i - 1];
      i -= i & -i;
    }
    return r;
  }
  ll sum(ll l, ll r){
    if(l>=r)return 0;
    return sum(r)-sum(l);
  }
  ll get(ll i){return sum(i+1)-sum(i);}
};
 
struct BIT {
  cBIT p, q;
  BIT(ll n) : p(n + 1), q(n + 1) {}
  void add(ll l, ll r, ll w) {
    p.add(l, -w * l);
    p.add(r, w * r);
    q.add(l, w);
    q.add(r, -w);
  }
  ll sum(ll r) {
    return p.sum(r) + q.sum(r) * r;
  }
  ll sum(ll l, ll r){
    if(l>=r)return 0;
    return sum(r)-sum(l);
  }
  ll get(ll i){return sum(i+1)-sum(i);}
};
//↑すべて半閉区間で扱う

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    BIT tree(N);
    vector<ll> a(N,0);
    for(ll i=0;i<N;++i)cin>>a[i];
    for(ll i=0;i<N;++i)tree.add(i,i+1,a[i]);
    vector<vector<ll>> dp(N+1, vector<ll>(N+1, -1));
    function<ll(ll,ll)> F=[&](ll x,ll y){
        if(dp[x][y]!=-1)return dp[x][y];
        if(y==x+1)return dp[x][y]=0;
        ll ret=INF;
        for(ll i=x+1;i<=y-1;++i)chmin(ret,F(x,i)+F(i,y));
        return dp[x][y]=ret+tree.sum(x,y);
    };
    prt(F(0,N))

    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;


int main(){
  int n;
  cin >> n;
  if(n % 2 == 0) print(n/2 * n/2);
  else print((n-1)/2 * (n+1)/2);

  
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char in[1001];
	char table[] = "w kstnhmyr";
	int p;
	
	scanf("%s", in);
	
	p = 0;
	
	while (in[p] != '\0'){
		if ('0' <= in[p] && in[p] <= '9'){
			if (in[p] == '0' && in[p + 1] == 'U'){
				printf("nn");
				p += 2;
				continue;
	 		}
			if (in[p] != '1'){
				printf("%c", table[in[p] - '0']);
			}
			p++;
		}
		switch (in[p++]){
		  case 'T':
		    printf("a");
			break;

		  case 'L':
		    printf("i");
			break;

		  case 'U':
		    printf("u");
			break;

		  case 'R':
		    printf("e");
			break;

		  case 'D':
		    printf("o");
			break;
		}
	
	}
	printf("\n");
	
	return (0);
}

			

Measured memory_bytes: 524
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <map>
#include <set>

using namespace std;


#define ll long long int


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, temp;
    cin>>n;
    vector<int> nimmsub(n, 0);
    for(int i=0; i<n-1; i++){
        cin>>temp;
        nimmsub[temp-1]++;
    }
    
    for(int i=0; i<n; i++){
        cout<<nimmsub[i]<<endl;
    }
    
    
    return 0;
    
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

lint dp[105][100005] = {0};

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

    int n, W;
    cin >> n >> W;

    vector<int> w(n);
    vector<lint> v(n);
    rep(i, n){
        cin >> w[i] >> v[i];
    }

    rep(i, n){
        rep(j, W + 1){
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if(j + w[i] <= W){
                dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
            }
        }
    }

    cout << dp[n][W] << endl;

    return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k,s;
  cin>>k>>s;
  long long res=0;
  for(int i=0;i<k+1;i++)
  {
    for(int j=0;j<k+1;j++)
    {
      if(s-(i+j)>k)continue;
      if(i+j>s)break;
      res++;

    }
  }
  cout<<res;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define str string
#define all(x) begin(x),end(x)
int main(){
    int N,K,X,Y=3;
    str s,t,u;
    cin>>s>>t>>u;
    cout<<'A'<<t.at(0)<<'C'<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
  public static double calc(int b,int c,int d,double n,int[][][]vis,double[][][]dp){
    if(Math.min(Math.min(b,c),Math.min(d,c))<0||(b==0&&c==0&&d==0))return 0;
    if(vis[b][c][d]==1)return dp[b][c][d];
    vis[b][c][d]=1;
    double sum=b+c+d;
    dp[b][c][d]=n/sum+(double)b/sum*calc(b-1,c,d,n,vis,dp)+(double)c/sum*calc(b+1,c-1,d,n,vis,dp)+(double)d/sum*calc(b,c+1,d-1,n,vis,dp);
    return dp[b][c][d];
  }
  public static void main(String[] args){
    int n,b=0,c=0,d=0,m;
    Scanner in=new Scanner(System.in);
    n=in.nextInt();
    for(int i=0;i<n;i++){
      m=in.nextInt();
      if(m==1)b++;
      else if(m==2)c++;
      else d++;
    }
    double[][][]dp=new double[n+1][n+1][n+1];
    int[][][]vis=new int[n+1][n+1][n+1];
    System.out.println(calc(b,c,d,(double)n,vis,dp));
    
  }
}

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

int main(){

    int a = 0, b = 0;
    int ans = 0;
    string s;
    cin >> s;
    for(int i=0; i < s.size(); i++){
        char c = s[i];
        if(c == '0'){
            if(b){
                b--;
                ans+=2;
            }
            else a++;
        }
        else{
            if(a){
                a--;
                ans+=2;
            }
            else b++;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 512
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    rand::Rng,
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

const K: usize = 40;

fn main() {
    input! {
        n: usize,
        k: usize,
        mut td: [(Usize1, usize); n]
    }
    td.sort_by_key(|&(_, d)| Reverse(d));
    let mut s = BinaryHeap::<(Reverse<usize>, usize)>::new();
    let mut p = 0;
    let mut ts = vec![0; n];
    let mut sum = 0;
    for i in 0..k {
        let (t, d) = td[i];
        if ts[t] == 0 {
            p += 1;
        }
        sum += d;
        ts[t] += 1;
        s.push((Reverse(d), t));
    }

    let mut ans = p * p + sum;
    for i in k..n {
        if p == k {
            break;
        }
        let (t, d) = td[i];
        if ts[t] != 0 {
            continue;
        }
        ts[t] = 1;
        sum += d;
        p += 1;
        while let Some((Reverse(dn), tn)) = s.pop() {
            if ts[tn] > 1 {
                ts[tn] -= 1;
                sum -= dn;
                break;
            }
        }
        ans = max(ans, sum + p * p);
    }
    println!("{}", ans);
}


Measured memory_bytes: 7376
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(string S) {
  bool f['z' - 'a' + 1] = {};

  REP(i, S.size()) { f[S[i] - 'a'] = true; }

  REP(i, 'z' - 'a' + 1) if (!f[i]) {
    char buf = 'a' + i;
    cout << buf << endl;
    return;
  }
  cout << "None" << endl;
}

int main() {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 512
# 2020/05/10
# AtCoder Beginner Contest 167 - D

# Input
n, k = map(int,input().split())
a = list(map(int,input().split()))
a.insert(0, -1)

# Calc
idx = a[1]
sendto = [0] * (n+1)
passed = [0] * (n+1)
sendto[0] = 1

cnt = 1
roopst = -1
while(idx != 1):
    if passed[idx] == 1:
        roopst = idx
        break
    sendto[cnt] = idx
    passed[idx] = 1
    cnt = cnt + 1
    idx = a[idx]

if roopst != -1:
    for i in range(n):
        if sendto[i] == roopst:
            roopstidx = i
            break
    if k < cnt:
        tgt = k % cnt
    else:
#        tgt = ((k-roopstidx) % cnt) + roopstidx + 1
        tgt = ((k-roopstidx) % (cnt-roopstidx)) + roopstidx

else:
    tgt = k % cnt

ans = sendto[tgt]

# Output
print(ans)


Measured memory_bytes: 32384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int a[n];
	zip(i, 0, n)
	{
		cin >> a[i];

	}

	zip(i, 1, n)
	{
		a[i] = a[i] ^ a[i - 1];
	}
	if (a[n - 1] == 0)
	{
		cout << "Yes" << en;
	}
	else
	{
		cout << "No" << en;
	}


	return 0;
}



Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  string s;
  vector<ll> march(5, 0);
  rep(i, n){
    cin >> s;
    if(s[0]=='M') ++march.at(0);
    if(s[0]=='A') ++march.at(1);
    if(s[0]=='R') ++march.at(2);
    if(s[0]=='C') ++march.at(3);
    if(s[0]=='H') ++march.at(4);
  }
  ll ans =0;
  rep(i, 5) rep(j, i) rep(k, j) ans += march.at(i)*march.at(j)*march.at(k);


  cout << ans << endl;



  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    s: chars,
  }
  let rev: Vec<_> = s.iter().rev().collect();
  let d = s.iter().zip(rev.iter()).filter(|&(&a, &&b)| a != b).count();

  puts!("{}\n", d / 2);
}


Measured memory_bytes: 4352
//Kaori Miyazono, did I reach you ?
//"I can't die because... I'm the one who will protect you." -Asuna Yuuki
 
#include <bits/stdc++.h>
using namespace std;

const int N = 200200;
const long long int inf = 1e18;
const int inf2 = 1e9;

typedef pair<int, int> pii;
vector<pii> adj[N];
long long int x[N];
int n, m;
long long int d[N];
int r[N], l[N];

void no() {
	cout << "No";
	exit(0);
}

void dfs(int v, int pos) {
	if (x[v] != inf && x[v] != pos) {
		no();
	}
	if (x[v] != inf) return;
	x[v] = pos;
	for(pii edge : adj[v]) {
		int u = edge.first;
		int cost = edge.second;
		dfs(u, x[v] + cost);
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		cin >> l[i] >> r[i] >> d[i];
		l[i]--;
		r[i]--;
		adj[l[i]].push_back(pii(r[i], d[i]));
		swap(l[i], r[i]);
		adj[l[i]].push_back(pii(r[i], -d[i]));
		swap(l[i], r[i]);
	}
	for(int i = 0; i < N; i++) x[i] = inf;
	if (m == 0) {
		cout << "Yes";
		return 0;
	}
	for(int i = 0; i < n; i++) {
		if (x[i] == inf) {
			dfs(i, 0);
		}
	}
	long long int mini = -inf;
	for(int i = 0; i < n; i++) mini = min(mini, x[i]);
	for(int i = 0; i < n; i++) x[i] += mini;
	for(int i = 0; i < n; i++) {
		if (x[i] > inf2) no();
	}
	cout << "Yes";
   	return 0;
}	

Measured memory_bytes: 17792
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	int X, Y, Z,an;
	cin >> X >> Y >> Z;
	cout << (X - Z) / (Y + Z) << endl;
	
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
using ppa = pair<pa,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#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 = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF INT_MAX
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

//4近傍
//int dy[]={0, 1, 0, -1};
//int dx[]={1, 0, -1, 0};

//8近傍
//int dy[]={0,0,1,-1,1,1,-1,-1};
//int dx[]={1,-1,0,0,1,-1,1,-1};

const ll MOD = 1000000007;

ll pow_mod(ll a,ll b,ll mod){
    ll tmp = 1;
    a %= mod;
    if(b > 0){
        tmp = pow_mod(a, b/2, mod);
        if(b % 2) tmp = (((tmp*tmp)%mod)*a)%mod;
        else tmp = (tmp*tmp)%mod;
    }
    return tmp;
}

void solve() {
    string s; cin >> s;
    stack<char> st;
    int n = s.size();
    rep(i,n){
        if(s[i] == 'B' && !st.empty()) st.pop();
        else if(s[i] != 'B') st.push(s[i]);
    }
    string a;
    while(!st.empty()){
        a += st.top();
        st.pop();
    }
    REVERSE(a);
    cout << a << endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
/*
 * 2629.cc: Manhattan
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long double ld;

/* global variables */

/* subroutines */

ld maxly(ld d, ld dx) {
  ld maxll = 0.0, d2 = d * d;
  for (ld y = 0.0; y <= d; y += 1.0) {
    ld x = sqrtl(d2 - y * y);
    ld l = x + y;
    if (y > 0.0 && x <= dx) {
      ld l0 = dx * 2 - x + y;
      ld l1 = 2.0 - dx * 2 + x + y;
      l = (l0 < l1) ? l0 : l1;
    }
    if (maxll < l) maxll = l;
  }
  return maxll;
}

ld maxlx(ld d, ld dx) {
  ld maxll = 0.0, d2 = d * d;
  for (ld x = 0.0; x + dx <= d; x += 1.0) {
    ld y = sqrtl(d2 - (x + dx) * (x + dx));
    ld l = x + dx + y;
    if (maxll < l) maxll = l;
  }
  return maxll;
}

ld search_max(ld d, ld dxl, ld dxr, ld (&f)(ld, ld)) {
  for (int i = 0; i < 200; i++) {
    ld dx0 = (dxl * 2 + dxr) / 3;
    ld dx1 = (dxl + dxr * 2) / 3;
    ld maxl0 = f(d, dx0);
    ld maxl1 = f(d, dx1);
    if (maxl0 > maxl1) dxr = dx1;
    else dxl = dx0;
  }
  return f(d, dxl);
}

/* main */

int main() {
  ld d;
  cin >> d;

  ld ly0 = search_max(d, 0.0, 0.5, maxly);
  ld ly1 = search_max(d, 0.5, 1.0, maxly);
  ld ly = (ly0 > ly1) ? ly0 : ly1;
  
  ld lx0 = search_max(d, 0.0, 0.5, maxlx);
  ld lx1 = search_max(d, 0.5, 1.0, maxlx);
  ld lx = (lx0 > lx1) ? lx0 : lx1;
  
  ld maxl = (ly > lx) ? ly : lx;
  printf("%.12Lf\n", maxl);
  return 0;
}

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

bool so[100010];
ll a[100010], b[100010];

int main() {
	for(int i=2;i<100010;i++){
		so[i]=true;
	}
	for(int i=2;i<100010;i++){
		for(int j=2;j<100010;j++){
			if(i*j>100001){
				break;
			}
			so[i*j]=false;
		}
	}
	for(int i=3;i<100001;i+=2){
		if(so[i]==true&&so[(i+1)/2]==true){
			a[i]=1;
		}
	}
	for(int i=3;i<100001;i++){
		b[i]=a[i]+b[i-1];
	}
	ll q;
	cin>>q;
	for(int i=0;i<q;i++){
		int l,r;
		cin>>l>>r;
		cout << b[r]-b[l-1]<<endl;
	}
}

Measured memory_bytes: 2304
import math
import numpy as np

N, D = map(int, input().split())
ctr = 0

X = [list(map(int, input().split())) for i in range(N)]
X = np.array(X)

def cal_distance(a, b):
    distance = np.sqrt(np.sum((a - b) ** 2))
    return (distance)

for i in range(N):
    
    for j in range(i + 1, N):
        
        dis = cal_distance(X[i], X[j])
        if (math.floor(dis) == dis):
            ctr += 1

print(ctr)

Measured memory_bytes: 12472
p = 10**9 + 7

L = input()
N =len(L)
powlis =[1]
foo = 1
for _ in range(N):
    foo = foo *3 %p
    powlis.append(foo)

foo = 2
ans = powlis[N-1]
for i,n in enumerate(L[1:-1]):
    i += 2
    if n == "1":
        ans += (foo* powlis[N-i])%p
        foo = (foo*2) %p
if L[-1]=="1" and N!=1:
    ans = (ans + foo*3)%p
else:
    ans = (ans +foo)%p
print(ans)


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

int main(){
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	cout.tie(NULL);
	
	long long int n,m;
	cin>>n>>m;
	map<long long int,long long int> hm;
	long long int i,p;
	string s;
	map<long long int,long long int> nop;
	map<long long int,long long int> ac;
	for(i=0;i<m;i++){
	    cin>>p>>s;
	    if(s=="AC"){
	        ac[p]=1;
	    }
	    else{
	        if(ac[p]==0){
	            nop[p]++;
	        }
	    }
	}
	long long int noc=0,no=0;
	for(auto itr=ac.begin();itr!=ac.end();itr++){
	    if(itr->second==1){
	        noc++;
	        no=no+nop[itr->first];
	    }
	}
	
	cout<<noc<<" "<<no;
	return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int v[MAXN];

void solve(){
	int n, mn, mx, cnt_mn, cnt_mx;
	scanf("%d", &n);
	mn = INF;
	mx = 0;
	REP(i, 0, n){
		scanf("%d", &v[i]);
		mn = min(mn, v[i]);
		mx = max(mx, v[i]);
	}
	if (mx - mn >= 2){
		printf("No\n");
		return;
	}
	if (mx == mn){
		if (mn == n - 1 || 2 * mn <= n){
			printf("Yes\n");
		} else {
			printf("No\n");
		}
		return;
	}
	if (mx == mn + 1){
		cnt_mn = 0;
		cnt_mx = 0;
		REP(i, 0, n){
			if (v[i] == mn){
				cnt_mn++;
			}
			if (v[i] == mx){
				cnt_mx++;
			}
		}
		if (cnt_mn <= mn && cnt_mx >= 2 * (mx - cnt_mn)){
			printf("Yes\n");
		} else {
			printf("No\n");
		}
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

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

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

  int abs_mn = INF;
  int minus = 0;
  rep(i, n){
    abs_mn = min(abs_mn, abs(a[i]));
    if(a[i] < 0) minus++;
  }

  ll ans = 0;
  rep(i, n){
    ans += abs(a[i]);
  }
  if(minus & 1){
    ans -= 2 * abs_mn;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
# Aizu Problem 0094: Calculation of Area
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


a, b = [int(_) for _ in input().split()]
A = a * b / 3.305785
print("%.6f" % A)

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

fn read_pair<T: std::str::FromStr>() -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let mut it = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap());
    (it.next().unwrap(), it.next().unwrap())
}

fn main() {
    let n = read::<usize>();
    let mut ab: Vec<(u32, u32)> = (0..n).map(|_| read_pair::<u32>()).collect();
    ab.sort_by_key(|k| k.1);

    let mut spent: u32 = 0;
    for i in 0..n {
        spent += ab[i].0;
        if spent > ab[i].1 {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 6524
input = gets.chomp.split(' ').map { |v| v.to_i }
n = input[0]
m = input[1]

cities = []
prefectures = []

m.times { |i|
  input = gets.chomp.split(' ').map { |v| v.to_i }
  
  prefectures[input[0]-1] = 1
  
  cities.push({
    prefecture: input[0],
    year: input[1]
  })
}

tmp = cities.sort {|a, b| a[:year] <=> b[:year]}
tmp.each {|city|
  city[:id] = format('%06d%06d', city[:prefecture], prefectures[city[:prefecture]-1])
  prefectures[city[:prefecture]-1] += 1
}

cities.each {|city|
  puts city[:id]
}

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

int main()
{
    int s, count = 1;
    cin >> s;
    while (1)
    {
        if (s == 4 || s == 2 || s == 1)
        {
            break;
        }
        else if (s % 2 != 0)
        {
            s *= 3;
            s++;
            count++;
        }
        else if (s % 2 == 0)
        {
            s /= 2;
            count++;
        }
    }
    cout << count + 3 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cctype>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <deque>
#include <map>
#include <bitset>
#include <functional>
#include <cmath>

#define INF 1000000000
using namespace std;

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

	vector<long long> a;
	vector<long long> b;

	for(long long i = 0; i < n; i++){
		long long aa, bb;
		cin >> aa >> bb;
		a.push_back(aa);
		b.push_back(bb);
	}

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

	if(n%2 == 1){
		cout << b[n/2] - a[n/2] + 1 << endl;
	}else{
		cout << (b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1])+1 << endl;
	}
}


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

int main(){
  int i,array[200001]={},c;
  string a,b;
  cin>>a>>b;
  if(a.size()<b.size()){
    cout<<"LESS"<<endl;
    return 0;
  }else if(a.size()>b.size()){
    cout<<"GREATER"<<endl;
    return 0;
  }else{
    for(i=0;i<a.size();i++){
      if(a[i]<b[i]){
        cout<<"LESS"<<endl;
        return 0;
      }else if(a[i]>b[i]){
        cout<<"GREATER"<<endl;
        return 0;
      }
    }
  }
  cout<<"EQUAL"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		
		if(D == 25) {
			System.out.println("Christmas");
		} else if(D == 24) {
			System.out.println("Christmas Eve");
		} else if(D == 23) {
			System.out.println("Christmas Eve Eve");
		} else if(D == 22) {
			System.out.println("Christmas Eve Eve Eve");
		}
		
	}
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll x;
	cin >> x;
	ll money = 100;	
	int ans = 0;
  	while(money < x){
      money *= 1.01;
      ans++;
    }
    cout << ans << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

const int N = 1001;
bool table[N][N];

int main() {
  int V, d;
  while (scanf("%d%d", &V, &d) != EOF) {
    memset(table, false, sizeof(table));

    int prev = 1, curr = 2;
    for (int i = 0; i < V && !table[curr][prev]; ++i) {
      table[curr][prev] = true;
      curr += prev;
      prev = curr - prev;
      curr %= N;
      prev %= N;
    }

    prev = -100000000;
    int ans = 0;
    REP(i, N) {
      REP(j, N) {
        if (table[i][j]) {
          if (i - prev >= d) { ++ans; }
          prev = i;
          break;
        }
      }
    }

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

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)



int main(){
    int n,k;
    cin >> n >> k;
    if(n%k == 0)cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lld long long int
#define vi vector<int>
#define vlld vector<lld>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define mii map<int, int>
#define vii vector<pii>
 
using namespace std;
 
 
 
int main(){
   	std::ios::sync_with_stdio(false);
   	

   	int x,five=0,seven=0;
   	for(int i=0;i<3;i++){
   		cin>>x;
   		if(x==5) five++;
   		else if(x==7) seven++;
   	}
   	if(five==2 && seven==1){
   		cout<<"YES";
   	}
   	else{
   		cout<<"NO";
   	}
   	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;

int N, M;
Graph G;
vector<int> us, vs;

bool rec(int v, int p, int target, long long &path) {
    if (v == target) {
        path = 0;
        return true;
    }
    for (auto e : G[v]) {
        if (e.first == p) continue;
        if (rec(e.first, v, target, path)) {
            path |= (1LL<<e.second);
            return true;
        }
    }
    return false;
}

int bitcount(long long bit) {
    int con = 0;
    for (int i = 0; i <= 60; ++i) if (bit & (1LL<<i)) ++con;
    return con;
}

long long solve() {
    vector<long long> paths(M, 0);
    for (int i = 0; i < M; ++i) rec(us[i], -1, vs[i], paths[i]);
    long long res = 0;
    for (long long bit = 0; bit < (1<<M); ++bit) {
        long long val = 0;
        for (int i = 0; i < M; ++i) if (bit & (1LL<<i)) val |= paths[i];
        long long remnum = N-1 - bitcount(val);
        if (bitcount(bit) % 2 == 0) res += 1LL<<remnum;
        else res -= 1LL<<remnum;
    }
    return res;
}

int main() {
    cin >> N;
    G.assign(N, vector<Edge>());
    for (int i = 0; i < N-1; ++i) {
        int x, y; cin >> x >> y; --x, --y;
        G[x].emplace_back(y, i);
        G[y].emplace_back(x, i);
    }
    cin >> M;
    us.resize(M), vs.resize(M);
    for (int i = 0; i < M; ++i) {
        cin >> us[i] >> vs[i];
        --us[i], --vs[i];
    }
    cout << solve() << endl;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll k,x;
	cin >> k >> x;
	for(ll i=x-k+1; i<=x+k-1; i++) cout << i << " ";
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>


/* ---------- Namespace ---------- */

using namespace std;


/* ---------- Type Abbreviation ---------- */

template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

using ll = long long;
using PL = P<ll, ll>;
using PS = P<string, ll>;

using VI = V<int>;
using VVI = V<VI>;
using VL = V<ll>;
using VVL = V<VL>;
using VS = V<string>;
using VB = V<bool>;
using VVB = V<VB>;
using VPL = V<PL>;
using VPS = V<PS>;

#define fst first
#define snd second


/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)


/* ---------- container ---------- */

#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define GSORT(c) sort(ALL(c), greater<decltype((c).front())>())
#define SZ(x) (LL((x).size()))


/* ---------- repetition ---------- */

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)

#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// Usual REP runs from 0 to n-1 (R: n to 0)
// Natural REP runs from 1 to n (R: n to 1)


/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = 3.14159265358979;
// const ll dx[4] = {0, -1, 1, 0};
// const ll dy[4] = {-1, 0, 0, 1};
// const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};


/* ---------- Short Functions ---------- */

template <typename T>
T square(T a) {
    return a * a;
}


/* ---------- Debug ---------- */
#define GET_VAR_NAME(variable) #variable

#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;
#define testP(p) cout << GET_VAR_NAME(p) << " = (" << (p).fst << ", " << (p).snd << ")" << endl;


/* ^^^^^^^^^^^^^^^ Settting Part ^^^^^^^^^^^^^^^ */

/* ---------- Variances ---------- */


/* ---------- Functions ---------- */


/* ---------- Main Function ---------- */

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

    ll N;
    cin >> N;

    ll digit = 0;
    bool nine = true;

    while (N >= 10) {
        if (N % 10 < 9) {
            nine = false;
        }
        N /= 10;
        digit++;
    }

    if (nine) {
        cout << N + digit * 9 << endl;
    } else {
        cout << N - 1 + digit * 9 << endl;
    }
    return 0;
}

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

int main() {
	int n,d,x;
	cin >> n >> d >> x;
	for(int i = 0;i < n;i++)
	{
		int a;
		cin >> a;
		x += (d - 1) / a +1;
	}
    cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }
 
int a[200001];
bool b[200001];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = n; i >= 1; i--) {
        int x = a[i];
        for (int j = i << 1; j <= n; j += i) {
            x ^= b[j];
        }
        b[i] = x;
        if (x)
            ans++;
    }
    cout << ans << "\n";
    for (int i = 1; i <= n; i++) {
        if (b[i]) {
            cout << i << " ";
        }
    }
 
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(Math.min(A, B) + " " + Math.max(0, A + B - N));

    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
	int sx,sy,tx,ty;
	cin >> sx >> sy >> tx >> ty;
	const int dx=tx-sx,dy=ty-sy;
 
	// Path 1
	cout << string(dy,'U') << string(dx,'R');
	
	// Path 2
	cout << string(dy,'D') << string(dx,'L');
		
	// Path 3
	cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
	
	// Path 4
	cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';
		
	// EndLine
	cout << endl;
	return 0;
}

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

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

constexpr int MAX_N = 24;
constexpr int MAX_C = 4;

int n;
int x[MAX_N], y[MAX_N], r[MAX_N], c[MAX_N];

int ans;
int over[MAX_N];
bool visited[1 << MAX_N];

inline int square(int value) {
	return value * value;
}

inline bool intersect(int x1, int y1, int r1, int x2, int y2, int r2) {
	return square(x1 - x2) + square(y1 - y2) < square(r1 + r2);
}

void dfs(int rest, int cnt = 0) {
	chmax(ans, cnt);
	visited[rest] = true;

	int candidates[MAX_C] = {};
	for(int i = 0; i < n; ++i) {
		if((rest & (1 << i)) && (rest & over[i]) == 0) {
			candidates[c[i]] |= 1 << i;
		}
	}

	for(const auto &bit : candidates) {
		for(int p = bit; p;) {
			const int i = p & -p;
			p &= p - 1;

			for(int q = p; q; q &= q - 1) {
				const int j = q & -q;
				const int next_rest = rest ^ (i | j);
				if(!visited[next_rest]) dfs(next_rest, cnt + 2);
			}
		}
	}
}

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

	while(cin >> n && n) {
		fill_n(over, n, 0);

		for(int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i] >> r[i] >> c[i];
			--c[i];

			for(int j = 0; j < i; ++j) {
				if(intersect(x[i], y[i], r[i], x[j], y[j], r[j])) {
					over[i] |= 1 << j;
				}
			}
		}

		fill_n(visited, 1 << n, false);
		ans = 0;
		dfs((1 << n) - 1);
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

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

int main() {
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<string> S(N);
    for(auto &e : S) cin >> e;

    string ans = "", tmp = "";
    auto dfs = [&](auto &&dfs, int i, int a, int b, int c) {
        if(!ans.empty()) return;
        if(a < 0 or b < 0 or c < 0) return;
        if(i == N) { ans = tmp; return; }
        if(S[i] == "AB") {
            tmp += 'A';  dfs(dfs, i + 1, a + 1, b - 1, c);
            tmp[i] = 'B'; dfs(dfs, i + 1, a - 1, b + 1, c);
            tmp.pop_back();
        } else if(S[i] == "BC") {
            tmp += 'B'; dfs(dfs, i + 1, a, b + 1, c - 1);
            tmp[i] = 'C'; dfs(dfs, i + 1, a, b - 1, c + 1);
            tmp.pop_back();
        } else if(S[i] == "AC") {
            tmp += 'A'; dfs(dfs, i + 1, a + 1, b, c - 1);
            tmp[i] = 'C'; dfs(dfs, i + 1, a - 1, b, c + 1);
            tmp.pop_back();
        }
    };

    dfs(dfs, 0, A, B, C);
    if(!ans.empty()) {
        cout << "Yes" << '\n';
        for(auto &e : ans) cout << e << '\n';
    } else {
        cout << "No" << '\n';
    }
    return 0;
}


Measured memory_bytes: 16056
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    string str;
    cin >> str;
    
    // calculation
    str.replace(3, 1, "8");
    
    cout << str << "\n";
    return 0;
}


Measured memory_bytes: 256