akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef array <ll, 2> pii;
typedef vector <int> vi;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int K = 9;
const int N = (1 << 18) + 123, M = 1e5 + 123;
int n, val[N], w[N], q, h[N], b[N];

int mv[(1 << 9) + 1], mw[(1 << 9) + 1];
int cnt, ind[N], opt[(1 << 9) + 1][M];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	for (int i = 1; i < (1 << 9); i++) {
		for (int j = 0; j < 9; j++) {
			if (i >> j & 1) {
				b[i] = j;
				break;
			}
		}
	}
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> val[i] >> w[i];
	}
	vi vec;
	for (int i = 1; i <= n; i++) {
		h[i] = h[i / 2] + 1;
		if (h[i] == K) {
			int v = i;
			vec.clear();
			while (v) {
				vec.pb(v);
				v /= 2;
			}
			int s = vec.size();
			ind[i] = cnt++;
			int k = ind[i];
			for (int j = 0; j < (1 << s); j++) {
				if (j > 0) {
					int el = vec[b[j]];
					mw[j] = mw[j ^ (1 << b[j])] + w[el];
					mv[j] = mv[j ^ (1 << b[j])] + val[el];
				}
				if (mw[j] < M) {
					opt[k][mw[j]] = max(opt[k][mw[j]], mv[j]);
				}
			}
			for (int j = 1; j < M; j++) {
				opt[k][j] = max(opt[k][j], opt[k][j - 1]);
			}
		}
	}
	cin >> q;
	while (q--) {
		int V, L;
		cin >> V >> L;
		if (h[V] <= K) {
			vec.clear();
			while (V) {
				vec.pb(V);
				V /= 2;
			}
			int s = vec.size(), res = 0;
			for (int i = 0; i < (1 << s); i++) {
				if (i > 0) {
					int el = vec[b[i]];
					mw[i] = mw[i ^ (1 << b[i])] + w[el];
					mv[i] = mv[i ^ (1 << b[i])] + val[el];
				}
				if (mw[i] <= L) {
					res = max(res, mv[i]);
				}
			}
			cout << res << '\n';
		}	else {
			vec.clear();
			while (h[V] > K) {
				vec.pb(V);
				V /= 2;
			}
			int k = ind[V];
			int s = vec.size(), res = 0;
			for (int i = 0; i < (1 << s); i++) {
				if (i > 0) {
					int el = vec[b[i]];
					mw[i] = mw[i ^ (1 << b[i])] + w[el];
					mv[i] = mv[i ^ (1 << b[i])] + val[el];
				}
				if (mw[i] <= L) {
					res = max(res, mv[i] + opt[k][L - mw[i]]);
				}
			}
			cout << res << '\n';
		}
	}
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = l[0], A = l[1], B = l[2];

            var add = 0L;
            if ((B - A) % 2 == 1)
            {
                if (A - 1 <= N - B)
                {
                    add = (A - 1) + 1;
                    A = 1;
                    B -= (add);
                }
                else
                {
                    add = (N - B) + 1;
                    B = N;
                    A += (add);
                }
            }

            var ans = (B - A) / 2 + add;

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/* Precode Start Here *\



     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
int main()
{
   ll n,ans=0;
   cin>>n;
   for(ll i=0;i<n;i++)
   {
      cin>>A[i];
   }
   for(ll i=0;i<n;i++)
   {
       for(ll j=i+1;j<n;j++)
       {
           ans+=A[i]*A[j];
       }
   }
   cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 2304
K=int(input())
n=50
t=K//50
r=K%50
a=49+t
s=[a]*n
for i in range(r):
    for j in range(n):
        if j==n-i-1:
            s[j]+=n
        else:
            s[j]-=1
print(n)
print(*s)


Measured memory_bytes: 39024
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  for (int i = 0; i < min(K, 41); i++) {
    vector<int> tmp(N, 0);
    for (int j = 0; j < N; j++) {
      int l = max(0, j - A[j]);
      int r = min(N - 1, j + A[j]);
      tmp[l]++;
      if (r + 1 < N)
        tmp[r + 1]--;
    }
    for (int j = 0; j < N - 1; j++) {
      tmp[j + 1] += tmp[j];
    }

    A.swap(tmp);
  }

  for (int i = 0; i < N - 1; i++) {
    cout << A[i] << " ";
  }
  cout << A[N - 1] << endl;

  return 0;
}

Measured memory_bytes: 5128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,g_ma = 0,g_mi = 1000000;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    int r,l;
    scanf("%d %d",&l,&r);
    g_ma = max(g_ma,l);
    g_mi = min(g_mi,r);
  }
  if(g_mi < g_ma){
    cout << 0 << endl;
  }else{
    g_mi-=g_ma; 
    cout << g_mi+1 << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class Type>struct is_vector : std::false_type {};
	template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
	template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
		if (v.empty())return out;
		constexpr bool is_vector_v = is_vector<T>::value;
		if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
		else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
		return out;
	}
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
	inline void putn() {}
	template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

	void solve() {
		IOS;
		int n, m;
		cin >> n >> m;
		while (n + m != 0) {
			vector<int> c(m), x(n);
			REP(i, m) {
				cin >> c[i];
			}
			REP(i, n) {
				cin >> x[i];
			}
			vector<vector<ll>> dp(n + 1, vector<ll>(256, LLONG_MAX));
			dp[0][128] = 0;
			REP(i, n) {
				REP(j, 256) {
					if (dp[i][j] != LLONG_MAX) {
						REP(k, m) {
							int t = j + c[k];
							if (t < 0)t = 0;
							if (255 < t)t = 255;
							chmin(dp[i + 1][t], dp[i][j] + (x[i] - t) * (x[i] - t));
						}
					}
				}
			}
			ll res = LLONG_MAX;
			REP(j, 256) {
				chmin(res, dp[n][j]);
			}
			put(res);
			cin >> n >> m;
		}
		
	}
} // namespace idaten

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



Measured memory_bytes: 43828
#include <stdio.h>
int main()
{
  int a , b, c, d, e, f, x;
  while(1)
    {
      scanf("%d", &x);
      if( x == 0 )break;
      a = (1000 - x) / 500;
      b = (1000 - x) % 500 / 100;
      c = (1000 - x) % 500 % 100 / 50;
      d = (1000 - x) % 500 % 100 % 50 / 10;
      e = (1000 - x) % 500 % 100 % 50 % 10 / 5 ;
      f = (1000 - x) % 500 % 100 % 50 % 10 % 5 / 1;
  
      printf("%d\n",a+b+c+d+e+f);
    }
  return 0;
}

Measured memory_bytes: 600
fun main(args: Array<String>) {
	val n = readLine()!!.toInt()
	val a = mutableListOf<String>()

	for (p in listOf('S', 'H', 'C', 'D')) {
		for (i in 1 .. 13) {
			a.add("$p $i")
		}
	}
	for (i in 0 until n) {
		a.remove(readLine())
	}
	if (a.size != 0) println(a.joinToString("\n"))
}


Measured memory_bytes: 29460
#include<stdio.h>
int dp[50];
int fib(int n){
  if(n==0||n==1)return dp[n]=1;
  if(dp[n]!=-1)return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
  int n,i;
  for(i=0;i<50;i++)dp[i]=-1;
  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int a[100000],gp[1000000],g=0;
int inf=100000,n,m;
vector< vector<int> > v(100000);
void dfs(int s){
    gp[s]=g;
    a[s]=inf;
    for(int i=0;i<(int)v[s].size();i++){
        if(a[v[s][i]]!=inf){
            dfs(v[s][i]);
        }
    }
}
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
      int tmp,u;
      cin>>tmp>>u;
      v[tmp].push_back(u);
      v[u].push_back(tmp);
  }
  dfs(0);
  for(int i=0;i<n;i++){
      g++;
      if(!a[i])dfs(i);
  }
  int qu;
  cin>>qu;
  int s[qu],t[qu];
  for(int i=0;i<qu;i++)cin>>s[i]>>t[i];
  for(int i=0;i<qu;i++){
      if(gp[s[i]]==gp[t[i]])
          cout<<"yes\n";
      else
          cout<<"no\n";
  }
}



Measured memory_bytes: 12152
N,M = [int(i) for i in input().split()]
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

if A == B:
    print('Yes')
    exit()

for i in range(N-M):
    for j in range(N-M):
        flag = 1
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] != B[k][l]:
                    flag = 0
        if flag:
            print('Yes')
            exit()

print('No')


Measured memory_bytes: 40176
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=SI()
    ans="".join("P" if c=="P" else "D" for c in s)
    print(ans)

main()

Measured memory_bytes: 10536
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, A;
	map<int, int> mp;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A, mp[A - 1] = i + 1;
	for (int i = 0; i < N; i++) {
		if (i != 0) cout << " ";
		cout << mp[i];
	}
	cout << endl;
}

Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, q;
int S[110000], T[51000];
int binarySearch(int key) {
    int left = 0;
    int right = n;
    while (left < right) {
        int mid = (right + left) / 2;
        if (S[mid] == key) return 1;
        else if (S[mid] < key) left = mid + 1;
        else right = mid;
    }
    return 0;
}
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> S[i];
    cin >> q;
    for (int i = 0; i < q; ++i) cin >> T[i];  
    int count = 0;
    for (int i = 0; i < q; ++i) count += binarySearch(T[i]); 
    cout << count << endl;
}


Measured memory_bytes: 3668
/* 
    AtCoder Beginner Contest 081
    A:Placing Marbles
    AC
*/

#include <iostream>
using namespace std;

int main(void)
{
    int i;
    int s;
    int count = 0;
    cin >> s;
    for (i = 0; i < 3; i++)
    {
        count += s % 10;
        s = s / 10;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
int a,b;
cin >> a >> b;
if(a <= b){
    for ( int i=0; i < b; i++){
        cout << a;
    }

}
else{
    for(int i=0; i < a; i++){
        cout << b;
    }
}

return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    vector<int> r(1e7 + 1, 0);
    for(int  i= 0; i < n; ++i){
        cin >> a[i] >> b[i];
        ++r[a[i]];
        --r[b[i] + 1];
    }
    int c = 0;
    for(int i = 0; i < 1e7; ++i){
        c += (bool)r[i];
        r[i + 1] += r[i];
    }
    cout << c << endl;
}


Measured memory_bytes: 39296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x, y;
    cin >> n >> m;
    vector<int> ball(n, 1);
    vector<int> is_contain(n, 0);
    is_contain[0] = 1;

    for (int i = 0; i < m; ++i) {
        cin >> x >> y;
        is_contain[y - 1] |= is_contain[x - 1];
        ball[y - 1]++;
        ball[x - 1]--;
        if (ball[x - 1] == 0) is_contain[x - 1] = 0;
    }

    int ans = 0;
    for (auto t: is_contain) {
        if (t == 1) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const int MOD = 1e9 + 7;
const int INF = 2e9;
// const int N = ;

int ans, temp;
string s, t;

void solve() {
    cin >> s >> t;
    ans = 1e4;
    for(int i = 0; i < s.size() - t.size() + 1; i++) {
        temp = 0;
        for(int j = i, k = 0; j < i + t.size(); j++, k++) {
            if(s[j] != t[k]) temp++;
        }
        ans = min(ans, temp);
    }
    cout << ans << "\n";
}

int main() {
 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;

  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;vector<long long>V(N*3);
  for(int X=0;X<N*3;X++)cin>>V[X];
  sort(V.begin(),V.end());
  reverse(V.begin(),V.end());
  long long K=0,M=0;
  for(int X=0;X<N*3;X++){
    if(X%2==1){
      K+=V[X];M++;
    }
    if(M==N)break;
  }
  cout<<K<<endl;
}

Measured memory_bytes: 5468
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
	char str[1001], cmd[16];
	int i, j, k, cmd_cnt;

	memset(str, '\0', sizeof(str));

	scanf("%s", str);
	scanf("%d", &cmd_cnt);

	int str_len = strlen(str);

	for (i = 0; i < cmd_cnt; i++) {
		memset(cmd, '\0', sizeof(cmd));
		scanf("%s", cmd);

		if (strcmp(cmd, "print") == 0) {
			int s = 0;
			int e = 0;
			scanf("%d", &s);
			scanf("%d", &e);

			for (j = s; j <= e; j++) {
				printf("%c", str[j]);
			}
			printf("\n");
		}
		else if (strcmp(cmd, "reverse") == 0) {
			int s = 0;
			int e = 0;
			char reverse[1001];

			memset(reverse, '\0', sizeof(reverse));
			scanf("%d", &s);
			scanf("%d", &e);

			memcpy(reverse, &str[s], e - s + 1);

			for (j = 0; j < (e - s + 1) / 2; j++) {
				char tmp = reverse[j];
				reverse[j] = reverse[(e - s) - j];
				reverse[(e - s) - j] = tmp;
			}

			memcpy(&str[s], reverse, e - s + 1);
		}
		else if (strcmp(cmd, "replace") == 0) {
			int s = 0;
			int e = 0;
			char p[1001];

			memset(p, '\0', sizeof(p));
			scanf("%d", &s);
			scanf("%d", &e);
			scanf("%s", p);

			memcpy(&str[s], p, e - s + 1);
		}
	}
	return 0;
}

Measured memory_bytes: 592
module SS = Set.Make(String);;

let _ =
  let n = read_int () and
      s = SS.empty
  in
  let rec read s = function
      0 -> ()
    | i ->
       let (op, key) = Scanf.scanf "%s %s\n" (fun x y -> (x,y)) in
       if op = "insert" then
         read (SS.add key s) (i-1)
       else if op = "find" then
         begin
           if SS.mem key s then print_endline "yes"
           else print_endline "no"
          ;read s (i-1)
         end
  in read s n;;

Measured memory_bytes: 36176
m = {'a':0, 'b':1, 'c':2}

a = input()
b = input()
c = input()

arr = [a,b,c]

def r(c):
	if len(arr[m[c]]) == 0:
		global w
		w = c
		return
	else:
		p = arr[m[c]][0] 
		arr[m[c]] = arr[m[c]][1:] 		
		r(p)

s = arr[0][0]
arr[0] = arr[0][1:]
r(s)
print(w.upper())


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

int main() {
  int N, K; cin >> N >> K;
  vector<int64> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];

  int64 ans = 0x3f3f3f3f;
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());

  for (int i = 0; i <= N - K; i++) {
    int64 tmp = h[i] - h[i + K - 1];
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using i32 = int_fast32_t;
using u32 = uint_fast32_t;

#define int i64

bool comp(pair<i64, i64> a, pair<i64, i64> b) {
	if(a.second != b.second) return a.second < b.second;
	return a.first < b.first;
}

signed main() {
	i64 N;
	cin >> N;
	vector<pair<i64, i64>> ST(N);
	for(i64 i = 0; i < N; i++) {
		cin >> ST[i].first >> ST[i].second;
		ST[i].first -= ST[i].second;
		ST[i].second += ST[i].first + ST[i].second;
		// ST[i].second += ST[i].first;
	}

	sort(ST.begin(), ST.end(), comp);
	
	i64 res = 0;
	i64 buf = -1e9-100;
	for(i64 i = 0; i < N; i++) {
		if(ST[i].first >= buf) {
			res++;
			buf = ST[i].second;
		}
	}

	cout << res << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, c=0, x;
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        cin >> x;
        if(c+1 == x)
            c++;
    }
    if(c>0)
        cout << n-c << endl;
    else
        cout << -1 << endl;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k,  m, y, q ;
string s, t, d;
ld w;

// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	set<ll> val;
	for(ll i=0;i<n;i++) {
		cin>>x;
		val.insert(x);
	}
	if(val.size() == n) {
		cout<<"YES";
	}
	else {
		cout<<"NO";
	}
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 12940
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

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

using namespace std;

int N,Q;
string S;
int count;
int AC[200000];

int main(){
  cin >> N >> Q >> S;
  REP(i,N) AC[i]=0;
  int count = 0;
  REP(i,N-1){
    if (S[i]=='A' && S[i+1]=='C'){
      count ++;
    }
    AC[i] = count;
  }
  REP(i,Q){
    int r,l;
    cin >> l >> r;
    int kotae = 0;
    if(l==1){
      kotae = AC[r-2];
    }
    else kotae = AC[r-2]-AC[l-2];
    cout << kotae << endl;


  }



  return 0;
}


Measured memory_bytes: 1408
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout

int32_t N;
int32_t D[6666];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N; N *= 2;
	for (size_t i = 0; i < N; ++i)
	{
		in >> D[i];
	}
	std::sort(D, D + N);
	int64_t r = 0;
	for (int i = N - 1; i >= 1; i-=2)
	{
		r += D[i - 1];
	}
	out << r << endl;

	return 0;
}
#endif

#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout

#include <queue>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <iterator>

using COST_T = uint32_t;
int32_t N;
constexpr uint32_t N_MAX = 2000;
constexpr COST_T INF = 1000 * 1000 * 1000 + 1000;//std::numeric_limits<double>::infinity()

#if defined(_MSC_VER) && defined(_DEBUG)
//static_assert(false, "リリースでコンパイルしないと遅いよ！！");
#endif

struct edge {
	uint32_t to;
	static constexpr COST_T cost = 1;
	edge() {}
	edge(uint32_t to_)
		:to(to_) {}
};
std::vector<edge> graph[N_MAX];

//ダイクストラ
COST_T in_edge[N_MAX] = {};
COST_T D[N_MAX];
void Dijkstra(uint32_t s)
{
	using P = std::pair<COST_T, uint32_t>;//cost pos
	std::priority_queue<P, std::vector<P>, std::greater<>> que;
	std::fill(std::begin(D), std::end(D), INF);

	D[s] = 0;
	que.emplace(0, s);
	while (!que.empty())
	{
		auto p = que.top(); que.pop();
		const auto& nowpos = p.second;
		const auto& nowcost = p.first;
		if (D[nowpos] < nowcost) { continue; }

		//for (int32_t to = 0; to < N; ++to)
		//{
		//	auto cost = nowcost + graph[nowpos][to];
		//	if (cost < D[to]) {
		//		D[to] = cost;
		//		que.emplace(D[to], to);
		//	}
		//}

		for (const auto& e : graph[nowpos])
		{
			auto cost = nowcost + e.cost;
			if (cost < D[e.to]) {
				D[e.to] = cost;
				que.emplace(cost, e.to);
			}
		}

	}
}



int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	for (int32_t i = 0; i < N-1; ++i)
	{
		int32_t a, b;
		in >> a >> b; --a; --b;
		++in_edge[a];
		++in_edge[b];
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	for (int32_t i = 0; i < N; ++i)
	{
		if (in_edge[i] == 0) {
			Dijkstra(i);
			break;
		}
	}


	return 0;
}
#endif


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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

void Main(){
    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC" << en;
    } else {
        cout << "ABC" << en;
    }
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int x,y,ans=0;
    cin>>x>>y;
    if(x<=3) ans+=(4-x)*100000;
    if(y<=3) ans+=(4-y)*100000;
    if(x==1 and y==1) ans+=400000;
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int x = scanner.nextInt();
		
		if (x == 0)
			System.out.println(1);
		else
			System.out.println(0);
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32404
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i] >> B[i];
    }
    ll count = 0;
    for (int i = N-1; i >= 0;--i) {
        if((A[i] + count) % B[i] == 0){
            continue;
        }else{
            count += B[i] - ((A[i] + count) % B[i]);
        }
    }
    cout << count << endl;
}


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

#define mod 1000000007
#define INF 1000000000

#define eb emplace_back
#define len(x) ((int)(x).size())
#define log(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)

using ll = long long;
using vi = vector<int>;

string color(int r) {
	if (r >= 2800) return "red";
	if (r >= 2400) return "orange";
	if (r >= 2000) return "yellow";
	if (r >= 1600) return "blue";
	if (r >= 1200) return "cyan";
	if (r >= 800) return "green";
	if (r >= 400) return "brown";
	if (r >= 1) return "gray";
	return "";
}

int main() {
	int n, mn=0, mx=0;
	cin >> n;

	vi a(n);
	rep(i,n) cin>>a[i];

	int lgm = 0;
	set<string> clrs;

	rep (i, len(a)) {
		if (a[i] < 3200) clrs.emplace(color(a[i]));
		else lgm += 1;
	}
	mn = len(clrs);
	mx = mn+lgm;

	if (mn == 0) {
		mn = 1;
	}

	printf("%d %d\n", mn, mx);

	return 0;
}





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 - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

const ll mod = 1e+9 + 7;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


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

    ll nCa = 1, nCb = 1;

    rep(i, a){
        nCa *= (n - i);
        nCa = nCa % mod;
    }
    rep(i, a){
        nCa *= modinv(i + 1, mod);
        nCa = nCa % mod;
    }
    rep(i, b){
        nCb *= (n - i);
        nCb = nCb % mod;
    }
    rep(i, b){
        nCb *= modinv(i + 1, mod);
        nCb = nCb % mod;
    }

    ll ans = modpow(2, n, mod) - 1;
    ans -= ((nCa % mod) + (nCb % mod)) % mod;
    if (ans < 0) ans = (ans + mod) % mod;
    ans = ans % mod;

    if (n > 2) cout << ans << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int d = scanner.nextInt();

		String ans = (Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)) ? "Yes" : "No";

		System.out.println(ans);
	}
}


Measured memory_bytes: 22740
#include <stdio.h>

int n, a[20];

int solve(int i, int m) {
	if (m == 0) {
		return 1;
	}
	if (i >= n) {
		return 0;
	}
	int res = solve(i + 1, m) || solve(i + 1, m - a[i]);
	
	return res;
}

int main(void) {
	int q, m;
	int i;

	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);
		if (solve(0, m)) {
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <cmath>
#include <stdio.h>
#include <sstream>
#define int_inf 1000000000 //1e9
#define ll_inf  1000000000000000000 //1e18
using namespace std;
template <typename T> std::string to_string(const T& t){
	std::ostringstream os; os<<t; return os.str();
}

int main(){
	int x, t;
	cin>>x>>t;
	
	cout<<max(x-t, 0)<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int H=0;
    int W=0;
    bool can=true;
    cin>>H>>W;
    string Si[100];
    for(int i=0;i<H;i++) cin>>Si[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
        if(Si[i][j]=='#'){
            int count=0;
            if(i-1>=0&&Si[i-1].at(j)=='#')count++;
              if(i+1<H&&Si[i+1].at(j)=='#')count++;
              if(j-1>=0&&Si[i].at(j-1)=='#')count++;
              if(j+1<W&&Si[i].at(j+1)=='#')count++;
             
              if(count==0){
                  can=false;
              }
      
        }
        
        
        }
    }
    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
int_n = int(input())
arr_int_a = list(map(int, input().split()))

w_s = set()
counter = 0
for i in arr_int_a:
    if i < 3200:
        w_s.add(i // 400)
    else:
        counter += 1

print(len(w_s) if len(w_s) != 0 else 1, len(w_s) + counter)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#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=1, ans=0, count=0, sum=0;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, red=0, green=0, blue=0;
  string S;
  
  cin >> N >> S;
  rep(i, N) {
    if(S[i]=='R') red++;
    if(S[i]=='G') green++;
    if(S[i]=='B') blue++;
  }
  ans = red*green*blue;
  
  rep(i, N-2) {
    ll d=1;
    while(i+d*2<=N-1) {
      set<char> color, full={'B','G','R'};
      rep(j, 3) color.insert(S[i+d*j]);
      if(color==full) ans--;
      d++;
    }
  }
  
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3656
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int a[] = new int[n];
		
		for(int i=0; i<n; i++){
		    a[i] = sc.nextInt();
		}
		
		for(int i=1; i<n-1; i++){
		    if((a[i]>a[i+1] && a[i]<a[i-1]) || (a[i]<a[i+1] && a[i]>a[i-1])){
		        ans++;
		    }
		}
		
        System.out.println(ans);
	}
}


Measured memory_bytes: 35832
program main
    use iso_fortran_env
    implicit none
    character(200000) :: tmp
    character(:), allocatable :: s, t
    character(1), allocatable :: a(:)
    integer(int32), allocatable :: b(:)

    read *, tmp
    s = trim(tmp)
    read *, tmp
    t = trim(tmp)
    allocate(b(len_trim(t)), source = 1)

    print *, len_trim(t) - sum(pack(b, (transfer(s, a) == transfer(t, a))))

end program main

Measured memory_bytes: 5424
a=input()
N=int(a.split()[0])
M=int(a.split()[1])
num=[]
for i in range(N):
  a=input()
  for j in range(int(a.split()[0])):
    num.append(int(a.split()[j+1]))
count=0
for i in range(M+1):
  if(num.count(i)==N):
    count+=1
print(count)

Measured memory_bytes: 3064
import sys
from collections import deque

INF = 10 ** 20
def Bellman_Ford(I):
  N = len(I)
  d = [INF for _ in range(N)] # 各頂点への最小コスト
  d[0] = 0 # 自身への距離は0
  visited = [0 for _ in range(N)]
  for i in range(N-1):
    update = False # 更新有無
    task = deque([(0,0,0)])

    visited[0] = i-1
    while task: 
      a, b, c = task.popleft() 
      if d[b] > d[a] + c:
        d[b] = d[a] + c 
        update = True   
      if visited[b] <= i:
        for x, ct in I[b]:
          task.append((b, x, ct))
        visited[b] += 1
    if not update:
        break
        
  # 負閉路の検知
  visited = [0 for _ in range(N)]
  neg = [0 for _ in range(N)]
  for i in range(N):
    update = False # 更新有無
    task = deque([(0,0,0)])
    visited[0] = i-1
    while task: 
      a, b, c = task.popleft() 
      if d[b] > d[a] + c:
        d[b] = d[a] + c 
        update = True 
        neg[b] = 1
        
      if visited[b] <= i:
        for x, ct in I[b]:
          task.append((b, x, ct))
        visited[b] += 1
        
    if not update:
        break
        
    if neg[N-1] == 1:
      return []
    
  return d

N, M = map(int,input().split()) # N:頂点数, M:辺の数
I = [[] for _ in range(N)]
for _ in range(M):
  a, b, c = map(int,input().split()) # 始点,終点,コスト
  I[a-1].append((b-1,-c))
  #I.append((b,a,c)) 
#print(I)
d = Bellman_Ford(I)
print(-d[N-1] if d else "inf")


Measured memory_bytes: 75564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int n;
	cin >> n;
	std::vector<double> a(n);
	rep(i,n) cin >> a[i];
	double ans = 0;
	rep(i,n) ans += 1.0/a[i];
	ans = 1.0/ans;
	printf("%.10f",ans);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    int dp[200000][3], ar[200000][3];
    for(int i = 0; i < n; i++) {
        cin >> ar[i][0] >> ar[i][1] >> ar[i][2];
    }
    dp[0][0] = ar[0][0];
    dp[0][1] = ar[0][1];
    dp[0][2] = ar[0][2];
    for(int i = 0; i < n - 1; i++) {
        dp[i + 1][0] = max({dp[i + 1][0], ar[i + 1][0] + dp[i][1], ar[i + 1][0] + dp[i][2]});
        dp[i + 1][1] = max({dp[i + 1][1], ar[i + 1][1] + dp[i][0], ar[i + 1][1] + dp[i][2]});
        dp[i + 1][2] = max({dp[i + 1][2], ar[i + 1][2] + dp[i][1], ar[i + 1][2] + dp[i][0]});

    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]});
}





Measured memory_bytes: 4864
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  int E,z,y,x;
  while (cin >> E && E>0){
    if (E>1000000){
    cout << "Incorrect input" << endl;
    exit(1);
    }
    int	min=10000000;
    for (z=0;z*z*z<=E;z++){
      for (y=0;y*y+z*z*z<=E;y++){
	x=E-y*y-z*z*z;
        if(min > x+y+z)
          min=x+y+z;
      }
    }
    cout << min << endl;
  }
}

Measured memory_bytes: 3052
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
using namespace std;

int n, x, a[101], d[101];

int main() {
    cin >> n >> x;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (x >= a[i]) {
            d[i] = a[i];
            x -= a[i];
        }
        if (i == n - 1) {
            d[i] += x;
        }
        ans += d[i] == a[i];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
	string S;
	int sum = 0;
	cin >> S;
	for (int i = 0;i<S.size();++i) {
		sum += (S[i] - '0');
	}
	if (0 == sum%9) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int x;
  cin >> x;
  if (x < 400) {
  } else if (x < 600) {
    cout << "8\n";
  } else if (x < 800) {
    cout << "7\n";
  } else if (x < 1000) {
    cout << "6\n";
  } else if (x < 1200) {
    cout << "5\n";
  } else if (x < 1400) {
    cout << "4\n";
  } else if (x < 1600) {
    cout << "3\n";
  } else if (x < 1800) {
    cout << "2\n";
  } else if (x < 2000) {
    cout << "1\n";
  }
}


Measured memory_bytes: 3660