akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
#include<random>

//by Skeef79

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}

int first_digit(int k)
{
	int pw = 10;
	while (pw<k)
		pw *= 10;
	pw /= 10;
	return k / pw;
}
int last_digit(int k)
{
	return k % 10;
}

void solve()
{
	int n;
	cin >> n;

	map<pair<int, int>, int> mp;
	for (int i = 1; i <= n; i++)
		mp[{first_digit(i), last_digit(i)}]++;

	int ans = 0;
	for (auto to : mp)
		if (to.first.first == to.first.second)
			ans += to.second * to.second;
		else
			ans += to.second* mp[{to.first.second, to.first.first}];
	cout << ans;
}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();

}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

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

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    int sum = 0;
    int remove = 0;
    int final = 0;
    for(int i = 1; i <= n; i++){
        if(sum + i > n){
            remove = sum + i - n;
            final = i;
            break;
        }
        sum += i;
    }

    for(int i = 1; i <= final; i++){
        if(i == remove) continue;
        cout << i << endl;
    }


}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	long long int a,b;
	cin >> a >> b;
	if(a >= 0 && b >= 0){
		if(a <= b) cout << b - a << endl;
		else if(a == 0 || b == 0) cout << a - b + 1 << endl;
		else  cout << a - b + 2 << endl;
	}
	else if(a >= 0 && b < 0){
		if(a >= -b) cout << 1 + a + b << endl;
		else cout << 1 - a - b << endl;
	}
	else if(a < 0 && b >= 0){
		if(b == 0) cout << -a << endl;
		else if(-a <= b) cout << 1 + a + b << endl;
		else cout << 1 - a - b << endl;
	}
	else{
		if(a <= b) cout << b - a << endl;
		else cout << a - b + 2 << endl;
	}
	return 0;
}

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

int main()
{
	int x, n, t ;
	cin >> x >> n ;
	
	vector<bool> mask(102, true);
	while(n--)
	{
		cin >> t ;
		mask[t] = false ;
	}
	
	for(int i = 0; i <= 100; ++i)
	{
		if(mask[x-i])
		{
			cout << x - i << '\n' ;
			break ;
		}
		if(mask[x+i])
		{
			cout << x + i << '\n' ;
			break ;
		}
	}
}


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

using namespace std;

typedef long long ll;

string solve(ll x){
  string res;
  if(x == 0LL){ return "0"; }
  ll a,b;
  int t = 0;
  for(; x ; t++){
    t = t & 1;
    a = x / 10;
    b = x - a * 10;
    if(b < 0 && t == 0){
      a--;
      b += 10;
    }else if(b > 0 && t == 1){
      a++;
      b -= 10;
    }
    b = (b < 0 ? -b : b);
    res = " " + res;
    res[0] = b + '0';
    x = a;
  }
  return res;
}

int main(){
  ll x;
  while(cin >> x, x){
    cout << solve(x) << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int k[n];
  rep(i,n)cin >> k[i];
  sort(k,k+n);
  cout << k[n/2]-k[n/2-1] << endl;
}  


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    vector<int> V(N);
    for (int i = 0; i < N; i++) cin >> V[i];
    sort(V.begin(), V.end());
    double ans = V[0];
    for (int i = 1; i < N; i++) {
        ans = (ans + V[i]) / 2;
    }
    printf("%.12f\n", ans);
}

Measured memory_bytes: 888
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
a = inpl()
res = 0
for i in range(n-1):
    if a[i+1] + a[i] > m:
        r = a[i+1] + a[i] - m
        res += r
        if a[i] <= m:
            a[i+1] -= r
        else:
            a[i+1] = 0
            a[i] = m
print(res)         

Measured memory_bytes: 85228
#include <bits/stdc++.h>
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(i,a,n) for(int i = a;i < (int)(n);i++)
using namespace std;
typedef long long ll;
 
int main(){
    int N;
    cin >> N;

    vector<ll> H(N);

    rep(i,N){
        cin >> H[i];
    }

    bool ok = true;

    for(int i = N-2;i >= 0;i--){
        if(H[i] - 1 == H[i+1]){
            H[i]--;
        }else if(H[i] - 1 > H[i+1]){
            ok = false;
        }
    }

    if(ok){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

ll MAX = pow(10, 5) * 2 + 1;
ll N, K;

vector<ll> calc(vector<ll>& ans) {
  vector<vector<ll>> place(MAX);
  for (ll i = 0; i < ans.size(); ++i) {
    place.at(ans.at(i)).push_back(i);
  }
  vector<ll> res;
  ll index = 0;
  while (index < ans.size()) {
    if (lower_bound(place.at(ans.at(index)).begin(), place.at(ans.at(index)).end(), index + 1) == place.at(ans.at(index)).end()) {
      res.push_back(ans.at(index));
    }
    else {
      index = *lower_bound(place.at(ans.at(index)).begin(), place.at(ans.at(index)).end(), index + 1);
    }
    index += 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;
  vector<ll> A(N);
  vector<vector<ll>> place(MAX);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
    place.at(A.at(i)).push_back(i);
  }
  // A = calc(A);
  // for (ll i = 0; i < A.size(); ++i) {
  //   cout << A.at(i) << " ";
  // }
  // cout << "\n";
  ll power = 40;
  vector<vector<ll>> d(power, vector<ll>(N));
  for (ll i = 0; i < N; ++i) {
    ll index = lower_bound(place.at(A.at(i)).begin(), place.at(A.at(i)).end(), i + 1) - place.at(A.at(i)).begin();
    if (index == place.at(A.at(i)).size()) {
      index = 0;
    }
    d.at(0).at(i) = (place.at(A.at(i)).at(index) + 1) % N;
  }
  for (ll i = 0; i < power - 1; ++i) {
    for (ll j = 0; j < N; ++j) {
      d.at(i + 1).at(j) = d.at(i).at(d.at(i).at(j));
    }
  }
  vector<vector<ll>> len(power, vector<ll>(N));
  for (ll i = 0; i < N; ++i) {
    len.at(0).at(i) = (d.at(0).at(i) - 1) - i;
    if (len.at(0).at(i) <= 0) {
      len.at(0).at(i) += N;
    }
    if (len.at(0).at(i) <= 0) {
      len.at(0).at(i) += N;
    }
    len.at(0).at(i) += 1;
  }
  for (ll i = 0; i < power - 1; ++i) {
    for (ll j = 0; j < N; ++j) {
      len.at(i + 1).at(j) = len.at(i).at(d.at(i).at(j)) + len.at(i).at(j);
    }
  }
  // for (ll i = 0; i < power; ++i) {
  //   for (ll j = 0; j < N; ++j) {
  //     cout << len.at(i).at(j) << " ";
  //   }
  //   cout << "\n";
  // }
  ll now = 0;
  ll num = 0;
  K *= N;
  while (true) {
    bool update = false;
    for (ll i = power - 1; i >= 0; --i) {
      if (len.at(i).at(now) <= K) {
        update = true;
        K -= len.at(i).at(now);
        now = d.at(i).at(now);
        break;
      }
    }
    if (!update) {
      break;
    }
  }
  // cout << now << "\n";
  // cout << K << "\n";
  vector<ll> ans;
  for (ll i = 0; i < K; ++i) {
    ans.push_back(A.at(now + i));
  }
  ans = calc(ans);
  for (ll i = 0; i < ans.size(); ++i) {
    cout << ans.at(i) << " ";
  }
  cout << "\n";
}


Measured memory_bytes: 156704
#include <iostream>

int main(){
  int N = 3;
  
  std::cin>>N;
  N = N%10;
  if(N == 3){
    std::cout<<"bon";
  }
  else if(N == 0||N == 1||N == 6||N == 8){
    std::cout<<"pon";
  }
  else{
    std::cout<<"hon";
  }
}

Measured memory_bytes: 3624
/*  ex7_3
    L40S38  */
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int high,wide,i,j;
    //high,wide:マス目の縦,横の長さ
    char **cells;
    scanf("%d %d",&high,&wide);

    int *black_exist_high,*black_exist_wide;
    //black_exist_high:黒いマスがあった行番号を格納
    //black_exist_wide:黒いマスがあった列番号を格納

    cells=(char**)calloc(high,sizeof(char*));
    if(cells==NULL){
        printf("memory allocation error.");
        exit(1);
    }
    for(i=0;i<high;i++){
        cells[i]=(char*)calloc(wide,sizeof(char));
        if(cells[i]==NULL){
            printf("memory allocation error.");
            exit(1);
        }
    }
    
    black_exist_high=(int*)calloc(high,sizeof(int));
    if(black_exist_high==NULL){
        printf("memory allocation error.");
        exit(1);
    }
    black_exist_wide=(int*)calloc(wide,sizeof(int));
    if(black_exist_wide==NULL){
        printf("memory allocation error.");
        exit(1);
    }
    for(i=0;i<high;i++){
        for(j=0;j<wide;j++){
            scanf(" %c",&cells[i][j]);
            if(cells[i][j]=='#'){
                black_exist_high[i]=1;
                black_exist_wide[j]=1;
                //黒いマスがあったらその行、列に印（1）をつける
            }
        }
    }
    
    for(i=0;i<high;i++){
        if(black_exist_high[i]==1){
            for(j=0;j<wide;j++){
                if(black_exist_wide[j]==1){
                    printf("%c",cells[i][j]);
                    //行・列の両方に印があった要素だけ出力
                }
            }
            printf("\n");
            free(cells[i]);
        }
    }
    free(cells);
    free(black_exist_high);
    free(black_exist_wide);
    return 0;
}


Measured memory_bytes: 1656
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int f(int n){
    if(n%2) return 3*n+1;
    else return n/2;
}
int main(){
    int n, t, a;
    cin >> n >> t >> a;
    vector<int> h(n+1,0);
    int m = 1000000000;
    int ans;
    rep(i,n){
        int b;
        cin >> b;
        h[i] = t*1000 - b*6; 
        if(m > abs(a*1000-h[i])){
            m = abs(a*1000-h[i]);
            ans = i+1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	double x[1010], y[1010], r[1010];
	cin>>x[0]>>y[0]>>x[1]>>y[1];
	r[0]=0, r[1]=0;
	int n; cin>>n;
	for(int i=2; i<=n+1; i++) cin>>x[i]>>y[i]>>r[i];
	double d[1010][1010];
	for(int i=0; i<n+2; i++){
		d[i][i]=0;
		for(int j=0; j<i; j++){
			double l=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
			d[i][j]=d[j][i]=max(0.0, l-(r[i]+r[j]));
		}
	}
	using Pd=pair<double, int>;
	priority_queue<Pd, vector<Pd>, greater<Pd>> que;
	double dist[1010];
	fill(dist, dist+n+2, 1e10);
	dist[0]=0;
	que.push({0, 0});
	while(!que.empty()){
		auto p=que.top(); que.pop();
		int x=p.second;
		if(dist[x]<p.first) continue;
		for(int y=0; y<n+2; y++){
			if(dist[y]>dist[x]+d[x][y]){
				dist[y]=dist[x]+d[x][y];
				que.push({dist[y], y});
			}
		}
	}
	printf("%.10lf\n", dist[1]);
	return 0;
}


Measured memory_bytes: 13808
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    print(10 - N / 200);
    
}


Measured memory_bytes: 3624
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

#define int ll

#define INF 10101010

struct FastIO
{
  FastIO() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(0); 
  }
}fastio;

signed main() {
  int n,m,q;
  std::cin >> n >> m >> q;
  std::vector<std::vector<int> > trains(n,std::vector<int>(n,0));
  rep(i,m) {
    int l,r;
    std::cin >> l >> r;
    l--;r--;
    trains[l][r]++;
  }
  std::vector<std::vector<int> > train_sum(n,std::vector<int>(n,0));
  rep(l,n) for(int r=l;r<n;r++) {
    if(l<r) train_sum[l][r] = train_sum[l][r-1];
    for(int i=l;i<=r;i++) {
      train_sum[l][r] += trains[i][r];
    }
  }
  rep(i,q) {
    int l,r;
    std::cin >> l >> r;
    l--;r--;
    std::cout << train_sum[l][r] << ENDL;
  }
  return 0;
}

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

int bubbleSort(int A[],int N){
    int sw = 0;
    bool flag = 1;
    for(int i = 0; flag; i++){
        flag = 0;
        for(int j = N - 1; j >= i + 1; j--){
        if(A[j] < A[j-1]){
            swap(A[j], A[j-1]);
            flag = 1;
            sw++;
        }
        }
    }
    return sw;
}
int main(){
    int A[100],N,sw;
    cin >> N;
    for(int i = 0; i < N;i++)cin >> A[i];
    sw = bubbleSort(A,N);
    for(int i = 0; i < N; i++){
        if(i)cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    return 0;
}



Measured memory_bytes: 3124
while true 
a,op,b = gets.split
case op
when "+"
puts a.to_i + b.to_i
when"-"
puts a.to_i - b.to_i
when "*"
puts a.to_i * b.to_i
when "/"
puts a.to_i / b.to_i
when "?"
break
end
end

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

typedef long long LL;

const int N=100000;

struct frac{
  LL x,a,b;
  frac(LL X=0,LL A=0,LL B=1){x=X;a=A;b=B;}
  bool operator < (const frac &p)const{return x<p.x||x==p.x&&a*p.b<b*p.a;}
};

int n;
LL sum;
struct board{
  int x,y;
}a[N+9];

bool cmp(const board &a,const board &b){return max(a.x,a.y)>max(b.x,b.y);}

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n;++i){
	scanf("%d%d",&a[i].x,&a[i].y);
	sum+=a[i].x;
  }
}

LL pre[N+9];

void Get_pre(){
  sort(a+1,a+n+1,cmp);
  for (int i=1;i<=n;++i) pre[i]=pre[i-1]+max(a[i].x,a[i].y);
}

frac ans;

void Get_ans(){
  for (int i=1;i<=n;++i){
	int p=lower_bound(pre+1,pre+i,sum-a[i].y)-pre;
	frac now;
	if (p==i){
	  p=lower_bound(pre+i,pre+n+1,sum-a[i].y+max(a[i].x,a[i].y))-pre;
	  if (p==n+1) continue;
	  now=frac(n-p,min(pre[p]+a[i].y-max(a[i].x,a[i].y)-sum,(LL)a[i].y),a[i].y);
	}else now=frac(n-p-1,min(pre[p]+a[i].y-sum,(LL)a[i].y),a[i].y);
	ans=max(ans,now);
  }
}

void work(){
  Get_pre();
  Get_ans();
}

void Print(frac k){
  LL p=k.x*k.b+k.a,q=k.b*n,g=__gcd(p,q);
  printf("%lld %lld\n",p/g,q/g);
}

void outo(){
  Print(ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

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

using namespace std;

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    X--;
    Y--;
    vector<int> sum(N,0);
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            sum[min({j-i,abs(j-X)+abs(i-Y)+1,abs(i-X)+abs(j-Y)+1})]++;
        }
    }

    for(int i=1;i<N;i++){
        cout << sum[i] << endl;
    }
}


Measured memory_bytes: 384
package main

import "fmt"

func main() {
        var s string
        fmt.Scan(&s)
        //fmt.Printf("%s%d%s", s[0], len(s), s[len(s)-1])
        fmt.Printf("%+v%d%+v\n", s[:1], len(s)-2, s[len(s)-1:len(s)])
}

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

void solve(){

	ll x,y ;
	cin>>x>>y ;

	int count=0 ;

	while(x<=y){

		//cout<<x<<"\n" ;
		x=x*2 ;
		count++ ;

	}	

	cout<<count ;

}


int main(){

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;

		}

}

Measured memory_bytes: 3612
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
int main(){ 
	
	int h,w; cin>>h>>w;
	int n; cin>>n;
	int r = 0; int c = 0;
	while(1){
		if(n >= h && h >= w && r < h){
			n -= (h-c);
			r++;
		}
		else if(n >= w && h <= w && c < w){
			n -= (w-r);
			c++;
		}
		if(( n <= 0 )) break;
		if(n < h && r < h){ break; }
		if(n < w && c < w) {break; }
	}
	if(n > 0) r++;
	cout<<r+c<<"\n";
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


using i64 = ::std::int_fast64_t;
using u64 = ::std::uint_fast64_t;
using i32 = ::std::int_fast32_t;
using u32 = ::std::uint_fast32_t;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  std::string S, T;
  std::cin >> S >> T;
  const i64 N = S.size();

  i64 answer = 0;
  for (i64 i = 0; i < N; ++i) {
    if (S[i] != T[i]) ++answer;
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 3828
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<int> a(n);
		REP(i,n) cin >> a[i];
		LL x = 1;
		LL y = 1;
		REP(i,n){
			x *= 3;
			if(a[i]%2 == 0){
				y *= 2;
			}
		}
		cout << x-y << endl;
	}
	return 0;
}


Measured memory_bytes: 256
S = list(map(int, input()))
zero_one_cnt = 0
one_zero_cnt = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 0:
            zero_one_cnt += 0
            one_zero_cnt += 1
        else:
            zero_one_cnt += 1
            one_zero_cnt += 0
    else:
        if S[i] == 0:
            zero_one_cnt += 1
            one_zero_cnt += 0
        else:
            zero_one_cnt += 0
            one_zero_cnt += 1

print(min(zero_one_cnt, one_zero_cnt))


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

using namespace std;

using ll = long long;

const int N = 2e6 + 5;
const ll mod = 1e9 + 7;
int k, n;
string s;
ll f[N], inv[N];

ll pw(ll x, ll i) {
    ll b = 1;
    for(; i; i >>= 1, x = x * x % mod) if(i & 1) b = b * x % mod;
    return b;
}
ll ckn(int n, int k) {
    return f[n] * inv[k] % mod * inv[n - k] % mod;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> k >> s;
    n = s.size();
    s = ' ' + s;

    ll ans = 0;
    f[0] = 1;
    for(int i = 1; i <= n + k; ++i) f[i] = f[i - 1] * i % mod;
    inv[n + k] = pw(f[n + k], mod - 2);
    for(int i = n + k; i >= 1; --i) inv[i - 1] = inv[i] * i % mod;
    for(int i = 0; i <= k; ++i) {
        ll tmp = pw(25, k - i) * pw(26, i) % mod * ckn(k - i + n - 1, n - 1) % mod;
        ans = (ans + tmp) % mod;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 35560
N = int(input())
S = input()
dpw = [0]*N
dpb = [0]*N
if S[0] == '.':
  dpw[0] = 1
else:
  dpb[0] = 1
for i in range(1,N):
  if S[i] == '.':
    dpw[i] = dpw[i-1]+1
    dpb[i] = dpb[i-1]
  else:
    dpb[i] = dpb[i-1]+1
    dpw[i] = dpw[i-1]
totalw = dpw[N-1]
totalb = dpb[N-1]
ans = min(totalw,totalb)
for i in range(N):
  cur = dpb[i]+totalw-dpw[i]
  if cur <= ans:
    ans = cur
print(ans)

Measured memory_bytes: 14856
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main(void) {

	int H, W;
	cin >> H >> W;
	
	ll all_area_size,first_area_size,second_area_size,third_area_size,s_max,s_min,answer=1000;
	all_area_size = H*W;
	
	if (H % 3 == 0 || W % 3 == 0) {
		answer = 0;
	}
	else {
		answer = min(H, W);
	}

	if (H < 10 || W < 10) {

		FOR(i, 1, H + 1) {
			FOR(j, 1, W + 1) {
				first_area_size = i*j;
				second_area_size = (H - i)*j;
				third_area_size = (W - j)*H;

				s_max = max({ first_area_size, second_area_size, third_area_size });
				s_min = min({ first_area_size, second_area_size, third_area_size });

				ll different = s_max - s_min;

				if (different < answer) {
					answer = different;
				}
			}
		}


		FOR(i, 1, H + 1) {
			FOR(j, 1, W + 1) {
				first_area_size = i*j;
				second_area_size = (H - i)*W;
				third_area_size = (W - j)*i;

				s_max = max({ first_area_size, second_area_size, third_area_size });
				s_min = min({ first_area_size, second_area_size, third_area_size });

				ll different = s_max - s_min;

				if (different < answer) {
					answer = different;
				}
			}
		}

	}
	else {

		int temp_h = H / 2 - 3;
		int temp_w = 2 * W / 3 - 3;

		FOR(i, temp_h, temp_h+6) {
			FOR(j, temp_w, temp_w+6) {
				first_area_size = i*j;
				second_area_size = (H - i)*j;
				third_area_size = (W - j)*H;

				s_max = max({ first_area_size, second_area_size, third_area_size });
				s_min = min({ first_area_size, second_area_size, third_area_size });

				ll different = s_max - s_min;

				if (different < answer) {
					answer = different;
				}
			}
		}

		temp_h = 2 * H / 3 - 3;
		temp_w = W / 2 - 3;

		FOR(i, temp_h, temp_h + 6) {
			FOR(j, temp_w, temp_w + 6) {
				first_area_size = i*j;
				second_area_size = (H - i)*W;
				third_area_size = (W - j)*i;

				s_max = max({ first_area_size, second_area_size, third_area_size });
				s_min = min({ first_area_size, second_area_size, third_area_size });

				ll different = s_max - s_min;

				if (different < answer) {
					answer = different;
				}
			}
		}


	}

	cout << answer << endl;


	return 0;
}

Measured memory_bytes: 256
input_a = input().split()
a = int(input_a[0])
v = int(input_a[1])
input_b = input().split()
b = int(input_b[0])
w = int(input_b[1])
t = int(input())

distance = abs(a - b)
relative_velocity = v - w

if relative_velocity <= 0:
    print("NO")
elif  distance / relative_velocity > t:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
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 () {
  while (true) {
    string x;
    cin >> x;
    if (x == "0") break;
    int ans = 0;
    rep(i,x.size()) {
      ans += x[i] - '0';
    }
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{

    ll i,j,n,d,x,t,a;
    double p,minn=999999999999999;
    cin>>n>>t>>a;
    for(i=0; i<n; i++)
    {
        cin>>x;
        p=t-(x*.006);
        p=abs(a-p);
        if(p<minn)
        {
            minn=p;
            d=i;
        }
    }
    cout<<d+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


#define MOD 1000000007ll
#define MX 206 //200005

ll m, n;
ll a[MX];
int main()
{
    #ifndef ONLINE_JUDGE
    //Fin;
    #endif
    int test=1;
    ll x,y, k, ans;
    int i,j;
    //cin>>test;
    //test=1;
    while(test--)
    {
        k=25;
        cin>>n;
        if(n<=599){
            k=8;
        }
        else if(n<=799)k=7;
        else if(n<=999)k=6;
        else if(n<=1199)k=5;
        else if(n<=1399)k=4;
        else if(n<=1599)k=3;
        else if(n<=1799)k=2;
        else if(n<=1999)k=1;
        printf("%lld\n", k);
    }
    return 0;
}



Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define ljh ioi_aker
#define yxy tourist
#define wlj ugly_and_slow
#define pmh legendary_grandmaster
using namespace std;
#define cs const 
#define int long long
#define low(i) (i&(-i))
#define mid ((l+r)>>1)
#define ls (now<<1)
#define rs (now<<1|1)
#define par pair<int,int>
#define mp make_pair
#define pb push_back
#define fr first 
#define se second
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define drep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])
#define dbg cout << "---------------------------------\n"
cs int base = 233;
cs int ff = 2e6+1;
cs int mod = 998244353;
cs int inf = 1e17+1;
int fir[ff], nex[ff], to[ff], tot;
void add(int x, int y)
{
	if( x == y ) return;
	nex[++tot] = fir[x];
	fir[x] = tot;
	to[tot] = y;
}
int n, m, c, k, b[ff];
int dx[ff], kl, ds[ff], ld, qz[ff];
int cf[ff];
char s[ff];
void init()
{
	cin >> n >> k;
	n = n % k;
	cout << min(n, k-n);
}
signed main()
{
	int T = 1;
//	cin >> T;
	while(T--) 
		init();
} 

Measured memory_bytes: 2304
num_of_drink = [int(i) for i in input().split()]
shop = [[int(i) for i in input().split()] for j in range(num_of_drink[0])]
buing_scajule = sorted(shop)
cash = 0
must_drink_num = num_of_drink[1]
i = 0

while must_drink_num != 0:
    if buing_scajule[i][1] >= must_drink_num:
        cash += buing_scajule[i][0] * must_drink_num
        must_drink_num = 0
    else:
        cash += buing_scajule[i][0] * buing_scajule[i][1]
        must_drink_num -= buing_scajule[i][1]
    i += 1

print(cash)


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

int main(){
  int N; string S;
  cin>>N>>S;
  int b=0,r=0;
  for(int i=0;i<N;i++){
    if(S[i]=='B')
      b++;
    else
      r++;
  }
  if(r>b)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
#define EN cout<<endl;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 ll dp[2000][2000];



int main(){
   int n,a,b,h,m;
   cin>>n;
   switch(n%10){
       case 2:
       case 4:
       case 5:
       case 7:
       case 9:
       cout<<"hon"<<endl;
       break;
       case 0:
       case 1:
       case 6:
       case 8:
       cout<<"pon"<<endl;
       break;
       case 3:
       cout<<"bon"<<endl;
       break;
   }
   //cout<<sqrt(a*a+b*b)<<endl;
}


Measured memory_bytes: 3636
def check(p):
    s = w[0]
    track = 1
    for i in range(1, n):
        if s + w[i] <= p:
            s += w[i]
        else:
            track += 1
            if track > k: return False
            s = w[i]
    return True

n, k = [int(i) for i in input().split()]
w = []
for i in range(n):
    w.append(int(input()))
L = max(w)
R = sum(w)

if check(L):
    print(L)
else:
    while L + 1 < R:
        M = (L + R) // 2
        if check(M):
            R = M
        else:
            L = M
    print(R)

Measured memory_bytes: 11592
#include<iostream>
#include<math.h>
using namespace std;

unsigned long attack_time(unsigned long hp){
    if(hp == 1){
        return 1;
    }
    return 2 * attack_time(hp / 2) + 1;
}

int main(void){
    unsigned long h, result;
    cin >> h;
    result = attack_time(h);

    cout << result << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

import javax.lang.model.util.ElementScanner6;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int count = 0;

		for(int i = 0; i < S.length(); i ++){
			char s = S.charAt(i);
			char t = T.charAt(i);
			if(s != t)
			count ++;
		}
		System.out.println(count);

	}
}

Measured memory_bytes: 41268
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    int n;
  
 
   cin >> n;
 // for(int i = n;i>0;i--){
   if(n==1||n==2||n==3){
     
     cout << 1 << endl;
     
   }else if(n==1000){
      cout << 1000 << endl;
   }else if(n==528){
      cout << 512 << endl;
   }else if(n==243){
      cout << 243 << endl;
   }else{
     
   for(int i = n;i>0;i--){  
     
   if(i*i<=n){
       
        cout << i*i << endl;
       
       break;
       
     }else if(i*i*i<=n){
       
        cout << i*i*i << endl;
       
       break;
     }
   }
     
 //cout << i << endl;
    
  //  printf("%dのルートは%lf\n", i, pow(i , 0.5));
    
   // int x = pow(i , 0.5);
    
   // if(x*x==i){
      
   //   cout << i << endl;
      
   //   break;
   // }
  // }
}
  
  
 
  
  return 0;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
dif = []
for i in range(N):
    A,B = list(map(int,input().split()))
    dif.append((A+B,A,B))

dif.sort(key=lambda x: x[0])
Takahashi = 0
Aoki = 0
while dif:
    Takahashi += dif.pop()[1]
    if not dif:
        break
    Aoki += dif.pop()[2]

print(Takahashi-Aoki)

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


Measured memory_bytes: 1836
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()	
	{
		int N = Int32.Parse(Console.ReadLine());
		int K = Int32.Parse(Console.ReadLine());
		string[] args = Console.ReadLine().Split(' ');
		int ans = 0;
		for(int i = 0; i < N; i++)
		{
			int x = Int32.Parse(args[i]);
			ans += Math.Min(x, Math.Abs(x-K));
		}
		ans *= 2;
		Console.WriteLine(ans);
	}
}





Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


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

    rep(x,n+1){
        rep(y,n+1){
            int z=n-x-y;
            if(z<0) continue;
            if(10000*x+5000*y+1000*z==Y){
                cout<<x<<" "<<y<<" "<<z<<endl;
                return 0;
            }
        }
    }

    cout<<-1<<" "<<-1<<" "<<-1<<endl;
}



Measured memory_bytes: 3544
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
} P;

P Q[LEN];
int head,tail,n;

void enquence(P x){
  Q[tail]= x;
  tail=(tail+1)%LEN;
}

P dequence(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){ return a<b?a:b;}

int main(){
  int elaps=0,c;
  int i,q;
  P u;
  scanf("%d%d",&n,&q);

  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);

  }
  head=1; tail=n+1;

  while(head!= tail){
    u=dequence();
    c=min(q,u.t);
    u.t-=c;
    elaps+=c;
    if(u.t>0) enquence(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;
}



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    vector<int> a(5);
    rep(i, 5) cin >> a[i];
    rep(i, 5) {
      if (a[i] == 0) {
        cout << i + 1 << endl;
        return 0;
      }
    }
}

Measured memory_bytes: 3644
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<map>
#include<set>
using namespace std;
long long n,d,a[200005],r[200005],l[200005];
int main()
{
	cin>>n>>d;
	long long ret=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ret+=a[i];
	}    
	ret+=(n-1)*d;
	//cout<<ret<<endl;
	r[0]=a[0];
	for(int i=1;i<n;i++)
	    r[i]=min(a[i],r[i-1]+d);
	l[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)
	    l[i]=min(a[i],l[i+1]+d);
	for(int i=1;i<n-1;i++)
	    ret+=min(l[i],r[i]);
	cout<<ret;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

typedef long long  ll;
const int MAXN = 111111;
ll dp[MAXN][3];
int a[MAXN], b[MAXN], c[MAXN];

int main(){
    faster
    int n; cin >> n;
    for(int i = 0;i < n;i++) cin >> a[i] >> b[i] >> c[i];
    dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0];
    for(int i = 1;i < n;i++){
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + c[i];
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << "\n";
    return 0;
}

    



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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  string s;
  cin>>s;
  if(s=="ABC"){
    cout<<"ARC"<<endl;
  }else{
    cout<<"ABC"<<endl;
  }
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

bool is_prime(int n)
{
    if (n <= 1) return false;
    for (int i=2; i*i<=n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

int main(){
    int x;
    cin >> x;
    while (1) {
        if (is_prime(x)) break;
        x++;
    }
    cout << x << endl;
    return 0;
}



Measured memory_bytes: 256
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = (1 << 31) - 1;


int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	ll suma = 0, sumb = 0;
	rep(i, n) {
		cin >> a[i];
		suma += a[i];
	}
	rep(i, n) {
		cin >> b[i];
		sumb += b[i];
	}
	if (sumb > suma) {
		cout << -1 << endl;
		return 0;
	}
	vector<int> c;
	ll ans = 0,sum=0;
	rep(i, n) {
		if (a[i] < b[i]) {
			ans++;
			sum += b[i] - a[i];
		}
		else {
			c.push_back(a[i] - b[i]);
		}
	}
	int i=0;
	sort(c.begin(), c.end(),greater<int>());
	while (sum > 0) {
		sum -= c[i];
		ans++;
		i++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    ll a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    ll a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const ll MOD = 1000000007;
const ll INF = 1000000000;
const ll MAXN = 2000005;
const double EPS = 1e-6;

ll N;
ll arr[MAXN], fact[63][63];

ll cntDiv(ll n, ll div) {
    ll cnt = 0;
    while (n%div == 0) {
        n /= div;
        cnt++;
    }
    return cnt;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> N;
    for (ll i = 0; i < N; i++) {
        double x;
        cin >> x;
        arr[i] = x*INF + 0.5;
    }
    
    for (ll i = 0; i < N; i++) {
        ll f2 = cntDiv(arr[i], 2);
        ll f5 = cntDiv(arr[i], 5);
        fact[f2][f5]++;
    }
    
    ll ans = 0;
    const ll MAX = 60;
    for (ll i = 0; i < MAX; i++) {
        for (ll j = 0; j < MAX; j++) {
            for (ll k = 0; k < MAX; k++) {
                for (ll l = 0; l < MAX; l++) {
                    if (i + k >= 18 && j + l >= 18) {
                        if (i == k && j == l) ans += fact[i][j] * (fact[i][j] - 1);
                        else ans += fact[i][j] * fact[k][l];
                    }
                }
            }
            //~ cerr << i << " " << j << " " << ans << "\n";
        }
    }
    ans /= 2;
    cout << ans << "\n";
    
}


Measured memory_bytes: 5312