akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
const int N = five;
ll dp[2][N];
pll val[N];
ll pre[N];
int main()
{
       int n;
       cin>>n;
       int a[n];
       pll b[n];
       fri(i,0,n){
              cin>>a[i]>>b[i].fr;
              b[i].sc = i;
       }
       sort(b,b+n);
       int st = 1;
       int i = 0;
       while(i<n){
              int fin = st+a[b[i].sc]-1;
              if(fin > b[i].fr){
                     cout<<"No"<<endl;
                     return 0;
              }
              st = fin+1;
              i++;
       }
       cout<<"Yes"<<endl;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define rank AAAAAA
#define MAX 114514
using namespace std;
int par[MAX];
int rank[MAX];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
}
int find(int x){
  if(par[x]==x)return x;
  else return par[x]=find(par[x]);
}
void unit(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;

  if(rank[x]<rank[y]){
    par[x]=y;
  }
  else{
    par[y]=x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

map<int,int> mm;

int main(){
  int n,m,k,a,b,c;
  cin>>n>>m>>k;
  init(n+1);
  for(int i=1;i<=k;i++){
    cin>>c>>a>>b;

    if(c==1){
      int p1=find(a),p2=find(b);
      
      if(mm[p1]&&mm[p2]&&mm[p2]!=mm[p1]){
	cout<<i<<endl;
	break;
      }
      unit(a,b);
      if(mm[p1])mm[p2]=mm[p1];
      if(mm[p2])mm[p1]=mm[p2];
    }
    else{
      int p=find(a);
      if(mm[p]&&mm[p]!=b){
	cout<<i<<endl;
	break;
      }
      mm[p]=b;
    }
    if(i==k)cout<<0<<endl;
  }
  

}

Measured memory_bytes: 8588
#include <bits/stdc++.h>     
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

ll a, b, c, k;
void solve(){
	cin >> a >> b >> c >> k;
	if(k & 1) swap(a, b);
	cout << a - b;
}
main () {
	int t = 1;
	//scanf("%d", &t);
	while(t--)
		solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int a,b;
  cin >> a >> b;
  
  vector<int> vec(1000);
  
  vec[0] = 0;
  
  for(int i = 1; i < 1000;i++){
    vec[i] = i + vec[i-1];
  }
  
  cout << vec[b-a] - b;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;

const int maxn=200111;
const int inf=0x3f3f3f3f;

vector<int> g[maxn];
int n,d[maxn],down[maxn],up[maxn],fa[maxn],near[maxn],near2[maxn],d2[maxn];
char s[maxn];

void dfs(int x,int f)
{
	down[x]=0;fa[x]=f;
	if(s[x]=='0')near[x]=inf;else near[x]=0;
	for(int i=0;i<(int)g[x].size();i++)if(g[x][i]!=f)
	{
		dfs(g[x][i],x);
		down[x]=max(down[x],down[g[x][i]]+1);
		near[x]=min(near[x],near[g[x][i]]+1);
	}
}
void dfs2(int x)
{
	if(s[x]=='1')near2[x]=0;
	int mx=up[x]+1,mx2,mn=near2[x]+1;
	for(int i=0;i<(int)g[x].size();i++)if(g[x][i]!=fa[x])
	{
		up[g[x][i]]=mx;
		near2[g[x][i]]=mn;
		mn=min(mn,near[g[x][i]]+2);
		mx=max(mx,down[g[x][i]]+2);
	}
	mx=0;mn=inf;
	for(int i=(int)g[x].size()-1;i>=0;i--)if(g[x][i]!=fa[x])
	{
		up[g[x][i]]=max(up[g[x][i]],mx);
		near2[g[x][i]]=min(near2[g[x][i]],mn);
		mx=max(mx,down[g[x][i]]+2);
		mn=min(mn,near[g[x][i]]+2);
		dfs2(g[x][i]);
	}
	
	mx=mx2=0;
	d2[x]=inf;if(s[x]=='1')d2[x]=0;
	for(int i=0;i<(int)g[x].size();i++)
	{
		int cur;if(g[x][i]==fa[x])cur=up[x];else cur=down[g[x][i]]+1;
		int cur2;if(g[x][i]==fa[x])cur2=near2[x];else cur2=near[g[x][i]]+1;
		if(cur>mx)
		{
			mx2=mx;
			mx=cur;
		}
		else if(cur>mx2)mx2=cur;
		d2[x]=min(d2[x],max(cur2,cur));
	}
	d[x]=min(mx-1,mx2+1);
	
//	printf("x= %d mx= %d mx2= %d d= %d\n",x,mx,mx2,d[x]);
}

int main()
{
	scanf("%d",&n);
	for(int i=1,u,v;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].pb(v);g[v].pb(u);
	}
	scanf("%s",s+1);
	
	dfs(1,0);near2[1]=inf;dfs2(1);
	
	LL ans=1;
	for(int i=1;i<=n;i++)ans+=max(0,d[i]-d2[i]+1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 28800
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N;
	cin >> N;
	string A, B, C;
	cin >> A;
	cin >> B;
	cin >> C;
	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (A[i] == B[i] && A[i] == C[i])
		{
			ans += 0;
		}
		else if (A[i] == B[i] || A[i] == C[i] || B[i] == C[i])
		{
			ans += 1;
		}
		else
		{
			ans += 2;
		}
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <stdio.h>

#define INF 1000000000

#define min(a, b) (((a) < (b)) ? (a) : (b))

const int di[2][9] = {{-2, -1, -1, 0, 0, 0, 1, 1, 2}, {-2, -1, -1, 0, 0, 0, 1, 1, 2}};
const int dj[2][9] = {{1, 1, 2, 1, 2, 3, 1, 2, 1}, {-1, -2, -1, -3, -2, -1, -2, -1, -1}};

typedef struct {
	int i, j, f, d;
} PairCoordDis;

PairCoordDis heap[32400];
int hsize;

void insert(int i, int j, int f, int d) {
	int ii;
	for (ii = hsize++; ii > 0 && d < heap[ii - 1 >> 1].d; ii = ii - 1 >> 1)
		heap[ii] = heap[ii - 1 >> 1];
	heap[ii] = (PairCoordDis){i, j, f, d};
}

inline int calcNextIdx(int i) {
	return i * 2 + 1 + (i * 2 + 2 < hsize && heap[i * 2 + 1].d > heap[i * 2 + 2].d);
}

PairCoordDis delete(void) {
	int i;
	int nextIdx;
	const PairCoordDis root = heap[0], last = heap[--hsize];

	for (i = 0; i * 2 + 1 < hsize && last.d > heap[nextIdx = calcNextIdx(i)].d; i = nextIdx)
		heap[i] = heap[nextIdx];
	heap[i] = last;

	return root;
}

char field[60][30];
int cost[60][30];
int d[60][30][2];

void dijkstra(int h, int w, int si, int sj, int sf) {
	int i, j;

	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			d[i][j][0] = d[i][j][1] = INF;

	d[si][sj][sf] = 0;
	insert(si, sj, sf, 0);
	while (hsize > 0) {
		const PairCoordDis fromP = delete();
		const int nf = fromP.f ^ 1;

		if (fromP.d > d[fromP.i][fromP.j][fromP.f])
			continue;

		for (i = 0; i < 9; i++) {
			const int ni = fromP.i + di[fromP.f][i], nj = fromP.j + dj[fromP.f][i];
			if (ni >= 0 && ni < h && nj >= 0 && nj < w)
				if (fromP.d + cost[ni][nj] < d[ni][nj][nf]) {
					d[ni][nj][nf] = fromP.d + cost[ni][nj];
					insert(ni, nj, nf, d[ni][nj][nf]);
				}
		}
	}
}

int main(void) {
	int i, j, k;
	int w, h;

	while (scanf("%d %d", &w, &h), w) {
		int min;

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++) {
				scanf(" %c", field[i] + j);
				cost[i][j] = field[i][j] == 'X' ? INF : field[i][j] <= '9' ? field[i][j] - '0' : 0;
			}

		min = INF;
		for (i = 0; i < w; i++)
			if (field[h - 1][i] == 'S')
				for (j = 0; j < 2; j++) {
					dijkstra(h, w, h - 1, i, j);
					for (k = 0; k < w; k++)
						if (field[0][k] == 'T') {
							min = min(min, d[0][k][0]);
							min = min(min, d[0][k][1]);
						}
				}

		printf("%d\n", min == INF ? -1 : min);
	}

	return 0;
}

Measured memory_bytes: 632
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>
#include <bitset>

using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int N;
    ll K,A[100000];
    bitset<40> b;
    cin>>N>>K;
    int num[40];
    rep(i,N) {
        cin>>A[i];
        b=bitset<40>(A[i]);
        rep(j,40){
            if(i==0) num[j]=0;
            if(b[j]) num[j]++;
        }
    }
    bool t=true;
    bitset<40> bk(K);
    ll ans=0;
    ll pow2[40];
    pow2[0]=1;
    rep(i,39) pow2[i+1]=2*pow2[i];
    rep(i,40){
        if(t&&(!bk[39-i])){
            ans+=num[39-i]*pow2[39-i];
        }else if(t){
            if((N-num[39-i])>num[39-i]){
                ans+=(N-num[39-i])*pow2[39-i];
            }else{
                t=false;
                ans+=num[39-i]*pow2[39-i];
            }
        }else{
            ans+=max(num[39-i],N-num[39-i])*pow2[39-i];
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

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

#define INF 0x3f3f3f3f
#define NINF -0x3f3f3f3f

using namespace std;

typedef pair<int,int> pii;

int r[10];
int mat[205][205];
int dp[10][(1<<8)+5];

int solve (int ridx, int mask, int R)
{
	if (!mask)
		return 0;
		
	int &ret = dp[ridx][mask];
	
	if (ret == -1)
	{
		ret = INF;
		int src = r[ridx];
		for (int i = 0; i < R; i += 1)
		{
			if (mask & (1<<i))
			{
				int dst = r[i];
				ret = min(ret,solve(i,mask^(1<<i),R)+mat[src][dst]);
			}
		}
	}
	
	return ret;
}

int main (int argc, char const* argv[])
{
	int n,m;
	scanf("%d %d",&n,&m);
	
	int R;
	scanf("%d",&R);
	
	for (int i = 0; i < R; i += 1)
	{
		scanf("%d",&r[i]);
		--r[i];
	}
	
	for (int i = 0; i < n; i += 1)
	{
		for (int j = 0; j < n; j += 1)
		{
			mat[i][j] = INF;
		}
	}
	
	for (int i = 0; i < m; i += 1)
	{
		int a,b,c;
		scanf("%d %d",&a,&b);
		scanf("%d",&c);
		
		--a; --b;
		
		mat[a][b] = mat[b][a] = c;
	}
	
	for (int k = 0; k < n; k += 1)
	{
		for (int i = 0; i < n; i += 1)
		{
			for (int j = 0; j < n; j += 1)
			{
				mat[i][j] = min(mat[i][j],mat[i][k]+mat[k][j]);
			}
		}
	}
	
	r[R] = n;
	memset(dp,-1,sizeof dp);
	printf("%d\n",solve(R,(1<<R)-1,R));
	
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int seat[17] = {0};
	int X = 0;
	int stop[100] = {0};
	int time = 0;
	queue<int> Q;
	while(X < 100){
		int x;
		if(time%5 == 0 && time < 500){
			Q.push(time/5);
		}
		while(1){
			if(Q.size())x = Q.front();
			else x = -1;
			bool f = false;
			
			if(~x){
				int people = (x%5==1?5:2);
				int use = 19 + 3 * (x%3) + 17 * (x%2);
				rep(i,17-people+1){
					bool flag = true;
					rep(j,people){
						flag &= seat[i+j] == 0;
					}
					if(flag){
						rep(j,people){
							seat[i+j] = use;
						}
						f = true;
						break;
					}
				}
			}
			if(f){	
				stop[x] = time - x * 5;
				Q.pop();
				X++;
			}
			if(!f)break;
		}
		rep(i,17){
			seat[i] = max(0,seat[i]-1);
		}
		time++;
	}
	int n,c=0;
	
	while(cin >> n){
		if(n == 4)c++;
		cout << stop[n] << endl;
	}
	int a = 0;
	while(c>=1){cout << a/a << endl;};
	
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#define N 100

int main()
{
  char b[N];
  int x,i,count=0,stack[N],cal1,cal2,result,change;
  while(scanf("%s",b)!=EOF)
    {
      if(b[i]=='+' || b[i]=='-' || b[i]=='*')
	{
	  //printf("stack %d %d",stack[count-1],stack[count-2]);
	  //printf("%d %c\n",count,b[i]);
	  count--;
	  cal2=stack[count];
	  count--;
	  cal1=stack[count];
	  //printf("%d %d\n",cal1,cal2);
	  switch(b[i])
	    {
	    case '+':
	      result=cal1+cal2;
	      break;
	    case '*':
	      result=cal1*cal2;
	      break;
	    default:
	      result=cal1-cal2;
	    }
	  stack[count]=result;
	  count++;
	}
      else
	{
	  change=atoi(&b[i]);
	  stack[count]=change;
	  //printf("stack %d",stack[count]);
	  count++;
	}      
    }
  printf("%d\n",stack[count-1]);
  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <cmath>
#include <complex>
#include <cfloat>

using namespace std;

#define INFD numeric_limits<double>::infinity()
#define INFL (int)1e8
#define INFLL (long long)1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

int main() {
  ll n; cin >> n;
  vll a(n); Loop(i, n) cin >> a[i];
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  else {
    ll sum = 0;
    Loop(i, n) sum += a[i];
    if (sum % (n * (n + 1) / 2) != 0) {
      cout << "NO" << endl;
      return 0;
    }
    else {
      ll k = sum / (n * (n + 1) / 2);
      vll d(n);
      Loop(i, n) {
        d[i] = a[(i + 1) % n] - a[i % n];
      }
      vll v(n);
      Loop(i, n) {
        if (k < d[i] || (k - d[i]) % n != 0) {
          cout << "NO" << endl;
          return 0;
        }
        else {
          v[i] = (k - d[i]) / n;
        }
      }
      Loop(i, n) {
        k -= v[i];
      }
      if (k == 0) {
        cout << "YES" << endl;
        return 0;
      }
      else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 2560
import collections

N = int(input())
A = list(map(int,input().split()))
AS = set(A)

def comb(n):
    return n*(n-1)//2

L = collections.Counter(A)

ans_tmp = 0
for a in AS:
    ans_tmp += comb(L[a])

for i in range(N):
    ans = ans_tmp
    ans += (comb(L[A[i]]-1) - comb(L[A[i]]))

    print(ans)


Measured memory_bytes: 28732
#include<bits/stdc++.h>
using namespace std; 
int a[400005],n,k;
double ans,num;
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++)
	    cin>>a[i];
    for(int i=1;i<=k;i++)
	    num+=a[i];
    ans=num;
    for(int i=2;i<n;i++)
    {
	    num-=a[i-1];
	    num+=a[i+k-1];
	    ans=max(ans,num);
	}
	printf("%10.12f",(ans+k)/2);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  int sum = 0;
  int cnt = 1;
  rep(i, n){
    if(i == n-1 || a[i] != a[i+1]){
      if(cnt < a[i]) sum += cnt;
      else sum += (cnt - a[i]);
      cnt = 1;
    }
    else cnt++;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 640
n = int(input())
s = list(map(int,input().split()))
dp = [0]
dp.append(abs(s[1]-s[0]))
for i in range(n-2):
        a = dp[i+1] + abs(s[i+2] - s[i+1])
        b = dp[i] + abs(s[i+2]-s[i])
        dp.append(min(a,b))
print(dp[-1])

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

int main() {
  int A, B;
  cin >> A >> B;
  
  	if (A < B && A == 1) {
      cout << "Alice" << endl;
    }
  	else if (A < B && A != 1) {
      cout << "Bob" << endl;
    }
  	else if (A > B && B == 1) {
      cout << "Bob" << endl;
    }
  	else if (A > B && B != 1) {
      cout << "Alice" << endl;
    }
  	else {
      cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   ll a, b, k;
   cin>>a>>b>>k;

   if(k<=a){
      a-=k;
   }
   else{
      k-=a;
      a=0;
      b=max((ll)0, b-k);
   }
   cout<<a<<" "<<b<<endl;

   return 0;
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

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

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    ll K, A, B;
    cin >> K >> A >> B;
    ll result = 1;
    if (A + 2 < B) {
        if (K >= A - 1) {
            result += A - 1;
            K -= A - 1;
            result += (B - A) * (K / 2);
            if (K % 2 == 1) {
                result += 1;
            }
        } else {
            result += K;
        }
    } else {
        result += K;
    }
    cout << result << endl;

    return 0;
}



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

#define N 100005

int vis[N],depth[N],pre[N];

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	memset(vis,0,sizeof(vis));
	memset(depth,0,sizeof(depth));

	vector<vector<int> > e(N);
	
	for(int i=1;i<=m;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
	}
	
	queue<int> q;
	while (!q.empty()) q.pop();
	
	vis[1]=1;
	q.push(1);
//	cout<<q.front();
	while(!q.empty()) 
	{
		int x=q.front();
//		cout<<e[x][0]<<endl;
		for(int k=0;k<e[x].size();k++)
		{
//			cout<<"nnnn";
			if(vis[e[x][k]]==0)
			{
//				cout<<"JJJJ";
				q.push(e[x][k]);
				vis[e[x][k]]=1;
				depth[e[x][k]]=depth[x]+1;
				pre[e[x][k]]=x;
			}
		}
		q.pop();
//		cout<<q.front();
	}
	
	int flag=0;
	for(int i=2;i<=n;i++)
	{
		if(depth[i]==0)
		{
			printf("No\n");
			flag=1;
			break;
		}
	}
	
	if(flag==0)
	{
		printf("Yes\n");
		for(int i=2;i<=n;i++)
		{
			printf("%d\n",pre[i]);
		}
	}
	
	return 0;
} 

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

int main(){
	
	int d[31];
	for(int i=1;i<=30;i++)d[i]=i;
	int w,n;
	cin>>w>>n;
	while(n--){
		int a,b;
		scanf("%d,%d",&a,&b);
		swap(d[a],d[b]);
	}
	for(int i=1;i<=w;i++)cout<<d[i]<<endl;;
	
	return 0;
}


Measured memory_bytes: 1240
N, *LR = map(int, open(0).read().split())
L, R = LR[::2], LR[1::2]

max_l = max(L)
min_r = min(R)

A = sorted(max(0, r - max_l + 1) for r in R)
B = sorted(-max(0, min_r - l + 1) for l in L)

mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, min_r - max_l + 1)

for i in range(N - 1):
    mi = min(mi, -B[i])
    ma = max(ma, mi + A[i + 1])

print(ma)

Measured memory_bytes: 25564
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(c, b / a) << endl;

  return 0;
}

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

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
n,m=map(int, input().split())
job_list=[]
for i in range(n):
    tmp=[int(x) for x in input().split()]
    job_list.append(tmp)
job_list.sort()

import heapq
k=0
ans=0
salary_list=[]
for i in range(1,m+1):
    while k<n and job_list[k][0]==i:
        heapq.heappush(salary_list,job_list[k][1]*(-1))
        k+=1
    if len(salary_list)>0:
        ans+=heapq.heappop(salary_list)
print((-1)*ans)


Measured memory_bytes: 29848
def abs(x1,x2):
    if x1>x2:
        return x1-x2
    else:
        return x2-x1
    
n=int(input())
x=[]
y=[]
h=[]

for i in range(n):
    xi,yi,hi=map(int,input().split())
    x.append(xi)
    y.append(yi)
    h.append(hi)

hmax=h[0]
xhmax=x[0]
yhmax=y[0]
ihmax=0

for i in range(n):
    if hmax<h[i]:
        hmax=h[i]
        xhmax=x[i]
        yhmax=y[i]
        ihmax=i
    
for cx in range(101):
    for cy in range(101):
        hh=hmax+abs(xhmax,cx)+abs(yhmax,cy)
        yesno="yes"
        for i in range(n):
            if h[i]!=max(hh-abs(x[i],cx)-abs(y[i],cy),0):
                yesno="no"
                break
        if yesno=="yes":
            print(cx,cy,hh)
            break
    if yesno=="yes":
        break

Measured memory_bytes: 3064
use std::io;
use std::str::FromStr;
fn main() {
    let stdin = io::stdin();
    let mut s = String::new();
    let mut nums : Vec<i64> = Vec::new();
    {
        stdin.read_line(&mut s).ok();
        let it = s.trim().split_whitespace();
        for arg in it {
            nums.push(i64::from_str(&arg).expect("e1"));
       }
    }
    let n = nums[0];
    let m = nums[1];
    let mut a : Vec<i64> = Vec::new();
    s = String::new();
    stdin.read_line(&mut s).ok();
    let it = s.trim().split_whitespace();
    for arg in it {
        a.push(i64::from_str(&arg).expect("e2") % m);
    }
    let mut sum : Vec<i64> = Vec::new();
    sum.push(0);
    let mut s : i64 = 0;
    for i in 0..a.len() {
        s += a[i];
        s %= m;
        sum.push(s);
    }
    sum.sort();
    let mut ans : i64 = 0;
    let mut temp = sum[0];
    let mut c = 1;
    for i in 1..sum.len() {
        if temp == sum[i] {
            c += 1;
        } else {
            ans += c * (c - 1) / 2;
            c = 1;
            temp = sum[i];
        }
    }
    ans += c * (c - 1) / 2;
    println!("{}",ans);
}

Measured memory_bytes: 8444
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

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

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 2100;

int n, k, q;
int a[MAXN];

int cnt[MAXN];

multiset<pair<int, int> > ss;
int cc[MAXN];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> k >> q;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int ans = 1e9 + 100;
	for (int i = 0; i < n; ++i) {
		ss.clear();
		int cur = 0;
		cc[cur] = 0;
		for (int j = 0; j < n; ++j) {
			if (a[j] < a[i]) {
				++cur;
				cc[cur] = 0;
			}
			else {
				++cc[cur];
				ss.emplace(a[j], cur);
			}
		}
		int now = q;
		int mx = a[i];
		while (now && !ss.empty()) {
			auto tmp = *ss.begin();
			ss.erase(ss.begin());
			if (cc[tmp.second] >= k) {
				--cc[tmp.second];
				mx = max(mx, tmp.first);
				--now;
			}
			else
				continue;
		}
		if (now)
			continue;
		ans = min(ans, mx - a[i]);
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 512
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll=long long;

int main()
{
	string s;
	cin>>s;
	vector<string> weekly = {
		"",
		"SAT",
		"FRI",
		"THU",
		"WED",
		"TUE",
		"MON",
		"SUN",
	};
	cout<<find(weekly.begin(),weekly.end(),s)-weekly.begin()<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <algorithm>

using std::cout;
using std::cerr;
using std::cin;
using std::endl;


#define NNN (100000)
#define MMM (10000)
void funcC() {
	int N;
	int M;
	std::vector<int> A[NNN+1];
	int P[NNN];
	int Y[NNN];

	cin >> N;
	cin >> M;

	for (int m = 0; m < M; ++m) {
		int p;
		int y;
		cin >> p;
		cin >> y;
		P[m] = p;
		Y[m] = y;
	}
	for (int m = 0; m < M; ++m) {
		A[P[m]].push_back(Y[m]);
	}
	for (int n = 1; n < N+1; ++n) {
		std::sort(A[n].begin(), A[n].end());
	}

	for (int m = 0; m < M; ++m) {
		int p = P[m];
		int y = Y[m];
		
		int idx =  std::lower_bound(A[p].begin(), A[p].end(), y) - A[p].begin();
		printf("%.6d%.6d\n", p, idx + 1);
		/*
		int idx = -1;
		for (int i = 0; i < A[p].size(); ++i) {
			if (A[p][i] == y) {
				//cerr << p << "," << i + 1 << endl;
				printf("%.6d%.6d\n", p, i + 1);
			}
		}
		*/
	}



}

std::vector<int> X;
#define LENGTH (9+1)
void funcC775_sub(std::string S) {
	if (S.length() >= LENGTH) {
		return;
	}

	if (S.find("3") != std::string::npos &&
		S.find("5") != std::string::npos &&
		S.find("7") != std::string::npos) {
		//cerr << S << ": OK" << endl;
		X.push_back(atoi(S.c_str()));
	}
	else {
		//cerr << S << ": NOT" << endl;
	}
	//cerr << S << endl;
	funcC775_sub(S + "3");
	funcC775_sub(S + "5");
	funcC775_sub(S + "7");
}
void funcC775() {
	int N;
	cin >> N;
	std::string SSS = "";

	funcC775_sub(SSS);
	std::sort(X.begin(), X.end());
	int idx = std::lower_bound(X.begin(), X.end(),N+1) - X.begin();
	cout << idx << endl;
	
}	

int main() {
	//funcB();
	funcC775();

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >>s;
  ll ss=s.size();
  vector <string> p;
  for(ll i=0;i<ss;i++){
    for(ll j=1;j<=(ss-i);j++){
      string k=s.substr(i,j);
      p.push_back(k);
    }
  }
  ll ps=p.size();
  ll ans=0;
  for(ll i=0;i<ps;i++){
    ll ks=p[i].size();
    ll fl=1;
    for(ll j=0;j<ks;j++){
      if(p[i][j]!='A'&&p[i][j]!='C'&&p[i][j]!='G'&&p[i][j]!='T'){
        fl=0;
        break;
      }
    }
    if(fl==1) ans=max(ans,ks);
  }
  cout <<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


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



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

	vector<ll> A(N + 1);
	repn(i, N) cin >> A[i];

	vector<ll> dpu(N + 1, 1);
	vector<ll> dpd(N + 1, 1);

	for (ll i = 2; i <= N; i++) {
		if (A[i] < A[i - 1]) { dpu[i] = min(dpd[i - 1] + 1, dpu[i - 1] + 1); }
		else { dpu[i] = min(dpd[i - 1] + 1, dpu[i - 1]); }

		if (A[i] > A[i - 1]) { dpd[i] = min(dpu[i - 1] + 1, dpd[i - 1] + 1); }
		else { dpd[i] = min(dpu[i - 1] + 1, dpd[i - 1]); }
	}

	cout << min(dpd[N], dpu[N]);

	system("PAUSE");
}


Measured memory_bytes: 2808
n = int(input())
t = [int(input()) for i in range(5)]
p = n
time = 0
for i,k in enumerate(t):
  
  p = max(0,n-(time-i)*k)
  
  if p <= k:
    time+=1
  else:
    if p%k>0:
      time += int(p/k)+1
    else:
      time+= int(p/k)
print(time)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  string A;
  cin >> A;
  for (int i = 0; i < A.length(); i++) {
    if (i % 2 == 0) {
      if (A[i] == 'L') {
        cout << "No";
        return 0;
      }
    } else {
      if (A[i] == 'R') {
        cout << "No";
        return 0;
      }
    }
  }
  
  cout << "Yes";
  return 0;
}
  /*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
    //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
from operator import itemgetter
n = int(input())
base_list = []
for i in range(n):
  name, point = input().split()
  base_list.append((name, -int(point), i+1))
sorted_list = sorted(base_list, key=itemgetter(0, 1))
for i in range(n):
  print(sorted_list[i][2])

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
  string s;
  cin >> s;
  string c = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'B') {
      c = c.substr(0, c.size() - 1);
    } else {
      c += s[i];
    }
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::collections::BinaryHeap;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

// Partial orderなものをTotal orderにする
#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

fn main() {
    input! {
        n: usize,
        v: [f64; n],
    }
    let mut bs = BinaryHeap::new();
    for i in 0..n {
        bs.push(Rev(Total(v[i])));
    }
    //let mut ans = 0.0;
    loop {
        let Rev(Total(a)) = bs.pop().unwrap();
        if bs.is_empty() {
            println!("{}", a);
            return;
        }
        let Rev(Total(b)) = bs.pop().unwrap();
        let ans = (a + b) / 2.0;
        bs.push(Rev(Total(ans)));
        //println!("{}", ans);
    }
}

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

struct data{
    data(){}
    string name;
    int start;
    bool operator<(const data other) const{
        return start < other.start;
    }
};

int main(){
    int n;
    while(cin >> n, n){
        bool t[60*24*8] = {};
        data d[n];
        int a, b;
        for(int i = 0; i < n; i++){
            cin >> d[i].name >> a >> b;
            d[i].start = 60*24*a + b/100*60 + b%100;
        }
        sort(d, d+n);
        
        map<string,int> m;
        for(int i = 0; i < n; i++)  m[d[i].name] = i;

        int p;
        cin >> p;
        
        string imp;
        bool valid = true;
        
        for(int i = 0; i < p; i++){
            cin >> imp;
            for(int j = 0; j < 30; j++){
                if(t[d[m[imp]].start+j])   valid = false;
                t[d[m[imp]].start+j] = true;
            }
        }

        if(!valid){
            cout << -1 << endl;
            continue;
        }

        int ans = p;
        for(int i = 0; i < n; i++){
            bool judge = true;
            for(int j = 0; j < 30; j++){
                if(t[d[i].start+j])   judge = false;
            }
            if(!judge)  continue;
            for(int j = 0; j < 30; j++){
                t[d[i].start+j] = true;
            }
            ans++;
        }

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


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
  ll n;cin>>n;
  vi v(n);
  rep(i,n)cin>>v[i];
  ll ans=0;
  rep(i,n){
    ll a;cin>>a;
    if(v[i]-a>0)ans+=v[i]-a;
  }
  out(ans);
}


Measured memory_bytes: 256
package main

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

type work struct {
	time     int
	deadline int
}

type works []work

var sc = bufio.NewScanner(os.Stdin)

func (w works) Len() int {
	return len(w)
}

func (w works) Swap(i, j int) {
	w[i], w[j] = w[j], w[i]
}

func (w works) Less(i, j int) bool {
	if w[i].deadline == w[j].deadline {
		return w[i].time < w[j].time
	} else {
		return w[i].deadline < w[j].deadline
	}
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	sc.Split(bufio.ScanWords)

	var ws works = make([]work, 0)
	for i := 0; i < n; i++ {
		var w work
		sc.Scan()
		w.time, _ = strconv.Atoi(sc.Text())
		sc.Scan()
		w.deadline, _ = strconv.Atoi(sc.Text())
		ws = append(ws, w)
	}

	sort.Sort(ws)

	time := 0
	for _, work := range ws {
		time += work.time
		if work.deadline < time {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 12544
def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result %= M

    return result


def pow(x, n):
    ans = 1
    while(n > 0):
        if(bin(n & 1) == bin(1)):
            ans = (ans*x) % M
        x = (x*x) % M
        n = n >> 1  # ビットシフト
    return ans


N, a, b = map(int, input().split())
M = 10**9+7

print((pow(2, N) - cmb(N, a)-cmb(N, b)-1) % M)


Measured memory_bytes: 108236
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

#define in(i) int i; cin >> i
#define in_ll(i) ll i; cin >> i
#define in_ld(i) ll i; cin >> i
#define in_c(c) char c; cin >> c
#define in_str(s) std::string s; cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){cin>>x;}

#define print(x)   cout << x
#define println(x) cout << x << "\n"

#define rep(i, n) for (auto i = 0; i < n; ++i)

using namespace std;
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in_c(c);
    if (isupper(c)) {
        print('A');
    } else {
        print('a');
    }
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) b.rbegin(),v.rend()
typedef long long ll;
//isPrime
//modpow modinv
int main() {
  cout << fixed << setprecision(10);
  string s,t;
  int a,b;
  string u;
  cin >> s >> t >> a >> b >> u;
  if(s==u){
    a--;
  }else{
    b--;
  }
  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	for (int i(0); i < 9; i++) {
		if (pow(2, i) > n) {
			cout << pow(2, i - 1) << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B; cin >> A >> B;
    int acc = 1;
    REP(i,1000){
        if(acc >= B){
            cout << i << endl;
            return 0;
        }
        acc += A-1;
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,M;
  long long MOD=1000000007;
  cin>>N>>M;
  if(abs(N-M)>=2){
    cout<<0<<endl;
  }
  else{
    long long NN=1;
    long long MM=1;
    for(int i=0;i<N;i++){
      NN=(NN*(i+1))%MOD;
    }
    for(int i=0;i<M;i++){
      MM=(MM*(i+1))%MOD;
    }
    if(N==M){
      cout<<(2*NN*MM)%MOD<<endl;
    }
    else{
      cout<<(NN*MM)%MOD<<endl;
    }
  }
}
    
    


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for (int i=0; i<N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  int sum = 1;
  
  for (int i=0; i<N-1; i++) {
    if (vec.at(i) < vec.at(i+1)) {
      sum += 1;
    }
  }
  
  cout << sum << endl;
}

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	string s, t; cin >> s >> t;
	s += t[t.size()-1];
	cout << ((s==t)?"Yes":"No") << '\n';
	return 0;
}

Measured memory_bytes: 3608
s = input()

if s[0] == "A" and s[2:-1].count("C") == 1:
  idx = s.index("C")
  if s[1:idx] == s[1:idx].lower() and s[idx+1:] == s[idx+1:].lower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();		
		int count = r.ri();
		int sum = 0;
		for(int i = 0; i<count; i++) {
			int[] arr = r.ria();
			sum += arr[1]-arr[0]+1;
		}
		
		print(sum);		
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


Measured memory_bytes: 20564
#include <bits/stdc++.h>
     //https://www.codechef.com/viewsolution/28454497
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
vector < ll> primes;
 int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int n,m;
bool isvalid(int x,int y){
  return (x>=0 and x<n and y>=0 and y<m);
}
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
 const int N = 5e5 + 5;
 	int connected;
	int par[N], sz[N];
 
struct DSU
{

	void init(int n) 
	{
		for(int i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
		}
		connected=n;
	}
 
	int getPar(int k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}
 
	int getSize(int k)
	{
		return sz[getPar(k)];
	}
 
	void unite(int u, int v)
	{
		int par1=getPar(u), par2=getPar(v);
 
		if(par1==par2)
			return;
 
		connected--;
 
		if(sz[par1]>sz[par2])
			swap(par1, par2);
 
		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};
 
 

DSU dsu;
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}
   
int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
   
    int n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
    
    
    
    
}



Measured memory_bytes: 256