akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
struct node{int to,nxt,cost;}sq[1200100];
int all=0,head[600600];
int n,m,dis[600600],tot;
bool vis[600600]; 
struct hnode{int u,dis;};
bool operator <(hnode p,hnode q) {return p.dis>q.dis;}
priority_queue<hnode> q;
map<pii,int> num;

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

void add(int u,int v,int w)
{
	all++;sq[all].to=v;sq[all].nxt=head[u];sq[all].cost=w;head[u]=all;
}

int dij()
{
	memset(dis,0x3f,sizeof(dis));
	dis[1]=0;q.push((hnode){1,0});
	while (!q.empty())
	{
		int u=q.top().u;q.pop();
		go(u,i)
		{
			int v=sq[i].to;
			if (dis[v]>dis[u]+sq[i].cost)
			{
				dis[v]=dis[u]+sq[i].cost;
				if (!vis[v]) q.push((hnode){v,dis[v]});
			}
		}
	}
	return dis[n];
}

int getp(int u,int x)
{
	pii tmp;tmp.fir=u;tmp.sec=x;
	if (num[tmp]) return num[tmp];
	else {num[tmp]=(++tot);return tot;}
}

int main()
{
	n=read();m=read();tot=n;
	rep(i,1,m)
	{
		int u=read(),v=read(),c=read();
		int u1=getp(u,c),v1=getp(v,c);
		add(u,u1,1);add(u1,u,1);
		add(u1,v1,0);add(v1,u1,0);
		add(v1,v,1);add(v,v1,1);
	}
	int ans=dij();
	if (ans>maxd) ans=-1;else ans/=2;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 45180
#include <bits/stdc++.h>
#if ONLINE_JUDGE
    #define DEBUG false
#else
    #define DEBUG true
#endif
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define forlist(i, vec) for(auto &&i : vec)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define UNIQUE(x) x.erase(unique(all(x)), x.end());
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) if(DEBUG) cout << #x << ": " << (x) << endl
using namespace std;
typedef long long LL;
typedef long long int64;
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
typedef std::vector<LL> VL;
typedef std::vector<VL> VVL;
typedef std::vector<std::string> VS;
typedef std::pair<int, int> PII;
typedef std::pair<LL, LL> PLL;
typedef std::queue<int> QI;
typedef std::priority_queue<int> PQI;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline void vcinpb(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
template<class T>inline void dumpv(T &v){
    if(DEBUG){cout<<"{";rep(i,v.size()){cout<<v[i]<<",";}cout<<"}"<<endl;}
}

const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
// M_PI 3.1415...

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    VL v(n+10), ph(201000), mh(201000), idxes;
    LL ans = 0;
    rep(i, n){
        cin >> v[i];
    }
    rep(i, n){
        if(i+1 + v[i] < 200900){
            ph[ i+1 + v[i] ]++;
            if (ph[ i+1 + v[i] ] == 1){
                idxes.pb(i+1 + v[i]);
            }
        }
        if(i+1 - v[i] > 0){
            mh[ i+1 - v[i] ]++;
            if (mh[ i+1 - v[i] ] == 1){
                idxes.pb(i+1 - v[i]);
            }
        }

    }
    SORT(idxes);
    UNIQUE(idxes);
    dumpv(idxes);
    for(auto&& i : idxes){
        ans += ph[i] * mh[i];
        dump(ans);
    }
    co(ans);
    return 0;
}

Measured memory_bytes: 10008
#include <iostream>

int opts[6][2] = {{2, 380},   {3, 550},   {5, 850},
                  {10, 1520}, {12, 1870}, {15, 2244}};

int func(int qnt, int index, int subqnt, int subcost) {
    if (qnt == subqnt) return subcost;
    if (index < 0) return -1;
    int i = (qnt - subqnt) / opts[index][0];
    int min_cost = -1;
    while (i >= 0) {
        int res = func(qnt, index - 1, subqnt + opts[index][0] * i,
                       subcost + opts[index][1] * i);
        if (res > 0 && (min_cost > res || min_cost < 0)) min_cost = res;
        i--;
    }
    return min_cost;
}

int main() {
    int n;
    while (std::cin >> n && n > 0) {
        n /= 100;
        std::cout << func(n, 5, 0, 0) << std::endl;
    }
}

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

using namespace std;

#define int  long long int

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

    int a , b , c , d;
    
    cin >> a >> b >> c >> d;
    
    int ans = max({a*c , b*d , a*d , b*c});
    
    cout << ans;

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
using namespace  std;
const int NIL = -1;

void fnMaxHeapifyUp(vector<int>& rvnPrtyHeap, int nx)
{
  int nParnt = nx / 2;
  int nLrge = nx;

  if (nParnt > 0  &&
      rvnPrtyHeap[nParnt] < rvnPrtyHeap[nLrge])
  {
    swap(rvnPrtyHeap[nParnt], rvnPrtyHeap[nLrge]);
    fnMaxHeapifyUp(rvnPrtyHeap, nParnt);
  }
}

void fnMaxHeapifyDown(vector<int>& rvnPrtyHeap, int nx)
{
  int nLeft = nx * 2;
  int nRigt = nLeft + 1;
  int nLrge = nx;

  if (nLeft < rvnPrtyHeap.size()  &&
      rvnPrtyHeap[nLrge] < rvnPrtyHeap[nLeft])  
    nLrge = nLeft;
  if (nRigt < rvnPrtyHeap.size()  &&
      rvnPrtyHeap[nLrge] < rvnPrtyHeap[nRigt])
    nLrge = nRigt;

  swap(rvnPrtyHeap[nx], rvnPrtyHeap[nLrge]);
  if (nx != nLrge)
    fnMaxHeapifyDown(rvnPrtyHeap, nLrge);
}

void fnPriorityQueue(vector<int>& rvnPrtyHeap)
{
  rvnPrtyHeap.push_back(NIL);
  string sCmd;
  while (cin >> sCmd && sCmd != "end")
  {
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      rvnPrtyHeap.push_back(nNo);
      int nx = rvnPrtyHeap.size() - 1;
      fnMaxHeapifyUp(rvnPrtyHeap, nx);
    }
    else if (sCmd[0] == 'e')
    {
      cout << rvnPrtyHeap[1] << endl;
      rvnPrtyHeap[1] = NIL;
      fnMaxHeapifyDown(rvnPrtyHeap, 1);
    }
    else;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnPrtyHeap; 

  fnPriorityQueue(vnPrtyHeap);
  return 0;
}

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

int main() {
  int n, m, i, y = 1;
  cin >> n >> m;
  
  vector<vector<int>> x(m, vector<int>(4));
  for(i = 0; i < m; i++){
    cin >> x.at(i).at(0) >> x.at(i).at(1);
    x.at(i).at(2) = i;
  }
  
  sort(x.begin(), x.end());
  
  x.at(0).at(3) = 1;
  for(i = 1; i < m; i++){
    if(x.at(i - 1).at(0) == x.at(i).at(0)){
      y++;
      x.at(i).at(3) = y;
    }
    else{
      y = 1;
      x.at(i).at(3) = y;
    }
  }
  
  for(i = 0; i < m; i++) swap(x.at(i).at(0), x.at(i).at(2));

  sort(x.begin(), x.end());
  
  for(i = 0; i < m; i++){
    cout << setfill('0') << setw(6) << x.at(i).at(2)
      << setfill('0') << setw(6) << x.at(i).at(3) << endl;
  }
}

Measured memory_bytes: 7040
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
AB = []
for i in range(n):
    a,b = readInts()
    AB.append((a,b))
CD = []
for i in range(m):
    c,d = readInts()
    CD.append((c,d))
for i in range(n):
    a,b = AB[i]
    MIN = float('inf')
    idx = -1
    for j in range(m):
        c,d = CD[j]
        if abs(a - c) + abs(b - d) < MIN:
            MIN = abs(a-c) + abs(b-d)
            idx = j+1
    print(idx)


Measured memory_bytes: 10384
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;


int main()
{
	int i, j, k, l, m, sum, N, C, cnt;
	sum = 0;
	cnt = 0;
	int ans[200001] = {};
	bool ch[31][200001] = {};
	cin >> N >> C;
	vector<int>s(N);
	vector<int>t(N);
	vector<int>c(N);
	for (i = 0; i < N; i++) {
		cin >> s[i] >> t[i] >> c[i];
	}
	for (i = 0; i < N; i++) {
		ch[c[i]][s[i] * 2 - 1] = true;
		ch[c[i]][t[i] * 2] = true;
	}
	for (i = 1; i <= C; i++) {
		for (j = 1; j <= 200000; j++) {
			if (ch[i][j]) {
				cnt++;
			}
			else {
				if (cnt % 2 == 1) {
					ch[i][j] = true;
				}
			}
		}
	}
	for (j = 1; j <= 200000; j++) {
		for (i = 1; i <= C; i++) {
			if (ch[i][j]) {
				ans[j]++;
			}
		}
	}
	sort(ans, ans + 200001);
		cout << ans[200000] << endl;
	return 0;
}



Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int bfs(int N,int M,vector<vector<char>> field,int sx,int sy,int gx, int gy);

int main(){ 
    int N,M,i,j;
    
    cin >> N;
    cin >> M ;
    vector<vector<char>> field(N,vector<char>(M));
    int sx,sy,gx,gy;
	int ans = 0;
    for (i = 0;i < N;i++){
        for (j = 0;j < M;j++){
            cin >> field.at(i).at(j); 
			if (field[i][j] == '.'){
				ans++;
			}
        } 
    }
	sx = 0;
	sy = 0;
	gx = N - 1;
	gy = M - 1;

	int res = bfs(N,M,field,sx,sy,gx,gy);
	if (res != INF){
	    cout << ans - res - 1 << endl;
	}
	else{
		cout << -1 << endl;
	}
}

int bfs(int N,int M,vector<vector<char>> field,int sx,int sy,int gx, int gy){
    int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
    int d[N][M];//距離の配列
    for (int i = 0;i < N;i++){
        for (int j = 0;j < M;j++){
            d[i][j] = INF;//初期化
        }
    }
    queue<P> que;
    que.push(P(sx,sy));
    d[sx][sy] = 0;

    //キューが空になるまでループ
    while(que.size()){
        P p = que.front();
        que.pop();//先頭を取り出す
        if (p.fs == gx && p.sc == gy){
            break;//探索終わり
        }
        for (int i = 0;i < 4;i++){
            int nx = p.fs + dx[i], ny = p.sc + dy[i];
            //nx,nyが進めるマスか、行ったことのないマスかどうかを判定
            if (0 <= nx && nx < N && 0 <= ny && ny < M && field[nx][ny] != '#' && d[nx][ny] == INF){
                que.push(P(nx,ny));//追加
                d[nx][ny] = d[p.fs][p.sc] + 1;//距離を確定 
            }
        }
    }
    return d[gx][gy];
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int K, S;
    int ans = 0;
    scanf("%d %d", &K, &S);
    for (int x = 0; x < K + 1; x++) {
        for (int y = 0; y < K + 1; y++) {
            int z = S - x - y;
            if (z >= 0 && z <= K) {
                ans++;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N, M;
    cin >> N >> M;
    vector<bool> A(N, false), B(N, false);
    A[0] = true;
    B[N - 1] = true;

    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        int big = max(a, b);
        int small = min(a, b);
        if(big == N - 1) B[small] = true;
        if(small == 0) A[big] = true;
    }

    bool flag = false;

    rep(i, N){
        if( A[i] && B[i] ){
            flag = true;
            break;
        } 
    }

    if(flag) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int n, s[100];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	int sum = 0;
	for (int i = 0; i < n; i+=2)
	{
		if (s[i] % 2)
			sum++;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,ll> Q;
#define mp make_pair
#define pb push_back
#define INF 10000000
int n,m;
int s[100005],p[100005];
int q[200005];
int main(){
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		cin >> s[i] >> p[i];
	}
	for(int i=m+1;i<=n;i++) cin >> s[i];
	int lb = 0;
	int ub = 1e9+50;
	while(ub-lb>1){
		int mid = (lb+ub)/2;
		int x = 1,y = n;
		fill(q+1,q+n+1,1);
		for(int i=1;i<=m;i++) if(s[i]>=mid) {q[p[i]] = 0;}else{q[p[i]] = n+5;}
		while(y-x>1){
			int sum = q[x]+q[x+1]+q[x+2];
			sum -= max(q[x],max(q[x+1],q[x+2]));
			q[y+1] = sum;
			x+=3;
			y++;
		}
		int cnt = 0;
		for(int i=m+1;i<=n;i++) cnt += (s[i]>=mid);
		if(q[y]<=cnt) lb = mid;
		else ub = mid;
	}
	cout << lb << endl;
}

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

//template
#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(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    vector<string> g(n);
    rep(i,0,n)cin>>g[i];
    bool f=1;
    rep(i,0,n)rep(j,0,n)if(g[i][j]=='#')f=0;
    if(f){printf("-1"); return 0;}
    int ans=inf,add=0;
    rep(i,0,n){
        f=0;
        rep(j,0,n)if(g[j][i]=='.')f=1;
        add+=f;
    }
    rep(i,0,n){
        f=1;
        rep(j,0,n)if(g[j][i]=='#')f=0;
        int cnt=f;
        rep(j,0,n)if(g[i][j]=='.')cnt++;
        chmin(ans,cnt);
    }
    printf("%d\n",ans+add);
    return 0;
}

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

int main() {

	int n;
	scanf("%d", &n);
	vector<int> v(n);
	int alice = 0;
	int bob = 0;
	for(int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	sort(v.begin() , v.end());
	for(int i = 0; i < n; i++) {
		if(i % 2 == 0) {
			alice += v[n - i - 1];
		}else {
			bob += v[n - i - 1];
		}
	}
	printf("%d\n", alice - bob);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); // number of 
#define ll long long                      //element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after sort  use as s.f();
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;                     
using namespace __gnu_pbds;
// assert(a[i]<n ) // if we want to check for special cond , used for debug
// make less_equal in order to make a multiset pbds
const ll Mod = (int)1e9;
ll CaseN=1;
ll fast_power(ll a,ll b,ll mod){
	ll ans=1;
	while(b>0){
	if(b&1){
	ans=(a*ans)%mod;
	}
	b=b>>1;
	a=(a*a)%mod;
	}
	return ans;
	}


ll nCr(ll n ,ll r)
{
ll p= n;
r = min(r,n-r);
ll a =1;
ll b=1;	
while(r)
{
	a = a*p;
	b = b*r;
	
	ll g = __gcd(a,b);
	
	a = a/g;
	b = b/g;
	
	p--;
	r--;	
}	
return a;
	
}

void solve()
{
ll x,y;
cin>>x>>y;
	bool ans=false;
	
	for(ll i=0;i<=x;i++)
	{
	ll a1=i;
	ll a2 = x-i; // 4 leg	
	if(y==(4*a2)+(2*a1))
	{
	ans = true;	
	}	
	}
	
	
  //cout<<"Case #"<<CaseN<<": ";
   CaseN++;
	// print your ans below;
   if(ans)
  {
  cout<<"Yes"<<endl; 
  }
  else
   {
  cout<<"No"<<endl;
  }
 
return ;
}


signed main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
	{
	solve();	
	//ch();
	}
}


Measured memory_bytes: 3656
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
/*#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 ll long long
#define ull unsigned long long
#define int long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
                                                                    
typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 1e5 + 10;
int n , m;
int a[N];
// pr[r] - pr[l - 1] > (r - l + 1) / 2;
//2 * pr[r] - 2 * pr[l - 1] >= r - l + 1
//2 * pr[r] - r - 1 >= 2 * pr[l - 1] - l
string s;
int pr[30][N];
pii val[30];
main(){
	cin >> s;

	s = '$' + s;
	rep(i , 0 , 25)
		val[i] = {1e9 , 1e9};
	rep(i ,1 ,  sz(s) - 1){
	 	pr[s[i] - 'a'][i]++;
	 	rep(j , 0 , 25){
	 		pr[j][i] += pr[j][i - 1];
			if(val[j].fi < 2 * pr[j][i] - i - 1){
				cout << val[j].se << ' ' << i << '\n';
				return 0;
			}
			if(val[j].fi > 2 * pr[j][i - 1] - i)
				val[j] = {2 * pr[j][i - 1] - i , i};
		}
	}
	ret("-1 -1");
}

Measured memory_bytes: 20988
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    string s;
    cin >> s;
    if (s[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    else
        s[0] = 'a';
    bool flag = false;
    for (int i = 2; i < s.size() - 1; i++) {
        if (s[i] == 'C' && !flag) {
            flag = true;
            s[i] = 'c';
        }
        else if (s[i] == 'C' && flag) {
            cout << "WA" << endl;
            return 0;
        }
    }
    if (!flag) {
        cout << "WA" << endl;
        return 0;
    }
    bool f = false;
    rep(i, s.size()) {
        if (s[i] <= 'Z' && s[i] >= 'A') {
            f = true;
        }
    }
    if (f)
        cout << "WA" << endl;
    else
        cout << "AC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N,A,B; cin >> N >> A >> B;
    cout << ((B-A)% 2 == 0 ? "Alice" : "Borys") << endl; 

}

Measured memory_bytes: 256
// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int n;
	cin >> n;
	vector<int> ans(n+1);
	for(int i=1;i<=100;++i)
	{
		for(int j=1;j<=100;++j)
		{
			for(int k=1;k<=100;++k)
			{
				int add=i*i;
				add+=j*j;
				add+=k*k;
				add+=i*j+j*k+i*k;
				if(add<=n)
				ans[add]++;
			}
		}
	}
	for(int i=1;i<=n;++i)
	cout << ans[i] << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3616
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    x,n=pin()
    p=set(pin())
    dis=100000
    ans=-1
    for i in range(-1,101+1):
        if i in p:continue

        if abs(x-i)<dis:
            ans=i
            dis=abs(x-i)
    print(ans)
#%%submit!
resolve()

Measured memory_bytes: 61976
import java.io.*;
import java.util.*;

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		String s = sc.next();
		
		Character[] c = new Character[4];
		for(int i = 0; i<  4;i++) c[i] = s.charAt(i);
		
		Arrays.sort(c);
		
		if(c[0] == c[1] && c[1] != c[2] && c[2] == c[3]) {
			out.println("Yes");
		}else{
			out.println("No");
		}
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

int main() {
  int n, m;
  cin>>n>>m;
  bool ac[n];
  int wa[n];
  for (int i=0; i<n; i++) {
    ac[i] = false;
    wa[i] = 0;
  }
  for (int i=0; i<m; i++) {
    int p;
    string s;
    cin>>p>>s;
    --p;
    if (s == "AC") {
      ac[p] = true;
    } else if (!ac[p]) {
      ++wa[p];
    }
  }
  int n_ac = 0, n_p = 0;
  for (int i=0; i<n; i++) {
    if (ac[i]) {
      ++n_ac;
      n_p += wa[i];
    }
  }
  cout<<n_ac<<" "<<n_p<<endl;
}

Measured memory_bytes: 768
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

l = []
for i in range(N):
  l.append(i+1)
ll = list(itertools.permutations(l))

PP = ll.index(P)
QQ = ll.index(Q)

print(abs(PP - QQ))

Measured memory_bytes: 8052
#include <stdio.h>

static const int N = 1000;

void trace(int A[], int n){
	int i;
	for (i = 0; i < n; i++){
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

int main(){
	int n, i, j;
	int A[N+1];
	int key;
	scanf("%d", &n);

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

	trace(A, n);

	for (i = 1; i < n; i++) {
		key = A[i];
		j = i-1;
		while (j >= 0 && A[j] > key){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = key;
		trace(A, n);
	}


	return 0;
}

Measured memory_bytes: 608
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int l = 753;
        String s = in.next();
        int m = Integer.MAX_VALUE;
        for (int i = 0; i < s.length() - 2; i++) {
            int x = Integer.parseInt(s.substring(i, i + 3));
            m = Math.min(m, Math.abs(x - l));
        }
        out.println(m);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}


Measured memory_bytes: 23252
#include<iostream>
#include<cmath>
using namespace std;
int main()
{int n,k,l;
 int m=0;
 cin>>n>>k;
 int A[n];
 for(int i =0;i<n;i++)
 {
 	cin>>A[i];
 	l = abs(A[i]-k);
 	if(A[i]<=l)
 	m = m+2*A[i];
 	else
 	m = m+2*l;
 }
 cout<<m;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll cnt(vl& V, ll a){
    return upper_bound(all(V), a) - lower_bound(all(V), a);
}

int main() {
    ll N;
    cin >> N;
    vl A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    bool isok = true;
    rep(i, N){
        ll acnt = cnt(A, B[i]), bcnt = cnt(B, B[i]);
        if(acnt + bcnt > N){
            isok = false;
            break;
        }
    }

    if(isok){
        vl ans(N);

        using P = pair<ll, ll>;
        priority_queue<P> pq;
        ll nx = 0;
        rep(i, N){
            if (i < nx) continue;
            pq.emplace(cnt(B, B[i]) + cnt(A, B[i]), B[i]);
            nx = upper_bound(all(B), B[i]) - B.begin();
        }

        map<ll, ll> mp, dd;
        rep(i, N) mp[A[i]]++;

        rep(i, N){
            auto [c1, v1] = pq.top();
            pq.pop();
            if(A[i] != v1){
                ans[i] = v1, c1--;
            }else{
                auto [c2, v2] = pq.top();
                pq.pop();
                ans[i] = v2, c2--;
                if (dd[v2] > 0) mp[v2] -= dd[v2], c2 -= dd[v2], dd[v2] = 0;
                if (c2 > mp[v2]) pq.emplace(c2, v2);
            }
            if (dd[v1] > 0) mp[v1] -= dd[v1], c1 -= dd[v1], dd[v1] = 0;
            if(c1 > mp[v1]) pq.emplace(c1, v1);

            dd[A[i]]++;
        }

        cout << "Yes" << '\n';
        rep(i, N) cout << ans[i] << (i < N - 1 ? " " : "\n");
    }else{
        cout << "No" << '\n';
    }
}


Measured memory_bytes: 36068
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  int t;
  cin >> t;
  vector<int> n(t);
  vector<vector<ull> > a(t);
  vector<string> s(t);
  for (int i = 0; i < t; i++) {
    cin >> n[i];
    a[i] = vector<ull>(n[i]);
    for (auto &x: a[i]) cin >> x;
    cin >> s[i];
  }

  vector<int> ans(t);
  for (int i = 0; i < t; i++) {
    vector<ull> b, c;
    for (int j = 0; j < n[i]; j++) {
      if (s[i][j] == '0') b.push_back(a[i][j]);
    }
    reverse(b.begin(), b.end());
    bool good = true;
    for (int j = 0; j < n[i]; j++) {
      if (s[i][j] == '0') {
        b.pop_back();
        continue;
      }
      ull target = a[i][j];
      ull now = 0;
      auto b_temp = b;
      for (int k = 63; k >= 0; k--) {
        int pivot = -1;
        for (int l = 0; l < (int) b_temp.size(); l++) {
          if (pivot == -1) {
            if (b_temp[l] & (1ULL << k)) {
              pivot = l;
              if ((target & (1ULL << k)) != (now & (1ULL << k))) {
                now ^= b_temp[pivot];
              }
            }
          }
          else {
            if (b_temp[l] & (1ULL << k)) {
              b_temp[l] ^= b_temp[pivot];
            }
          }
        }
        if (pivot != -1) b_temp[pivot] = 0;
        if ((target & (1ULL << k)) != (now & (1ULL << k))) {
          good = false;
          break;
        }
      }
      if (!good) break;
    }
    if (good) ans[i] = 0;
    else ans[i] = 1;
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}


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

int gcd(int a,int b){
    int r = a % b;
    cout << r << endl;
    if (r == 0)return b;
    return gcd(b,r);
}

int main(){
    string s;
    vector<char> p;
    cin >> s;
    sort(s.begin(),s.end());
    string ans ;

    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2])ans = "Yes";
    else ans = "No";


    cout << ans << endl;
}

Measured memory_bytes: 256
n,k,q = map(int,input().split())
a = [int(input())-1 for i in range(q)]
b = [0 for i in range(n)]
for i in range(q):
    b[a[i]] += 1

for i in range(n):
    ans = k-q+b[i]
    if ans <= 0:
        print('No')
    else:
        print('Yes')


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	cout << n / 3 << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var H = input[1];
            var W = input[2];
            var ans = 0;
            for (int i = 0; i < N; i++)
            {
                input = ReadArrayInt();
                var A = input[0];
                var B = input[1];
                if (A >= H && B >= W) ans++;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
#!/usr/bin/env python3

import sys
import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    a, b = mi()
    a_s = math.ceil(a * 100 / 8)
    a_t = (a+1) * 100 / 8
    if a_t % 1 == 0:
        a_t = int(a_t) - 1
    else:
        a_t = int(a_t)
    for i in range(a_s, a_t + 1):
        if b * 10 <= i < (b+1) * 10:
            print(i)
            exit()
    print(-1)



if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
#define itn int
#define endl "\n"

int main(void){
    long long int n;
    cin >> n;
    string s = to_string(n);
    if(n < 10)cout << n << endl;
    else if(s[0] == '9'){
        int sum = 9;
        for(int i = 0;i < s.size();i++){
            if(s[i] != '9'){
                sum = (s[i-1]-1) - '0';
                break;
            }
        }
        cout << sum + (s.size()-1)*9 << endl;
    } else {
        int a = 0,sum = 0;
        for(int i = 0;i < s.size();i++)sum += s[i]-'0';
        for(int i = 0;i < s.size();i++){
            a += (s[i]-'0');
            int sum2 = a-1 + (s.size()-i-1)*9;
            sum = max(sum,sum2);
        }
        cout << sum << endl;
    }
}


Measured memory_bytes: 256
//14-1 ?????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    if(a<40) a = 40;
    if(b<40) b = 40;
    if(c<40) c = 40;
    if(d<40) d = 40;
    if(e<40) e = 40;
    int ans =(a+b+c+d+e)/5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3104
import sys

input = sys.stdin.readline
MOD = 1000000007

N = int(input())

x = {}
c  = {}

res = []

i = 0
for j in range(1,N+1):
    s,p =input().split()
    p = int(p)
    if s not in x:
        x[s]   = i
        i+=1
        res.append([])

    res[x[s]].append(p)
    c[p] = j


for j in range(i):
    res[j].sort()

dict2 = sorted(x.items(),key=lambda x: x[0])

for  key,value in dict2: #key : city name , value: city number
#    print(key,value)
    #print(res[value])
    for j in res[value][::-1]:
        print(c[j])



Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int MAXN =  1e5 + 5;

struct node{
	LL l,r;
}jiqi[MAXN];

bool cmp(node a,node b){
	if(a.r == b.r)
		return a.l < b.l;
	return a.r < b.r;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		LL x,len;
		scanf("%lld%lld",&x,&len);
		jiqi[i].l = x - len;
		jiqi[i].r = x + len;
	}
	sort(jiqi,jiqi + n,cmp);
	int et = -INF;
	int ans = 0;
	for(int i = 0;i < n;i++){
		if(jiqi[i].l >= et){
			et = jiqi[i].r;
			ans++; 
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
#define int ll

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

ll dp[51][5500];
int zero;
int N, A;
vector<ll> v;

void init()
{
	cin >> N;
	cin >> A;
	v.resize(N);
	rep(i, N) {
		cin >> v[i];
		v[i] -= A;
	}
	zero = N * A + 50;
	dp[0][zero] = 1;
}

void solve()
{
	rep(i, N) {
		rep(j, 5500) {
			dp[i+1][j] = dp[i][j];
			if (j - v[i] >= 0) {
				dp[i+1][j] += dp[i][j-v[i]];
			}
		}
	}
	cout << dp[N][zero] - 1 << endl;
}


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

int main() {
  int N, M, C, ans;
  cin >> N >> M >> C;
  vector<int>B(M);
  for (int i = 0; i < M; i++) {
    cin >> B.at(i);
  }
  vector<vector<int>>A(N,vector<int>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
    }
  }
  vector<int>count(N);
  for (int i = 0; i < N; i++) {
    count.at(i) = C;
    for (int j = 0; j < M; j++) {
      count.at(i) += A.at(i).at(j) * B.at(j);
    }
    if (count.at(i) > 0) {
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

int main() {
   Int n;
   std::string ss;
   std::cin >> n;
   getchar();
   std::getline(std::cin, ss);
   Int res = std::count(ss.begin(), ss.end(), 'Y');
   puts(res>0 ? "Four" : "Three");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 10005;
int n, X, A[N];
int main()
{
    scanf("%d%d", &n, &X);
    for (int i = 1; i <= n; i ++)
    {
        scanf("%d", &A[i]);
        A[i] += A[i - 1];
        if (A[i] > X)
            return !printf("%d\n", i);
    }
    return !printf("%d\n", n + 1);
}

Measured memory_bytes: 256
### main

loop do
  n = gets.strip.to_i
  break if n == 0

  hn = n / 2
  as = gets.strip.split(' ').map(&:to_i)
  #p as

  ahash = Hash.new(0)
  max_a = nil

  as.each{|a| ahash[a] += 1; max_a = a if ahash[a] > hn}

  puts (max_a.nil? ? 'NO COLOR' : max_a)
end

Measured memory_bytes: 103348
num_val = int(input())
num_list = [int(i) for i in input().split()]

if num_val == 1:
    print('OK')
elif (num_list[0] % num_val == 0 ) or (num_list[1] % num_val == 0):
    print('OK')
elif (num_list[0] // num_val) == (num_list[1] // num_val):
    print('NG')
else:
    print('OK')

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

vector<vector<int> > v(2000);
int ans=mod,num=0,k;
void dfs(int now,int count,int p){
	if(count>k)num++;
	for(auto& i:v[now]){
		if(p==i)continue;
		dfs(i,count+1,now);
	}
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    cin>>n>>k;
    vector<pair<int,int> > ve;
    for(int i=1;i<n;i++){
    	cin>>a>>b;
    	a--,b--;
    	v[a].pb(b);
    	v[b].pb(a);
    	ve.push_back({a,b});
    }
    if(k&1){
    	k/=2;
    	for(auto& i:ve){
    		num=0;
    		dfs(i.first,0,i.second);
    		dfs(i.second,0,i.first);
    		ans=min(ans,num);
    	}
    }
    else{
    	k/=2;
    	for(int i=0;i<n;i++){
    		num=0;
    		dfs(i,0,-1);
    		ans=min(ans,num);
    	}
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]) {
	unsigned int mod = 1000000007;
	int N;
	std::cin >> N;
	int judge[N/2+N%2];
	int jsize = sizeof(judge) / sizeof(judge[0]);
	for (size_t i = 0; i < jsize; i++) {
		judge[i] = 0;
	}
	int A[N];
	for (size_t i = 0; i < N; i++) {
		std::cin >> A[i];
		judge[A[i]/2]++;
	}

	// 正誤判定
	if (N % 2 == 0 && judge[0] != 2) {
		std::cout << 0 << '\n';
		return 0;
	}
	if (N % 2 == 1 && judge[0] != 1) {
		std::cout << 0 << '\n';
		return 0;
	}
	for (size_t i = 1; i < jsize; i++) {
		if (judge[i] != 2) {
			std::cout << 0 << '\n';
			return 0;
		}
	}

	unsigned int ans = 1;
	for (size_t i = 0; i < N/2; i++) {
		ans = ((ans % mod) * 2) % mod;
	}

	std::cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 768
// AOJ 0208
// Room Numbers of Hospital (a@Ì®Ô)

#include <cstdio>

using namespace std;

const int table[] = { 0, 1, 2, 3, 5, 7, 8, 9 };

void solve(int n){
    
    if(n >= 8){
        solve(n / 8);
    }
    
    printf("%d", table[n % 8]);
}

int main(){
    int n;
    
    while(scanf("%d", &n), n > 0){
        solve(n);
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 0
package main
import (
  "bufio"
  "fmt"
  "os"
  "sort"
)

func main() {
  solve()
}

func solve() {
  input := bufio.NewScanner(os.Stdin)
  input.Scan()
  
  var re []string
  for input.Scan() {
    re = append(re, input.Text())
  }
  sort.Strings(re)
  
  var s string
  for _, v := range re {
    s += v
  }
  fmt.Println(s)
}
  

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

int main() {
  ll n;
  cin>>n;
  ll i=1;
  ll ans=0;
  while(n>0){
    n/=2;
    ans+=i;
    i*=2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forr(x,n) for(int x = 0; x < n; ++x)
#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
	int a=0,b=0;
	forr(i,s.length())
	{
		if(s[i]=='A')
		a++;
		else
		b++;
	}
	if(a>0&&b>0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}




Measured memory_bytes: 256