akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void swap(int *a,int *b){
    int tmp;

    tmp = *a;
    *a = *b;
    *b = tmp;

}

int main(){
    int i,j;
    int n;
    int sum=0;
    int in[100];

    while(1){
        scanf("%d",&n);

        if(!n) break;

        for(i=0;i<n;i++){
            scanf("%d",&in[i]);
        }

        for(i=0;i<n;i++){
            for(j=0;j<n-i-1;j++){
                if(in[j] > in[j+1]){
                    swap(&in[j],&in[j+1]);
                }
            }
        }

        for(i=1;i<n-1;i++){
            sum += in[i];
        }

        printf("%d\n",sum/(n-2));

        sum=0;
    }

    return 0;
}


Measured memory_bytes: 2040
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 22 21:34:54 2019

@author: owner
"""
import numpy as np

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(x, y):
    return (x * y) // gcd(x, y) #math.gcd(x, y)

# %%
A, B, C, D = list(map(int, input().split()))
    
CD = lcm(C, D) 

n_C = np.int(np.floor(B/C) - np.floor((A-1)/C))
n_D = np.int(np.floor(B/D) - np.floor((A-1)/D))

n_CD = B // CD - (A-1) // CD #np.floor(B/CD) - np.floor((A-1)/CD)

Cdiv = B // C - (A-1) // C
Ddiv = B // D - (A-1) // D
import fractions
cddiv = (C*D)//fractions.gcd(C,D)
CDdiv = B // (cddiv) - (A-1) // (cddiv)
    
ans = int(B - A + 1 -Cdiv - Ddiv + n_CD)#- n_C - n_D + 
print('{}'.format(ans))


Measured memory_bytes: 13556
void main() {
	auto ip = readAs!(BigInt[]), N = ip[0], A = ip[1], B = ip[2];
	if((B - A) % 2 == 0) writeln((B - A) / 2);
	else {
		auto x1 = (B - A + 1) / 2, x2 = N + (A - B  + 1) / 2;
		auto l1 = B - x1, l2 = x2 - A;
		const BigInt MAX = BigInt("1000000000000000000000000000000000000");
		writeln(min(
		max(A-1, B-1), max(N-A, N-B),
		l1 > 0 ? l1 : MAX, l2 > 0 ? l2 : MAX
		));
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int a,b,f=0,i;
  cin>>a>>b;
  
    for(i=b*10; i<(b+1)*10; i++){
        if(floor(i*0.08) == a){
            f=1;
            break;
        }
    }
    
    if(f==1)
    cout<<i<<"\n";
    
    else cout<<-1<<"\n";
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
 
using namespace std;
 
int s[10]={0};
 
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        for(int i=0;i<10;i++)
            scanf("%d",&s[i]);
        int a=0,b=0;
        bool flag=0;
        for(int i=0;i<10;i++)
        {
            if(s[i]<a&&s[i]<b)
            {
                flag=1;
                break;
            }
            else if(s[i]<a&&s[i]>b)b=s[i];
            else if(s[i]>a&&s[i]<b)a=s[i];
            else
            {
                a=a>b?s[i]:a;
                b=a<b?s[i]:b;
                if(a==b)a=s[i];
            }
        }
        if(flag)printf("NO\n");
        else printf("YES\n");
    }
    return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N;
int num[3];
int S[100010];
char res[100010];

char ex(int i){
    if(i == 0) return 'A';
    if(i == 1) return 'B';
    if(i == 2) return 'C';
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> num[0] >> num[1] >> num[2];
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        if(s[0] == 'A') S[i] += 1;
        if(s[0] == 'B') S[i] += 2;
        if(s[1] == 'B') S[i] += 2; 
        if(s[1] == 'C') S[i] += 4;
    }
    S[N] = 7;

    for(int i = 0; i < N; i++){
        int r = S[i] & S[i + 1];
        if(r == S[i]){
            if(S[i] == 3){
                if(num[0] == 0) num[0]++, num[1]--, res[i] = 'A';
                else num[0]--, num[1]++, res[i] = 'B';
            }
            if(S[i] == 5){
                if(num[0] == 0) num[0]++, num[2]--, res[i] = 'A';
                else num[0]--, num[2]++, res[i] = 'C';
            }
            if(S[i] == 6){
                if(num[1] == 0) num[1]++, num[2]--, res[i] = 'B';
                else num[1]--, num[2]++, res[i] = 'C';

            }
        }else{
            int p = S[i] - r;
            for(int j = 0; j < 3; j++){
                if(r >> j & 1){
                    r = j;
                    break;
                }
            }
            for(int j = 0; j < 3; j++){
                if(p >> j & 1){
                    p = j;
                    break;
                }
            }
            if(num[p] == 0){
                num[p]++;
                num[r]--;
                res[i] = ex(p);
            }else{
                num[r]++;
                num[p]--;
                res[i] = ex(r);
            }
        }
        if(num[0] < 0 || num[1] < 0 || num[2] < 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 0; i < N; i++) cout << res[i] << endl;
    return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
vector<int> part_ans(0);
vector<int> t_ans;
bool fin=false;
int min_size=1001;

vector<int> topo_sort1(vector<vector<int>> e)
{
  int n=e.size();
  vector<int> ans(0);
  vector<int> ins(n,0);
  int i,j;
  rep(i,n)
  {
    rep(j,e[i].size())
    {
      ins[e[i][j]]++;
    }
  }
  queue<int> s;
  rep(i,n) if(ins[i]==0)s.push(i);
  while(!s.empty())
  {
    int now=s.front();
    s.pop();
    ans.emplace_back(now);
    rep(i,e[now].size())
    {
      ins[e[now][i]]--;
      if(ins[e[now][i]]==0)
      {
        s.push(e[now][i]);
      }
    }
  }
  return ans;
}

void dfs(int now,vector<bool> &visited,vector<vector<int>> e,int count)
{
  int i,j;
  visited[now]=true;
  part_ans.emplace_back(now);
  if(fin)return;
  int pas=part_ans.size();
  rep(i,e[now].size())
  {
    if(!visited[e[now][i]])
    {
      if(pas<min_size)
      {
        dfs(e[now][i],visited,e,count+1);
      }
    }
    else
    {
      if(pas==min_size)
      {
        t_ans=part_ans;
        fin=true;
        break;
      }
    }
  }
  visited[now]=false;
  part_ans.erase(part_ans.end()-1,part_ans.end());
}

int main()
{
  int n,m;cin>>n>>m;
  vector<int> a(m);
  vector<int> b(m);
  int i,j;
  rep(i,m)cin>>a[i]>>b[i];
  rep(i,m)
  {
    a[i]--;
    b[i]--;
  }
  vector<vector<int>> e(n);
  rep(i,m)
  {
    e[a[i]].emplace_back(b[i]);
  }
  vector<int> ans=topo_sort1(e);
  if(ans.size()==n)
  {
    cout<<-1<<endl;
  }
  else
  {
    int minst=-1;
    rep(i,n)
    {
      vector<bool> visited(n,false);
      queue<int> q;
      queue<int> q2;
      q.push(i);
      int steps=1;
      while(!q.empty())
      {
        while(!q.empty())
        {
          int now=q.front();
          q.pop();
          rep(j,e[now].size())
          {
            if(e[now][j]==i)
            {
              if(steps<min_size)
              {
                min_size=steps;
                minst=i;
              }
            }
            else if(!visited[e[now][j]])
            {
              visited[e[now][j]]=true;
              q2.push(e[now][j]);
            }
          }
        }
        while(!q2.empty())
        {
          q.push(q2.front());
          q2.pop();
        }
        steps++;
      }
    }
    vector<bool> visited(n,false);
    dfs(minst,visited,e,0);
    cout<<t_ans.size()<<endl;
    rep(i,t_ans.size())
    {
      cout<<t_ans[i]+1<<endl;
    }
  }
}

Measured memory_bytes: 55168
#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
li fact(li a){
  // vector,repa 必須
  static vector<li> f(1,1);

  if(f.size()>a)return f[a];
  if(df)print(a,"!");
  int n=f.size();
  repa(i,n,a+1){
    f.push_back(f[i-1]*i%MOD);
    if(df)print(i,a+1,f[i]);
  }
  return f[a];
}

li inv(li a){
  // unordered_map 必須
  static unordered_map<li,li> f;
  f[1]=1;
  a%=MOD;
  if(f.find(a)!=f.end())return f[a];
  return f[a]=MOD-MOD/a*inv(MOD%a)%MOD;
}

li comb(li n,li r){
  if(n>10000){
    if(r>n-r) r=n-r;
    li bo=1,si=1;
    rep(i,r){
      (bo*=r-i)%=MOD;
      (si*=n-i)%=MOD;
    }
    return si*inv(bo)%MOD;
  }
  if(df)print("n!",n,"r!n-r!",r);
  li a=fact(n),x=fact(r)*fact(n-r)%MOD;
  return a*inv(x)%MOD;
}

li pow(li b,li r){
  li s=1;
  while(r){
    if(r%2) (s*=b)%=MOD;
    (b*=b)%=MOD; r/=2;
  }
  return s;
}

int main(){
  int k; cin >>k;
  string s; cin >>s;
  if(df)print(k+s.size(),s.size(),comb(k+s.size(),s.size()),pow(25,k));
  li ans=0;
  li t=s.size()-1;
  li x=1,y=1,z=pow(26,k);
  rep(i,k+1){
    if(df)print(x,y,z);
    (ans+=x*y%MOD*z%MOD)%=MOD;
    (x*=t+i+1)%=MOD;
    (x*=inv(i+1))%=MOD;
    (y*=25)%=MOD;
    (z*=inv(26))%=MOD;
  }
  print(ans);
}


Measured memory_bytes: 43684
#include <bits/stdc++.h>
using namespace std;
 
  int main() {
  int x = 1; //もともとの整数
  int N; //操作回数
  int K; //足した場合の値
  int y,z; //それぞれかけた場合、足した場合のxの値
   //xにKを足した場合とxに2を掛けた場合の2つの値を比較し、小さいほうをxに代入
  cin >>N >>K;

  for(int i=0;i<N;i++)
  {
   y=x*2;
   z=x+K;
   if(y>z)x=z;
   else x=y;
//cout <<x <<endl; //動作確認用。後で消す
  }

cout <<x <<endl;
}

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

using namespace std;

int N;

char swap(char alphabet) {
    if (alphabet + N > 'Z') {
        return alphabet + N - 26;
    } else {
        return alphabet + N;
    }
}

int main(void) {
    string str;
    cin >> N; 
    cin >> str;

    for (int i= 0 ; i < str.length(); i++) {
        str[i] = swap(str[i]);
    }

    cout << str << endl;

    return 0;
}

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

using namespace std;

bool isValid(long long a,long long b,long long c) {

    return ((a+b)>c and (b+c)>a and (a+c)>b);

}

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    long long n;

    cin >> n;

    vector<long long> a(n);

    for(long long i = 0 ; i < n ; i++) {

        cin >> a[i];

    }

    long long res=0;

    for(long long i = 0 ; i < a.size() ; i++) {

        for(long long j=i+1; j<a.size(); j++) {

            for(long long k=j+1; k<a.size(); k++) {

                if(isValid(a[i],a[j],a[k]) and a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i]) {

                    res++;

                }

            }

        }

    }

    cout << res << '\n';

    return 0;

}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
// const ll INF = 1LL << 30;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

ll l[100050], r[100050];

ll gcd(ll a, ll b){
    if(a == 0 || b == 0){
        return max(a, b);
    }
    while(1){
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}

int main() {
    ll n; cin >> n;
    Vl a(n+1);
    Rep(i, 1, n) cin >> a[i];
    Rep(i, 1, n){
        l[i] = gcd(a[i], l[i-1]);
    }
    for(int i = n; i >= 1; i--){
        r[i] = gcd(a[i], r[i+1]);
    }
    ll ans = -1;
    Rep(i, 1, n){
        chmax(ans, gcd(l[i-1], r[i+1]));
    }
    co(ans);

    return 0;
}



Measured memory_bytes: 5624
N=int(input())
H=list(map(int, input().split()))
Flag=True

if N==1:
  print("Yes")
else:
  for i in range(1,N):
    if H[i]>H[i-1]:
      H[i]=H[i]-1
    if H[i]>=H[i-1]:
      pass
    else:
      Flag=False
      break
      
  if Flag:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 14396
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
struct scc{
    int N;
    vector<vector<int>> G, rG;
    vector<bool> used;
    vector<int> temp;
    vector<int> order;//分解後のトポロジカル順序
    vector<vector<int>> cnt;
    scc(int V){
        G.resize(V);
        rG.resize(V);
        N = V;
        order.resize(V);
    }
    void add(int s, int t){
        G[s].push_back(t);
        rG[t].push_back(s);
    }
    void dfs(int s){
        used[s] = true;
        for(int j: G[s]){
            if(!used[j]) dfs(j);
        }
        temp.push_back(s);
    }
    void rdfs(int s, int k){
        used[s] = true;
        order[s] = k;
        for(int j: rG[s]){
            if(!used[j]) rdfs(j, k);
        }
    }
    vector<vector<int>> solve(){//分解後の頂点数を返す
        used.resize(N, false);
        for(int i = 0; i < N; i++){
            if(!used[i]) dfs(i);
        }
        used.assign(N, false);  
        int k = 0; 
        for(int i = (int)temp.size() - 1; i >= 0; i--){ //番号が大きい方から順にdfs
            if(!used[temp[i]]) {
                rdfs(temp[i], k);
                k++;
            }
        }
        cnt.resize(k);
        for(int i = 0; i < N; i++){
            cnt[order[i]].push_back(i);
        }
        return cnt;
    }
};
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, M;
    cin >> N >> M;
    scc scc(N);
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        scc.add(a, b);
    }
    vector<vector<int>> k = scc.solve();
    cout << k.size() << endl;
    for(int i = 0; i < (int)k.size(); i++){
        int size = k[i].size();
        cout << size << ' ';
        for(int j = 0; j < size; j++){
            if(j != size - 1) cout << k[i][j] << ' ';
            else cout << k[i][j] << endl;
        }
    }
}

Measured memory_bytes: 106984
use std::io;
use std::str::FromStr;

fn input_tuple() -> (i32, i32, i32, i32) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2], vec[3])
}


fn main() {
    let (a, b, c, k) = input_tuple();
    if k <= a {
        println!("{}", k);
    } else if k <= a + b {
        println!("{}", a);
    } else {
        println!("{}", a - (k - (a + b)));
    }
}


Measured memory_bytes: 2124
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;

static const int MAX = 100;
static const int White = 0;
static const int Gray = 1;
static const int Black = 2;


int n, M[MAX][MAX];
int d[MAX], p[MAX],color[MAX];

void dijkstra() {
	rep(i, n) {
		color[i] = White;
		d[i] = INF;
		p[i] = -1;
	}
	d[0] = 0;
	while (true) {
		int u, mincost = INF;
		rep(i, n) {
			if (color[i] != Black and d[i] < mincost) {
				u = i;
				mincost = d[i];
			}
		}
		if (mincost == INF) break;
		color[u]  = Black;
		int v;
		rep(v, n) {
			if (color[v] != Black and M[u][v] != INF) {
				if (d[u] + M[u][v] < d[v]) {
					d[v] = d[u] + M[u][v];
					p[v] = u;
					color[v] = Gray;
				}
			}
		}
	}
	rep(i, n) {
		cout << i << ' ' << d[i] << '\n';
	}
}

signed main() {
	ios::sync_with_stdio(false);
	int i, j, k;
	cin >> n;
	rep(i, n) {
		rep(j, n) {
			M[i][j] = INF;
		}
	}
	rep(i, n) {
		int u, k;
		cin >> u >> k;
		rep(j, k) {
			int c,v;
			cin >> v >> c;
			M[u][v] = c;
		}
	}
	dijkstra();
	return 0;
}


Measured memory_bytes: 3236
#include <stdio.h>
int main(void){
	int N,K,i,j,k,a[51],max=0,sum=0;
	scanf("%d %d",&N,&K);
	for(i=0;i<N;i++){scanf("%d",&a[i]);}
	for(i=0;i<K;i++){
		for(j=0;j<N;j++){if(max<a[j]){max=a[j];k=j;}}
		sum+=max;
		a[k]=0;
		max=0;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
"""
// Author : snape_here - Susanta Mukherjee
     
"""
 
from __future__ import division, print_function
 
import os,sys
from io import BytesIO, IOBase
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
 
 
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())
 
 
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
    
 
def read():
    sys.stdin = open('input.txt', 'r')  
    sys.stdout = open('output.txt', 'w') 
 
 
import math

from itertools import permutations

mod=100000007 

def main():

    n=ii()
    print(int(math.ceil(n/2)))
        

# region fastio#
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
 
if __name__ == "__main__":
    #read()
    main() 
#Comment read()


Measured memory_bytes: 29420
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(b-a)<=d&&abs(b-c)<=d) cout<<"Yes"<<endl;
  else if(abs(a-c)<=d) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
n, y = map(int, input().split())
 
flagCount = 0
 
for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if i*10000 + j*5000 + k*1000 == y and k >= 0:
            flagCount += 1
            if flagCount == 1:
                print(i, j, k)
            
 
if flagCount == 0:
    print(-1, -1, -1)

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

int main() {
    int n, t; cin >> n >> t;
    int a[200010];
    rep(i, 1, n + 1) {
        cin >> a[i];
    }
    int ans = 0;
    rep(i, 1, n) {
        ans += min(a[i + 1] - a[i], t);
    }
    cout << ans + t << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
	int n,nx[1000]={0},ny[1000]={0},mx[]={-1,0,1,0},my[]={0,-1,0,1},i,a,b,maxx=0,maxy=0,minx=0,miny=0,l=0,fx[1000],fy[1000];
	while(1){
		maxx=maxy=minx=miny=0;
		for(i=0;i<1000;i++){
			nx[i]=0;
			ny[i]=0;
		}
		scanf("%d",&n);
		if(n==0){
			break;
		}
		i=1;
		while(i<n){
			scanf("%d %d",&a,&b);
			nx[i]=nx[a]+mx[b];
			ny[i]=ny[a]+my[b];
			if(nx[i]>maxx){
				maxx=nx[i];
			}
			else if(nx[i]<minx){
				minx=nx[i];
			}
			if(ny[i]>maxy){
				maxy=ny[i];
			}
			else if(ny[i]<miny){
				miny=ny[i];
			}
			i++;
		}
		a=maxx-minx+1;
		b=maxy-miny+1;
		fx[l]=a;
		fy[l]=b;
		l++;
	}
	for(i=0;i<l;i++){
		printf("%d %d\n",fx[i],fy[i]);
	}
	return 0;
}

Measured memory_bytes: 616
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int Q;
	cin >> Q;
	vector<int> ln(Q), c1(Q), c2(Q), c3(Q); vector<string> tp(Q), v1(Q), v2(Q), v3(Q);
	vector<string> varlist;
	function<bool(string)> is_number = [&](string str) {
		for (int i = 0; i < str.size(); ++i) {
			if (!('0' <= str[i] && str[i] <= '9')) {
				return false;
			}
		}
		return true;
	};
	function<int(string)> get_index = [&](string varname) {
		int ptr = find(varlist.begin(), varlist.end(), varname) - varlist.begin();
		return ptr;
	};
	for (int i = 0; i < Q; ++i) {
		cin >> ln[i] >> tp[i];
		if (tp[i] == "ADD" || tp[i] == "SUB") {
			cin >> v1[i] >> v2[i] >> v3[i];
			varlist.push_back(v1[i]);
			if (!is_number(v2[i])) varlist.push_back(v2[i]);
			if (!is_number(v3[i])) varlist.push_back(v3[i]);
		}
		if (tp[i] == "SET") {
			cin >> v1[i] >> v2[i];
			varlist.push_back(v1[i]);
			if (!is_number(v2[i])) varlist.push_back(v2[i]);
		}
		if (tp[i] == "IF") {
			cin >> v1[i] >> v2[i];
			varlist.push_back(v1[i]);
		}
		if (tp[i] == "HALT") {
			// input nothing
		}
	}
	sort(varlist.begin(), varlist.end());
	varlist.erase(unique(varlist.begin(), varlist.end()), varlist.end());
	int S = varlist.size();
	for (int i = 0; i < Q; ++i) {
		if (tp[i] == "ADD" || tp[i] == "SUB") {
			c1[i] = get_index(v1[i]) - S;
			c2[i] = (is_number(v2[i]) ? stoi(v2[i]) : get_index(v2[i]) - S);
			c3[i] = (is_number(v3[i]) ? stoi(v3[i]) : get_index(v3[i]) - S);
		}
		if (tp[i] == "SET") {
			c1[i] = get_index(v1[i]) - S;
			c2[i] = (is_number(v2[i]) ? stoi(v2[i]) : get_index(v2[i]) - S);
		}
		if (tp[i] == "IF") {
			c1[i] = get_index(v1[i]) - S;
			c2[i] = find(ln.begin(), ln.end(), stoi(v2[i])) - ln.begin(); // if not found, c2[i] will be Q
		}
		if (tp[i] == "HALT") {
			// do nothing
		}
	}
	vector<int> vars(S, 0);
	int cur = 0;
	bool halted = true;
	vector<vector<bool> > vis(Q, vector<bool>(1 << (S * 4), false));
	while (cur < Q) {
		int h = 0;
		for (int i = 0; i < S; ++i) {
			h = h * 16 + vars[i];
		}
		if (vis[cur][h]) {
			halted = false;
			break;
		}
		vis[cur][h] = true;
		vector<int> prevars = vars;
		if (tp[cur] == "ADD") {
			vars[c1[cur] + S] = (c2[cur] >= 0 ? c2[cur] : vars[c2[cur] + S]) + (c3[cur] >= 0 ? c3[cur] : vars[c3[cur] + S]);
		}
		if (tp[cur] == "SUB") {
			vars[c1[cur] + S] = (c2[cur] >= 0 ? c2[cur] : vars[c2[cur] + S]) - (c3[cur] >= 0 ? c3[cur] : vars[c3[cur] + S]);
		}
		if (tp[cur] == "SET") {
			vars[c1[cur] + S] = (c2[cur] >= 0 ? c2[cur] : vars[c2[cur] + S]);
		}
		if (tp[cur] == "IF") {
			if (vars[c1[cur] + S] != 0) {
				cur = c2[cur];
				continue;
			}
		}
		if (tp[cur] == "HALT") {
			break;
		}
		if (vars[c1[cur] + S] < 0 || 16 <= vars[c1[cur] + S]) {
			vars = prevars;
			break;
		}
		++cur;
	}
	if (!halted) {
		cout << "inf" << endl;
	}
	else {
		for (int i = 0; i < S; ++i) {
			cout << varlist[i] << "=" << vars[i] << endl;
		}
	}
	return 0;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll a,b;
  char op;
  cin>>a>>op>>b;
  if(op=='-')
  cout<<a-b<<endl;
  else
  cout<<a+b<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long l,r;
  cin>>l>>r;
  r=min(r,l+4038);
  int ans=2018;
  for(long long i=l;i<=r;i++){
    for(long long j=i+1;j<=r;j++){
      int res=(i*j)%2019;
      ans=min(ans,res);
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&i:a)cin>>i;
	priority_queue<int>pls;
	int64_t mns=0,ans=0;
	for(int i=0;i<n;++i){
		int b; cin>>b;
		int cal=a.at(i)-b;
		if(cal<0)mns+=cal,++ans;
		else pls.push(cal);
	}
	while(pls.size()&&mns<0){
		int rem=pls.top(); pls.pop();
		mns+=rem;
		++ans;
	}
	cout<<(mns<0?-1:ans)<<"\n"s;
}

Measured memory_bytes: 1276
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <set>
#include <cmath> //abs();
using namespace std;

long long int wa(long long int n){
    if(n==0) return 0;
    return n+(wa(n-1));
} 

int main(void)
{
    long long int k,ans=0,temp=0,modgo1,modgo2;
    int i,j,n;
    cin >> n >> k;
    vector<int> vec(n);

    for(i=0;i<n;i++){
        cin >> vec.at(i);
    }

    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            if(vec.at(i)>vec.at(j)) ans += 1;
        } 
    }
    ans *= k;
    modgo1 = ans % (1000000000+7);

    sort(vec.begin(),vec.end());
    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            if(vec.at(i)<vec.at(j)) temp += 1;
        } 
    }
    
    modgo2 = k*(k-1)/2%(1000000000+7);
    modgo2 = modgo2*temp%(1000000000+7);
 //   ans += temp*wa(k-1);
    ans = modgo1+modgo2;
    cout << ans%(1000000000+7);

    return 0;
}

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

int main(){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
    if(x-r>=0&&y+r<=H&&y-r>=0&&x+r<=W){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    return 0;
	}


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

//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}

bool valid(vector<ll> v, vector<pair<ll, pair<ll, ll>>> vp) {
  REP(i, vp.size()){
    // 発言者が正直
    if(v.at(vp.at(i).first) == 1) {
      // 発言内容と実際の値が異なる場合は不適
      if(v.at(vp.at(i).second.first - 1) != vp.at(i).second.second) return false;
    }
  }
  return true;
}
 
int main() {
  ll n;
  cin >> n;
  
  vector<pair<ll, pair<ll, ll>>> vp;
  // 全員の発言が成立するbitを取得しそのbitの正直者の数を数える
  REP(m, n) { //全ての集合
    ll r;
    cin >> r;
    REP(l, r) {
      ll p,q;
      cin >> p >> q;
      vp.push_back( make_pair(m, make_pair(p, q)) );
    }
  }
  
  ll m = 0;
  
  REP(i, (1<<n)) {
    vector<ll> v(15, 0);
    ll tmp = 0;
    REP(l, n) {
      if (i & (1 << l)) {
        v.at(l) = 1;
        tmp++;
      }
    }
    //cout << "{" << v.at(0) << ", " << v.at(1) << ", " << v.at(2) << "}" << endl;

    if (valid(v, vp)) {
      m = max(m, tmp);
    }
  }
  cout << m << endl;
  
}

Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


long long dp[50][500][500];
int main(void) {
	int n, m, p; cin >> n >> m >> p;

	const int NMAX = 3000;
	const int MMAX = 5010;

	int a[MMAX], b[MMAX];
	ll c[MMAX];

	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
		c[i] = -c[i] + p;
	}

	ll dist[NMAX];
	for (int i = 0; i < n; i++)
	{
		dist[i] = INF;
	}
	dist[0] = 0;

	for (int loop = 0; loop < n-1; loop++)
	{
		for (int i = 0; i < m; i++)
		{
			if (dist[a[i] - 1] == INF) continue;
			if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
				dist[b[i] - 1] = dist[a[i] - 1] + c[i];
			}
		}
	}

	ll ans = dist[n - 1];

	bool negative[NMAX];
	for (int i = 0; i < n; i++)
	{
		negative[i] = false;
	}

	for (int loop = 0; loop < n; loop++)
	{
		for (int i = 0; i < m; i++)
		{
			if (dist[a[i] - 1] == INF) continue;
			if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
				dist[b[i] - 1] = dist[a[i] - 1] + c[i];
				negative[b[i] - 1] = true;
			}
			if (negative[a[i] - 1])negative[b[i] - 1] = true;
		}

	}

	if (negative[n-1]) {
		cout << -1 << endl;
	}
	else {
		cout << max(0ll,-dist[n - 1]) << endl;
	}
	return 0;
}

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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll T = b - a, U = 0;
    if (T % 2 != 0) {
        T--;
        if (n - b > a - 1) {
            U = a;
        } else {
            U = n - b + 1;
        }
    }
    
    cout << U + (T / 2) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n, m, c, ans = 0;
    cin >> n >> m >> c;
    vector<int> b(m);
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n; i++){
        int sum = 0;
        for(int j = 0; j < m; j++){
            int a;
            cin >> a;
            sum += a * b[j];
        }
        if(sum + c > 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s=input()

for i in range(len(s)):
    if(s[i]!="U" or s[i]!="D"):
      if(i%2==1 and s[i]=="R"):
        print("No")
        break
      elif(i%2==0 and s[i]=="L"):
        print("No")
        break
    if(i==(len(s)-1)):
      print("Yes")
      
 

Measured memory_bytes: 2940
n=int(input())
s=input()
ans=0
for i in range(1000):
  tmp=str(i)
  while len(tmp)<3:
    tmp="0"+tmp
  j=0

  for k in range(n):
    if tmp[j]==s[k]:
      j+=1
    if j==3:
      ans+=1
      break
print(ans)

Measured memory_bytes: 41180
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>

using LL = long long;
const int kN = 100000 + 5;
LL a[kN];
int n;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i)
        scanf("%lld", &a[i]);
    LL l = 2, r = 1e14;
    LL lbound = -1, rbound = -1;
    while (l <= r) {
        LL mid = l + r >> 1;
        LL v = mid;
        for (int i = 0; i < n; ++ i)
            v = v / a[i] * a[i];
        if (v < 2)
            l = mid + 1;
        else
            r = mid - 1;
        if (v == 2)
            lbound = mid;
    }
    l = 2, r = 1e14;
    while (l <= r) {
        LL mid = l + r >> 1;
        LL v = mid;
        for (int i = 0; i < n; ++ i)
            v = v / a[i] * a[i];
        if (v <= 2)
            l = mid + 1;
        else
            r = mid - 1;
        if (v == 2)
            rbound = mid;
    }
    if (lbound == -1)
        puts("-1");
    else
        printf("%lld %lld\n", lbound, rbound);
}


Measured memory_bytes: 896
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100010];
int tmp;
int n,ans=1;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	tmp=a[1];
	for(int i=2;i<=n;++i){
		if(tmp==a[i]){
			--ans;
			tmp=-1;
		}
		else{
			++ans;
			tmp=a[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

int main(){
    
    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;

    a--;b--;c--;d--;
    rep(i,a,c-1){
        if(s[i] == '#' && s[i+1] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }
    rep(i,b,d-1){
        if(s[i] == '#' && s[i+1] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }

    if(b < c && c < d){
        cout << "Yes" << endl;
        return 0;
    }
    else if(c < d){
        cout << "Yes" << endl;
        return 0;
    }

    rep(i,b-1,d){
        rep(j,0,3){
            if(s[i+j] == '#') break;
            else if(j == 2){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

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

int n, a;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (a % 2 == 0 && a % 3 != 0 & a % 5 != 0)
        {
            cout << "DENIED";
            return 0;
        }
    }
    cout << "APPROVED";
}

Measured memory_bytes: 256
// 復習

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

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

    ll h, w;
    cin >> h >> w;

    if (h % 3 == 0 || w % 3 == 0) {
        cout << 0 << endl;
        return 0;
    }

    ll diff = min(h, w);
    for (ll y = 1; y < h; ++y) {
        if ((h-y) % 2 == 0) {
            diff = min(diff, abs(y*w - (h-y)/2*w));
        } else {
            ll a = y*w, b = (h-y)/2*w, c = ((h-y)/2+1)*w;
            diff = min(diff, max({abs(a-b), abs(b-c), abs(c-a)}));
        }

        if (w % 2 == 0) {
            diff = min(diff, abs(y*w - (h-y)*w/2));
        } else {
            ll a = y*w, b = (h-y)*(w/2), c = (h-y)*(w/2+1);
            diff = min(diff, max({abs(a-b), abs(b-c), abs(c-a)}));
        }
    }

    for (ll x = 1; x < w; ++x) {
        if ((w-x) % 2 == 0) {
            diff = min(diff, abs(x*w - (w-x)/2*w));
        } else {
            ll a = x*w, b = (w-x)/2*w, c = ((w-x)/2+1)*w;
            diff = min(diff, max({abs(a-b), abs(b-c), abs(c-a)}));
        }

        if (h % 2 == 0) {
            diff = min(diff, abs(x*h - (w-x)*h/2));
        } else {
            ll a = x*h, b = (w-x)*(h/2), c = (w-x)*(h/2+1);
            diff = min(diff, max({abs(a-b), abs(b-c), abs(c-a)}));
        }
    }

    cout << diff << endl;
    return 0;
}

Measured memory_bytes: 256
#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>;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n-2) {
        if (s[i] == 'A') {
            if (s[i+1] == 'B' && s[i+2] == 'C') ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int a, b, c, ans = 0;
    cin >> a >> b >> c;
    int sum = a+b+c;
    int m = max(a,b);
    m = max(m,c);
    int m3 = m*3;
    if(sum %2 == m3%2) cout << (m3-sum)/2<<endl;
    else cout << (m3+3 - sum) / 2 << endl;
}

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

int main(){
  string s; cin >> s;
  rep(i,s.size())
    if(i%2 == 0) cout << s[i];
  return 0;
}

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

int N;

struct Robo {
	int X;
	int L;
};

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

    vector<Robo> robots(N);

    for (int i=0; i<N; i++) {
    	cin >> robots[i].X >> robots[i].L;
    }

    sort(robots.begin(), robots.end(), [](const Robo &a, const Robo &b) {
        return a.X + a.L < b.X + b.L;
    });

    // 左端を残す場合
    int n_robo_1 = 1;
    int r_arm_pos = robots[0].X + robots[0].L;
    for (int i=1; i<N; i++) {
    	int l_arm_pos = robots[i].X - robots[i].L;
    	if (l_arm_pos >= r_arm_pos) {
    		n_robo_1++;
    		r_arm_pos = robots[i].X + robots[i].L;
    	}
    }

    // 左端を残さない場合
    int n_robo_2 = 1;
    r_arm_pos = robots[1].X + robots[1].L;
    for (int i=2; i<N; i++) {
    	int l_arm_pos = robots[i].X - robots[i].L;
    	if (l_arm_pos >= r_arm_pos) {
    		n_robo_2++;
    		r_arm_pos = robots[i].X + robots[i].L;
    	}
    }

    int ans = max(n_robo_1, n_robo_2);
    cout << ans << endl;

    return 0;
}

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

int main(){
  int N; cin >> N;
  
  vector<pair<int,int>> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i).first;
    A.at(i).second = i+1;
  }
  
  sort(A.begin(),A.end());

  for(int i=0; i<N; i++)
    cout << A.at(i).second << ' ';
}

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

int main() {
  int n;

  cin >> n;
  
  int thousands = n / 1000;
  int hundreds = (n % 1000) / 100;
  int tens = (n % 100) / 10;
  int ones = (n % 10) / 1;
    
  if (thousands == hundreds && hundreds == tens) {
    cout << "Yes" << endl;
  } else if (hundreds == tens && tens == ones) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
S = input()
even_black_num = 0
even_white_num = 0
odd_black_num = 0
odd_white_num = 0
for i, s in enumerate(S):
    if i % 2 == 0:
        if s == "1":
            even_white_num += 1
        else:
            even_black_num += 1
    else:
        if s == "1":
            odd_white_num += 1
        else:
            odd_black_num += 1

print(min(even_black_num + odd_white_num, odd_black_num + even_white_num))

Measured memory_bytes: 3188
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>

using namespace std;
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main() {
	int N = 1;
	int D, B;
	cin >> D >> B;
	for (int i = 0; i < D; i++) N *= 100;
	if(B<100)	cout << B*N << endl;
        else cout<<101*N<<endl;
	return 0;
}


Measured memory_bytes: 256
function Main(s){
  s = s.split("\n");
  var n = s[0].split(" ").map(a=>+a);
  var m = n[1];
  var q = n[2] - 1;
  var t = n[3] - 1;
  n = n[0];
  var u = [], v = [], a = [], b = [];
  for(var i = 0; i < m; i++){
    var z = s[i+1].split(" ").map(a=>+a);
    u[i] = z[0] - 1; v[i] = z[1] - 1; a[i] = z[2]; b[i] = z[3];
  }
  var c = dijkstra(u,v,a,q,n);
  var d = dijkstra(u,v,b,t,n);
  var e = [];
  i = n - 1;
  e[i] = 1e15 - c[i] - d[i];
  for(;i--;)e[i] = Math.max(e[i+1], 1e15 - c[i] - d[i]);
  console.log(e.join("\n"));
}
function dijkstra(a,b,c,s,k){
  var t = Array(k).fill(0).map(a=>[]);
  for(var i = 0; i < a.length; i++)t[a[i]][b[i]] = t[b[i]][a[i]] = c[i];
  var r = Array(k).fill(9e99); r[s] = 0;
  var f = Array(k).fill(0);
  var pq = new PriorityQueue();
  pq.push([s,0]);
  while(pq.size()){
    var x = pq.pop();
    if(f[x])continue;
    f[x] = 1;
    for(i in t[x]){
      if(r[i] <= r[x] + t[x][i])continue;
      r[i] = r[x] + t[x][i];
      pq.push([i,r[i]]);
    }
  }
  return r;
}
var PriorityQueue = function() {
  this.heap = new Array();
  this.pointer = 0;
};
PriorityQueue.prototype = {
  push : function(x) {
    var i = this.pointer++;
    while (i > 0) {
      //親ノードの番号を求める
      var p = Math.floor((i - 1) / 2);
      //もう逆転してなければ処理を打ち切る
      if (this.heap[p][1] <= x[1]) break;
      this.heap[i] = this.heap[p];
      i = p;
    }
    this.heap[i] = x;
  },
  pop : function() {
    var ret = this.heap[0];
    var x = this.heap[--this.pointer];
    var i = 0;
    //子ノードがなくなるまでループ
    while (i * 2 + 1 < this.pointer) {
      var a = i * 2 + 1; //左子ノード
      var b = i * 2 + 2; //右子ノード
      if (b < this.pointer && this.heap[b][1] < this.heap[a][1]) a = b;
      //もう逆転してなければ処理を打ち切る
      if (this.heap[a][1] >= x[1]) break;
      this.heap[i] = this.heap[a];
      i = a;
    }
    this.heap[i] = x;
    //最終ノードを削除する
    this.heap.pop();
    return ret[0];
  },
  size : function() {
    return this.heap.length;
  }
};
Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  vector<int> n = {a, b, c};
  sort(n.begin(), n.end());
  cout << n.at(2)*10 + n.at(1) + n.at(0) << endl;
}

Measured memory_bytes: 3632
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int n, m;

int main() {
	string s;
	cin >> s;
	string::size_type  pos = 0;
	while ((pos = s.find("eraser", 0)) != std::string::npos) {
		s.replace(pos, 6, "");
	}
	pos = 0;
	while ((pos = s.find("erase", 0)) != std::string::npos) {
		s.replace(pos, 5, "");
	}
	pos = 0;
	while ((pos = s.find("dreamer", 0)) != std::string::npos) {
		s.replace(pos, 7, "");
	}
	pos = 0;


	while ((pos = s.find("dream", 0)) != std::string::npos) {
		s.replace(pos, 5, "");
	}
	if (s.length() == 0) {
		cout << "YES" << endl;
	}
	else if (s.length() % 2) {
		cout << "NO" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#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>;

int main(){
    int a,b;
    cin >> a >> b ;
    string c;
    if(a>=b){
        rep(i,a){
            c+=to_string(b);
        }

    }
    else{
        rep(i,b){
            c+=to_string(a);
        }
    }
    cout << c << endl;

    return 0;
}

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

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

    long long i,j,k,l,m,n,o,p,T;

  while(cin>>n){
    j=n*n;
    k=j*n;
    cout<<n+j+k<<endl;
  }

    return 0;

}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll n; cin >> n;
	vl a(n); REP(i, n) cin >> a[i];
	{
		map<ll, ll> a_rev;
		set<ll> a_s(ALL(a));
		ll index = 0;
		for (ll x : a_s) a_rev[x] = index++;
		REP(i, n) a[i] = a_rev[a[i]];
	}

	ll cnt = 0;
	REP(i, n) if (i % 2 != a[i] % 2) cnt++;
	cout << cnt / 2 << endl;

	return 0;
}

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

using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> edges(N - 1);
  vector<vector<int>> G(N, vector<int>());
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edges[i] = {a, b};
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int K = 0;
  map<pair<int, int>, int> colors;
  vector<int> colors_to_parent(N);
  vector<bool> visited(N, false);
  queue<int> que;
  que.push(0);
  visited[0] = true;

  while (!que.empty()) {
    int v = que.front();
    que.pop();

    chmax(K, (int)G[v].size());

    int color = 1;
    for (int u : G[v]) {
      if (visited[u]) {
        continue;
      }
      if (color == colors_to_parent[v]) {
        color++;
      }
      colors_to_parent[u] = colors[{u, v}] = colors[{v, u}] = color;
      color++;
      visited[u] = true;
      que.push(u);
    }
  }

  cout << K << endl;
  for (auto e : edges) {
    cout << colors[e] << endl;
  }

  return 0;
}


Measured memory_bytes: 19712