akhauriyash/Code-Regression huggingface dataset:
module ABC102

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_B

  ! constants for this <module>
  integer(INT32), parameter, private :: len_sequence_max = 100

  ! variables for this <module>
  integer(INT32), private :: len_sequence

  ! array for this <module>
  integer(INT32), private :: val_sequence(1:len_sequence_max)

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_B

    ! variables for this <subroutine>
    integer :: iter

    ! STEP.01
    ! read out the length of the given sequence
    read(unit=INPUT_UNIT, fmt=*) len_sequence

    ! STEP.02
    ! read out the values of the given sequence
    read(unit=INPUT_UNIT, fmt=*) val_sequence(1:len_sequence)  

    ! STEP.03
    ! calculate & output the maximum difference of the given sequence
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') &!
      maxval(val_sequence(:), dim=1, mask=val_sequence .ge. 1_INT32) - &!
      minval(val_sequence(:), dim=1, mask=val_sequence .ge. 1_INT32)

    ! STEP.END
    return

  end subroutine task_B

end module ABC102


program main

  ! <module>s to import
  use, non_intrinsic :: ABC102

  ! require all variables to be explicitly declared
  implicit none

  call task_B

end program main

Measured memory_bytes: 256
N, L = map(int,input().split())
Aji =[0]*N
for i in range(N):
    Aji[i] = L +i
AjiAbs = list(map(abs,Aji))
minAjiAbs = min(AjiAbs)
a=AjiAbs.index(minAjiAbs)

print(sum(Aji)-Aji[a])

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

#define pb push_back
#define FOR(i, s, e) for (int (i) = (s); (i) < (e); (i)++)

int main() {
    int A, B, Q; cin >> A >> B >> Q;
    vector<ll> s, t;
    s.pb(-1e18); t.pb(-1e18);
    FOR(i, 0, A) {
        ll x;
        cin >> x;
        s.pb(x);
    }
    s.pb(-s[0]);
    FOR(i, 0, B) {
        ll x;
        cin >> x;
        t.pb(x);
    }
    t.pb(-t[0]);

    FOR(i, 0, Q) {
        ll d; cin >> d;
        int r = lower_bound(s.begin(), s.end(), d) - s.begin();
        int l = lower_bound(t.begin(), t.end(), d) - t.begin();

        ll ans = 1e18;
        ans = min(ans, max(s[r], t[l]) - d);
        ans = min(ans, d - min(s[r - 1], t[l - 1]));
        ans = min(ans, 2*s[r] - t[l - 1] - d);
        ans = min(ans, 2*t[l] - s[r - 1] - d);
        ans = min(ans, -2*s[r - 1] + t[l] + d);
        ans = min(ans, -2*t[l - 1] + s[r] + d);
        printf("%lld\n", ans);
    }

}

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int n,s[10000]={},q,t,i,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",s+i);
    }
    for(scanf("%d",&q);q--;){
        scanf("%d",&t);
        for(i=0;i<n;i++){
            if(s[i]==t){
                cnt++;
                break;
            }
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 2132
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 2e5 + 300, N2 = 2e3, inf = 1e9 + 200;

int t[4*N], c[4*N];
int d[N];

vector <int> L[N], R[N];
/*
void push(int v, int l, int r){
	t[v] += c[v];
	if (l != r){
		c[v+v] += c[v];
		c[v+v+1] += c[v];
	}
	c[v] = 0;
}

void update (int v, int ll, int rr, int l, int r, int res){
	push(v, ll, rr);
	if (ll > r || rr < l) return;
	if (ll >= l && rr <= r){
		c[v] += res;
		push(v, ll, rr);
	}
	else{
		int mid = (ll + rr) / 2;
		update(v+v, ll, mid, l, r, res);
		update(v+v+1, mid + 1, rr, l, r, res);
		t[v] = max(t[v+v], t[v+v+1]);
	}
}

int maxi(int v, int ll, int rr, int l, int r){
	push(v, ll, rr);
	if (ll > r || rr < l){
		return -1;
	}
	if (ll >= l && rr <= r){
		return t[v];
	}
	int mid = (ll + rr) / 2;
	return max(maxi(v+v, ll, mid, l, r), maxi(v+v+1, mid + 1, rr, l, r));
}*/

void propagate(int pos,int left,int right){

	if(c[pos] == 0) return;

	if(left != right){
		c[2*pos] += c[pos];
		c[2*pos+1] += c[pos];
	}

	t[pos] += c[pos];
	c[pos] = 0;

}

void update(int pos,int left, int right,int i,int j, int delta){

	propagate(pos,left,right);
	if(left > right || left > j || right < i) return;

	if(left >= i && right <= j){
		c[pos] += delta;
		propagate(pos,left,right);
		return;
	}

	int mid = (left+right)/2;
	update(2*pos,left,mid,i,j,delta);
	update(2*pos+1,mid+1,right,i,j,delta);

	t[pos] = max(t[2*pos],t[2*pos+1]);

}

int maxi(int pos,int left,int right,int i,int j){

	propagate(pos,left,right);

	if(left >= i && right <= j) return t[pos];

	int mid = (left+right)/2;
	if(j <= mid) return maxi(2*pos,left,mid,i,j);
	else if(i >= mid + 1) return maxi(2*pos+1,mid+1,right,i,j);
	else return max(maxi(2*pos,left,mid,i,j), maxi(2*pos+1,mid+1,right,i,j));

}

int l[N], r[N], x[N];

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		cin >> l[i] >> r[i] >> x[i];
		L[l[i]].pb(i);
		R[r[i]].pb(i);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++){
		for(int j : L[i]){
			update(1, 0, n, 0, l[j] - 1, x[j]);
		}
		d[i] = maxi(1, 0, n, 0, i - 1); 
		ans = max(ans, d[i]);
		update(1, 0, n, i, i, d[i]);
		for(int j : R[i]){
			update(1, 0, n, 0, l[j] - 1, -x[j]);
		}
	}
	cout << ans;
	
	return 0;
}

/*
for(int i = 1;i<=N;i++){
		for(int j : adiciona[i]){
			update(1,0,N,0,ini[j] - 1,valor[j]);
		}
		dp[i] = query(1,0,N,0,i-1);
		update(1,0,N,i,i,dp[i]);
		for(int j : retira[i]){
			update(1,0,N,0,ini[j] - 1,-valor[j]);
		}
	}*/









Measured memory_bytes: 39424
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    if(x==2){
      System.out.println(2);
      return;
    }
    for(long i=x;i<x*5;i++){
      boolean flag = true;
      for(int j=2;j<=Math.sqrt(i);j++){
        if(i%j==0)flag=false;
      }
      if(flag){
        System.out.println(i);
        return;
      }
    }
  }
}


Measured memory_bytes: 21716
'use strict';
(function(stdin) {
  var greaterOrEqualZero = function(v) {
    return v >= 0;
  };
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);
  (function(W, H, x, y, r) {
    // ????????????????????????
    // 
    console.log({true:'Yes',false:'No'}[
      [W - (x + r), H - (y + r), x - r, y - r]
        .every(greaterOrEqualZero)
    ]);

  }(params[0], params[1], params[2], params[3], params[4]));

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15580
#include <stdio.h>
#include <stdlib.h>

int n,m,a;
typedef struct{
	int h;
	int p;
	int q;
} wire;
wire lines[1001];

int comp(const void *c1,const void *c2){
	wire *w1=(wire*)c1;
	wire *w2=(wire*)c2;
	return w2->h - w1->h;
}

void solve(){
	int i,h,p,q;
	for(i=1;i<=1000;i++){
		lines[i].h=0;
		lines[i].p=0;
		lines[i].q=0;
	}
	for(i=0;i<m;i++){
		scanf("%d %d %d",&h,&p,&q);
		lines[i].h=h;
		lines[i].p=p;
		lines[i].q=q;
	}
	qsort(lines,m,sizeof(wire),comp);

	h=lines[0].h;
	i=0;
	while(h){
		for(;lines[i].h==h;i++){
			if(lines[i].p==a){
				a=lines[i].q;
			}else if(lines[i].q==a){
				a=lines[i].p;
			}
		}
		h--;
	}
	printf("%d\n",a);
	return;
}


int main(void){
	while(scanf("%d %d %d",&n,&m,&a),n|m|a){
		solve();
	}
	return 0;
}

Measured memory_bytes: 668
#define _CRT_SECURE_NO_DEPRECATE
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; // 注意必要时改类型
typedef vector<int> vi;
const int N = (int)1e5;
//dp[i] = 1 石子为i的时候 先手赢
//dp[i] = -1 后手赢
int n, k, dp[N];
vi a;
set<int> s;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifdef _DEBUG
	int tt = clock();
	// freopen("in.txt", "r", stdin);
#endif 
	cin >> n >> k;
	a.resize(n);
	for (Rint i = 0; i < n; ++i) {
		cin >> a[i];
		s.insert(a[i]);
	}
	sort(a.begin(), a.end());
	dp[0] = -1;
	// 遍历0-k;
	for (Rint i = 0; i <= k; ++i) {
		if (i < a[0]) {
			// 如果不够拿 后手赢
			dp[i] = -1;
			continue;
		}
		else {
			// 必能拿
			dp[i] = -1;
			for (Rint j = 0; j < a.size() && i >= a[j]; ++j) {
				if (dp[i - a[j]] == -1) dp[i] = 1;
			}
		}
	}
	if (dp[k] == 1) cout << "First" << endl;
	else cout << "Second" << endl;
#ifdef _DEBUG
	cerr << "\nTIME = " << clock() - tt << endl;
	tt = clock();
#endif

	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

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

//main code

int main(int argc, char const* argv[])
{
	int n,k;
	cin >> n >> k;
	int sum = n / 2 + (n % 2);
	cout << (sum < k ? "NO" : "YES") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#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 pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi H(N);
  rep(i,N) {
    cin >> H[i];
  }
  int ans = 0;
  int temp = 0;
  int h = H[0];
  srep(i,1,N) {
    if(H[i] <= h) {
      temp++;
    } else {
      ans = max(ans,temp);
      temp = 0;
    }
    h = H[i];
  }
  ans = max(ans,temp);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int w, h, x, y;
   cin >> w >> h >> x >> y;
   double s = (double)w * h / 2.0;
   if (w == 2 * x && h == 2 * y) {
      printf("%0.9f 1\n", s);
   } else {
      printf("%0.9f 0\n", s);
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        #define ll long long
        #define lld long double
        #define MOD 1000000007
        #define CAP 100000001
        #define inf 1000000000000000LL
        #define pii pair<ll,ll>
        #define f first
        #define s second
        #define pb push_back
        #define mp make_pair
        #define endl '\n'
        #define sz(v) v.size()
        #define all(v)    v.begin(),v.end()
        #define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
        #define int ll
        using namespace std;
        ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
         
         
        signed main() {
        	//fast;
        	ll n;
        	cin>>n;
        	ll s=0;
        	ll lef=0,rig=0;
        	multiset<ll> s1,s2;
        	for(int i=0;i<n;i++){
        		ll q;
        		cin>>q;
        		if(q==1){
        			ll a,b;
        			cin>>a>>b;
        			s+=b;

        			if(s2.empty()||(*(s2.begin()))>a){
        				s1.insert(a);
        				lef+=a;
        			}
        			else {
        				s2.insert(a);
        				rig+=a;
        			}
        			
        			if((ll)s1.size()>(ll)s2.size()+1) {
        				multiset<ll>::iterator it=std::prev(s1.end());
        				ll temp= *it;
        				rig+=temp;
        				lef-=temp;
        				s2.insert(temp);
        				s1.erase(it);
        			}
        			if((ll)s2.size()>(ll)s1.size()) {
        				multiset<ll>::iterator it=s2.begin();
        				ll temp= *it;
        				rig-=temp;
        				lef+=temp;
        				s1.insert(temp);
        				s2.erase(it);
        			}
        		}
        		else {
        			multiset<ll>::iterator it=std::prev(s1.end());
        			ll med=*it;
        			ll ans=s;
                  	if((ll)s1.size()>(ll)s2.size()) ans+=med;
                  ans-=lef;
                    ans+=rig;
        			cout<<med<<" "<<ans<<endl;
        		}
        	}
        }

Measured memory_bytes: 9600
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 2; i <= n; ++i) {
        int tmp = i;
        for (int j = 2; j * j <= i; ++j) {
            while(1) {
                if (tmp % j != 0) break;
                ++mp[j];
                tmp /= j;
            }
        }
        //cout << i << " " << tmp << endl;
        if (tmp!=1) ++mp[tmp];
    }
    //for (auto p : mp) {
    //    cout << p.first << " " << p.second << endl;
    //}
    vector<int> dp(76, 0);
    dp[1] = 1;
    for (int i = 1; i <= 100; ++i) {
        if (mp[i]!=0) {
            for (int j = 75; j >= 1; --j) {
                for (int x = 1; x <= mp[i]; ++x) {
                    if (j * (x+1) <= 75) {
                        dp[j*(x+1)] += dp[j];
                    } 
                }
            }
        }
    }
    cout << dp[75] << endl;
    return 0;
}

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

const int n_ = 200000+2;
const int sz_ = (1<<18);

int n, q, a[n_], s[n_], z[n_];
int d[n_];
int tree[sz_+sz_];
vector<int> v[n_];

void update(int s, int e, int x) {
    s += sz_, e += sz_;
    while (s <= e) {
        tree[s] = min(tree[s], x);
        tree[e] = min(tree[e], x);
        s  = (s+1)>>1, e = (e-1)>>1;
    }
}

int query(int i) {
    int r = 1e9;
    i += sz_;
    while (i) {
        r = min(r, tree[i]);
        i >>= 1;
    }
    return r;
}

int main() {
    for (int i = 1; i < sz_+sz_; i++) {
        tree[i] = 1e9;
    }
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        s[i] = s[i-1] + 1 - a[i];
    }
    scanf("%d", &q);
    while (q--) {
        int l, r;
        scanf("%d %d", &l, &r);
        v[r].push_back(l);
    }

    for (int i = 1; i <= n; i++) {
        update(i-1, i-1, d[i-1]-s[i-1]);
        d[i] = d[i-1] + a[i];
        for (int l : v[i]) {
            update(l, i, query(l-1));
        }
        d[i] = min(d[i], query(i)+s[i]);
    }

    //puts("");

    printf("%d\n", d[n]);

    return 0;
}

Measured memory_bytes: 14848
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 1e2 + 2;
const int K = 1e5 + 2;

int n, k, a[N];
int dp[K];

int DP(int numStone)
{
    if (~dp[numStone])
        return dp[numStone];
    if (numStone == 0)
        return dp[numStone] = 0;
    for (int i = 1; i <= n; ++i)
        if (numStone - a[i] >= 0 && !DP(numStone - a[i]))
            return dp[numStone] = 1;
    return dp[numStone] = 0;
}

int main()
{
//    freopen("input.inp", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    memset(dp, -1, sizeof dp);
    cout << (DP(k) ? "First" : "Second");
    return 0;
}


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

using namespace std;

long n,k,d[100],m,ans;
bool a[100];

int main () 
{
    cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		cin>>d[i];
		for(int j=0;j<d[i];j++) 
		{
			cin>>m;
			a[m]=true;
		}
	} 
	for(int i=1;i<=n;i++) if(a[i]==false) ans++;
	cout<<ans;
    return 0;
}

Measured memory_bytes: 3592
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*

 */
string s;
int main(){
  cin >> s;
  if (s[0] == s[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    map<int,int> a;
    rep(i,n){
        int x; cin >> x;
        a[x]++;
    }
    int m; cin >> m;
    rep(i,m){
        int x; cin >> x;
        a[x]--;
        if(a[x] < 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


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

int main() {
  int64_t A, V, B, W, T;
  cin >> A >> V >> B >> W >> T;
  int64_t D = A - B;
  if(D < 0) D *= -1;
  int64_t d = V - W;
  if(d == 0) d = -1;
  if(d * T >= D) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3632
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;
}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_C() {}

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

    int N; cin >> N;
    vi t(N+1, 0), x(N+1, 0), y(N+1, 0); 
    FOR(i,1,N+1) cin >> t[i] >> x[i] >> y[i];

    bool ok = true;

    FOR(i,0,N) {
        int dt = t[i+1] - t[i];
        int dx = abs(x[i+1] - x[i]);
        int dy = abs(y[i+1] - y[i]);
        if (dx+dy > dt || (dx+dy)%2 != dt%2){
            ok = false;
            break;
        }
    }
  
    string ans = ok ? "Yes" : "No";
    cout << ans << endl;  

    return 0;
}

Measured memory_bytes: 1408
H,W,N = map(int,input().split())
d = {}
for _ in range(N):
    a,b = list(map(int,input().split()))
    for dy in range(-1,2):
        for dx in range(-1,2):
            cy = a + dy
            cx = b + dx
            if 2 <= cy <= H-1 and 2 <= cx <= W-1:
                if (cy,cx) not in d:
                    d[(cy,cx)] = 1
                else:
                    d[(cy, cx)] += 1
ans = [0]*10
for v in d.values():
    ans[v] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])

for i in range(10):
    print(ans[i])

Measured memory_bytes: 143736
n=int(input())
S="SHCD"
A=[]
for i in range(4):
    B=[0 for i in range(13)]
    A.append(B)
for i in range(n):
    a,b=[j for j in input().split()]
    b=int(b)
    b-=1
    if a=="S":
        a=0
    elif a=="H":
        a=1
    elif a=="C":
        a=2
    else: 
        a=3
    A[a][b]=1
for i in range(4):
    for j in range(13):
        if A[i][j]==0:
            print(S[i],end=" ")
            print(j+1)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {
    fastio
	int n,t,i,j,x,k=0,y;
	int h,w,ans;
    cin>>h>>w>>n;
    
    set<pair<int,int> > st;
    vector<int> a(h+1,0),b(w+1,0);
    
    for(i=0;i<n;i++){
        cin>>x>>y;
        st.insert({x,y});
        a[x]++,b[y]++;
    }
    
    vector<pair<int,int> > l(h),p(w);
    
    for(i=1;i<=h;i++)
    l[i-1]={a[i],i};
    
    for(i=1;i<=w;i++)
    p[i-1]={b[i],i};
    
    sort(l.rbegin(),l.rend());
    sort(p.rbegin(),p.rend());
    
    ans=l[0].first+p[0].first;
    if(st.count({l[0].second,p[0].second})==1) 
    ans-=1;
    else{
        cout<<ans;
        exit(0);
    }
    
    i=1,j=1;
    x=l[0].first;
    y=p[0].first;
    int c=0;
    
    if(i<h){
    while(l[i].first==x){
        if(st.count({l[i].second,p[0].second})==0){
            c=1;
            ans++;
        }
        i++;
        if(i==h || c==1) break;
    }
    }
    if(j<w && c==0){
    while(p[j].first==y){
        if(st.count({l[0].second,p[j].second})==0){
            c=1;
            ans++;
        }
        j++;
        if(j==w || c==1) break;
    }
    }
    cout<<ans;
    
	return 0;
}

Measured memory_bytes: 24660
import java.util.Scanner;

/**
 * お遊び
 *
 * @author s-sugimoto
 */
public class Main {

	/**
	 * 隠蔽
	 */
	private Main() {
	}

	/**
	 * メイン
	 *
	 * @param args 起動引数
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		// 100A
		double a = scanner.nextInt();
		// 100B
		double b = scanner.nextInt();
		// C
		double c = scanner.nextInt();
		// D
		double d = scanner.nextInt();
		// 砂糖は100GあたりEとけるらしい
		double e = scanner.nextInt();
		// 砂糖と水の質量の合計がF
		double f = scanner.nextInt();

		double satoumizu = 100 * a;
		double satou = 0.0;
		double noudo = 0.0;
		for (int i = 0; i * a * 100 <= f; i++) {
			for (int j = 0; (i * a + j * b) * 100 <= f; j++) {
				// 溶かすことのできる砂糖の量
				double mizu = (i * a + j * b) * 100;
				double satouLimit = (i * a + j * b) * e < f - mizu ? (i * a + j * b) * e : f - mizu;

				for (int k = 0; k * c <= satouLimit; k++) {
					int dsSatouLimitCount = (int) ((satouLimit - k * c) / d);
					double newSatou = k * c + dsSatouLimitCount * d;
					double newSatoumizu = mizu + newSatou;

					// System.out.println(String.format("砂糖水の量:%f,cの砂糖:%f,dの砂糖%f,総砂糖:%f", (i * a + j * b) * 100 +
					// newSatou, c, d,
					// newSatou));

					if (i + j != 0 && k + dsSatouLimitCount != 0) {
						double newnoudo = newSatou * 100 / newSatoumizu;
						// System.out.println(String.format("砂糖水の量:%f,cの砂糖:%f,dの砂糖%f,総砂糖:%f,濃度:%f",
						// (i * a + j * b) * 100 + newSatou, c, d, newSatou, newnoudo));

						if (noudo < newnoudo && satoumizu <= f) {
							satou = newSatou;
							satoumizu = newSatoumizu;
							noudo = newnoudo;
						}
					}
				}
			}
		}

		System.out.println((int) satoumizu + " " + (int) satou);
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
using namespace std;

int n;
int a[500005];
int lf[500005/2];
int rt[500005/2];
int count = 0;

void merge(int l, int mid, int r) {
    int n1 = mid - l;
    int n2 = r - mid;
    for (int i = 0; i < n1; i++) {
        lf[i] = a[l + i];
    }
    for (int i = 0; i < n2; i++) {
        rt[i] = a[mid + i];
    }
    int i = 0;
    int j = 0;
    for (int k = l; k < r; k++) {
        count++;
        if ((lf[i] <= rt[j] && i != n1) || (j == n2)) {
            a[k] = lf[i];
            i++;
        } else {
            a[k] = rt[j];
            j++;
        }
    }
}

void mergeSort(int l, int r) {
    if (l + 1 < r) {
        int mid = (l + r) / 2;
        mergeSort(l, mid);
        mergeSort(mid, r);
        merge(l, mid, r);
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d",&a[i]);
    }
    mergeSort(0, n);
    for (int i = 0; i < n; i++) {
        if (i) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;
    cout << count << endl;
    return 0;
}

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

#define ll long long
using namespace std;
const int mod = 1e9 + 7, N = 1007;
int n, m;
int dp[N][N];
char grid[N][N];
int solve(int i,int j){
    if(i==n-1&&j==m-1)return 1;
    if(i>=n||j>=m||grid[i][j]=='#')return 0;
    int &ret=dp[i][j];
    if(~ret)return ret;
    return ret=(solve(i+1,j)+solve(i,j+1))%mod;
}
int main() {
    scanf("%d%d",&n,&m);
     ll sum=0;
    memset(dp,-1, sizeof dp);
    for (int i = 0; i < n; ++i)for (int j = 0; j < m; ++j)scanf(" %c",&grid[i][j]);
cout<<solve(0,0);
    return 0;
}


Measured memory_bytes: 5248
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Schitiz
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A_166 solver = new A_166();
        solver.solve(1, in, out);
        out.close();
    }

    static class A_166 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            if(s.equals("ABC")) out.println("ARC");
            else out.println("ABC");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if(numChars == -1) {
                throw new InputMismatchException();
            }
            if(curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch(IOException e) {
                    throw new InputMismatchException();
                }
                if(numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        private String nextString() {
            int c = read();
            while(isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if(Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while(!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            if(filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32336
#include<iostream>
#include<vector>
#include<queue>
#define INF 2e9
using namespace std;

void Dikstra(const vector<vector<pair<int, int> > >& G, vector<int>& d){
    d[0] = 0;
    priority_queue<pair<int, int> , vector<pair<int, int> >, greater<pair<int, int> > > PQ;
    PQ.push(make_pair(0, 0));
    vector<bool> is_black(d.size(), false);
    is_black[0] = true;
    while (!PQ.empty()) {
        int t = PQ.top().second;
        PQ.pop();
        is_black[t] = true;
        for (int i = 0; i < G[t].size(); i++) {
            int v = G[t][i].first;
            int w = G[t][i].second;
            if (!is_black[v] && d[t] + w < d[v]) {
                d[v] = d[t] + w;
                PQ.push(make_pair(d[v], v));
            }
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<pair<int, int> > > G(n);
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            G[u].push_back(make_pair(v, c));
        }
    }
    vector<int> d(n, INF);
    Dikstra(G, d);
    for (int i = 0; i < n; i++) {
        cout << i << " " << d[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3120
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){
  int i,j;
  int l;
  int n;
  int p[100000];
  int max1=0;
  int max2=0;
  int max11,max22=0;
  int maxnum1;
  int maxnum2;
  int maxnum11;
  int maxnum22;
  int a,b=0;

  for(i=0; i<100000; i++){
    p[i]=0;
  }

  scanf("%d",&n);

  int v[n];

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

  for(i=0; i<=n-1; i++){
    if(i%2==0){
      l = v[i];
      p[l]++;
    }
  }
  for(i=0; i<100000; i++){
    if(p[i]>max1){
      max1 = p[i];
      maxnum1 = i;
    }
  }
  for(i=0; i<100000; i++){
    if(p[i]>max11 && i!=maxnum1){
      max11 = p[i];
      maxnum11 = i;
    }
  }
  //printf("%d\n",maxnum1);
  for(i=0; i<100000; i++){
    p[i]=0;
  }
  for(i=0; i<=n-1; i++){
    if(i%2==1){
      l = v[i];
      p[l]++;
    }
  }
  for(i=0; i<100000; i++){
    if(p[i]>max2){
      max2 = p[i];
      maxnum2 = i;
    }
  }
  for(i=0; i<100000; i++){
    if(p[i]>max22 && i!=maxnum2){
      max22 = p[i];
      maxnum22 = i;
    }
  }

  if(maxnum1!=maxnum2){
    for(i=0; i<=n-1; i++){
      if(i%2==0){
        if(v[i]!=maxnum1){
          a++;
        }
      }else if(i%2==1){
        if(v[i]!=maxnum2){
          b++;
        }
      }
    }
  }
  if(maxnum1==maxnum2){
    if(max1+max22>=max2+max11){
      for(i=0; i<=n-1; i++){
        if(i%2==0){
          if(v[i]!=maxnum1){
            a++;
          }
        }else if(i%2==1){
          if(v[i]!=maxnum22){
            b++;
          }
        }
      }
    }else if(max1+max22<max2+max11){
      for(i=0; i<=n-1; i++){
        if(i%2==0){
          if(v[i]!=maxnum11){
            a++;
          }
        }else if(i%2==1){
          if(v[i]!=maxnum2){
            b++;
          }
        }
      }
    }
  }

  //printf("%d\n",a);
  printf("%d\n",a+b);


  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD (int)1e9 + 7
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, 1, -1, 1, -1 };

int n, t, base;
vi v;

int main() {
	fastio;
	cin >> n;
	FOR(i, n) {
		cin >> t;
		v.pb(t);
		base ^= t;
	}
	FOR(i, n) {
		cout << (base ^ v[i]) << " ";
	}
}

Measured memory_bytes: 4268
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

int N;
string C;

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

    int R=0, W=0;
    rep(i,N){
        if(C[i]=='R') R++;
        else W++;
    }

    int r=0, w=0;
    int ans=R;
    rep(i,N){
        if(C[i]=='R') r++;
        else w++;
        int res=0;
        res+=min(w,R-r);
        res+=abs(R-r-w);
        ans=min(ans,res);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3612
n=gets.to_i

p 0

aa=gets.chomp
if aa=="Vacant"
    exit
end
gg=(n+1)/2
p (n+1)/2



bb=gets.chomp

if bb=="Vacant"
    exit
end

ll=0
rr=0
p n-1

ss=gets.chomp
if ss=="Vacant"
    exit
end





if aa!=bb && gg%2==0
    ll=0
    rr=gg
    
    elsif aa==bb  &&  gg%2==1
    ll=0
    rr=gg
    
else
    ll=gg
    rr=n-1
    
end
    
17.times{
    
   kk=(ll+rr)/2
   p kk
    
    cc=gets.chomp
    
    if cc=="Vacant"
    exit
    end
    
    if cc==aa && kk%2==0
     ll=kk
     
     elsif cc!=aa && kk%2==1
     ll=kk
     
     else  
         rr=kk
     end
    
    
    
    
}









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

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

int main(void) {
    string s, ans = "";

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    REP(i, s.length()) {
        if (s[i] != 'B') {
            ans += s[i];
        } else if (!ans.empty()) {
            ans.erase(ans.length() - 1);
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#include <limits>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
const double eps = 1e-7;
int N, M, K, Q, T;
ll gcd(ll a, ll b) {
	if (b == 0LL) return a;
	return gcd(b, a % b);
}

int main()
{
	int i, j;
	long double a, b;
	cin >> a >> b;
	long double c = a * b;
	ll d = (ll)c;
	cout << d;
}

Measured memory_bytes: 3724
n = gets.to_i
d = n.to_s.size # 桁数
num = [3, 5, 7]
q = num.dup
ans = 0
until q.empty?
  c = q.shift
  cd = c.to_s.size
  if cd < d
    num.each do |ci|
      t = 10 * c + ci
      q << t
      next if t > n
      t = t.to_s
      if t.count("3") > 0 && t.count("5") > 0 && t.count("7") > 0
        ans += 1
      end
    end
  end
end
p ans

Measured memory_bytes: 1916
import sys
import math

n = int(sys.stdin.readline().strip())

a = math.ceil(math.sqrt(n))

ans = 10
i = a
while i > 0:
    if n % i == 0:
        m1 = i
        m2 = int(n/i)

        m = max(m1, m2)
        ord_m = int(math.log10(m) + 1)
        ans = min(ans, ord_m)
    i -= 1

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#define NMAX 100000
#define QMAX 50000
using namespace std;

bool chkInS (int t, int *S, int sb, int se) {
    if (sb == se) {
        if ( S[sb] == t ) {
            return true;
        } else return false;
    } else if (se - sb == 1) {
        if ( S[sb] == t || S[se] == t ) {
            return true;
        } else return false;
    } else {
        int c = (sb + se) / 2;
        if ( S[c] == t ) {
            return true;
        } else if ( t < S[c] ) {
            return chkInS (t, S, sb, c-1);
        } else if ( t > S[c] ) {
            return chkInS (t, S, c+1, se);
        }
    }
    return false;
}

void solve (int *S, int n, int *T, int q, int *c) {
    for (int i=0; i<q; i++) {
        if ( chkInS ( T[i], S, 0, n-1 ) ) {
            *c += 1;
        }
    }
}

int main () {
    // input
    int n;
    cin >> n;
    int S[NMAX];
    for (int i=0; i<n; i++) {
        cin >> S[i];
    }
    int q;
    cin >> q;
    int T[QMAX];
    for (int i=0; i<q; i++) {
        cin >> T[i];
    }

    // solve
    int c = 0;
    solve (S, n, T, q, &c);

    // output
    cout << c << endl;
}


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b) f(i,0,n){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

/*****************************************************************************/


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

	int d, g;
	cin >> d >> g;
	vi p(d), c(d);
	f_v2I(p, c, d);
	int ans = 1e9;
	f(mask, 0, 1 << d) {
		int s = 0, num = 0, rest_max = -1;
		f(i, 0, d) {
			if (mask >> i & 1) {
				s += 100 * (i + 1)*p[i] + c[i];
				num += p[i];
			}
			else {
				rest_max = i;
			}
		}
		if (s < g) {
			int s1 = 100 * (rest_max + 1);
			int need = (g - s + s1 - 1) / s1;
			if (need >= p[rest_max]) {
				continue;
			}
			num += need;
		}
		ans = min(ans, num);
	}
	cout << ans;
	return 0;
}

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

long long int n;
vector< pair< long long int, string > > v;

int kansu( long long int k, long long int c ) {

  for ( long long int i = 0; i < c; i++ ) {
    cout << ".";
  }
  cout << v[k].second << endl;

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

    if ( v[i].first == k + 1 ) {
      kansu( i, c + 1 );
    }

  }

  return 0;

}

int main() {

  cin >> n;

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

    long long int in;
    string s;
    cin >> in >> s;
    v.push_back( make_pair( in, s ) );

  }

  kansu( 0, 0 );

  return 0;

}

Measured memory_bytes: 1376
#include <random>
#include <utility>
using namespace std;
template<typename T> class RBST {
public:
	struct node {
		T value;
		T min_val;
		int cnt;
		node *left,*right;
		node(T v):value(v),min_val(v),cnt(1) {
			left=right=NULL;
		}
	};
	random_device rnd;
	mt19937 mt;
	node *root;
	RBST():root(NULL) {mt.seed(rnd());}
	int count(node *t) {return !t?0:t->cnt;}
	node *update(node *t) {
		if(!t) return NULL;
		t->cnt=count(t->left)+count(t->right)+1;
		t->min_val=t->value;
		if(t->left) t->min_val=min(t->min_val,t->left->min_val);
		if(t->right) t->min_val=min(t->min_val,t->right->min_val);
		return t;
	}
	node *merge(node *l,node *r) {
		if(!l||!r) return !l?r:l;
		uniform_real_distribution<> x(0,l->cnt+r->cnt);
		if(x(mt)<l->cnt) {
			l->right=merge(l->right,r);
			return update(l);
		}else {
			r->left=merge(l,r->left);
			return update(r);
		}
	}
	pair<node*,node*> split(node *t,int k) {
		if(!t) return pair<node*,node*>(NULL,NULL);
		if(k<=count(t->left)) {
			pair<node*,node*> s=split(t->left,k);
			t->left=s.second;
			return make_pair(s.first,update(t));
		}else {
			pair<node*,node*> s=split(t->right,k-count(t->left)-1);
			t->right=s.first;
			return make_pair(update(t),s.second);
		}
	}
	node *insert(node *t,int k,T v) {
		pair<node*,node*> s=split(t,k);
		node *u=new node(v);
		t=merge(s.first,u);
		t=merge(t,s.second);
		return update(t);
	}
	void insert(int k,T v) {
		root=insert(root,k,v);
	}
	int lower_bound(node *t,T v) {
		if(!t) return 0;
		int c=count(t->left);
		if(t->value>v) {
			return lower_bound(t->left,v);
		}else if(t->value==v) {
			return c;
		}else {
			return c+1+lower_bound(t->right,v);
		}
	}
	int lower_bound(T v) {
		return lower_bound(root,v);
	}
	T get(node *t,int k) {
		int c=count(t->left);
		if(c==k) {
			return t->value;
		}else if(c>k) {
			return get(t->left,k);
		}else {
			return get(t->right,k-c-1);
		}
	}
	T get(int k) {
		return get(root,k);
	}
	node *erase(node *t,int k) {
		pair<node*,node*> u,v;
		u=split(t,k+1);
		v=split(u.first,k);
		t=merge(v.first,u.second);
		return update(t);
	}
	void erase(int k) {
		root=erase(root,k);
	}
};
int main() {
	RBST<int> r;
	int n,q;
	scanf("%d %d",&n,&q);
	for(int i=0;i<n;i++) {
		int a;
		scanf("%d",&a);
		r.insert(i,a);
	}
	for(int i=0;i<q;i++) {
		int x,y,z;
		scanf("%d %d %d",&x,&y,&z);
		if(x==0) {
			pair<RBST<int>::node*,RBST<int>::node*> a,b,c;
			a=r.split(r.root,z+1);//[0,z+1)[z+1,n)
			b=r.split(a.first,z);//[0,z)[z,z+1)
			c=r.split(b.first,y);//[0,y)[y,z)
			r.root=r.merge(c.first,r.merge(b.second,r.merge(c.second,a.second)));
		}else if(x==1) {
			pair<RBST<int>::node*,RBST<int>::node*> a,b,c;
			a=r.split(r.root,z+1);
			b=r.split(a.first,y);
			printf("%d\n",b.second->min_val);
			r.root=r.merge(b.first,r.merge(b.second,a.second));
		}else {
			r.erase(y);
			r.insert(y,z);
		}
	}
}

Measured memory_bytes: 13588
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=5e5;
int n,x,a[N],p[N];
int main()
{
    scanf("%d%d",&n,&x);n=2*n-1;
    if(x==1||x==n){puts("No");return 0;}
    puts("Yes");
    if(n==3)
    {
        cout<<1<<endl<<2<<endl<<3<<endl;
        return 0;
    }
    if(x==2)
    {
        a[n/2+1]=2;a[n/2]=1;a[n/2-1]=n;a[n/2+2]=3;
        p[2]=p[1]=p[n]=p[3]=1;
    }
    else if(x==n-1)
    {
        a[n/2+1]=n-1;a[n/2]=n;a[n/2-1]=1;a[n/2+2]=n-2;
        p[n]=p[n-1]=p[1]=p[n-2]=1;
    }
    else 
    {
        a[n/2+1]=x;a[n/2]=x-1;a[n/2-1]=x+1;a[n/2+2]=x+2;
        p[x]=p[x-1]=p[x+1]=p[x+2]=1;
    }
    int j=1;
    for(int i=1;i<=n;i++)
    {
        if(a[i])continue;
        while(p[j])++j;
        a[i]=j,++j;
    }
    for(int i=1;i<=n;i++)printf("%d\n",a[i]);
}

Measured memory_bytes: 4620
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vi a(28);
	rep(i,28) cin>>a[i];
	rep(i,30) if(find(allof(a),i+1)==a.end()) cout<<i+1<<endl;
	
	return 0;
}

Measured memory_bytes: 0
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed parsing")
}

fn main() {
    let q = read();
    let mut xs: Vec<String> = Vec::new();
    let mut ys: Vec<String> = Vec::new();
    for _ in 0..q {
        xs.push(read());
        ys.push(read());
    }

    for n in 0..q {
        let s: Vec<char> = xs[n].chars().collect();
        let t: Vec<char> = ys[n].chars().collect();
        // dp[i][j] = sの長さiの部分文字列と、tの長さjの部分文字列に対するLCS
        let mut dp = vec![vec![0; t.len() + 1]; s.len() + 1];

        for i in 1..s.len() + 1 {
            for j in 1..t.len() + 1 {
                dp[i][j] =
                    if s[i - 1] == t[j - 1] {
                        dp[i - 1][j - 1] + 1
                    } else {
                        std::cmp::max(dp[i - 1][j], dp[i][j - 1])
                    };
            }
        }
        println!("{}", dp[s.len()][t.len()]);
    }
}


Measured memory_bytes: 9108