akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int n[101];
int m;
int ans;
int N;

void func(int j,int k){
	if (j>k) {
		return;
	}
	else {
		ans++;
		if (n[(j+k)/2]<m) {
			func((j+k)/2+1,k);
		}
		else if (n[(j+k)/2]>m) {
			func(j,(j+k)/2-1);
		}
	}
	return;
}

	

int main(){
	
	while (1) {
		cin>>N;
		if (N==0) {
			break;
		}
		ans=0;
		for (int i=0; i<N; i++) {
			cin>>n[i];
		}
		cin>>m;
		func(0,N-1);
		cout << ans << endl;
	}
	
}
	
	

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

//#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    string s;
    cin>>s;
    vector<int>v(26,0);
    for(auto c:s)
    {
        v[c-'a']++;
    }
    bool flag=false;
    char d;
    for(int i=0;i<26;i++)
    {
        d='a'+i;
        if(v[i]==0)
        {
            cout<<s+d<<endl;
            exit(0);
        }
    }
    for(int j=s.length()-1;j>=1;j--)
    {
        if(s[j]>s[j-1])
        {
            vector<char>v;
            for(int k=j;k<s.length();k++)
                if(s[k]>s[j-1])
                v.push_back(s[k]);
              sort(v.begin(),v.end());
              swap(s[j-1],v[0]);
              for(int i=0;i<j;i++)
                  cout<<s[i];
              exit(0);
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3636
N = int(input())
A = map(int, (input().split()))
d = dict()
for a in A:
    if a not in d:
        d[a] = 1
    else:
        d[a] = d[a] + 1
ans = 0
for k, v in d.items():
    if k > v:
        ans = ans + v
    else:
        ans = ans + v - k
print(ans)

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

int main(){
    bool cards[4][14];
    int n,rank;
    char suit;
    
    for(int s=0;s<4;s++)
    for(int r=1;r<=13;r++)
    cards[s][r]=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>suit>>rank;
        if(suit=='S')cards[0][rank]=1;
        if(suit=='H')cards[1][rank]=1;
        if(suit=='C')cards[2][rank]=1;
        if(suit=='D')cards[3][rank]=1;
        
    }
    for(int s=0;s<4;s++){
        for(int r=1;r<=13;r++){
            if(cards[s][r])continue;
            if(s==0)suit='S';
            if(s==1)suit='H';
            if(s==2)suit='C';
            if(s==3)suit='D';
            cout<<suit<<" "<<r<<endl;
            
        }
    }
    return 0;
}


Measured memory_bytes: 3080
use input::{Input, ReadMode};

fn main() {
    let mut input = Input::new(ReadMode::Line);

    let x: u64 = input.parse();

    let mut a = 100u64;
    let mut c = 0;
    while a < x {
        a += a / 100;
        c += 1;
    }

    println!("{}", c);
}

#[allow(dead_code)]
pub mod input {
    use std::io::{BufRead, Read};
    use std::str::{FromStr, SplitAsciiWhitespace};

    pub enum ReadMode {
        Full,
        Line,
    }

    pub struct Input<'a> {
        lock: std::io::StdinLock<'static>,
        iter: Option<SplitAsciiWhitespace<'a>>,
        mode: ReadMode,
    }

    impl<'a> Input<'a> {
        fn naive_read(&mut self) -> Option<SplitAsciiWhitespace<'a>> {
            let mut s = Box::leak(Box::new(String::new()));
            let res = match self.mode {
                ReadMode::Full => self.lock.read_to_string(&mut s),
                ReadMode::Line => self.lock.read_line(&mut s),
            };
            res.ok().expect("failed to read");
            Some(s.split_ascii_whitespace())
        }
        pub fn new(mode: ReadMode) -> Self {
            let lock = Box::leak(Box::new(std::io::stdin())).lock();
            let iter = None;
            Self { lock, iter, mode }
        }
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            self.lock.read_line(&mut s).ok().expect("failed to read");
            s
        }
        pub fn parse<T: FromStr>(&mut self) -> T {
            match &mut self.iter {
                Some(iter) => {
                    let x = match iter.next() {
                        Some(x) => x,
                        None => {
                            self.iter = self.naive_read();
                            self.iter.as_mut().unwrap().next().expect("reached EOF")
                        }
                    };
                    x.parse().ok().expect("failed to parse")
                }
                None => {
                    self.iter = self.naive_read();
                    self.parse()
                }
            }
        }
    }
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, L[200];

signed main(){
    cin >> N;
    REP(i, N) cin >> L[i];
    ll ans = 0;
    sort(L, L + N);
    REP(i, N - 2){
        FOR(j, i + 1, N - 1){
            FOR(k, j + 1, N){
                if(L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;
                if(L[i] + L[j] > L[k]) ans++;
            }
        }
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3636
k,n = map(int,input().split())

ns = [0] * n
ans = 0

def modpow(a,n,mod=1000000007):
    if n==0:
        return 1
    elif n%2==0:
        return modpow(a*a%mod, n//2, mod)
    else:
        return a * modpow(a,n-1,mod) % mod

for i in range(n,0,-1):
    # ns[i-1] = ((n//i)**k) % (10**9+7)
    ns[i-1] = modpow(n//i,k)
    for j in range(2*i,n+1,i):
        ns[i-1] -= ns[j-1]
    ans += (i * ns[i-1])%(10**9+7)
    ans %= (10**9+7)

print(ans)

Measured memory_bytes: 76980
n, q = map(int, input().split())
s = input()

ss = [0] * (n+1)

for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        ss[i+1] = 1

sss = [0] * (n+1)
cnt = 0
for i in range(n+1):
    cnt += ss[i]
    sss[i] = cnt


for i in range(q):
    l, r = map(int, input().split())
    print(sss[r-1] - sss[l-1])



Measured memory_bytes: 52184
#!/usr/bin/env python

s = int(input())
mod = 10**9+7

if s == 1 or s == 2:
    print(0)
    exit()

dp = [0 for _ in range(s+1)]
dp[0] = dp[1] = dp[2] = 0 

for i in range(s+1):
    for j in range(i-3, 2, -1):
        dp[i] += dp[j]
    dp[i] += 1

ans = dp[s]%mod
print(ans)



Measured memory_bytes: 9328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int r, g, b;

int main() {
	cin >> r >> g >> b;
	if ((r * 100 + g * 10 + b) % 4 == 0)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int n;
  cin >> n;

  vector<ll> a(n), b(n), c(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];
  SORT(a);
  SORT(c);

  ll ans = 0;
  REP(i, n) {
    ll aNum = lower_bound(ALL(a), b[i]) - a.begin();
    ll cNum = c.end() - upper_bound(ALL(c), b[i]);
    ans += aNum * cNum;
  }

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


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<stdlib.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define INF 1e17
#define pi 3.1415926535897932384626433832795028841971

#define MAX 1000005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	char ch;
	db aa,bb,cc;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,d,n,m,sum=0,ans=0,temp,t;
    cin >> aa;
    a=ceil(aa/3);
    cout << fixed << setprecision(12);
    bb=aa*aa*aa;
    cout << bb/27;
    
    
    
    return 0;
}

















/* UJJWAL KESHRI */

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc123/tasks/abc123_a
#include <bits/stdc++.h>
using namespace std;

int main(void){
  int d[5], k;
  for (int i = 0; i < 5; i++) cin >> d[i];
  cin >> k;

  bool ok = true;
  for (int i = 0; i < 5; i++){
    for (int j = i; j < 5; j++){
      if (i != j && abs(d[i] - d[j]) > k)
        ok = false;
    }
  }
  cout << ((ok) ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int a[2], k;
  cin >> a[0] >> a[1] >> k;
  for(int i = 0; i < k; i++){
    a[i&1] >>= 1;
    a[!(i&1)] += a[i&1];
  }
  cout << a[0] << " "<< a[1] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>

using namespace std;

typedef pair<int,long long> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	int n,cnt,b,s,f;
	long long t,c;
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		cnt=0;
		vector<pii> v;
		rep(i,n){
			scanf("%d%d%d",&b,&t,&c);
			s=v.size();
			f=1;
			rep(i,s)if(v[i].first==b){
				v[i].second += t*c;
				f=0;
			}
			if(f)v.push_back(pii(b,t*c));
		}
		s=v.size();
		rep(i,s)if(v[i].second >= 1000000){
			printf("%d\n",v[i].first);
			cnt++;
		}
		if(cnt==0)puts("NA");
	}
	return 0;
}

Measured memory_bytes: 1228
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
typedef long long ll;

using namespace std;

int main() {
	int n;
	int ans = 0;
	cin >> n;
	vector <int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}

	for (int i = 1; i < n - 1; i++) {
		if (min(p[i - 1], p[i + 1]) < p[i] && p[i] < max(p[i - 1], p[i + 1])) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

typedef long long ll;

using namespace std;

int main() {
	int a, b; cin >> a >> b;
	for(int i = 1; i <= 1000; i++) {
		int x = i*0.08, y = i*0.1;
		if (x == a and y == b) {cout << i; return 0;}
	}
	cout << -1;
}





Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
s, t = zip(*(input().split() for _ in range(N)))
t = list(map(int, t))
X = input()

print(sum(t[s.index(X)+1:]))


Measured memory_bytes: 10036
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

vector<string> cities;
vector<int> scores;

bool comp(int i, int j) {
  if (cities[i] == cities[j])
    return scores[i] > scores[j];
  else
    return cities[i] < cities[j];
}

int main(int argc, char* argv[]) {
  int N;
  cin >> N;


  vector<int> indices(N);
  cities.resize(N);
  scores.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> cities[i];
    cin >> scores[i];
    indices[i] = i;
  }

  sort(indices.begin(), indices.end(), comp);

  for (int i = 0; i < N; ++i)
    cout << indices[i] + 1 << endl;

  return 0;
}

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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,start,end) for(int i=(start);i<=(end);i++)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	double a, b;
	cin >> a >> b;
	cout << a/b << endl;
	return 0;
}

Measured memory_bytes: 256
// 最小全域木 ( プリム法 )
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

#include<queue>

using namespace std;

#define MAX_N 100
// 値の定義
const int INV = -1;
const int MAX_W = 2000;

// グラフ情報を保持する配列
int ary_graph[MAX_N + 1][MAX_N + 1];

// 入力された頂点を保持するキュー
queue<int> Base_Queue;

int n = 0;

// プリム法で最小全域木を求める
int MinimumSpanningTree(int start_vertex);

int main(void)
{
    int sum = 0;

    for(int i = 0; i < MAX_N + 1; i++)
    {
        for(int j = 0; j < MAX_N + 1; j++)
        {
            // 配列の初期化
            ary_graph[i][j] = INV;
        }
    }

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        // グラフを構成する頂点の格納
        Base_Queue.push(i);

        for(int j = 0; j < n; j++)
        {
            // 隣接行列の設定
            cin >> ary_graph[i][j];
        }
    }

    // 頂点１から最小全域木を探索する
    sum = MinimumSpanningTree(0);

    // 結果の表示
    printf("%d\n", sum);

    return 0;
}

// 最小全域木を探索する関数
// start_vertex : 起点となる頂点のNo.
int MinimumSpanningTree(int start_vertex)
{

    int q_size_1, q_size_2, min_val, min_ele, s, t, tmp;
    // 辺の和を保持する変数
    int sum = 0;

    // 最小全域木を構成する頂点を保持するキュー
    queue<int> Prim_Queue;

    // 検索する頂点の初期値の設定
    s = Base_Queue.front();
    Base_Queue.pop();
    Prim_Queue.push(s);

    while( !Base_Queue.empty() )
    {
        min_val = MAX_W;
        min_ele = INV;
        q_size_1 = Base_Queue.size();
        q_size_2 = Prim_Queue.size();

        for( int i = q_size_2 - 1; i >= 0; i-- )
        {
            // s から t に向かう辺の重みを探索する
            s = Prim_Queue.front();
            Prim_Queue.pop();
            // 要素を順番に取り出すために, 取り出したものを元に戻す
            Prim_Queue.push(s);

            for( int i = q_size_1 - 1; i >= 0; i-- )
            {
                t = Base_Queue.front();
                Base_Queue.pop();

                if( ary_graph[s][t] != INV && min_val > ary_graph[s][t] )
                {
                    // 最小のコストを持つ, 辺を探索する
                    min_val = ary_graph[s][t];
                    min_ele = t;
                }

                // 一旦, 元に戻す
                Base_Queue.push(t);
            }
        }

        // 最小のコストを持つ辺の頂点を追加して, 木を構成する
        for(int i = 0; i < Base_Queue.size(); i++)
        {
            tmp = Base_Queue.front();
            Base_Queue.pop();

            if( tmp == min_ele )
            {
                Prim_Queue.push(tmp);
                break;
            }
            else
            {
                Base_Queue.push(tmp);
            }
        }

        sum += min_val;

    }

    return sum;
}



Measured memory_bytes: 3308
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(All(H));
    ll res = LINF;
    for(int i = 0; i + K - 1 < N; i++) {
        res = min(res, H[i + K - 1] - H[i]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >> s;
    
    int res = 0;
    
    for(int i = 1; i < s.length(); i++){
        if(s[i-1] == s[i]){
            s[i] = s[i] == '1' ? '0' : '1';
            res++;
        }
    }
    
    cout << res << endl;
    
}


Measured memory_bytes: 512
def mod(num):
    return num % (10 ** 9 + 7)

H, W = map(int, input().split())
dp = [[0] * W for _ in range(H)]

for i in range(H):
    a = input()
    for j in range(W):
        if a[j] == "#":
            dp[i][j] = -1

dp[0][0] = 1

for col in range(1, W):
    if dp[0][col] != -1:
        dp[0][col] = dp[0][col - 1]
    else:
        dp[0][col] = 0

for row in range(1, H):
    for col in range(W):
        if dp[row][col] != -1:
            if col == 0:
                dp[row][col] = dp[row - 1][col]
            else:
                dp[row][col] = mod(dp[row - 1][col] + dp[row][col - 1])
        else:
            dp[row][col] = 0

print(dp[-1][-1])

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

int main() {
  int n;
  string s;
  map<string,int> m;
  cin>>n;
  for(int i=0;i<n;i++) {
    cin >> s;
    m[s] += 1;
  }
  cout << m.size()<<endl;
  return 0;
}

Measured memory_bytes: 19044
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005

ll BIGMOD ( ll a, ll p, ll m )
{
    ll result = 1;
    ll x = a;

    while ( p )
    {
        if ( p & 1 ) //p is odd
        {
            result = ( result * x ) % m;
        }
        x = ( x * x ) % m;
        p = p >> 1;
    }

    return result;
}

int main()
{
   //fastread;
   int n,count=0;
   cin>>n;
   int arr[n];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
   }
   sort(arr,arr+n);
//   int pos=lower_bound(arr,arr+n,5)-arr;
//   cout<<pos<<endl;
   for(int i=0;i<n-2;i++)
   {
       for(int j=i+1;j<n-1;j++)
       {
           int sum=arr[i]+arr[j];
           int pos=lower_bound(arr,arr+n,sum)-arr;
           count=count+(pos-j-1);
       }
   }
   cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
S = input()

masu_s = S[:]
len_l = [0] * len(masu_s)

for i, s in enumerate(reversed(masu_s)):
    i = len(masu_s) - i - 1
    if s == 'L':
        len_l[i] = 0
    else:
        len_l[i] = len_l[i+1]+1
#print(len_l)

len_r = [0] * len(masu_s)
for i, s in enumerate(masu_s):
    if s == 'R':
        len_r[i] = 0
    else:
        len_r[i] = len_r[i-1]+1
#print(len_r)

ans = [0] * len(masu_s)
for i, n in enumerate(len_l):
    if n == 0:
        continue
        
    if n%2 == 0:
        ans[i+n]+=1
    else:
        ans[i+n-1]+=1

for i, n in enumerate(len_r):
    if n == 0:
        continue
        
    if n%2 == 0:
        ans[i-n]+=1
    else:
        ans[i-n+1]+=1
print(' '.join(list(map(str, ans))))

Measured memory_bytes: 51824
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		sc.close();
		int M=(int)Math.log10(N);
		int S=0;
		if(M%2==0) {
			for(int i=0;i<M/2;i++) {
				S+=9*(int)Math.pow(10, 2*i);
			}
			S+=(N+1-(int)Math.pow(10, M));
		}else {
			for(int j=0;j<=(M-1)/2;j++) {
				S+=9*(int)Math.pow(10, 2*j);
			}
		}
		System.out.println(S);
	}
}

Measured memory_bytes: 21972
#include <iostream>

using namespace std;
using ll = long long;

// 桁数を求める
int cnt_dig(ll num) {
    int cnt = 0;
    while(num > 0) {
        num /= 10;
        cnt++;
    }

    return cnt;
}

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

    // 最大公約数を求める
    ll tmp_m = 0;
    ll ans = cnt_dig(N);

    for(ll i = 1ll; (i * i) <= N; ++i) {
        if (N%i != 0) continue;
        const ll B = N / i;

        const int tmp_m = max(cnt_dig(i), cnt_dig(B));

        if (tmp_m < ans) {
            ans = tmp_m;
        }
    }

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

Measured memory_bytes: 256
import sys
import math


def solv(l, w, h, ent):
    cheese = [l, w, h]
    cheese.pop(cheese.index(max(cheese)))
    diagonal = math.sqrt(cheese[0] ** 2 + cheese[1] ** 2)
    ent_size = map(lambda x: x * 2, ent)
    for size in ent_size:
        if diagonal < size:
            print 'OK'
        else:
            print 'NA'


while True:
    l, w, h = tuple(map(int, sys.stdin.readline().split(' ')))
    if (l, w, h) == (0, 0, 0):
        exit()
    n = int(sys.stdin.readline())
    ent = []
    for i in range(n):
        ent.append(int(sys.stdin.readline()))
    solv(l, w, h, ent)

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

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

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

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

int main(){
    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    //Tenki
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(), t = sc.next();
        int res = 0;
        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == t.charAt(i)) res++;
        }
        System.out.println(res);
        sc.close();
    }
}


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

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9) {
        cout << -1;
    } else {
        cout << a * b;
    }
    return 0;
}


Measured memory_bytes: 892
l, r = map(int, input().split())

m = 2019
mod_min = m

is_return = False

for j in range(l,r+1,1):
    #j_ = j % m
    #if j_ == 0:
        #break
        
    if is_return:
        break
    for i in range(l,j,1):
        #i_ = i % m
        i_j = (i * j) % m
        
        if i_j < mod_min:
            mod_min = i_j
            
        if i_j == 0:
            is_return = True
            break
            
print(mod_min)

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	k = div(n,11)
    if n%11==0
        println(2*k)
    else
    	println(n%11<=6?2*k+1:2*k+2)
    end
end

main()

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

int main() {
  int N, M;
  string s[100], t[100];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> s[i];
  cin >> M;
  for (int i = 0; i < M; i++) cin >> t[i];

  int sum = 0, ans = -101;
  string str;
  for (int i = 0; i < N; i++) {
    str = s[i];

    for (int j = 0; j < N; j++) if (s[j] == str) sum++;
    for (int j = 0; j < M; j++) if (t[j] == str) sum--;
    ans = max(ans, sum);

    sum = 0;
  }

  cout << max(0, ans) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn=1e5+100;
const int mod=1e9+7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    string s;
    ll cur = 0, ans = 0;
    cin >> s;
    for(int i = 0; i < sz(s); i++)
    {
        if(s[i] == 'B') ++cur;
        else ans += cur;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 720
package main

import (
	"fmt"
	"sort"
)

type myInt64 []int64

func (a myInt64) Len() int {
	return len(a)
}

func (a myInt64) Less(i, j int) bool {
	return a[i] > a[j]
}

func (a myInt64) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var x, y, z, k int
	fmt.Scan(&x, &y, &z, &k)
	a := make(myInt64, x)
	b := make(myInt64, y)
	c := make(myInt64, z)
	for i := range a {
		fmt.Scan(&a[i])
	}
	for i := range b {
		fmt.Scan(&b[i])
	}
	for i := range c {
		fmt.Scan(&c[i])
	}

	sum := make(myInt64, x*y)
	// a, bの組み合わせを考える
	for i := 0; i < x; i++ {
		for j := 0; j < y; j++ {
			sum[i*y+j] = a[i] + b[j]
		}
	}
	sort.Sort(sum)
	sort.Sort(c)

	// sum[0:k], c[0:z]の組み合わせを考える
	ans := make(myInt64, k*z)
	iMax := min(k, x*y)
	for i := 0; i < iMax; i++ {
		for j := 0; j < z; j++ {
			ans[i*z+j] = sum[i] + c[j]
		}
	}
	sort.Sort(ans)

	for _, v := range ans[:k] {
		fmt.Println(v)
	}
}


Measured memory_bytes: 33024
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int x[] = new int[N];
		int y[] = new int[N];
		long h[] = new long[N];
		for(int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			h[i] = sc.nextLong();
		}
		int centerY = 0;
		int centerX = 0;
		long H = 0;
		for(int Y = 0; Y <= 100; Y++) {
			centerY = Y;
			out : for(int X = 0; X <= 100; X++) {
				centerX = X;
				in : for(int i = 0; i < N; i++) {
					if(h[i] != 0) {
						H = h[i] + Math.abs(x[i] - centerX) + Math.abs(y[i] - centerY);
						break in;
					}
				}
				for(int i = 0; i < N; i++) {
					if(Math.max(H - Math.abs(x[i] - centerX) - Math.abs(y[i] - centerY), 0) != h[i]) {
						continue out;
					}
				}
				System.out.println(centerX + " " + centerY + " " + H);
				return;
			}
		}
	}
}


Measured memory_bytes: 21972
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define ar array
#define f first
#define s second
#define dd long double

void solve() {
    ll a;
    string b;
    cin >> a;
    cin >> b;

    string bd = b.substr(b.find('.')+1);

    for (int i = b.length()-1; i >= 0; i--) {
        if (b[i] == '.') {
            b.pop_back();
            break;
        }
        b.pop_back();
    }

    ll bx = stoll(b)*100, by = stoll(bd);
    ll bc = bx + by;

    ll ans = bc * a;

    cout << ans/100 << endl;

    return;
}

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    
    int t = 1;
    /* cin >> t; */
    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans;
  
  if(a>c){
    if(a>=d){
      ans = 0;
    }else{
      if(b>=d) ans = d-a;
      if(b<d) ans = b-a;
    }
  }else{
    if(c>=b){
      ans = 0;
    }else{
      if(b>=d) ans = d-c;
      if(b<d) ans = b-c;
    }
  }
  
  cout << ans << endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

struct RangeAddQuery{
  vector<long long> data;
  long long sq;
  vector<long long> lazy;
  void boot(long long n){
    for(long long i = 0;i < n;i++)data.push_back(0);
    sq = round(sqrt((double)n));
    lazy.resize(n/sq+1);
    for(long long i = 0;i < lazy.size();i++)lazy[i] = 0;
  }
  void add(long long s,long long t,long long num){
    if(lazy[s/sq] != 0){
      for(long long i = s/sq*sq;i < min((s/sq+1)*sq,(long long)data.size());i++)data[i] += lazy[s/sq];
      lazy[s/sq] = 0;
    }
    if(lazy[t/sq] != 0){
      for(long long i = t/sq*sq;i < min((t/sq+1)*sq,(long long)data.size());i++)data[i] += lazy[t/sq];
      lazy[t/sq] = 0;
    }
    while(s%sq && s<=t){
      data[s] += num;
      s++;
    }
    while((t-s)/sq){
      lazy[s/sq] += num;
      s += sq;
    }
    while(s <= t){
      data[s] += num;
      s++;
    }
    return;
  }
  long long get(long long s){
    if(lazy[s/sq] != 0){
      for(long long i = s/sq*sq;i < min((s/sq+1)*sq,(long long)data.size());i++)data[i] += lazy[s/sq];
      lazy[s/sq] = 0;
    }
    return data[s];
  }
};

signed main(){
  RangeAddQuery RAQ;
  int n,q;
  cin >> n >> q;
  int query,s,t,x;
  RAQ.boot(n);
  vector<long long> ans;
  FOR(i,0,q){
    cin >> query;
    if(query == 0){
      cin >> s >> t >> x;
      RAQ.add(s,t,x);
    }
    else{
      cin >> s;
      ans.pb(RAQ.get(s));
    }
  }
  for(auto x:ans)cout << x << endl;
}


Measured memory_bytes: 5208
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t H, N;
  cin >> H >> N;
  vector<int64_t> total_mp(2e4L + 1, kInf);
  total_mp[0] = 0;
  int64_t result = kInf;
  for (int64_t i = 0; i < N; ++i) {
    int64_t damage, mp;
    cin >> damage >> mp;
    for (int64_t prev_damage = 0; prev_damage < H; ++prev_damage) {
      const int64_t next_damage = prev_damage + damage;
      total_mp[next_damage] =
          min(total_mp[next_damage], total_mp[prev_damage] + mp);
      if (next_damage >= H) {
        result = min(result, total_mp[next_damage]);
      }
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;

#define MAX 30001
#define ll long long int



int main()
{
  
    int n;
    cin>>n;
    cout<<ceil(n/2.0);
    
}


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

template<class t>
class vector{
    private:
    t *line;
    int size_current;
    int size_real;
    public:
    int get_size(int n){
        int res = 1;
        while(res<=n){
            res <<= 1;
        }
        return res;
    }
    vector(int n_){
        size_current = n_;
        size_real = get_size(n_);
        line = new t[size_real];
    }
    vector(int n_, t initial_value){
        size_current = n_;
        size_real = get_size(n_);
        line = new t[size_real];
        for(int i=0;i<size_current;++i){
            line[i] = initial_value;
        }
    }
    vector(){
        size_current = 0;
        size_real = 1;
        line = new t[size_real];
    }

    t& operator[](int p){
        if(p<0||size_current<=p){
            cout << "out range error" << endl;
            exit(1);
        }
        return line[p];
    }

    void push_back(t value){
        if(size_current+1>=size_real){
            size_real = get_size(size_current+1);
            t *next = new t[size_real];
            for(int i=0;i<size_current;++i){
                next[i] = line[i];
            }
            delete[] line;
            line = next;
        }
        line[size_current] = value;
        ++size_current;
    }
    t pop_back(){
        if(size_current<=0){
            cout << "empty and pop error" << endl;
            exit(2);
        }
        --size_current;
        return line[size_current];
    }
    t& front(){
        return line[0];
    }
    t& back(){
        return line[size_current-1];
    }
    int size(){
        return size_current;
    }

};

int main(){
    vector<int> line;
    string str;
    while(cin>>str){
        if(str=="+"){
            int value = line.pop_back();
            line.back() += value;
        }else if(str=="-"){
            int value = line.pop_back();
            line.back() -= value;
        }else if(str=="*"){
            int value = line.pop_back();
            line.back() *= value;
        }else{
            line.push_back(stoi(str));
        }
    }
    cout << line.back() << endl;
}


Measured memory_bytes: 3216
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> ans(4, 0);

  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    if (s == "AC") {
      ++ans.at(0);
    } else if (s == "WA") {
      ++ans.at(1);
    } else if (s == "TLE") {
      ++ans.at(2);
    } else if (s == "RE") {
      ++ans.at(3);
    }
  }
  cout << "AC x " << ans.at(0) << endl;
  cout << "WA x " << ans.at(1) << endl;
  cout << "TLE x " << ans.at(2) << endl;
  cout << "RE x " << ans.at(3) << endl;


  return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

#define N 2000
#define TRUE 1
#define FALSE 0
 
int solve(int, int);
int n;
int A[N];
 
int main(){
 
  int q,i;
  int m[N];
 
  scanf("%d", &n);

  for(i=0; i<n; i++){  
    scanf("%d", &A[i]);
  }
  
  scanf("%d", &q);
 
  for(i=0; i<q; i++){
    scanf("%d", &m[i]);    
    if(solve(0, m[i]) == TRUE)
      printf("yes\n");
    else 
      printf("no\n");
  }
   
  return 0;
}

int solve(int i, int m){

  if(m == 0)
    return TRUE;
  
  if(i >= n)
    return FALSE;
  
  return (solve(i + 1, m) || solve(i + 1, m - A[i]));
}

Measured memory_bytes: 588
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>
#include<bitset>
#include<cstdio>
#include<iomanip>

#define pii pair<int,int>
#define ll long long
#define IMAX 1000000007
#define in2d(i,j,H,W)(0<=i&&i<H&&0<=j&&j<W)

using namespace std;
#define LLMAX 100000000000000
int N;
vector<int>a;
vector<vector<ll> >dp;
vector<ll>acc;
ll dfs(int l,int r){
	if(dp[l][r]!=LLMAX)return dp[l][r];
	ll ret=LLMAX;
	for(int i=l;i<r;i++){
		ll lmin=dfs(l,i);
		ll rmin=dfs(i+1,r);
		ret=min(ret,lmin+rmin);
	}
	return dp[l][r]=(ret+acc[r+1]-acc[l]);
}
int main(){
	//cout<<fixed<<setprecision(11);
	
	int N;cin>>N;
	a=vector<int>(N);
	for(int i=0;i<N;i++)cin>>a[i];
	acc=vector<ll>(N+1,0);
	for(int i=0;i<N;i++)acc[i+1]=acc[i]+a[i];
	dp=vector<vector<ll> >(N,vector<ll>(N,LLMAX));
	for(int i=0;i<N;i++)dp[i][i]=0;
	cout<<dfs(0,N-1)<<endl;

	return 0;
}



Measured memory_bytes: 1536
#template
def inputlist(): return [int(k) for k in input().split()]
#template
K = int(input())
li = [1,2,3,4,5,6,7,8,9]
from collections import deque
que = deque()
for i in range(1,10):
    que.append(str(i))
while len(li) < K:
    i = que.popleft()
    i0 = i[-1]
    i1 = int(i0)
    if i0 != '9' and i0 != '0':
        nm = [i1-1,i1,i1+1]
        for j in range(3):
            i2 = i + str(nm[j])
            li.append(int(i2))
            que.append(i2)
    if i0 == '9':
        nm = [8,9]
        for j in range(2):
            i2 = i + str(nm[j])
            li.append(int(i2))
            que.append(i2)
    if i0 == '0':
        nm = [0,1]
        for j in range(2):
            i2 = i+str(nm[j])
            li.append(int(i2))
            que.append(i2)
print(li[K-1])

Measured memory_bytes: 11940
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  string S;
  cin>>S;
  for(ll i=0;i<S.size();i+=2) {
      cout<<S[i];
  }
  cout<<endl;

  }

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, all_weight=0;
  cin >> N;
  vector<int> W(N);
  for(int i=0; i<N; i++){
    cin >> W.at(i);
    all_weight += W.at(i);
  }
  int left_weight, right_weight, tmp =0, difference=10000, tmp_diff;
  for (int i=0; i<N; i++){
    tmp += W.at(i);
    right_weight = all_weight - tmp;
    tmp_diff = abs(tmp - right_weight);
    if (tmp_diff <= difference)
      difference = tmp_diff;
  }
  cout << difference <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    REP(i, N) {
        cin >> A[i];
        A[i]--;
    }
    REP(i, N) { cin >> B[i]; }
    REP(i, N - 1) { cin >> C[i]; }

    int ans = B[A[0]];
    // cout << ans << endl;

    FOR(i, 1, N) {
        ans += B[A[i]];
        if (A[i - 1] == (A[i] - 1)) {
            ans += C[A[i - 1]];
        }
        // cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


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

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            var values1 = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int H = values1[0];

            int N = values1[1];

            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

            if (H <= A.Sum())
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 19680
S = input()

YYMM=0
MMYY=0

if int(S[2:])<=12 and int(S[2:])!=0:
    YYMM+=1
if int(S[:2])<=12 and int(S[:2])!=0:
    MMYY+=1

if YYMM==1 and MMYY!=1:
    print('YYMM')
elif YYMM!=1 and MMYY==1:
    print('MMYY')
elif YYMM==1 and MMYY==1:
    print('AMBIGUOUS')
else:
    print('NA')

Measured memory_bytes: 3060
n, m = map(int, input().split())
g = [[] * n for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    g[a].append(b)
    g[b].append(a)

for path in g:
    print(len(path))


Measured memory_bytes: 9184
package main

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

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

type SortName [][]int

func (x SortName) Len() int           { return len(x) }
func (x SortName) Less(i, j int) bool { return x[i][1] < x[j][1] }
func (x SortName) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	xl := make([][]int, n)
	for i := 0; i < n; i++ {
		t := make([]int, 3)
		x, _ := strconv.Atoi(stringLineScan())
		l, _ := strconv.Atoi(stringLineScan())
		t[0] = x - l
		t[1] = x + l
		xl[i] = t
	}
	sort.Sort(SortName(xl))
	m := -10000000000
	ans := 0
	for i := 0; i < n; i++ {
		if m <= xl[i][0] {
			m = xl[i][1]
			ans++
		}
	}
	fmt.Println(ans)
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

int main() {
    int n; cin >> n;
    string s,t; cin >> s >> t;
    string ans;
    rep(i, n) {
        ans += s[i];
        ans += t[i];
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
//Author: Lixiang
#include<stdio.h>
struct C{
	int N;
	void init(){
		scanf("%d",&N);
	}
	void work(){
		int t,x,y,delta_t,delta_x,delta_y,last_t=0,last_x=0,last_y=0,delta;
		while(N--){
			scanf("%d%d%d",&t,&x,&y);
			delta_t=t-last_t;
			delta_x=x-last_x;
			delta_y=y-last_y;
			delta=delta_t-delta_x-delta_y;
			if(delta%2!=0||delta<0){
				puts("No");
				return ;
			}
			last_t=t;
			last_x=x;
			last_y=y;
		}
		puts("Yes");
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
ll n,m;
cin >> n >> m;
cout << (n)*(n-1)/2+(m)*(m-1)/2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll md = 1000000007;
vector<ll> fact(1e6 + 7), invfact(1e6 + 7);

ll fn(ll a, ll r, ll n, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) { 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    if(s == "ARC") {
        cout << "ABC\n";
    } else {
        cout << "ARC\n";
    }
    return 0; 
}

Measured memory_bytes: 18604
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

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

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

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

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

const SIZE: usize = 100_010;

fn main() {
  input! {
    q: usize,
    query: [(usize, usize); q],
  }
  let mut is_prime = vec![false; SIZE];
  for i in 2 .. SIZE {
    is_prime[i] = true;
    for j in (2 .. SIZE).take_while(|j| j * j <= i) {
      if i % j == 0 {
        is_prime[i] = false;
        break;
      }
    }
  }
  let mut like = vec![0i64; SIZE];
  for i in 3 .. SIZE {
    if i % 2 == 1 && is_prime[i] && is_prime[(i + 1) / 2] {
      like[i] = 1;
    }
  }
  for i in 1 .. SIZE {
    like[i] += like[i - 1];
  }
  for &(l, r) in &query {
    println!("{}", like[r] - like[l - 1]);
  }
}


Measured memory_bytes: 8828