akhauriyash/Code-Regression huggingface dataset:
/**
*	created: 13.09.2020 21:10:40
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// ModInt
template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {if ((x = x_ % mod + mod) >= mod) x -= mod;}
    ModInt inv() const {return pow(*this, mod - 2);}
    ModInt& operator+=(ModInt rhs) {if ((x += rhs.x) >= mod) x -= mod; return *this;}
    ModInt& operator-=(ModInt rhs) {if ((x -= rhs.x) < 0) x += mod; return *this;}
    ModInt& operator*=(ModInt rhs) {x = (unsigned long long)x * rhs.x % mod; return *this;}
    ModInt& operator/=(ModInt rhs) {x = (unsigned long long)x * rhs.inv().x % mod; return *this;}
    ModInt operator-() const {return -x < 0 ? mod - x : -x;}
    ModInt operator+(ModInt rhs) const {return ModInt(*this) += rhs;}
    ModInt operator-(ModInt rhs) const {return ModInt(*this) -= rhs;}
    ModInt operator*(ModInt rhs) const {return ModInt(*this) *= rhs;}
    ModInt operator/(ModInt rhs) const {return ModInt(*this) /= rhs;}
    bool operator==(ModInt rhs) const {return x == rhs.x;}
    bool operator!=(ModInt rhs) const {return x != rhs.x;}
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {s << a.x; return s;}
    friend istream& operator>>(istream& s, ModInt<mod>& a) {s >> a.x; return s;}
};

using mint = ModInt<MOD>;

// table
mint fac[MAX], finv[MAX], inv[MAX];

void make_table() {
    fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1;
    rep2(i,2,MAX){
        fac[i] = fac[i-1] * (mint)i;
        inv[i] = (mint)MOD - inv[MOD%i] * (mint)(MOD/i);
        finv[i] = finv[i-1] * inv[i];
    }
}

struct table {table() {make_table();}} table_init;

mint COM(int n,int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n-k];
}

mint PER(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] / fac[n-k];
}

signed main() {
    int n; cin >> n;
    mint a = pow((mint)10,n);
    mint b = pow((mint)8,n);
    mint c = pow((mint)9,n);
    mint t = b - c*2 + a;
    cout << t << endl;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <stdio.h>
int main(){
  int N, K;
  scanf("%d %d", &N, &K);
  int d[K], A[K][100];
  for(int i=0; i<K; i++){
    for(int j=0; j<100; j++)
      A[i][j] = 0;
  }
  for(int i=0; i<K; i++){
    scanf("%d", &d[i]);
    for(int j=0;j<d[i];j++)
      scanf("%d", &A[i][j]);
  }
  int flag=0, count=0;
  for(int t=1;t<=N;t++){
    for(int i=0;i<K;i++){
      for(int j=0;j<100;j++){
        if(A[i][j]==t){
          flag=1;
          break;
        }
      }
      if(flag==1)
        break;
    }
    if(flag==0){
      count++;
    }else{
      flag=0;
    }
  }
  printf("%d\n", count);
}

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

int main(){
	int number;
	char random[100];
	scanf("%d\n %s", &number, &random);
	int len = strlen(random);
	
	if(len <= number) {
		printf(random);
	}
	else {
		for (int x = 0; x<number; x++){
			printf("%c",random[x]);
		}
		puts("...");
	}

    return 0;
}

Measured memory_bytes: 1660
def LI():
	return [ int(s) for s in input().split() ]

K,N = LI()
A = LI()

A_diff = [0]*N
A_diff[0] = A[0] + K-A[N-1]

for i in range(N-1):
  A_diff[i+1] = A[i+1]-A[i]
  
print(K-max(A_diff))


Measured memory_bytes: 26420
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int main() 
{
	string s;
	cin >> s;
	vector <char> v(s.size());
	vector <char> cp;
	for(int i = 0; i < s.size(); ++i) {
		v[i]= s[i];
	}
	int q, x, y = 0;
	cin >> q;
	char ch;
	bool ok = 1;
	while(q--) {
		cin >> x;
		if(x == 1) {
			ok = !ok;
		} else {
			cin >> x >> ch;
			if(x == 1) {
				if(ok) {
					cp.push_back(ch);
				} else {
					v.push_back(ch);
				}	
			} 
			else {
				if(ok) {
					v.push_back(ch);
				} else {
					cp.push_back(ch);
				}
			}
		}
	}
	if(ok) {
		for(int i = cp.size()-1; i > -1; --i) cout << cp[i];
		for(auto i : v) cout << i;

		return 0;
	}
	for(int i = v.size()-1; i >-1; -- i) cout << v[i];
	for(auto i : cp) cout << i;
}

Measured memory_bytes: 1152
/**
 *      ///----- My Info -----///
 *      Code by: Ernesto Abreu
 *      Codeforces User: Ernest0_0Abreu
 *      Country: Cuba
 *      E-mail: ernestoabreup@gmail.com
 *      CopyRight
**/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
        ///----- My Template -----///
#define int long long
///=====================================================================================================================
/// Red-Black Tree
// #include <ext/pb_ds/assoc_container.hpp>  // .find_of_order(x); .order_of_key(x);
// using namespace __gnu_pbds;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > indexed_set;
/// Typedef
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
/// Function
#define pi (acos(-1))
#define lg2(x) 31-__builtin_clz(x)
#define lgx(x,b) log(b)/log(x)
/// Macros
#define fst first
#define scd second
#define pb push_back
#define	up upper_bound
#define lb lower_bound
#define left (node<<1)
#define right ((node<<1)+1)
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
/// Debug
#define _end cout << "\n"
#define debug(x) cerr << #x << " = " << x << " "
#define db(x) cerr << "[" << #x << "]: " << to_string(x) << '\n'
template <typename A, typename B> string to_string(pair<A, B> p);
string to_string(const string& s){ return '"' + s + '"'; }
string to_string(const char* s){ return to_string((string) s); }
string to_string(char &c){ string s; s += c; return s; }
string to_string(bool b){ return (b ? "true" : "false"); }
string to_string(vector<bool> v){ bool first = true; string res = "{"; for(int i = 0 ; i < static_cast<int>(v.size()) ; i++){if(!first){res += ", ";}first = false;res += to_string(v[i]);}res += "}"; return res;}
template <size_t N> string to_string(bitset<N> v){string res = "";for(size_t i = 0 ; i < N ; i++){ res += static_cast<char>('0' + v[i]); }return res;}
template <typename A> string to_string(A v){bool first = true;string res = "{";for(const auto &x : v){if(!first){ res += ", "; }first = false;res += to_string(x);}res += "}"; return res;}
template <typename A, typename B> string to_string(pair<A, B> p){ return "(" + to_string(p.first) + " , " + to_string(p.second) + ")"; }
/// Constant
const int MAXN = 1e6+7;
const int MOD = 1e9+7;
const ull BASE = 311;
const ld EPS = 1e-9;
const int INF = ((1<<30)-1);
const ll INFLL = ((1ll<<62ll)-1ll);
const ll oo = 2e18;
/// Hash Prime Numbers: 2, 277, 293, 307, 331, 337, 1009, 2027;
/// Module Prime Numbers: 3, 998244353, 1000000007, 1000000009, 1000000021, 1000000033;
///=====================================================================================================================
        ///----- My code -----///



int32_t main (){
	
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
	cout.setf(ios::fixed);cout.precision(10);
	
	ld N;
	cin >> N;
	cout << 2.0*pi*N;

    return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int main() {
  int N,i,j;
  ll K;
  cin>>N>>K;
  vector<int> A(N);
  vector<vector<int> > B(63, vector<int>(N));
  for (i=0;i<N;i++) {
    cin>>A[i];
    B[0][i] = A[i] - 1;
  }
  for (i=1;i<63;i++) {
    for (j=0;j<N;j++) {
      B[i][j] = B[i-1][B[i-1][j]];
    }
  }
  int town=0;
  for (i=0;i<63;i++) {
    if (K>>i & 1) {
      town = B[i][town];
    }
  }
  cout<<town + 1<<endl;
  return 0;
}


Measured memory_bytes: 53752
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    cin >> s;

    cout << (s == "ABC" ? "ARC" : "ABC") << endl;
    


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

Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string> 
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
#define debug() puts("okkkkkkkk")

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

int n,m;
int fa[100005],val[100005];

int gf(int x){
	int i=x,r=x,j,sum=0;
	while(r!=fa[r]){sum+=val[r];r=fa[r];}
	int t=sum,tmp=val[i];val[i]=sum;
	
	while(i!=r){
		t-=tmp;
		j=fa[i];
		fa[i]=r;
		i=j;
		tmp=val[i];
		val[i]=t;
	}
	return r;
}

int main(){
//	freopen("B.in","r",stdin);
	memset(val,0,sizeof(val));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)fa[i]=i;
	for(int i=1;i<=m;i++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
//		printf("db %d %d %d %d %d %d\n",i,val[1],val[2],val[3],val[4],val[5]);
		int fx=gf(x),fy=gf(y);
//		printf("%d %d %d %d %d %d\n",i,val[1],val[2],val[3],val[4],val[5]);
		if(fx!=fy){
			fa[fy]=fx;val[fy]=val[x]+z-val[y];	
		}else{
			if(z!=val[y]-val[x]){puts("No");return 0;}
		}
	}
	puts("Yes");
	
	return 0;
}


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

int main(void){
  int N; cin >> N;
  while(N--){
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    if(pow(xa - xb, 2) + pow(ya - yb, 2) > pow(ra + rb, 2)){
      cout  << 0 << endl;
      continue;
    }

    

    if(sqrt(pow(xa - xb, 2) + pow(ya - yb, 2)) + rb < ra){
      cout << 2 << endl;
      continue;
    }
    if(sqrt(pow(xa - xb, 2) + pow(ya - yb, 2)) + ra < rb){
      cout << -2 << endl;
      continue;
    }
    cout << 1 << endl;
  }  

  return 0;
}

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

int main() {
	int a;
  scanf("%d",&a);int ar[a],c=1;
        for(int i=0;i<a;i++)
        scanf("%d",&ar[i]);
        for(int i=1;i<a;i++)
        ar[i]=min(ar[i],ar[i-1]);
        for(int i=1;i<a;i++)
        if(ar[i]!=ar[i-1])
        ++c;
        printf("%d",c);
	return 0;
}


Measured memory_bytes: 4576
n=int(input())
a=[]
for i in range(n):
     a.append([int(input()),i+1])
a=sorted(a,key=lambda x:x[0])

ans=0
count=0
bef=0
for i,j in a:
    if j>bef:
        count+=1
        ans=max(ans,count)
    else:
        count=1
    bef=j
print(n-ans)

Measured memory_bytes: 41460
# -*- coding: utf-8 -*-
from collections import Counter

def combinations(n, r):
    res = 1
    for i in xrange(n - r + 1, n + 1):
        res *= i
    for i in xrange(2, r + 1):
        res /= i
    return res

N, A, B = map(int, raw_input().split())
v = map(int, raw_input().split())
v.sort(reverse = True)
cnt = Counter(v)

mx = sum(v[:A]) 
comb = 0
for n in xrange(A, B + 1):
    tmp = 1
    for key, val in Counter(v[:n]).items():
        tmp *= combinations(cnt[key], val)

    if A*sum(v[:n]) == n*mx:
        comb += tmp 

print "%.10f" % (mx*1.0/A)
print comb 


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

int main() {
  string a, b;
  cin >> a >> b;
  if(a== b){
    cout << "H" << endl;
  }else {
    cout << "D" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
inline int in() { int x; cin >> x; return x; }

int dp[3005];
int main() {
  int n = in(), t = in();
  vector<pair<int,int>> v(n);
  for (auto &i : v) i = {in(), in()};
  sort(v.begin(), v.end());

  rep(i,n) rep(j,t) {
    int j2 = t-1-j;
    int k = min(t, j2 + v[i].first);
    dp[k] = max(dp[k], dp[j2] + v[i].second);
  }
  cout << dp[t] << endl;

  return 0;
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    # divisors.sort()
    return divisors
n = int(input())
res = 0
for x in make_divisors(n):
    x = x-1
    if x == 0:
        continue
    if n % x == n // x:
        res += x
print(res)

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

int F[102][102];
int cnt=0;

void DFS(int XS, int YS, int XG, int YG, int e){
	if(F[XS][YS]!=e){
		return;
	}
	if(XS==XG&&YS==YG){
		cnt++;
	}
	F[XS][YS]=0;

	DFS(XS-1,YS  ,XG,YG,e);
	DFS(XS  ,YS+1,XG,YG,e);
	DFS(XS+1,YS  ,XG,YG,e);
	DFS(XS  ,YS-1,XG,YG,e);
}

int main(){
	while(true){
		int w,h;
		cin>>w>>h;
		if(w==0&&h==0)
			break;
		for(int i=0; i<=102; i++){
			for(int j=0; j<=102; j++){
				F[j][i]=0;
			}
		}
		cnt=0;
		int xs,ys;
		cin>>xs>>ys;
		int xg,yg;
		cin>>xg>>yg;
		int n;
		cin>>n;
		int c[n];
		int d[n], x[n], y[n];
		for(int i=0; i<n; i++){
			cin>>c[i]>>d[i]>>x[i]>>y[i];
		}
		for(int i=0; i<n;  i++){
			if(d[i]==0){
				F[x[i]  ][y[i]]=c[i];	F[x[i]  ][y[i]+1]=c[i];
				F[x[i]+1][y[i]]=c[i];	F[x[i]+1][y[i]+1]=c[i];
				F[x[i]+2][y[i]]=c[i];	F[x[i]+2][y[i]+1]=c[i];
				F[x[i]+3][y[i]]=c[i];	F[x[i]+3][y[i]+1]=c[i];
			}
			else{
				F[x[i]][y[i]  ]=c[i];	F[x[i]+1][y[i]  ]=c[i];
				F[x[i]][y[i]+1]=c[i];	F[x[i]+1][y[i]+1]=c[i];
				F[x[i]][y[i]+2]=c[i];	F[x[i]+1][y[i]+2]=c[i];
				F[x[i]][y[i]+3]=c[i];	F[x[i]+1][y[i]+3]=c[i];
			}
		}
		if(F[xs][ys]!=0){
			if(F[xg][yg]!=0){
				DFS(xs,ys,xg,yg,F[xs][ys]);
			}
		}
		if(cnt==1){
			cout<<"OK"<<endl;
		}
		else{
			cout<<"NG"<<endl;
		}
	}
	return 0;
}

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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	if(flag)ans=-ans;
	return ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	if(flag)ans=-ans;
	return ans;
}

void writ(int n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;n/=10)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}

void wrll(long long n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;n/=10ll)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}
const int N=2333;
int a[N][N],up[N][N];

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
	{
		static char str[N];
		scanf("%s",str);
		for(int j=0;j<m;j++)
		{
			a[i][j]=(str[j]=='.');
		}
	}
	int ans=max(n,m);
	n--,m--;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			a[i][j]^=a[i+1][j]^a[i][j+1]^a[i+1][j+1];
			if(a[i][j])up[i][j]=1;
			else if(!i)up[i][j]=2;
			else up[i][j]=up[i-1][j]+1;
			//printf("%d ",a[i][j]);
		}
		//puts("");
	}
	for(int i=0;i<n;i++)
	{
		static int ext[N],q[N];
		int w=0;
		for(int j=0;j<=m;j++)
		{
			for(;w && (up[i][q[w-1]]>up[i][j] || j==m);w--)
			{
				ext[q[w-1]]=j;
			}
			q[w++]=j;
		}
		w=0;
		for(int j=m-1;j>=-1;j--)
		{
			for(;w && (up[i][q[w-1]]>up[i][j] || j<0);w--)
			{
				ans=max(ans,(ext[q[w-1]]-j)*up[i][q[w-1]]);
				//printf("i=%d q[w-1]=%d ans=%d\n",i,q[w-1],ans);
			}
			q[w++]=j;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 39168
#include "bits/stdc++.h"
using namespace std;
typedef long long int lli;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5 + 5;


int main() {
	IOS
	int T = 1;
	// int counter = 1;
	// cin >> T;
	while(T--) 
	{
		int a,b,c;
		cin>>a>>b>>c;
		cout<<c<<" "<<a<<" "<<b<<endl;
	}
	return 0;
}


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

int main() {
    int n, d;
    cin >> n >> d;

    if ( n % ( 2 * d + 1 ) != 0 ) {
        cout << n / ( 2 * d + 1 ) + 1 << endl;
    }
    else {
        cout << n / ( 2 * d + 1 ) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    string s;
    cin >> s;
    if (s.size() % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < s.size(); i += 2) {
        if (s[i] != 'h' || s[i + 1] != 'i') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  cout << (n - 1) * (m - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

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

  int kagami_mochi[n];
  set<int> kagami_mochi_set;
  for(auto i = 0; n > i; i++){
    cin >> kagami_mochi[i];
    kagami_mochi_set.insert(kagami_mochi[i]);
  }

  cout << kagami_mochi_set.size() << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BCollatzProblem {
public:
    void solve(std::istream &in, std::ostream &out) {
        int s;
        in >> s;
        unordered_set<int> seen;
        seen.insert(s);
        for (int i = 2;; i++) {
            s = s % 2 ? 3 * s + 1 : s / 2;
            if (seen.count(s)) {
                out << i << '\n';
                break;
            }
            seen.insert(s);
        }
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BCollatzProblem solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3620
import scala.io.StdIn

object Main{
  def main(args: Array[String]){
    val label = StdIn.readLine.split(" ").toList.map(_.toInt)
    val q = Iterator.continually(StdIn.readLine).takeWhile(_ != null).toList
    val dice = new Dice(label)

    println(q.tail.map(_.split(" ").toList.map(_.toInt)).map(dice.findRight(_)).mkString("\n"))
  }
}

class Dice(sur: List[Int]){
  val index: List[Int] = sur

  def findRight(list: List[Int]): Int={
    val dice = new Dice(index)
    val kindOfDices = List[Dice](dice, dice.rotN, dice.rotS, dice.rotW, dice.rotE, dice.rotN.rotN)

    val finddice = for{
      kindOfDice <- kindOfDices
    }yield kindOfDice match{
      case x if(x.getVal(0) == list(0) && x.getVal(1) == list(1)) => x.getVal(2)
      case x if(x.rotR.getVal(0) == list(0) && x.rotR.getVal(1) == list(1)) => x.rotR.getVal(2)
      case x if(x.rotR.rotR.getVal(0) == list(0) && x.rotR.rotR.getVal(1) == list(1)) => x.rotR.rotR.getVal(2)
      case x if(x.rotR.rotR.rotR.getVal(0) == list(0) && x.rotR.rotR.rotR.getVal(1) == list(1)) => x.rotR.rotR.rotR.getVal(2)
      case _ => 0
    }

    finddice.sum
  }

  def getVal(i: Int): Int ={
    index(i)
  }

  def rotR(): Dice ={
    new Dice(index).rotS.rotW.rotN
  }

  def rotN(): Dice ={
    new Dice(List[Int](index(1), index(5), index(2), index(3), index(0), index(4)))
  }

  def rotS(): Dice ={
    new Dice(List[Int](index(4), index(0), index(2), index(3), index(5), index(1)))
  }

  def rotW(): Dice ={
    new Dice(List[Int](index(2), index(1), index(5), index(0), index(4), index(3)))
  }

  def rotE(): Dice ={
    new Dice(List[Int](index(3), index(1), index(0), index(5), index(4), index(2)))
  }
}

Measured memory_bytes: 46680
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

public class Main {
	static boolean debug = false;

	public static void main(String[] args) throws IOException {

		UserScanner scan = new UserScanner();
		PrintWriter pwriter = new PrintWriter(System.out);

		int n = scan.nextInt();
		SubSeq subseq = new SubSeq(n);
		for (int i = 0; i < n; i++)
			subseq.addElem(i, scan.nextInt());
		pwriter.println(subseq.getAnswer());

		pwriter.flush();
		scan.close();
		System.exit(0);
	}
}

class SubSeq {
	int[] elemA;
	int[] maxA;

	public SubSeq(int n) {
		elemA = new int[n];
		maxA = new int[n + 1];
		for (int i = 1; i < maxA.length; i++)
			maxA[i] = Integer.MAX_VALUE;
		maxA[0] = Integer.MIN_VALUE;
	}

	public int getAnswer() {
		int currMax = 0;
		for (int k = 0; k < elemA.length; k++)
			for (int i = currMax; i >= 0; i--)
				if (maxA[i] < elemA[k] && elemA[k] < maxA[i + 1]) {
					maxA[i + 1] = elemA[k];
					if (i == currMax)
						currMax++;
					break;
				}
		int ret = maxA.length - 1;
		for (; ret >= 0 && maxA[ret] == Integer.MAX_VALUE; ret--)
			;

		return ret;
	}

	public void addElem(int i, int a) {
		elemA[i] = a;
	}

}

class UserScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean read() throws IOException {
		ptr = 0;
		buflen = in.read(buffer);
		if (buflen <= 0)
			return false;
		else
			return true;
	}

	private byte getByte() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			return -1;
		} else
			return buffer[ptr++];
	}

	private void skipCtlSpace() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			ptr++;
			skipCtlSpace();
		}
	}

	private boolean isCtlSpace(byte b) {
		if (b <= ' ' || b > '~')
			return true;
		else
			return false;
	}

	public void close() throws IOException {
		in.close();
	}

	public String next() throws IOException {
		skipCtlSpace();
		StringBuilder sb = new StringBuilder();
		byte b;
		while ((b = getByte()) != -1) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() throws IOException {
		skipCtlSpace();
		int n = 0;
		boolean minus = false;
		byte b;
		while ((b = getByte()) != -1) {
			if (b == '-')
				minus = true;
			else {
				n *= 10;
				n += (b - '0');
			}
		}
		if (minus)
			return n * -1;
		else
			return n;
	}
}

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

int main(void) {
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int a1, a2, a3, ans;
  cin >> a1 >> a2 >> a3;
  ans = max({a1, a2, a3}) - min({a1, a2, a3});
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, pair<ll, ll> > p;
 
#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, D;
    cin >> N >> D;

    ll ans = 0;

    for(int i = 0; i < N; i++) {
        ll X, Y;
        cin >> X >> Y;
        if(D * D >= X * X + Y * Y) {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i,n) FOR(i, 0, n)

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> cities(M, vector<int>(2));

	rep(i, M) {
		rep(j, 2) {
			cin >> cities.at(i).at(j);
		}
	}

	for(int i=1; i<=N; i++) {
		int roads = 0;
		rep(j, M) {
			if (cities.at(j).at(0) == i || cities.at(j).at(1) == i) {
				roads++;
			}
		}
		cout << roads << endl;
	}

	
	return 0;

}

Measured memory_bytes: 256
n,q = map(int,input().split())
word = input()
xy= [tuple(input().split()) for i in range(q)]

# 右探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  flag = 0
  for x, y in xy:
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == n):
      flag = 1
      break
    elif (pos == -1):
      break
  if (flag == 1):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
right_pos = pos
# 左探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  for x, y in xy:
    flag = 0
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == -1):
      flag = 1
      break
    elif (pos == n):
      break
  if (flag == 0):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
left_pos = pos
print(right_pos - left_pos)

Measured memory_bytes: 96844
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

int main(void){
    int n,an[5100],max,sum;
    
    while (1)
    {
        cin>>n;
        if(n==0){break;}
        max=-100000;
        sum=0;
        for (int i=0; i<n; i++){cin>>an[i];}
        for(int i=0;i<n;i++)
        {
            if(max<an[i]){max=an[i];}
            sum=an[i];
            for (int j=i+1; j<n; j++)
            {
                sum += an[j];
                if (max<sum) {max=sum;}
            }
            sum=0;
        }
        cout<<max<<endl;
    }
        return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;
using vpii = vector<pii>;
using mpii = map<int, int>;
using mpci = map<char, int>;
using mpsi = map<string, int>;
using si = set<int>;
using sll = set<ll>;
 
 
#define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
 
bool custom1 (pii a, pii b) {
  return a.first < b.first;
}
 
bool custom2 (pii a, pii b) {
  return a.second < b.second;
}
 
const int MOD = 1000000007;
 
int main() {
  int n;
  cin >> n;
  vi A(n);
  rep(i, n) cin >> A[i];
  vector<int> lcmVec((int)pow(10, 6)+1);
  vector<vpii> primeVec(n);
 
  rep(i, n) {
    vpii prime;
    int copy = A[i];
    for(int j=2;j*j<=A[i];j++) {
      int count = 0;
      while(copy % j ==0) {
        count++;
        copy /= j;
      }
      if(count != 0) prime.emplace_back(make_pair(j, count));
      if(copy == 1) break;
    }
    if(copy != 1) prime.emplace_back(make_pair(copy, 1));
 
    for(auto it = prime.begin(); it != prime.end(); it++) {
      if(it->second > lcmVec[it->first]) lcmVec[it->first] = it->second;
    }
    primeVec[i] = prime;
  }

  vpii lcm;

  rep(i, (int)lcmVec.size()) {
    if(lcmVec[i] != 0) {
      lcm.emplace_back(make_pair(i, lcmVec[i]));
    }
  }
 
  int ans = 0;
 
  rep(i, n) {
    vpii copy = lcm;
    auto itr_1 = primeVec[i].begin();
    auto itr_2 = copy.begin();
    while(itr_1 != primeVec[i].end() && itr_2 != copy.end()) {
      if(itr_1->first == itr_2->first) {
        itr_2->second -= itr_1->second;
        itr_1++;
      }
      itr_2++;
    }
    long long int value = 1;
    for(auto it = copy.begin(); it != copy.end(); it++) {
      value *= (long long int)pow(it->first, it->second);
      value %= MOD;
    }
    ans = (ans + value) % MOD;
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
static const int MAX_HW = 500;
typedef pair<int, int> pint;
typedef pair<pint, pint> ppint;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int H, W, num = 0, odd = 0;
    cin >> H >> W;
    vector<vector<int>> a(H, vector<int>(W, 0));
    rep(i, H)
    {
        rep(j, W)
        {
            cin >> a[i][j];
            if (a[i][j] & 1) {
                ++odd;
            }
        }
    }

    vector<ppint> res;
    int x = 0, y = 0;
    rep(i, H * W)
    {
        if (a[x][y] & 1) {
            ++num;
        }
        int nx = x, ny = y;
        if (x % 2 == 0) {
            if (ny == W - 1) {
                ++nx;
            } else {
                ++ny;
            }
        } else {
            if (ny == 0) {
                ++nx;
            } else {
                --ny;
            }
        }
        if (num & 1)
            if (num < odd) {
                res.push_back(ppint(pint(x, y), pint(nx, ny)));
            }
        x = nx, y = ny;
    }

    cout << res.size() << endl;
    for (auto p : res) {
        cout << p.first.first + 1 << " " << p.first.second + 1 << " " << p.second.first + 1 << " " << p.second.second + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const signed INF_=1001001001; const int INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N=IN;
    vector<int> d(N);
    cin>>d;
    sort(ALL(d));
    int cnt=0;
    REPF(i,1,N) {
        if(d[i-1]==d[i]) cnt++;
    }
    cout<<(N-cnt)<<endl;
    return 0;
}


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

int main(){
  int N;cin>>N;
  
  ll ans=0;
  int sta;cin>>sta;
  for(int i=1;i<N;i++){
    int next;cin>>next;
    if(sta<next)sta=next;
    else ans+=sta-next;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int num;
	cin >> num;
	vector<int> m(num);
	for (int i = 0; i < num; ++i) {
		cin >> m[i];
	}
	int ans=0,hmax=0;
	for (int i = 0; i < num; i++) {
		if (m[i] >= hmax) {
			ans++;
		}
		hmax = max(hmax, m[i]);
	}
	cout << ans << endl;
	return 0;
}

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

template <typename T>
inline T read(){
    T x=0,f=1;char c=getchar();
    while(!isdigit(c)){ if(c=='-') f=-f;c=getchar();}
    while(isdigit(c)){x=(x<<3)+(x<<1)+(c-48);c=getchar();}
    return x*f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read<int>()
#define readlint read<lint>()
const int inf=1e9+1e7;

lint A,B,C,res,k;

int main(void){

    // freopen("testdata.in","r",stdin);
    // freopen("testdata.out","w",stdout);

    bool flag=false;
    scanf("%lld%lld%lld%lld",&A,&B,&C,&k);
    for(int i=1;i<=k;i++){
        if(A>=B) B*=2;
        else C*=2;
    }
    if(A<B && B<C) puts("Yes");
    else puts("No");

    return 0;
}

Measured memory_bytes: 3764
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	char a[5];
	int x = 0, y = 0, z = 0;
	scanf("%s", a);
	int len = strlen(a);
	for(int i = 0; i < len; i++)
	{
		if(a[i] == 'a') x++;
		if(a[i] == 'b') y++;
		if(a[i] == 'c') z++;
	}
	if(x == 1&& y == 1 && z == 1) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, k;
vector<ll> t,d;
vector<pair<ll,ll>> v;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    for (int i = 0; i < n; i++)
    {
        ll temp,temp1;
        cin >> temp>>temp1;
        t.push_back(temp);
        d.push_back(temp1);
        v.push_back(make_pair(temp1,temp));
    }
    sort(ALL(v));
    reverse(ALL(v));
    map<ll,ll> m;
    ll ans=0;
    ll syurui;
    ll count=0;
    priority_queue<ll,vector<ll>,greater<ll>>que;
    rep(i,k){
        m[v[i].second]++;
        if(m[v[i].second]==1)count++;
        if(m[v[i].second]>1)que.push(v[i].first);
        ans+=v[i].first;
    }
    ans+=count*count;
    ll ansa=ans;
    for(int i=k;i<n;i++){
        if(m[v[i].second]||que.empty())continue;
        ll temp=que.top();
        ans-=count*count;
        count++;
        ans+=count*count;
        que.pop();
        ans-=temp;
        ans+=v[i].first;
        m[v[i].second]++;
        chmax(ansa,ans);
    }
    cout << ansa << "\n";
}


Measured memory_bytes: 9692
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main(void){
    int N;
    vector<double> price(20);
    vector<string> kinds(20);
    
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> price[i] >> kinds[i];
    
    double res = 0;
    for(int i = 0; i < N; ++i){
        if(kinds[i] == "BTC") res += price[i] * 380000.0;
        else res += price[i];
    }
    
    cout << setprecision(20) << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n;
    cin >> n;
    int x[n], l[n];
    rep(i, n){
        cin >> x[i] >> l[i];
    }

    P p[n];
    rep(i, n){
        int li = x[i]-l[i];
        int ri = x[i]+l[i];
        p[i] = make_pair(ri, li);
    }

    sort(p, p+n);

    int tmpl = -INF, tmpr=-INF;
    int cnt = 0;
    rep(i, n){
        if(p[i].second >= tmpr){
            cnt++;
            tmpl = p[i].second;
            tmpr = p[i].first;
        }
    }


    cout << cnt << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
#ABC146 F

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m = LI()
s = input()

i = 0
cnt = 0
M = 0
while i < n+1:
    if s[i] == '1':
        cnt += 1
        M = max(M,cnt)
    else:
        cnt = 0
    i += 1
if M >= m:
    print(-1)
    quit()

lst = []
now = n
while now > 0:
    if now - m <= 0:
        lst.append(now)
        now -= m 
    else:
        for j in range(1,m+1)[::-1]:
            if s[now-j] == '0':
                lst.append(j)
                now -= j
                break
print(*lst[::-1])

Measured memory_bytes: 50672
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;
vector<vector<int>> v;

bool cp(vector<int> a, vector<int> b){
   int end = a[0] + a[1];
   int end2 = b[0] + b[1];
   return end < end2;
}

int32_t main(){_
   
   cin>>n;

   for (int i = 0; i < n; ++i)
   {
      int x, l;
      cin >> x >> l;
      v.push_back({x, l});
   }

   sort(v.begin(), v.end(), cp);

   int end = -inf;
   int ans = 0;
   for(auto &it: v){
      int left = it[0] - it[1];
      int right = it[0] + it[1];
      if(left >= end){
         ans++;
         smax(end, right);
      }
   }
   
   cout<<ans;

   return 0;
}

Measured memory_bytes: 6708
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

int A, B, T;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> A >> B >> T;

  int ans = 0;
  int t = 0;
  while (T >= t + A) {
    ans += B;
    t += A;
  }

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000001145
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans;
int n,m;
int a[111111];
int sum[111111];

unordered_map<int,int> cnt;

signed main(){
	
	cin>>n>>m;
	
	rep(i,n)cin>>a[i];
	rep(i,n){
		sum[i+1]=sum[i]+a[i];
	}
	rep(i,n+1){
		cnt[sum[i]%m]++;
	}
	for(auto x:cnt){
		ans+=x.second*(x.second-1)/2;
	}
	cout<<ans<<endl;

}


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

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

	bool can_buy(false);
	for (int i = 0; i <= 25; i++) {
		for (int j = 0; j <= 20; j++) {
			if ((4 * i) + (7 * j) == N) {
				can_buy = true;
				break;
			}
		}
	}

	std::cout << ((can_buy) ? "Yes" : "No") << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

int main() {
	int n;
	scanf("%d", &n);

	char in[32];
	vector<int> win(n + 1, 0);;
	for(int i = 1; i <= n; ++i) {
		scanf("%s", in);
		for(int j = 0; j < n; ++j)
			if(in[j] == 'o')
				++win[i];
	}

	vector<int> hand;
	int strongest = 0;
	for(int i = 1; i <= n; ++i) {
		if(win[i] == n - 1)
			strongest = i;

		else
			for(int j = 0; j < win[i]; ++j)
				hand.push_back(i);
	}

	for(int i = 0; i < 1000; ++i) {
		if(strongest)
			printf("%d\n",strongest);
		else
			printf("%d\n", hand[rand() % hand.size()]);

		fflush(stdout);
		
		int judge_ai_hand;
		scanf("%d", &judge_ai_hand);
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1332
/*
"Won't stop untill I'm Phenomenal"
- Phenomenal, EMINEM
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n; cin>>n;
    int x,y; cin>>x>>y;
    vector<int> cnt(n-1);
    for(int i = 1  ; i <=n; i++){
        for(int j = i+1; j <= n; j++){
            cnt[min(j-i,min(abs(i-x) + abs(j-y), abs(j-x)+ abs(i-y))+1)-1]++;
        }
    }
    pra(cnt);
    //cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 3560
#include <iostream>

int a,b,c,d,e,f;

bool dp[31];

bool dp1[3001];

int main() {

    std::cin>>a>>b>>c>>d>>e>>f;

    dp[0]=dp[a]=dp[b]=true;

    for(int i=b;i<31;++i)
        dp[i]=dp[i-a]||dp[i-b];

    dp1[0]=dp1[c]=dp1[d]=true;

    for(int i=d;i<3001;++i)
        dp1[i]=dp1[i-c]||dp1[i-d];

    double res=0;

    int ans1=a*100,ans2=0;

    for(int i=1;i<31;++i){
        if(dp[i]){
            for(int j=1;j<3001;++j){
                if(dp1[j]){
                    if(i*100+j<=f&&j<=i*e){
                        if(res<(double)j/double(i*100+j)){
                            res=(double)j/double(i*100+j);
                            ans1=i*100+j;
                            ans2=j;
                        }
                    }
                }
            }
        }
    }

    std::cout<<ans1<<' '<<ans2<<std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
bool vis[60];
void tran(char card,int num){
	switch(card){
		case 'S':{
			vis[num]=true;
			break;
		}
		case 'H':{
			vis[num+13]=true;
			break;
		}
		case 'C':{
			vis[num+26]=true;
			break;
		}
		case 'D':{
			vis[num+39]=true;
			break;
		}
	}
}
void retran(int num){
	int i=(num-1)/13;
	char tmp;
	switch(i){
		case 0:{
			tmp='S';
			break;
		}
		case 1:{
			tmp='H';
			break;
		}
		case 2:{
			tmp='C';
			break;
		}
		case 3:{
			tmp='D';
			break;
		}
	}
	i=(num-1)%13+1;
	printf("%c %d\n",tmp,i);
}
int main(){
	int n,num;
	char card; 
	fill(vis,vis+60,false);
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++){
		scanf("%c %d",&card,&num);
		getchar();
		tran(card,num);
	}
	for(int i=1;i<=52;i++){
		if(!vis[i]){
			retran(i);
		}
	}
} 


Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int gcd(int x, int y){
	if(y == 0){
		return x;
	}
	else {
		gcd(y, x%y);
	}
}

int main() {
	int x, y;
	cin >> x >> y;

	int ans = gcd(x, y);

	cout << ans << endl;
}




Measured memory_bytes: 3080
s = list(input())
t = list(input())

flag = 0

for i in range(len(s)):
    flag = 0
    for j in range(len(s)):
        if s[j] != t[(j + i) % len(s)]:
            flag = 1

    if flag == 0:
        print("Yes")
        exit(0)
        

print("No")


Measured memory_bytes: 3060
#include <cstdio>

const int p=1000000007;

int x[120000];
int i,n1,n2,s1,s2;

int main()
{
	scanf("%d%d",&n1,&n2);
	for (i=1;i<=n1;i++)
	{
		scanf("%d",&x[i]);
		if (i>1)
			s1=(s1+1LL*(i-1)*(n1-i+1)%p*(x[i]-x[i-1]))%p;
	}
	for (i=1;i<=n2;i++)
	{
		scanf("%d",&x[i]);
		if (i>1)
			s2=(s2+1LL*(i-1)*(n2-i+1)%p*(x[i]-x[i-1]))%p;
	}
	printf("%d",1LL*s1*s2%p);
	return 0;
}

Measured memory_bytes: 512