akhauriyash/Code-Regression huggingface dataset:
from itertools import combinations
n, *S = open(0).read().split()
n = int(n)
march = []
for c in 'MARCH':
    march.append(len([s for s in S if s[0] == c]))
ans = 0
for a, b, c in combinations(march, 3):
    ans += a*b*c
print(ans)

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

int main() {
  int H, W;
  cin >> H >> W;
  if(H<1 || H>100 ||
     W<1 || W>100){
    return 0;
  }
  vector<string> A(H+2, string(W+2, '#'));
  for(int i=1; i<H+1; ++i){
    for(int j=1; j<W+1; ++j){
      char a;
      cin >> a;
      A.at(i).at(j) = a;
    }
  }
  for(auto s: A){
    cout << s << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using namespace std;
// O(log N)　keyのある場所を返す。なかったら-1を返す
int search(int key, vector<int> a){
  int right = a.size();
  int left = 0;
  while(right >= left){
    int middle = left + (right - left) / 2;
    if(a[middle] == key) return middle; //keyが入ってる場所を返す
    else if(a[middle] > key) right = middle - 1;
    else if(a[middle] < key) left = middle + 1;
  }
  //なければ-1を返す
  return -1;
}
// O(N^2) babble sort
int main(){
  int n;
  cin >> n;
  int ans1 = n / 10;
  if(ans1 % 111 == 0){
    cout << "Yes" << endl;
  }else{
    int ans2 = n % 1000;
    if(ans2 % 111 == 0){
      cout << "Yes" << endl;
      return 0;
    }
    cout << "No" << endl;
  }
  return 0;
}

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

int N,M;
int a[55],b[55];
bool graph[55][55];
bool vis[55];

void dfs(int n){
    if(vis[n])return;
    vis[n]=true;
    for(int i=0;i<N;i++){
        if(graph[n][i])dfs(i);
    }
}

int main(){
    int ans=0;
    cin>>N>>M;
    bool connected=true;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            graph[i][j]=false;
        }
    }

    for(int i=0;i<M;i++){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
        graph[a[i]][b[i]]=true;
        graph[b[i]][a[i]]=true;
    }

    for(int i=0;i<M;i++){
        graph[a[i]][b[i]]=graph[b[i]][a[i]]=false; //辺を一度取り除く
        for(int j=0;j<N;j++)vis[j]=false;
        dfs(0);
        bool check=true;
        for(int k=0;k<N;k++){
            if(!vis[k])check=false;
        } //すべての頂点に到達できていなければ、取り除いた辺は橋である。
        if(!check)ans++;
        graph[a[i]][b[i]]=graph[b[i]][a[i]]=true; //辺を戻す
    }
    cout<<ans<<endl;
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int ma = -1;
    for (int i = 0; i < N; i++) {
        ma = max(ma, A[i]);
    }

    int gcd = 0;
    for (int i = 0; i < N; i++) {
        gcd = __gcd(gcd, A[i]);
    }

    cout << ((K % gcd == 0 && K <= ma) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}

Measured memory_bytes: 3620
def calc(list_, len_list):
    def check_even():
        for l in list_:
            if l % 2 == 1:
                return False
        return True
    def half():
        for i in range(len_list):
            list_[i] //= 2

    counter = 0
    while True:
        if check_even():
            half()
            counter += 1
        else:
            print(counter)
            break

N = int(input())
A = [int(a) for a in input().split(" ")]
calc(A, N)

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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */
int gcd(int a,int b){return b?gcd(b,a%b):a;}

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//#define int ll
//#define int long long

signed main()
{
  int kind; cin >> kind;//2-n-100
  int cap; cin >> cap;//allm-x-1e5
  int gram;//1-m-1000
  int cnt = kind;
  
  vi Gram(0);
  REP(i, kind){
    cin >> gram;
    Gram.PB(gram);
  }
  
  for(const auto& g: Gram)
   cap = cap - g;
  
  int ming = *min_element(ALL(Gram)) ;
  
//  while(cap - ming > 0){cap = cap-ming;++cnt;}
  
  
  cout << kind + cap/ming;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define fo(i,a) for(ll i=0;i<a;i++)
#define Fo(i,a,n) for(ll i=a; i<n; i++)

using namespace std;
/*
void solve(){
    int a,b,k,t=0;
    cin>>a>>b>>k;
    char arr[a][b];
    int row[a];
    int ca=ol[b];
    int tmp;
    fo(i,a){
        tmp=0;
        fo(j,b){
            cin>>arr[i][j];
            if(arr[i][j]=='#') tmp++,t++;
        }
        row[a]=tmp;
    }
    if(k>t){
        cout<<0<<endl;
        return;
    }
    fo(i,b){
        tmp=0;
        fo(j,a){
            if(arr[i][j]=='#') tmp++;
        }
        col[i]=tmp;
    }
    int x, ans=0;
    fo(i,a){
        fo(j,b){

        }
    }
}
*/
void solve(){
    ll n;
    cin>>n;
    vl arr(n);
    fo(i,n){
        cin>>arr[i];
    }
    sort(arr.rbegin(), arr.rend());
    ll ans=arr[0];
    n-=2;
    int i=1;
    while(n){
        ans+=arr[i];
        n--;
        if(n){
            ans+=arr[i];
            n--;
        }
        i++;
    }
    cout<<ans<<endl;
}

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


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (N * A > B) {
    cout << B << endl;
  }
  else if (N * A <= B){
    cout << N * A << endl;
  }// ここにプログラムを追記
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
 
int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	string a,b;
	cin >> a >> b;
	if (a.length()>b.length())
	cout<<"GREATER";
	
	else if (a.length()<b.length())
	cout<<"LESS";
	
	else{
	
	if (a>b)
	cout<<"GREATER";
	
	else if (a<b)
	cout<<"LESS";
	
	else
	cout<<"EQUAL";
}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s1,s2;
  cin>>s1>>s2;
  for(int i=0;i<s1.size();i++){
   	cout<<s1[i]<<s2[i]; 
  }
  cout<<"\n";
 return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll a, b, c;
	cin >> a >> b >> c;
	ll remain = a - b;
	ll ans = c - remain;
	if (ans < 0) {
		cout << 0 << '\n';
	}
	else {
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	int a,p;cin>>a>>p;
	cout<<(3*a+p)/2<<endl;
}

Measured memory_bytes: 384
while True:
    n,p = map(int,input().split())
    if n == p == 0: break
    stones = [0 for i in range(n)]
    i = 0
    wan = p
    while True:
        if wan > 0:
            wan -= 1
            stones[i] += 1
        else:
            wan += stones[i]
            stones[i] = 0
        if stones[i] == p:
            print(i)
            break
        i = (i+1) % n

Measured memory_bytes: 5596
#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;

typedef long long            ll;
typedef unsigned long long   ull;
typedef vector<int>          vi;
typedef vector<ll>           vl;
typedef pair<int, int>       pi;
typedef pair<ll, ll>         pl;
typedef vector<pi>           vpi;
typedef vector<pl>           vpl;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define read        freopen("in.c", "r", stdin)
#define write       freopen("out.c", "w", stdout)
#define all(a)      a.begin(), a.end()
#define bye         exit(0)
#define mp          make_pair
#define ff          first
#define ss          second
#define L(x)        ((x) << 1)
#define R(x)        ((x) << 1 | 1)
#define SZ(a)       (ll)(a).size()
#define pb          push_back
#define eb          emplace_back
#define eps         1e-9
#define inf         (1000000000)
#define infl        (1000000000000000000LL)
#define cs(p)       printf("Case %d:", (p)++)
#define ptc(c)      putchar(c)
#define gtc()       getchar()
#define nl          puts("")
#define sp          printf(" ")
#define out(a)      printf("%lld", (ll)(a))
#define SET(a, x)   memset((a), x, sizeof(a))
#define dbg(x)      cout << "--- " << #x << " = " << (x) << '\n'

ll bgm(ll a, ll b, ll m) {
    b = (b == -1) ? (m - 2) : b;
    a %= m;
    ll rem = 1;
    while(b != 0) {
        if(b&1)
            rem = (rem * a) % m;
        a = (a * a) % m;
        b >>= 1;
    }
    return rem;
}

inline ll in() {
    ll a;
    assert(scanf("%lld", &a) != EOF);
    return a;
}

const int MAX = 1000000 + 5;
const int LEN = 50;
const ll MOD = 1000000007;


int main() {
    //read,write;
    while(1){
        string s;
        cin >> s;
        int sum=0;
        if(s=="0") break;
        int sz = s.size();
        for(int i=0;i<sz;i++){
            sum+=s[i]-'0';
        }
        cout << sum << endl;
        sum =0;
    }
  
   
 

    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define p pair<int,int>
#define P pair<p,p>
using namespace std;

int a[50][50][50][50];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int S[50][50];
signed main() {
	int b, c;
	while (cin >> c >> b, b | c) {
		memset(a, 0x3f, sizeof(a));
		int d, e, f, g; cin >> e >> d >> g >> f; d--; e--; f--; g--;
		a[d][e][f][g] = 0;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < c; j++) {
				scanf("%d", &S[i][j]);
			}
		}
		queue<P>Q;
		Q.push(P(p(d,e),p(f,g)));
		while (Q.size()) {
			P t = Q.front(); Q.pop();
			for (int i = 0; i < 4; i++) {
				int j = 3 - i;
				p n, m; n = t.first; m = t.second;
				n.first += x[i]; n.second += y[i];
				m.first += x[j]; m.second += y[j];
				if (n.first < 0 || n.first >= b || n.second < 0 || n.second >= c||S[n.first][n.second]==1) {
					n.first -= x[i]; n.second -= y[i];
				}
				if (m.first < 0 || m.first >= b || m.second < 0 || m.second >= c||S[m.first][m.second]==1) {
					m.first -= x[j]; m.second -= y[j];
				}
				if (a[n.first][n.second][m.first][m.second] == 1061109567) {
					a[n.first][n.second][m.first][m.second] = a[t.first.first][t.first.second][t.second.first][t.second.second]+1;
					Q.push(P(p(n.first,n.second),p(m.first,m.second)));
				}
			}
		}
		int MIN = 100;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < c; j++) {
				MIN = min(MIN, a[i][j][i][j]);
			}
		}
		if (MIN == 100)puts("NA");
		else cout << MIN << endl;
	}
}

Measured memory_bytes: 28284
class UnionFind():
  def __init__(self, n):
    self.n = n
    # n+1なのはノード番号とリストのインデックスを一致させるため
    # root[x]<0ならそのノードが根かつその絶対値が木の要素数
    self.root = [-1]*(n+1)
    self.rnk = [0]*(n+1)
  
  def Find_Root(self, x):
    if self.root[x] < 0:
      return x
    else:
      self.root[x] = self.Find_Root(self.root[x])
      return self.root[x]
    
  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return
    elif(self.rnk[x] > self.rnk[y]):
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1
 
  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)
  
  def Count(self, x):
    return -self.root[self.Find_Root(x)]

n, m = map(int, input().split())
UF = UnionFind(n)
for i in range(m):
  x, y, z = map(int, input().split())
  UF.Unite(x,y)

print(sum(x<0 for x in UF.root[1:]))

Measured memory_bytes: 73560
from itertools import *

N = int(input())
An = list(map(int, input().split()))

class MyIter:

    def __init__(self, it):
        self.it = it
        self.num_negs = 0
        self.total = 0
        self.minimum = 10**9
        pass

    def __update(self, value):
        self.total += value
        self.minimum = min(self.minimum, value)
        return value

    def __iter__(self):
        for value in self.it:
            if value < 0:
                self.num_negs += 1
                yield self.__update(-value)
                pass
            else:
                yield self.__update(value)
                pass
            pass
        pass

    def to_ans(self):
        if self.num_negs % 2 == 1:
            return self.total - 2 * self.minimum
        else:
            return self.total
        pass

    pass

myiter = MyIter(An)
Bn = list(myiter)

print(myiter.to_ans())


Measured memory_bytes: 14512
#include <stdio.h>
#include <math.h>
#define N_MAX 10000

int isPrime(int x)
{
  int i;
  if (x <= 3) {
    return 1;
  } else if (x % 2 == 0) {
    return 0;
  } else {
    for (i = 3; i <= sqrt(x); i = i + 2) {
      if (x % i == 0) {
        return 0;
      }
    }
    return 1;
  }
}

int main(int argc, char *argv[])
{
  int i, j, n, x;
  int answer = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    answer = answer + isPrime(x);
  }
  printf("%d\n", answer);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#define N 85
#define M 12805
using namespace std;

int h, w, a[N][N];
bool d[N][N][M];

void f(int p, int q, int r) {
	if (r < 0) r = -r;
	if (r >= M) return;
	d[p][q][r] = 1;
}

int main()
{
	int i, j, k, t;
	cin >> h >> w;
	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			scanf("%d", &t);
			a[i][j] -= t;
		}
	}
	d[1][0][0] = 1;
    for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			for (k = 0; k < M; k++) {
				if (d[i - 1][j][k] || d[i][j - 1][k]) f(i, j, k + a[i][j]), f(i, j, k - a[i][j]);
			}
		}
    }
    for (i = 0; i < M; i++) {
		if (d[h][w][i]) break;
    }
    cout << i << endl;
    return 0;
}

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

int main()
{
    long H,N;
    cin>>H>>N;
    vector<int>A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
        H-=A.at(i);
        if(H<=0){
            cout <<"Yes"<<endl;
            exit(0);
        }
    }
    cout <<"No"<<endl;
}

Measured memory_bytes: 640
from math import pi, sqrt, cos

def calc(a, b, h, m):
    theta = 2 * pi * (h / 12 + m / 60 / 12 - m / 60)
    c2 = a ** 2 + b ** 2 - 2 * a * b * cos(theta)
    return sqrt(c2)

A, B, H, M = map(int, input().split())
res = calc(A, B, H, M)
print('{:.12f}'.format(res))

Measured memory_bytes: 9416
N = int(input())
p = list(map(int,input().split()))

p_min = [0]*N

p_min[0] = N+1
for i in range(1,N):
	p_min[i] = min(p[i-1],p_min[i-1])

ans = 0

for i in range(N):
	if p_min[i] >= p[i]:
		ans += 1
print(ans)

Measured memory_bytes: 75856
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >>N;
  int cnt=0;
  int i=1;
  while(cnt<N && ++i<=55555){
    for(int j=2; j<=i/j; j++){
      if(i%j==0)
        break;
      if(j+1>i/(j+1) && i%5==1){
        cout<<i;
        if(cnt<N-1)
          cout<<" ";
        else
          cout<<endl;
        cnt++;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string s;
    bool flag = true;
    cin>>s;
    for(int i=0; i<3; i++){
        if(s[i] == s[i+1])
            flag = false;
    }
    flag ? cout<<"Good"<<endl : cout<<"Bad"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main (){
	string s,s1;
	cin>>s;
	int min=1000,n=s.size(),s2;
	for(int i=0;i<n-2;i++){
		s1=s.substr(i,3);
		s2=atoi(s1.c_str());
		if(s2>=753){
			if(min>s2-753)min=s2-753;
			}
		else{
			if(min>753-s2)min=753-s2;
			}
		}
		cout<<min<<endl;
		return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()
{
  int N, D;

  scanf("%d", &N);
  scanf("%d", &D);

  if(N%((2*D)+1) == 0){
    printf("%d", N/(2*D+1));
  } else{
    printf("%d", (N/((2*D)+1)+1));
  }

  return 0;

}

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
        cin >> x[i];
    vector<int> v(n);
    copy(x.begin(), x.end(), v.begin());
    sort(x.begin(), x.end());
    int a[n];
    for (int i = 0; i < n; i++) {
        if (v[i] < x[n / 2])
            a[i] = x[n / 2];
        else
            a[i] = x[(n - 2) / 2];
    }
    for (int i = 0; i < n; i++)
        cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 4480
def kippu():
    N = input()

    A,B,C,D = int(N[0]),int(N[1]),int(N[2]),int(N[3])

    op = ["+","-"]

    for one in op:
        for two in op:
            for three in op:
                ANS = A
                ANS = ANS + B if one=="+" else ANS - B
                ANS = ANS + C if two=="+" else ANS - C
                ANS = ANS + D if three=="+" else ANS - D
                if ANS==7:
                    print("{}{}{}{}{}{}{}=7".format(A,one,B,two,C,three,D))
                    return 0

kippu()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W;
    cin >> H >> W;
    string S[101];
    rep(i,0,H){
        cin >> S[i];
    }
    int flg_h[101] = {};
    int flg_w[101] = {};
    rep(i,0,H){
        rep(j,0,W){
            if(S[i][j] == '#'){
                flg_w[j] = 1;
                flg_h[i] = 1;
            }
        }
    }
    rep(i,0,H){
        rep(j,0,W){
            if(flg_w[j] == 1 && flg_h[i] == 1){
                cout << S[i][j];
            }
        }
        if(flg_h[i] == 1){
            cout << endl;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    string s;
    cin >> s;
    rep(i,s.size()){
        cout << "x";
    }
    cout << endl;
}

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

int main() {
  int a;
  cin>>a;
  vector<double> vec(a);
  vector<string> vecb(a);
  
  for(int i=0;i<a;i++){
    cin>>vec.at(i)>>vecb.at(i);
  }
  
  double answer=0;
  
  for(int i=0;i<a;i++){
    if(vecb.at(i)=="BTC"){
      vec.at(i) *=380000;
    }
    answer+=vec.at(i);
  }
  cout<<answer<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string t, h;
	int n, pt = 0, ph = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> t >> h;
		if (t == h)
		{
			pt++;
			ph++;
		}
		else if (t > h)
		{
			pt+=3;
		}
		else
		{
			ph+=3;
		}
	}
	cout << pt << " " << ph << endl;

}


Measured memory_bytes: 3124
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int[] a = new int[5];
		for(int i = 0 ; i < 5 ; i++) a[i] = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		sc.close();
		Arrays.sort(a);
		if(k >= a[4] - a[0]) ou.println("Yay!");
		else ou.println(":(");
		ou.flush();
	}
}

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

int main(){
	for (int i = 1; i < 9 + 1; i++){
		for (int j = 1; j < 9 + 1; j++){
			cout << i << 'x' << j << '=' << i * j << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3076
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
x = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

print(x.index(0)+1)

Measured memory_bytes: 9096
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    String[] x = str.split(" ");
    int a = Integer.parseInt(x[0]);
    int b = Integer.parseInt(x[1]);
    int c = Integer.parseInt(x[2]);
    int count = 0;
    for (int i = a; i <= b; i++){
      if((c % i) == 0){
        count++;
      }
    }
    System.out.println(count);
  }
}


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

int abs(int n) {
	return n >= 0 ? n : -n;
}

int main() {
	int n;
	int w[100];
	int s[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> w[i];
	s[0] = w[0];
	for (int i = 1; i < n; i++)
		s[i] = s[i - 1] + w[i];

	int min = 10001;
	for (int i = 0; i < n; i++) {
		if (min > abs(s[n - 1] - 2 * s[i]))
			min = abs(s[n - 1] - 2 * s[i]);
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<cassert>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int MAX_N = 1e5;

int main()
{
    int n;
    static int a[MAX_N], s[MAX_N];
    cin >> n;
    rep(i, n) {
        cin >> a[i];
    }
    s[0] = a[0];
    reps(i, 1, n) {
        s[i] = s[i-1] + a[i];
    }
    
    ll ans = 0, count = 0;
    int dif = 0;
    
    rep(i, n) {
        if (i%2 == 0) {
            if (s[i] + dif > 0){
                continue;
            }
            else {
                count += -(s[i] + dif) + 1;
                dif += -(s[i] + dif) + 1;
            }
        } else {
            if (s[i] + dif < 0) {
                continue;
            }
            else {
                count += (s[i] + dif) + 1;
                dif -= (s[i] + dif) +1;
            }
        }
    }
    
    ans = count;
    count = 0;
    dif = 0;
    
    rep(i, n) {
        if (i%2 == 1) {
            if (s[i] + dif > 0) continue;
            else {
                count += -(s[i] + dif) + 1;
                dif += -(s[i] + dif) + 1;
            }
        } else {
            if (s[i] + dif < 0) continue;
            else {
                count += (s[i] + dif) + 1;
                dif -= (s[i] + dif) +1;
            }
        }
    }
    ans = min(ans, count);
    cout << ans << endl;
    return 0;
}


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

namespace _2019mpA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int K = int.Parse(s[1]);

            if(K*2 -1 <= N)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");

            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int n,s;
int cnt=0;

map<int,int> dp[1<<10];

map<int,int> dfs(int d,int si){
	int sz=0;
	for(int i = 0; i < n; i++){
		if((si>>i)&1){
			sz++;
		}
	}

	if(dp[si].size()!=0){
		return dp[si];
	}
	map<int,int> ret;
	if(d==n){
		return ret;
	}
	for(int i = 0; i < 10; i++){
		if((si>>i)&1==1){
			map<int,int> ss = dfs(d+1,(si&~(1<<i)));
			if(ss.size()==0){
				ret[((d+1)*i)]++;
			}
			else{
				if(d==0){
					//cout<<endl;
				}
				for(map<int,int>::iterator it = ss.begin(); it!=ss.end(); it++){
					if((it->first)+(d+1)*i<=s)
						ret[(it->first)+(d+1)*i]+=it->second;
				}
			}
		}
	}
	dp[si]=ret;
	return dp[si];
}


//bool used[10];
//void dfs2(int d,int sum){
//	if(d==n){
//		if(sum==s)
//			cnt++;
//		return;
//	}
//	for(int i = 0; i < 10; i++){
//		if(!used[i]){
//			used[i]=true;
//			dfs2(d+1,sum+(d+1)*i);
//			used[i]=false;
//		}
//	}
//}

int main(){

	while(cin>>n>>s){
	//	fill(used,used+10,false);
		cnt=0;
		map<int,int> m = dfs(0,(1<<10)-1);
		int minNum=0;
		for(int i = n-1; i >= 0; i--){
			minNum+=(n-1-i)*(n-(n-1-i));
		}
		if(minNum>s)
			cout<<0<<endl;
		else
			cout<<m[s]<<endl;
		for(int j = 0; j < (1<<10); j++){
			dp[j].clear();
		}
	}

	return 0;
}

Measured memory_bytes: 2760
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int h,n;
   cin>>h>>n;
   int a[n],b[n];
   rep(i,0,n)cin>>a[i]>>b[i];
   int dp[h+1];
   rep(i,0,h+1)dp[i]=1e15;
   dp[0]=0;
   for(int j=1;j<=h;j++)
   {
       for(int i=0;i<n;i++)
       {
           if(a[i]>=j)
           {
               dp[j]=min(dp[j],dp[0]+b[i]);
           }
           else
           {
               dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
           }
       }
   }
   cout<<dp[h]<<endl;

}



Measured memory_bytes: 384
def main():
    import sys
    sys.setrecursionlimit(1000000)
    # 行先、上限、逆辺

    def add_edge(From, to, cap):
        g[From][to] = cap
        g[to][-From-1] = 0

    def max_flow(s, t):
        def dfs(v, t, f):
            q.append(v)
            if v == t:
                return f
            used[v] += 1
            for i in range(len(gkey[v])):
                to = gkey[v][i]
                cap = g[v][to]
                if to < 0:
                    to2 = -to-1
                else:
                    to2 = to
                if used[to2] or cap == 0:
                    continue
                d = dfs(to2, t, min(f, cap))
                if d > 0:
                    g[v][to] -= d
                    if to < 0:
                        to = -to-1
                    else:
                        v = -v-1
                    g[to][v] += d
                    return d
            q.pop()
            return 0

        flow = 0
        while True:
            used = [0]*n
            q = []
            f = dfs(s, t, 10**100)
            if not q:
                return flow
            flow += f

    n, m = map(int, input().split())
    g = [dict() for _ in range(n)]
    abc = [list(map(int, input().split())) for _ in [0]*m]
    for a, b, c in abc:
        add_edge(a, b, c)
    gkey = [list(i.keys()) for i in g]
    print(max_flow(0, n-1))


main()



Measured memory_bytes: 5972
import java.io.*;

public class Main{ 
        public static void main(String[] args){
            int i,m,j=0,kazu,k,a,count=0;
            int b[];
            String kard;
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{    b = new int[400];
                String[] kard1=new String[500];
                String[][] temp=new String[20][500];
                while(true){
                    kard=reader.readLine();
                    b[j]=kard.length();
                    if(kard.equals("-")){
                        break;
                    }
                    for(i=0;i<b[j];i++){
                        kard1[i]=String.valueOf(kard.charAt(i));
                    }
                    String kazul=reader.readLine();
                    kazu = Integer.parseInt(kazul);
                    for(m=0;m<kazu;m++){
                        String al=reader.readLine();
                        a = Integer.parseInt(al);
                        k=0;
                        for(i=a;i<b[j];i++){
                            temp[count][k]=kard1[i];
                            k++;
                        }
                        for(i=0;i<a;i++){
                            temp[count][k]=kard1[i];
                            k++;
                        }
                        for(i=0;i<b[j];i++){
                            kard1[i]=temp[count][i];
                        }
                    }
                    j++;
                    count++;
                }
                i=0;
                while(count>i){
                    for(j=0;j<b[i];j++){
                        System.out.print(temp[i][j]);
                    }
                    System.out.printf("\n");
                    i++;
                }
            } catch (IOException e){
                System.out.println(e);
            }
        }
    }


Measured memory_bytes: 24520
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int a, b; cin >> a >> b;
  FOR(ans, 1, 100000) {
    if (ans * 8 / 100 == a && ans * 10 / 100 == b) {
      cout << ans << '\n';
      return 0;
    }
  }
  cout << "-1\n";
  return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
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; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll A, B, M;
    cin >> A >> B >> M;
    VLL a(A),b(B),x(M),y(M),c(M);
    ll A_min=INF;
    ll B_min=INF;
    rep(i,A){
        cin >> a[i];
        A_min=min(a[i],A_min);
    }
    rep(i,B){
        cin >> b[i];
        B_min=min(B_min,b[i]);
    }
    rep(i,M){
        cin >> x[i] >> y[i] >> c[i];
    }
    ll mini=A_min+B_min;
    rep(i,M){
        ll a1=a[x[i]-1];
        ll b1=b[y[i]-1];
        mini=min(mini,a1+b1-c[i]);
    }
    
    cout << mini << endl;
}

Measured memory_bytes: 4224
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var result = "";
        for(var i = 0; i < str.Length; i++)
        {
            var s = str.Substring(i, 1);
            if (s == "1") result += "9";
            else result += "1";
        }
        WriteLine(result);
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;


public class Main {

    static void solve() {
        Scanner scan = new Scanner(System.in);
//        int t = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();

        boolean fTurn = true;
        while(true) {
            if(fTurn) {
                c-=b;
                if(c<=0) {
                    System.out.println("Yes");
                    return;
                }
                fTurn = false;
            }else{
                a-=d;
                if(a<=0) {
                    System.out.println("No");
                    return;
                }
                fTurn = true;
            }

        }
//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
//            int res = scase(n);
//            System.out.println(res);
//            solveCase(i, n, strs);
//        }
    }

    static void solveCase(int t, int n, String[] strs) {
//
//        System.out.println("Case #" + (t+1) + ": " + res);
    }


//    static int scase(int n) {
//
//    }


    public static void main(String[] args) {

//
        solve();

        //        Main m = new Main();
        //        Scanner scan = new Scanner(System.in);

        //        long n = scan.nextLong();
        //        long r = scan.nextLong();
        //        List<Long> list = new ArrayList<>();
        ////        int[] arr = new int[n];
        //        for (long i=0;i<n;i++){
        //            list.add(scan.nextLong());
        //        }
//            System.out.println(ch);
        //        solve(n, arr);
        //        scan.close();
    }


//
//    class Counter extends HashMap<Integer, Integer> {
//        public int get(int k) {
//            return containsKey(k) ? super.get(k) : 0;
//        }
//
//        public void add(int k, int v) {
//            put(k, get(k) + v);
//        }
//    }


//    static class Node {
//        int val;
//        Node next;
//        Node random;
//
//        public Node(int val) {
//            this.val = val;
//            this.next = null;
//            this.random = null;
//        }
//    }

//    static class Node {
//        int key;
//        int data;
//        Node next;
//        Node prev;
//
//        Node(int key, int data) {
//            this.key = key;
//            this.data = data;
//        }
//    }

    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }
}


Measured memory_bytes: 27036
#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>;
const int MX = 1000005;

int main(){
   string s,t;
   cin>>s>>t;
   int n,ans;
   n = s.size();
   rep(i,n){
       if (s[i]==t[i]){
           ans ++;
       }
   } 
   cout<<n-ans<<endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if ( k <= a + b ) cout << min(a, k) << endl;
    else cout << a - (k - (a + b)) << endl;

    return 0;
}

Measured memory_bytes: 3632
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    var N = parseInt(input[0], 10);
    var vec_A = input[1].map(e =>(parseInt(e, 10)));
    var W = xorAry(vec_A);
    var vec_ans = [];
    for (var i = 0; i < N; i++){
        vec_ans.push(String(W ^ vec_A[i]));
    }
	console.log(vec_ans.join(' '));
}   

var xorAry  = function(arr) {
    var res = 0;
    arr.forEach(function(elm) {
         res = res ^ elm;
    });
    return res;
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 66144
import java.util.Scanner;

public class Main {

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

        sc.close();

        if (a >= b) {
            System.out.println("delicious");
        } else if (a + x >= b) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)

#define mp make_pair
#define fi first
#define se second

#define bit(n) (1LL<<(n))

void Main()
{
  i64 n;
  cin >> n;

  vector<i64> l(n),r(n);
  i64 x,y;
  rep(i,n){
    cin >> x >> y;
    l[i] = x-y;
    r[i] = x+y;
  }

  vector<i64> ord(n);
  rep(i,n) ord[i]=i;
  sort(ord.begin(),ord.end(),[&](i64 s,i64 t){
      return r[s]<r[t];
  });

  i64 cur = -1*pow(10,10);
  i64 ans = 0LL;
  rep(i,n){
    if(l[ord[i]]>=cur){
      ans++;
      cur = r[ord[i]];
    }
  }

  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node {
	int value;
	struct node *next;
	struct node *prev;
};

typedef struct node NODE;

NODE *nil;
void init();
void insert(int x);
void delete(int x);
void deleteFirst();
void deleteLast();

void init() {
	nil = (NODE *)malloc(sizeof(NODE));
	nil->value = -1;
	nil->next = nil;
	nil->prev = nil;
}

void insert(int x) {
	NODE *tmp, *new, *next, *prev;

	new = (NODE *)malloc(sizeof(NODE));
	new->value = x;
	
	next = nil->next;
//	prev = next->prev;
	new->prev = nil;
	new->next = next;
	next->prev = new;
	nil->next = new;
	return;
}

void delete(int x) {
	NODE *inode, *next, *prev;
	for (inode = nil->next; inode->value != -1; inode = inode->next) {
		if (inode->value == x) {
			next = inode->next;
			prev = inode->prev;
			free(inode);
			prev->next = next;
			next->prev = prev;
			break;
		}
	}
	return;
}

void deleteFirst() {
	NODE *delete, *next, *prev;
	delete = nil->next;
	if (delete->value == -1) return;
	next = delete->next;
	prev = delete->prev;
	free(delete);
	prev->next = next;
	next->prev = prev;
	return;
}

void deleteLast() {
	NODE *delete, *next, *prev;
	delete = nil->prev;
	if (delete->value == -1) return;
	next = delete->next;
	prev = delete->prev;
	free(delete);
	prev->next = next;
	next->prev = prev;
	return;	
}

void showList() {
	NODE *inode;
//	printf("nil->value = %d\n", nil->value);
	for (inode = nil->next; inode->value != -1; inode = inode->next) {
		if (inode->next->value != -1) {
			printf("%d ", inode->value);
		} else {
			printf("%d\n", inode->value);
		}
	}
//	printf("\n");
}

int main(void) {
	int n, i, value;
	char cmd[20] = {0};
	
	init();
	scanf("%d", &n);

	for (i = 0; i < n; ++i) {
		scanf("%s", cmd);
		if (strcmp(cmd, "insert") == 0) {
			scanf(" %d", &value);
//			printf("%s %d\n", cmd, value);
			insert(value);
		} else if (strcmp(cmd, "delete") == 0) {
			scanf(" %d", &value);
//			printf("%s %d\n", cmd, value);
			delete(value);
		} else if (strcmp(cmd, "deleteFirst") == 0) {
//			printf("%s\n", cmd);
			deleteFirst();
		} else {
//			printf("%s\n", cmd);
			deleteLast();
		}
//		showList();
	}

	showList();
	
	
	return 0;
}

Measured memory_bytes: 31660
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll a,b,c;
  cin >> a >> b >> c;
  if(a+b>=c) pr("Yes");
  else pr("No");
}

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n,k,i;
	char s[60];
	scanf("%d %d",&n,&k);
	scanf("%s",s);
	switch(s[k-1])
	{
		case 'A' : s[k-1]='a'; break;
		case 'B' : s[k-1]='b'; break;
		case 'C' : s[k-1]='c'; break;
	}
	printf("%s",s);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <math.h>

using namespace std;

double min(double a,double b){
	if(a>=b)return b;
	else return a;
}

int main(){

	int d,e;
	while(cin>>d>>e){
		if(d==0 && e==0)break;
		double ans=100000000;
		for(int i=0;i<=d;i++){
			ans = min(fabs(sqrt((d-i)*(d-i)+i*i)-e),ans);
		}
		cout<<ans<<endl;
	}

	return 0;

}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
int f(int x) {
  return x*(x+1)/2;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b; cin>>a>>b;
  for (int i=1; i<999; i++) {
    int l = f(i);
    int r = f(i+1);
    if (l-a == r-b) out(l-a);
  }
  assert(0);
  

  return 0;
}


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

using namespace std;

using int64 = long long;

int main()
{
  int N, M;

  cin >> N;
  multiset< int > st;
  for(int i = 0; i < N; i++) {
    int d;
    cin >> d;
    st.emplace(d);
  }
  cin >> M;
  for(int i = 0; i < M; i++) {
    int t;
    cin >> t;
    if(st.count(t)) {
      st.erase(st.find(t));
    } else {
      cout << "NO" << endl;
      return(0);
    }
  }

  cout << "YES" << endl;
}

Measured memory_bytes: 9600