akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
int main() {
	int r; cin >> r;
	if (r < 1200)cout << "ABC" << endl;
	else if (r < 2800)cout << "ARC" << endl;
	else cout << "AGC" << endl;
	return 0;
}

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

void A()
{
    // 入力
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    
    // 起きている時間を求める（分）
    int M = (60 - M1) + M2 + (H2 - (H1 + 1)) * 60;
    
    // 出力
    cout << M - K << endl;
}

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

Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<int> n(3);
	while (N--)
	{
		cin >> n[0] >> n[1] >> n[2];

		sort(n.begin(), n.end());
		if (pow(n[0], 2) + pow(n[1], 2) == pow(n[2], 2))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1212
module Main where

import Data.Functor
import Data.List

main :: IO ()
main = do
  { xs <- getInts
  ; let result = sort xs
  ; putInts result
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	string ans;
	for (int i = 0; i < 3; i++)
	{
		string a;
		cin >> a;
		ans += a[i];
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 100000000

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans[110] = {0};
    int result = 0;
    for (int i = a; i <= b; i++)
    {
        ans[i]++;
    }
    for (int i = c; i <= d; i++)
    {
        if (ans[i] == 1)
        {
            result++;
        }
    }
    result--;
    cout << max(0, result) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 55
using namespace std;
int n,m,k;
char g[N][N];
int p[N][N];
int on[N][N];
int off[N][N];
int sb[N][N];
bool vis[N][N];
int sx,sy,gx,gy;
const int d1[4]={0,-1,0,1},d2[4]={1,0,-1,0};
long long ans;
void input_matrix(int (*a)[N])
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        scanf("%d",&a[i][j]);
}
void update(int x,int y,int cur)
{
    if(sb[x][y]==-1)
           {
               ans+=on[x][y];
           }
           else
           {
               long long  tmp1=(long long )p[x][y]*(cur-sb[x][y]),tmp2=off[x][y]+on[x][y];
               ans+=tmp1>tmp2?tmp2:tmp1;
           }
           sb[x][y]=cur;
}
bool dfs(int x,int y,int cur)
{
  vis[x][y]=1;
  if(x==gx&&y==gy)
  {
    update(x,y,cur);
    return true;
  }
  for(int i=0;i<4;i++)
  {
      int tmpx=x+d1[i],tmpy=y+d2[i];
      if(tmpx<n&&tmpx>=0&&tmpy<m&&tmpy>=0&&!vis[tmpx][tmpy]&&g[tmpx][tmpy]=='.'&&dfs(tmpx,tmpy,cur+1))
      {
           update(x,y,cur);
           return true;
      }
  }
  return false;
}
int main()
{
//    cout << "Hello world!" << endl;
    while(scanf("%d%d%d",&n,&m,&k)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%s",g[i]);
        input_matrix(p);
        input_matrix(on);
        input_matrix(off);
        memset(sb,-1,sizeof(sb));
        ans=0;
        scanf("%d%d",&sx,&sy);
        int i=1;
        while(i<k)
        {
            memset(vis,0,sizeof(vis));
            scanf("%d%d",&gx,&gy);
            int tmp=sb[sx][sy]==-1?0:sb[sx][sy];
            dfs(sx,sy,tmp);
            sx=gx;
            sy=gy;
            i++;
        }
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
              if(sb[i][j]!=-1)
              ans+=off[i][j];
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1308
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int t;
	scanf("%d",&t);
    if(t%10==t/100){
    	printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int co[200005],n,sum[2];
V<int> v[200005];
void dfs(int p,int fa,int color){
	co[p]=color;
	sum[co[p]]++;
	for(auto u:v[p]){
		if(u==fa)continue;
		dfs(u,p,color^1);
	}
}
int ans[200005];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	int x,y;
	rep(i,1,n){
		cin>>x>>y;
		v[x].PB(y);
		v[y].PB(x);
	}
	dfs(1,-1,0);
	int l[4];
	l[1]=n/3+(n%3>0);
	l[2]=n/3+(n%3>1);
	l[3]=n/3;
	int t[2]={};
	if(l[1]<=sum[0]&&l[2]<=sum[1]){
		t[0]=1;t[1]=2;
	}else if(l[1]<=sum[1]&&l[2]<=sum[0]){
		t[1]=1;t[0]=2;
	}
	if(t[0]){
		FOR(i,1,n)ans[i]=t[co[i]],l[t[co[i]]]--;
		FOR(i,1,n){
			if(co[i]){
				if(l[t[1]]<0){
					l[t[1]]++;
					ans[i]=3;
				}
			}else{
				if(l[t[0]]<0){
					l[t[0]]++;
					ans[i]=3;
				}
			}
		}
	}else{
		int lc;
		if(l[3]>=sum[0]){
			lc=0;
		}else lc=1;
		FOR(i,1,n){
			if(co[i]==lc)ans[i]=3;
			else if(l[1]){
				l[1]--;ans[i]=1;
			}else if(l[2]){
				l[2]--;ans[i]=2;
			}else ans[i]=3; 
		}
	}
	int st[4]={};
	FOR(i,1,n){
		cout<<st[ans[i]]*3+ans[i]<<' ';
		st[ans[i]]++;
	}
	RE 0;
}




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

using namespace std;
#define ll long long
#define ld long double
const int N=2e5+5;
 
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int r;
    cin >> r;
    cout << 2 * 3.14 * r << endl;
    return 0;
}


Measured memory_bytes: 3736
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::collections::BinaryHeap;

fn main() {
    let N = get!(usize);
    let A = get!(Vec<i64>);
    let mut B = get!(Vec<i64>);

    let mut q = BinaryHeap::new();
    for i in (0..N) {
        q.push((B[i], i))
    }
    let mut ans = 0;
    while !q.is_empty() {
        let (b, i) = q.pop().unwrap();
        let s = B[(N + i - 1) % N] + B[(i + 1) % N];
        if b == A[i] {
            continue;
        }
        if b < s {
            ans = -1;
            break;
        }
        let d = (b - A[i]) / s;
        ans += d;
        B[i] -= d * s;
        if B[i] < A[i] || d == 0 {
            ans = -1;
            break;
        } else if B[i] > A[i] {
            q.push((B[i], i))
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 14492
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <cmath>
#include <random>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define MK make_pair
#define PB push_back
#define MSI map<string,int>
#define VI vector<int>
#define VII vector<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define W1 while(1);
const int MOD = 1000000007;
int main()
{
	int n;
	int temp=0;
	cin >> n;
	REP(i, n)temp += (i+1);
	cout << temp << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
#define MAX_N 100000
#define MAX_Q 50000
 
int main(void){
 
  int i, j, key, sum, s_n, t_n, s[MAX_N], t[MAX_Q];
 
  scanf("%d",&s_n);
  for(i=0; i<s_n;i++){
    scanf("%d", &s[i]);
  }
 
  scanf("%d",&t_n);
  for(i=0; i<t_n;i++){
    scanf("%d", &t[i]);
  }
 
  sum = 0;
  for(i=0;i<t_n;i++){
    key = t[i];
    int left = 0;
    int right = s_n;
    while(left < right){
      int mid = (int)((left + right) / 2);
       
      if(key == s[mid]){
        sum++;
        break;
      } else if(key > s[mid]){
        left = mid + 1;
      } else {
        right = mid;
      }
    }
  }
 
  printf("%d\n", sum);
 
  return 0;
}



Measured memory_bytes: 2296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    set<string> st;
    for(int i=0;i<n;i++){
        string s;cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 19288
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	while (N != 0) {
		bool rup = false;
		bool lup = false;
		int last = 0; // r=1 l=-1
		int ans = 0;
		REP(i, N) {
			string S;
			cin >> S;
			if (S == "lu") {
				lup = true;
				if (last == 1 && rup) {
					ans++;
				}
				last = -1;
			}
			else if (S == "ru") {
				rup = true;
				if (last == -1 && lup) {
					ans++;
				}
				last = 1;
			}
			else if (S == "ld") {
				lup = false;
				if (last == 1 && (!rup)) {
					ans++;
				}
				last = -1;
			}
			else if (S == "rd") {
				rup = false;
				if (last == -1 && (!lup)) {
					ans++;
				}
				last = 1;
			}
		}
		cout << ans << endl;

		cin >> N;
	}
	return 0;
}



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

int main() {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if ((A+B) > (C+D)) cout << "Left" << endl;
	else if ((A+B) < (C+D)) cout << "Right" << endl;
	else if ((A+B) == (C+D)) cout << "Balanced" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll &b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll &b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
ll num, ans=0, count=0, sum=0;

int main() {
  ll N, K;
  cin >> N >> K;
  N %= K;
  cout << min(N,K-N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m=1,ko=1;
	cin >> n;
	int a[n];
	a[0]=1;
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	for(int i=1;i<=n;i++){
		if(a[i]==1){
			if(a[i-1]==1){
				m++;
			}else{
				m=2;
			}
		}
		if(ko<m){
			ko=m;
		}
	}
	cout << ko << endl;
}


Measured memory_bytes: 3100
#include<stdio.h>

int main()
{
    int a,b,i,N,count=0;
    scanf("%d",&N);

    for(a=1;a<N;a++)
    {
        b=1;
        while((a*b)<N)
        {
            count++;
            b++;
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#define rep(i,N) for (int i = 0; i < N; i++)
using namespace std;

int main(){
        string s;
        cin >> s;
        int count = 0;
        rep(i,3) if(s[i] == 'o') count++;
        cout << 700 + 100*count << endl;
        return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll MAX = 2000 * 2000 + 1;
ll dp[MAX + 1];

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

    vector<ll> A(N);
    ll Sum = 0;
    for (int i = 0; i < N; ++i) cin >> A[i], Sum += A[i];

    bitset<MAX> dp(1);
    for (int i = 0; i < N; ++i)
        dp |= dp << A[i];

    ll ans = (Sum + 1) / 2;
    for (; ans < MAX; ++ans)
        if (dp[ans]) break;

    cout << ans << endl;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
using namespace std;
ll read(){
	char ch=getchar();ll x=0;int op=1;
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') op=-1;
	for (;isdigit(ch);ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
#define N 200005
int n,a[N],sum,Xor;ll ans=0;
int main(){
	n=read();
	rep (i,1,n) a[i]=read();
	int l=1,r=0;ll sum=0,Xor=0;
	while (r<n){
		r++;
		while (l<=r&&sum+a[r]!=(Xor^a[r])){
			sum-=a[l];Xor^=a[l++];
		}
		sum+=a[r];Xor^=a[r];
		ans+=r-l+1;
	}
	cout<<ans<<'\n';
	return 0;
}

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

int main() {
  int A, B, C;
  
  cin >> A;
  cin >> B;
  if(A < 10 && B < 10){
    C = A * B;
    cout << C << endl;
  } else {
    cout << "-1" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
# エラトステネスの篩
def Eratosthenes(N):
    ans = [True for i in range(N + 1)]
    ans[0], ans[1] = False, False
    
    for i in range(int(N ** (1 / 2)) + 1):
        if ans[i]:
            for j in range(2 * i, N, i):
                ans[j] = False
    
    return [i for i in range(N + 1) if ans[i]]

ans = [] # 答え
while True:
    M, A, B = map(int,input().split())
    if not M:
        break
    
    AdivB = A / B + 0.0000001
    
    prime_list = Eratosthenes(M)
    tmp_max = 0
    tmp_ans = [0, 0]
    
    # 必要な部分だけ探索
    for i in range(len(prime_list)):
        for j in range(i + 1, len(prime_list)):
            if prime_list[i] / prime_list[j] < AdivB or prime_list[i] * prime_list[j] > M:
                if tmp_max < prime_list[i] * prime_list[j - 1] and prime_list[i] * prime_list[j - 1] <= M:
                    tmp_max = prime_list[i] * prime_list[j - 1]
                    tmp_ans = [prime_list[i], prime_list[j - 1]]
                break

    ans.append(tmp_ans)

# 出力
[print(i[0], i[1]) for i in ans]



Measured memory_bytes: 7980
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;



int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint64 a[4], n;
	std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> n;
	for (uint32 i = 1;i < 4;++i) {
		a[i] = std::min(a[i],a[i - 1] << 1);
	}
	uint64 ans = 0;
	if (n & 1) ans += a[2];
	ans += a[3] * (n >> 1);
	std::cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const int INF=10010010;
const double PI=3.141592653589;


int main(){
  int x,n; cin>>n>>x;
  int c=1;
  int sum=0;
  vector<int> l(n);
  rep(i,n){
    cin>>l[i];
  }
  for(int i=1;i<=n;i++){
    sum=sum+l[i-1];
    // cout<<sum<<endl;
    if(sum<=x)
    c++;
  }
  cout<<c<<endl;

  return 0;
}


Measured memory_bytes: 256
from math import ceil
from decimal import *

N = int(input())
A,B = 1,1

for i in range(N):
	nums = [int(x) for x in input().split()]
	x,y = nums[0],nums[1]
	n = Decimal(max(ceil(A/x),ceil(B/y)))
	A,B = x*n, y*n
print(A+B)


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n1,num;
    set<int> set1;
    cin >> n1;
    
    for(int i = 0;i < n1;++i){
        cin >> num;
        set1.insert(num);
    }
    
    cin >> n1;
    for(int i = 0;i < n1;++i){
        cin >> num;
        set1.erase(num);
    }
    
    for(set<int>::iterator it = set1.begin();it != set1.end();++it){
        cout << *it << endl;
    }
}


Measured memory_bytes: 12508
class RingBuffer
  def initialize(cap)
    @cap = cap + 1
    @values = Array.new(@cap)
    @head = @tail = 0
  end

  def empty?
    @head == @tail
  end

  def full?
    @head == ((@tail + 1) % @cap)
  end

  def enq(value)
    raise 'buffer is full' if full?

    @values[@tail] = value
    @tail = (@tail + 1) % @cap
    nil
  end

  def deq
    raise 'buffer is empty' if empty?

    value = @values[@head]
    @head = (@head + 1) % @cap
    value
  end
end

n, q = gets.split.map(&:to_i)

buffer = RingBuffer.new(n)

while line = gets
  name, time = line.split
  buffer.enq(name: name, time: time.to_i)
end

current_time = 0

until buffer.empty?
  process = buffer.deq

  elapsed_time = [process[:time], q].min
  process[:time] -= elapsed_time
  current_time += elapsed_time

  if process[:time] > 0
    buffer.enq(process)
  else
    puts "#{process[:name]} #{current_time}"
  end
end

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

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

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

	for(int n; cin >> n && n;) {
		vector<pair<int, int>> dp(1, make_pair(0, 0));

		for(int i = 0; i < n; ++i) {
			int price;
			cin >> price;

			const int need = min((i + 1) * 499, (n - i - 1) * 500);
			vector<pair<int, int>> next_dp(need + 1, make_pair(-1, -1));

			for(int small = 0; small < dp.size(); ++small) {
				if(dp[small].first == -1) continue;

				chmax(next_dp[min(small, need)], dp[small]);
				const int num = dp[small].first;
				const int cost = -dp[small].second;

				const auto update = [&](const int pay) {
					const int need_small = pay % 1000;
					if(need_small > small) return;

					const int change = pay - price;
					const int next_small = min(small - need_small + change % 500, need);
					const int next_num = num + change / 500;
					const int next_cost = cost + price;
					chmax(next_dp[next_small], make_pair(next_num, -next_cost));
				};

				update((price + 999) / 1000 * 1000);
				update(price + 500);
			}

			dp = move(next_dp);
		}

		cout << dp[0].first << ' ' << -dp[0].second << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int seq[6];
int k;
int main()
{
	for(int i = 0; i < 5; i++)
		cin >> seq[i];
	cin >> k;
	sort(seq,seq+5);
	if(seq[4] - seq[0] > k)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;
	return 0;
 } 

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

int ng() {
    cout << -1 << "\n";
    return 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<int> d(n);
    vector<pair<int, int>> ds;
    for (int i = 0; i < n; i++) { 
        cin >> d[i];
        ds.emplace_back(d[i], i);
    }
    vector<pair<int, int>> e[n], uv;
    vector<int> c(m, 0), col(n, 0);
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        uv.emplace_back(u, v);
        e[u].emplace_back(v, i);
        e[v].emplace_back(u, i);
    }
    sort(ds.begin(), ds.end());
    for (int i = 0; i < n; i++) {
        auto &x = ds[i].second;
        auto &p = ds[i].first;
        bool ok = false;
        for (auto &ed: e[x]) {
            if (d[ed.first] <= p) {
                c[ed.second] = p;
                ok = true;
                break;
            }
        }
        if (!ok) return ng();
    }
    vector<int> f[n], visited(n, 0);
    for (int i = 0; i < m; i++) {
        if (c[i]) {
            auto &u = uv[i].first;
            auto &v = uv[i].second;
            f[u].emplace_back(v);
            f[v].emplace_back(u);
        } else c[i] = 1e9;
    }

    function<void(int, int)> dfs = [&](int curr, int prev) {
        visited[curr] = 1;
        for (auto &to: f[curr]) {
            if (to == prev) continue;
            col[to] = !col[curr];
            dfs(to, curr);
        }
    };

    for (int i = 0; i < n; i++) {
        if (!visited[i]) dfs(i, -1);
    }

    for (int i = 0; i < n; i++) {
        cout << (col[i] ? 'B' : 'W');
    }
    cout << "\n";
    for (int i = 0; i < m; i++) {
        cout << c[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 20208
#include <cstdio>
#include <iostream>
#include <utility>
using namespace std;

int main(){
  int a[3][101];
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++){
    int k;
    scanf("%d", &k);
    sum += k;
    a[1][i+1] = sum;
  }
  a[1][0] = 0;
  a[2][0] = 0;
  sum = 0;
  for (int i = 0; i < n; i++){
    int k;
    scanf("%d", &k);
    sum += k;
    a[2][i+1] = sum;
  }

  int m = 0;
  for (int i = 1; i <= n; i++){
    m = max(m, a[1][i] + a[2][n] - a[2][i - 1]);
  }
  printf("%d\n", m);
  return 0;
}

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

int main() {
	int sx,sy,tx,ty;
	
	int b=0, c=0;
	cin>>sx>>sy>>tx>>ty;
	for (int i=sx;i <=tx;i++){
		b++;
	}
	for (int i=sy;i <=ty;i++){
		c++;
	}
	
	
	for (int i=1;i <c;i++){
	cout<<"U";
	}
	for (int i=1;i <b;i++){
	cout<<"R";
	}
	
	
	for (int i=1;i <c;i++){
	cout<<"D";
	}
	for (int i=1;i <b;i++){
	cout<<"L";
	}
	
	cout<<"LU";
	for (int i=1;i <c;i++){
	cout<<"U";
	}
	for (int i=1;i <b;i++){
	cout<<"R";
	}
	cout<<"RD";
	
	cout<<"RD";
	for (int i=1;i <c;i++){
	cout<<"D";
	}
	for (int i=1;i <b;i++){
	cout<<"L";
	}
	cout<<"LU";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if ((a*b)%2==1){
            System.out.println("Odd");
        }else {
            System.out.println("Even");
        }
    }
}

Measured memory_bytes: 23764
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,d = map(int, input().split())
    list_num = []
    for i in range(n):
        list_x = list(map(int, input().split()))
        list_num.append(list_x)
    
    count = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                ans = 0
                result_num = 0
                for l in range(d):
                    result_num += pow(abs(list_num[i][l] - list_num[j][l]),2)
                ans = sqrt(result_num)
                
                if ans.is_integer():
                    count += 1
    print(count)

if __name__ == "__main__":
    main()

Measured memory_bytes: 5068
/* ex2_1: Plumber1 
  sachiyan */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int number;
    scanf("%d", &number);
    int depth[number];
    int minpower[number];
    int i;
    int per_1, per_2;

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

    minpower[0] = 0;
    minpower[1] = abs(depth[1]-depth[0]);

    for(i=2; i<number; i++){
        per_1 = minpower[i-1] + abs(depth[i]-depth[i-1]);
        per_2 = minpower[i-2] + abs(depth[i]-depth[i-2]);
        //printf("%d, %d\n",per_1, per_2);
        if(per_1 >= per_2){
            minpower[i] = per_2;
        }else{
            minpower[i] = per_1;
        }
    }
    //for(i=0;i<number;i++){
       // printf("minpower[%d] = %d\n", i , minpower[i]);
    //}

    printf("%d\n", minpower[number-1]);
    return 0;
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            string n;
            n = Console.ReadLine();
            char[] cs = n.ToCharArray();
            cs[3] = '8';
            Console.WriteLine(cs);
            Console.ReadKey();

        }
    }
}


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

const int MOD = 1000000007;

int main()
{
  long long N;
  cin >> N;
  vector<long long> P(N);
  for (int i = 0; i < N; i++)
  {
    cin >> P[i];
  }
  long long cnt = 1;
  long long prev = P[0];
  for (int i = 1; i < N; i++)
  {
    if (P[i] <= prev)
      cnt++;
    prev = min(prev, P[i]);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
import sys
from bisect import bisect_right as bsr
from collections import Counter as cnt
from collections import defaultdict as dd
from collections import deque
from fractions import gcd
from itertools import permutations as perm
from math import ceil, factorial, floor
from operator import itemgetter as ig

sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    A = input([int, N])
    i, ans = 1, 0
    for a in A:
        if not a == i:
            ans += 1
        else:
            i += 1
    if ans == N:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


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

int main(){
	string s;
	bool f=true;
	cin>>s;
	char a='0',b='0';
	int c=0,d=0;
	for(int i=0;i<4;i++){
		if(a=='0'){
			a=s[i];
			c++;
		}else if(a!=s[i]){
			if(b=='0'){
				b=s[i];
				d++;
			}else if(b!=s[i]){
				cout<<"No"<<endl;
				return 0;
			}else{
				d++;
			}
		}else{
			c++;
		}
	}		
	if(c==2&&d==2){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 36

struct Card{
  int num;
  char mozi;
};

int main(){
  struct Card C1[N], C2[N];
  int i, j, n, key, mini, flag = 0;
  char swap, ch;

  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf(" %c%d", &C1[i].mozi,  &C1[i].num);
  }

  for(i = 0; i < n; i++) C2[i] = C1[i];

  //bubble
  for(i = 0; i < n; i++){
    for(j = n-1; j > i; j--){
      if(C1[j].num < C1[j-1].num){
	key = C1[j].num;
	swap = C1[j].mozi;
	C1[j].num = C1[j-1].num;
	C1[j].mozi = C1[j-1].mozi;
	C1[j-1].num = key;
	C1[j-1].mozi = swap;
      }
    }
  }

  for(i = 0; i < n; i++){
    if(i > 0) printf(" ");
    printf("%c%d",C1[i].mozi, C1[i].num);
  }
  printf("\n");
  printf("Stable\n");

  // selection
    for(i = 0; i < n; i++){
    mini = i;
    for(j = i; j < n; j++){
      if(C2[j].num < C2[mini].num) mini = j;
    }
    key = C2[i].num;
    swap = C2[i].mozi;
    C2[i].num = C2[mini].num;
    C2[i].mozi = C2[mini].mozi;
    C2[mini].num = key;
    C2[mini].mozi = swap;
  }

  for(i = 0; i < n; i++){
    if(i > 0) printf(" ");
    printf("%c%d",C2[i].mozi, C2[i].num);
  }
  printf("\n");

  for(i = 0; i < n; i++){
    if(C1[i].mozi != C2[i].mozi) flag = 1;
  }
  if(flag == 0) printf("Stable\n");
  else printf("Not stable\n");
  return 0;
}

Measured memory_bytes: 1044
/*
AizuOnline A0226
Title Hit and Blow
@kankichi573
*/
#include <stdio.h>
char r[5],a[5];
int h,b;
//
main()
{
        int i,j;

        while(EOF!=scanf("%s %s",r,a) &&
              (strcmp("0",r) || strcmp("0",a)))
        {
                h=0;b=0;
                
                for(i=0;i<4;i++)
                        for(j=0;j<4;j++)
                        {
                                if(r[i]==a[j])
                                {
                                        if(i==j)
                                                h++;
                                        else
                                                b++;
                                }
                        }

                printf("%d %d\n",h,b);
        }
return(0);
}

Measured memory_bytes: 540
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W, N; 
  cin >> H >> W >> N;

  queue<int> q;
  REP(i, N){
    int A;
    cin >> A;
    while(A--) q.push(i+1);
  }

  vector<vector<int>> ans(H, vector<int>(W));

  REP(i, H){
    if(i%2 == 0){
      REP(j, W){
        ans[i][j] = q.front(); q.pop();
      }
    }else{
      RREP(j, W){
        ans[i][j] = q.front(); q.pop();
      }
    }
  }

  REP(i, H){
    REP(j, W){
      cout << ans[i][j]; SPBR(j, W);
    }
  }

  return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    int ans = 0;
    int m = 0;
    for(int i = 0; i < N; ++i)
    {
        int pi;
        cin >> pi;
        ans += pi;
        m = max(m, pi);
    }
    cout << ans - (m / 2) << endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool binSearch(int *s, int n, int target)
{
	int lo = 0;
	int hi = n - 1;
	while (lo <= hi)
	{
		int mid = lo + (hi - lo) / 2;
		if (s[mid] == target)
			return true;
		else if (target > s[mid])
			lo = mid + 1;
		else
			hi = mid - 1;
	}
	return false;
}

int main()
{
	int val, n, q;
	int s[100000], t[50000];

	cin >> n;
	for (int i = 0; i<n && cin >> val; ++i) s[i] = val;

	int count = 0;
	cin >> q;
	while (q--)
	{
		cin >> val;
		if (binSearch(s, n, val)) count++;
	}

	cout << count << endl;
	return 0;
}

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

int main() {
  int n,k;
  cin >>n>>k;
  vector<int> d(k);
  vector<vector<int>> a(k, vector<int>(n));
  vector<int> c(n);//check
  for(int i=0;i<k;i++){
    cin >> d.at(i);
    for(int j=0;j<d.at(i);j++){
      cin >> a.at(i).at(j);
      c.at(a.at(i).at(j)-1)++;
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(c.at(i)==0)ans++;
  }
  cout << ans<<endl;
  return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long int

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
    char n;
    scanf("%c", &n);
    if(n == 'z')
        n = 'a';
    else
        n += 1;
    printf("%c\n",n);    
    return 0;
}

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

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

  int k;
  string s;
  cin >> k >> s;

  int n = (int)s.size();
  if(n <= k) {
    cout << s << '\n';
  } else {
    string ans = s.substr(0, k);
    ans += "...";
    cout << ans << '\n';
  }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main(void){
    int r;cin>>r;
    co(2*r*PI);
}



Measured memory_bytes: 3788
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//
//using namespace __gnu_pbds;
using namespace std;

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

//#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

int main()
{
    fast_in_out;

     int n;
     cin>>n;
     map<int, int>mp;
     int x;
     for(int i=0; i<n-1; i++)
     {
         cin>>x;

         mp[x]++;
     }
     for(int i=1; i<=n ; i++) cout<<mp[i]<<"\n";
    return 0;
}


Measured memory_bytes: 13036
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Edge{
	int source, sink, id;
	public Edge(int sc, int sk, int id) {
		source = sc; sink = sk; this.id = id;
	}
}
class Main{
	// Generate Permutation of n elements
	static List<List<Integer>> genPermutations(int n){
		if(n == 1) {
			List<Integer> elem = new ArrayList<Integer>();
			elem.add(1);
			List<List<Integer>> ans = new ArrayList<List<Integer>>();
			ans.add(elem);
			return ans;
		}
		List<List<Integer>> recPerm = genPermutations(n - 1); // (n - 1)!
		List<List<Integer>> ans = new ArrayList<List<Integer>>();
		for(List<Integer> perm : recPerm) {
			for(int i = 0; i < n; i++) {
				List<Integer> newperm = new ArrayList<Integer>(n);
				for(int j = 0; j < n; j++) newperm.add(0);
				perm.add(i, n);
				Collections.copy(newperm, perm);
				ans.add(newperm);
				perm.remove(i);
			}
		}
		return ans;
	}
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt(), R = sc.nextInt();
		int[] r = new int[R];
		for(int i = 0; i < R; i++) r[i] = sc.nextInt() - 1;
		long[][] dist = new long[N][N];
		for(int i = 0; i < N; i++) Arrays.fill(dist[i], Long.MAX_VALUE);
		for(int i = 0; i < N; i++) dist[i][i] = 0;
		for(int i = 0; i < M; i++) {
			int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt();
			dist[A - 1][B - 1] = C;
			dist[B - 1][A - 1] = C;
		}
		// warshall-floyd
		for(int k = 0; k < N; k++) {
			for(int i = 0; i < N; i++) {
				for(int j = 0; j < N; j++) {
					if(dist[i][k] == Long.MAX_VALUE || dist[k][j] == Long.MAX_VALUE) continue;
					dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
		// Generate Permutation
		List<List<Integer>> perm = genPermutations(R);
		long ans = Long.MAX_VALUE;
		for(List<Integer> p : perm) {
			int tmp = 0;
			int before = p.get(0) - 1;
			for(int i = 1; i < R; i++) {
				tmp += dist[r[before]][r[p.get(i) - 1]];
				before = p.get(i) - 1;
			}
			ans = Math.min(ans, tmp);
		}
		System.out.println(ans);
	}
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


// main1.cppとほぼ同じ
int main() {
    int n; cin >> n;
    V<P<ll, ll> > v(n);
    for(int i = 0; i < n; i++){
        ll x, l; cin >> x >> l;
        v[i] = make_pair(x + l, x - l);
    }
    sort(ALL(v));

    ll ans = 0;
    ll pre = -1e9;
    for(int i = 0; i < n; i++){
        if(pre <= v[i].second){
            ans++;
            pre = v[i].first;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4852
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <vector>
#include <map>

using namespace std;

#define MOD 998244353

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

bitset<300> A[300];
mint pw[301];
int H, W;

int main() {
    pw[0] = 1;
    for (int i = 1; i <= 300; i++) {
        pw[i] = 2 * pw[i - 1];
    }
    scanf("%d %d", &H, &W);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int a;
            scanf("%d", &a);
            A[i][j] = a;
        }
    }
    int r = 0;
    for (int j = 0; j < W && r < H; j++) {
        int p = -1;
        for (int i = r; i < H; i++) {
            if (A[i][j]) {
                p = i;
                break;
            }
        }
        if (p == -1) continue;
        swap(A[p], A[r]);
        for (int i = r + 1; i < H; i++) {
            if (A[i][j]) {
                A[i] ^= A[r];
            }
        }
        r++;
    }
    map<int, int> mp;
    int rr = 0;
    for (int j = 0; j < W; j++) {
        int none = 1;
        for (int i = H - 1; i >= 0; i--) {
            if (A[i][j]) {
                mp[i]++;
                none = 0;
                break;
            }
        }
        rr += none;
    }
    mint ans = pw[H - r] * pw[rr];
    mint dp0 = 1;
    mint dp1 = 0;
    for (auto kv : mp) {
        mint dp0_ = 0;
        mint dp1_ = 0;
        int k = kv.second;
        dp0_ += dp0 * pw[k];
        dp1_ += dp1 * pw[k];

        dp0_ += dp0 * pw[k - 1];
        dp1_ += dp1 * pw[k - 1];

        dp1_ += dp0 * pw[k - 1];
        dp0_ += dp1 * pw[k - 1];

        dp0 = dp0_;
        dp1 = dp1_;
    }
    printf("%d\n", (dp1 * ans).n);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<pair<ll, ll>> ab(n);
    rep(i, n) cin >> ab[i].first >> ab[i].second;
    sort(all(ab), [](pair<ll, ll> &a, pair<ll, ll> &b){ return a.second < b.second; });
    // rep(i, n) printf("%lld:%lld:%lld\n", ab[i].first, ab[i].second, ab[i].second - ab[i].first);
    ll sum = 0;
    rep(i, n) {
        sum += ab[i].first;
        if (sum > ab[i].second) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main(void) {
	int n;
	cin >> n;
	vector<long long> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	long long pre = -2;
	for (int i = 0; i < n; i++) {
		if (pre <= a[i]- 1) {
			pre = a[i] -1;
		} else if (pre <= a[i]) {
			pre = a[i];
		} else {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <stdio.h>

using namespace std;

int n;
char s,t,b;

typedef pair<int,int> Pair;

double calc(){

	char floar[3][3];
	floar[0][0] = 'A';
	floar[0][1] = 'B';
	floar[0][2] = 'C';
	floar[1][0] = 'D';
	floar[1][1] = 'E';
	floar[1][2] = 'F';
	floar[2][0] = 'G';
	floar[2][1] = 'H';
	floar[2][2] = 'I';

	pair<int,int> startPlace;
	pair<int,int> finPlace;
	pair<int,int> wareHouse;

	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			if(floar[i][j] == s){
				startPlace.first = i;
				startPlace.second = j;
			}
			else if(floar[i][j] == t){
				finPlace.first = i;
				finPlace.second = j;
			}
			else if(floar[i][j] == b){
				wareHouse.first = i;
				wareHouse.second = j;
			}
		}
	}

	vector<Pair> placeList;
	vector<Pair> nextPlaceList;

	placeList.push_back(startPlace);
	int leaveBattery = n;
	pair<int,int> newPlace;

	int trueCount = 0;
	int falseCount = 0;

	int placeCount[3][3];
	int nextPlaceCount[3][3];

	for(int i = 0; i < 3; i++){
		fill(placeCount[i],placeCount[i]+3,0);
		fill(nextPlaceCount[i],nextPlaceCount[i]+3,0);
	}

	placeCount[startPlace.first][startPlace.second] = 1;

	while(leaveBattery){
		if(leaveBattery == 1){
			for(int i = 0; i < 3; i++){
				for(int j = 0; j < 3; j++){
					falseCount += placeCount[i][j];
				}
			}
			falseCount = falseCount * 4;
		}

		// ツ配ツ療アツづ個陳身ツづーツ暗堋督ョツつオツづつ「ツつュ
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				if(placeCount[i][j] >= 1){
					// ツ湘」ツづ可暗堋督ョ
					if(i - 1 >= 0 && !(i - 1 == wareHouse.first && j == wareHouse.second)){
						nextPlaceCount[i-1][j]+=placeCount[i][j];
					}
					else
						nextPlaceCount[i][j]+=placeCount[i][j];
					// ツ可コ
					if(i + 1 < 3 && !(i + 1 == wareHouse.first && j == wareHouse.second))
						nextPlaceCount[i+1][j]+=placeCount[i][j];
					else
						nextPlaceCount[i][j]+=placeCount[i][j];
					// ツ債カ
					if(j - 1 >= 0 && !(i == wareHouse.first && j - 1 == wareHouse.second))
						nextPlaceCount[i][j-1]+=placeCount[i][j];
					else
						nextPlaceCount[i][j]+=placeCount[i][j];
					// ツ右
					if(j + 1 < 3 && !(i == wareHouse.first && j + 1 == wareHouse.second))
						nextPlaceCount[i][j+1]+=placeCount[i][j];
					else
						nextPlaceCount[i][j]+=placeCount[i][j];
				}
			}
		}

		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				placeCount[i][j] = nextPlaceCount[i][j];
				nextPlaceCount[i][j] = 0;
			}
		}

		leaveBattery--;
	}

	trueCount = placeCount[finPlace.first][finPlace.second];

	return (double)trueCount/falseCount;
}

void solve(){
	//ifstream ifs("prob1020.txt");
	while(1){
		//ifs >> n;
		cin >> n;

		if(n == 0)
			break;
		cin >> s;
		cin >> t;
		cin >> b;
		//ifs >> s;
		//ifs >> t;
		//ifs >> b;
		double result = calc();
		printf("%.8f\n",result);
	}
}

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

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int M=sc.nextInt();
        int[] road = new int[N+1];
        for(int m=0;m<M;m++){
        	road[sc.nextInt()]++;
        	road[sc.nextInt()]++;
        }
        for(int n=1;n<=N;n++)System.out.println(road[n]);
        
    }
}

Measured memory_bytes: 23764