akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD=1e9+7;
const int INF=1<<29;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m=MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}

//-------------------< start here >-------------------------// 
const int N = 23;
int a[N];
void solve(){
  int n;
  cin >> n;
  int cnt = 0;
  for(int i = 1; i <= n; i++)
	    cin >> a[i];
  for(int i = 2; i <= n-1; i++){
	   vector<int> ans;
	   ans.push_back(a[i-1]);
	   ans.push_back(a[i]);
	   ans.push_back(a[i+1]);
	   sort(all(ans));
	   cnt += (a[i] == ans[1]);
	 }
	cout << cnt << endl;	
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


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

using namespace std;

int main(void){

    long n;
    cin >> n;
    long arr[50];
    int s = 0;

    if(n==1) {
        cout<<"0\n";
        return 0;
    }

    int i;
    while(true) {
        for(i = 2; i <= sqrt(n); i++) {
            if(n%i==0) {
                n /= i;
                arr[s] = i;
                s++;
                break;
            }
        }
        if(i>sqrt(n)) {
            arr[s] = n;
            s++;
            break;
        }
    }

    
    long arr2[50];
    int t = arr[0];
    int c = 0;
    arr2[0] = 0;
    for(i = 0; i < s; i++) {
        if(arr[i]==t) arr2[c]++;
        else {
            t = arr[i];
            c++;
            arr2[c] = 1;
        }
    }


    int sum = 0;
    for(i = 0; i <=c; i++) {
        t = 1;
        while(arr2[i]>=t) {
            arr2[i]-=t;
            t++;
        }
        sum+=(t-1);
    }
    cout<< sum<<"\n";

    



    return 0;
}

Measured memory_bytes: 3680
use std::io;
use std::str::FromStr;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {

    from_line!(n: u64);

    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let mut v: Vec<i64> = buf.split_whitespace()
            .map(|n| i64::from_str(n).unwrap())
            .collect();

    let mut flag = true;
    let mut count = 0;
    while flag {
        flag = false;
        for j in 1..n {
            if v[j as usize] < v[(j - 1) as usize] {
                let tmp = v[(j - 1) as usize];
                v[(j - 1) as usize] = v[j as usize];
                v[j as usize] = tmp;
                count += 1;
                flag = true;
            }
        }
    }

    for i in 0..v.len() {
        if i == v.len() - 1 {
            print!("{}", v[i]);
        }
        else {
            print!("{} ", v[i]);
        }
    }
    println!("");

    println!("{:?}", count);
}



Measured memory_bytes: 5040
n = int(input())
w = [input() for _ in range(n)]
ww = set(w)
if len(w) != len(ww):
    print("No")
    exit()
ans = True
for i in range(1, n):
    if w[i - 1][-1] != w[i][0]:
        ans = False
print("Yes" if ans else "No")

Measured memory_bytes: 3064
using System;
class Hoge {
  	public static void Main() {
      	var s = Console.ReadLine();
      	var ss = s.Split(' ');
		var d = int.Parse(ss[0]);
		var n = int.Parse(ss[1]);
      	for (var i = 1; true; i++) {
          	var x = i;
          	var c = 0;
          	while (x % 100 == 0) {
              	x /= 100;
              	c++;
            }
          	if (c == d) {
              	n--;
              	if (n == 0 ) {
                  	Console.WriteLine(i);
                  	break;
                }
            }
        }
    }
}

Measured memory_bytes: 11092
n = int(input())
a = [int(i) for i in input().split()]
i = 0
check = 1
satisfy = [False for i in range(n)]
break_block = 0
while i < n:
    if a[i] == check and not satisfy[check - 1]:
        satisfy[check - 1] = True
        check += 1
    else:
        break_block += 1
    i += 1
if not satisfy[0]:
    print(-1)
else:
    print(break_block) 

Measured memory_bytes: 25768
#include <stdio.h>
#include <iostream>
using namespace std;

int main() {
	int a[100], m[100] = {}, i = -1, mode = 0;
	while (cin >> a[++i]) {
		m[a[i]]++;
		if (mode < m[a[i]])
			mode = m[a[i]];
	}
	for (int j = 0; j < 100; j++) {
		if (mode == m[j])
			cout << j << endl;
	}
	return 0;
}


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

#define endl '\n'

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

    string s, t; cin >> s >> t;
    int a,b; cin >> a >> b;
    string u; cin >> u;
    if (u == s){
        cout << a-1 << " " << b << endl;
    } else cout << a << " " << b-1 << endl;
}

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

int n, k, a[101];

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

    cin >> n >> k;
    for(int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for(int j = 0; j < d; j++) {
            int x;
            cin >> x;
            a[x] = 1;
        }
    }

    int ans = 0;
    for(int i = 1; i <= n; i++)
        if(a[i] == 0) ans++;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);    
    
	 long long n,i,j,k,sum=0,count=0,ans=0,x,y,l,r,m;
     cin>>k>>x>>y;
     for(i=x;i<=y;i++)
     {
         if(i%k==0)
         {
             cout<<"OK"; return 0;
         }
     }
     cout<<"NG";
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#define rep(i,n) for(ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
int main(){
    string s;
    int ans = 0;

    cin >> s;
    int len = s.length();
    for(int i = 0; i < len/2; i++)
        if(s[i] != s[len-i-1]) ans++;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 200000;
int ai[2][N];
int ans;
int tr[N];
int A[N], B[N], C[N];
void add(int t, int d) {for (; t <= n; t += t & (-t)) tr[t] += d;}
int sum(int t) {int d = 0; for (; t; t -= t & (-t)) d += tr[t]; return d;}
void solve(int a[], int n, int p)
{
    memset(tr, 0, sizeof tr);
    for (int i = 1; i <= n; ++ i)
    {
        add(a[i], 1);
        ans ^= ((i - sum(a[i])) & 1) * p;
    }
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> A[i];
    for (int i = 1; i <= n; ++ i) cin >> B[i];
    for (int i = 1; i <= n; ++ i) cin >> C[i];
    for (int i = 1; i <= n; ++ i)
    {
        int a = A[i], b = B[i], c = C[i];
        if (a != c && (a - b) * (b - c) == 1 && b % 3 == 2 && !((((b + 1) / 3) ^ i) & 1))
        {
            ai[i & 1][(i + 1) / 2] = ((b + 1) / 3 + 1) / 2;
            ans ^= (a > b) * (i & 1? 1: 2);
        }
        else
        {
            cout << "No" << endl;
            return 0;
        }
    }
    solve(ai[0], n / 2, 1);
    solve(ai[1], (n + 1) / 2, 2);
    if (ans) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 3456
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, tmp;
    cin >> a >> b >> c;
    tmp = a;
    a = b;
    b = tmp;
    tmp = a;
    a = c;
    c = tmp;

    cout << a << " " << b << " " << c << endl;

}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int K = sc.nextInt();
		int X = sc.nextInt();

		sc.close();

		int xMin = X - (K - 1);
		int xMax = X + (K - 1);

		for (int i = xMin; i <= xMax; i++) {
			if (i != xMin) {
				out.print(" ");
			}
			out.print(i);
		}
		out.println();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 23252
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll X[N];
    ll sum = 0;
    ll centerA, centerB;
    rep(i, N){
        cin >> X[i];
        sum += X[i];
    }
    centerA = sum / N;
    centerB = centerA + 1;

    ll ansA = 0, ansB = 0;
    rep(i, N){
        ansA += (X[i] - centerA) * (X[i] - centerA);
        ansB += (X[i] - centerB) * (X[i] - centerB);
    }

    cout << min(ansA, ansB) << endl;

    return 0;
}

Measured memory_bytes: 3604
n, k = map(int,input().split())
lrl = []
for _ in range(k):
    lrl.append(list(map(int,input().split())))

N = 2 * n
# N: 処理する区間の長さ

data0 = [0]*(N+1)
data1 = [0]*(N+1)

mod = 998244353
# 区間[l, r)に x を加算
def _add(data, k, x):
    while k <= N:
        x %= mod
        data[k] += x
        data[k] %= mod
        k += k & -k
def add(l, r, x):
    _add(data0, l, -x*(l-1)%mod)
    _add(data0, r, x*(r-1)%mod)
    _add(data1, l, x)
    _add(data1, r, -x)

# 区間[l, r)の和を求める
def _get(data, k):
    s = 0
    while k:
        s += data[k]
        s %= mod
        k -= k & -k
    return s
def query(l, r):
    return _get(data1, r-1) * (r-1) + _get(data0, r-1) - _get(data1, l-1) * (l-1) - _get(data0, l-1)

add(1, 2, 1)
for i in range(n):
    now = query(i+1, i+2) 
    for l, r in lrl:
        add(l+i+1, r+i+2, now % mod)

print(query(n, n+1) % mod)


Measured memory_bytes: 76088
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int jil1=0,jil2=0,jil3=0,jil4=0;
	string s;
	getline(cin,s);
	for(int i=0;i<=s.length();i++)
	{
		if(s[i]=='C')
		{
			jil1=1;
			jil3=i;
		}
		if(s[i]=='F')
		{
			jil2=1;
			jil4=i;
		}
	}
	if(jil1&&jil2&&jil3<jil4)
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,m;
  cin >> n >> m;
  vector<ll> x(n),y(n),z(n);
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> z[i];
  }
  ll ans=0;
  for(int i=0;i<8;i++){
    ll sum=0;
    ll u=1,v=1,w=1;
    if(i&1){
      u=-1;
    }
    if((i>>1)&1){
      v=-1;
    }
    if((i>>2)&1){
      w=-1;
    }
    vector<ll> a(n);
    for(int j=0;j<n;j++){
      a[j]=x[j]*u+y[j]*v+z[j]*w;
    }
    sort(a.begin(),a.end(),greater<ll>());
    for(int j=0;j<m;j++){
      sum+=a[j];
    }
    ans=max(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<climits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
#include<deque>
#include<chrono>
using namespace std;
#define pi 3.141592653589793238


#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f0 get<0>
#define f1 get<1>
#define f2 get<2>
typedef vector<ll> vi;
typedef vector<vi> vvi;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    
    //cin >> T;
    while (T--) {
        ll h, w, k;
        cin >> h >> w >> k;
        string s[6];
        for(i = 0; i < h; i++){
            cin >> s[i];
        }
        ll ans = 0;
        bitset<6> row,col;
        for(i = 0; i < (1 << h); i++){
            for(j = 0; j < (1 << w); j++){
                ll cnt = 0;
                row = i, col = j;
                for(ll r = 0; r < h; r++){
                    for(ll c = 0; c < w; c++){
                        if(row[r] == 1 || col[c] == 1){
                            continue;
                        }
                        if(s[r][c] == '#')
                            cnt++;
                    }
                }
                if(cnt == k){
                    ans++;
                }
            }
        }
        cout << ans;
    }

    return 0;
}


Measured memory_bytes: 3576
#include <cstdio>
#include <cstdint>
#include <utility>

intmax_t gcd(intmax_t m, intmax_t n) {
  while (n) std::swap(m %= n, n);
  return m;
}

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

  intmax_t t = 1;
  intmax_t a = 1;
  for (int i = 0; i < N; ++i) {
    int T, A;
    scanf("%d %d", &T, &A);

    intmax_t t0 = (t+T-1)/T*T;
    intmax_t a0 = A*(t0/T);

    intmax_t a1 = (a+A-1)/A*A;
    intmax_t t1 = T*(a1/A);

    if (a0 < a) {
      t = t1;
      a = a1;
    } else {
      t = t0;
      a = a0;
    }
  }
  printf("%jd\n", t+a);
}


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

bool isPrime(int num){
    for (int tsumugi = 2; tsumugi <= pow(num, 0.5); tsumugi++){
        if (num % tsumugi == 0){
            return false;
        }
    }
    return true;
}

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

    int tmp = x;
    while (1){
        if (isPrime(tmp)){
            break;
        }
        tmp++;
    }

    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<cstring>
using namespace std;
int n,p,a[55],x=0,y=0;
unsigned long long gint=1;
int main(){
	cin>>n>>p;
	for (int i=0;i<n;i++){
		cin>>a[i];
		if (a[i]%2==0) y++;else x++;
	}
	unsigned long long cur1=0,cur2=0;
	if (p==0){
		if (x==1&&y==0){cout<<"1";return 0;}
		for (int i=2;i<=x;i+=2){
			gint=1;
			for(int j=1;j<=i;j++)	gint=(gint*(x-i+j))/j;
			cur1+=gint;
		}
		for (int i=1;i<=y;i++){
			gint=1;
			for (int j=1;j<=i;j++)	gint=(gint*(y-i+j))/j;
			cur2+=gint;
		}
		cout<<(cur2+cur1+cur1*cur2+1);
	}else{
		if (x==0) {cout<<"0";return 0;}
		for (int i=1;i<=x;i+=2){
			gint=1;
			for(int j=1;j<=i;j++)	gint=(gint*(x-i+j))/j;
			cur1+=gint;
		}
		for (int i=1;i<=y;i++){
			gint=1;
			for (int j=1;j<=i;j++)	gint=(gint*(y-i+j))/j;
			cur2+=gint;
		}
		cout<<(cur1*cur2+cur1);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int n, c;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c;
    v[i] -= c;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] > 0) {
      ans += v[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
p = 2019
s = input()
n = len(s)
M = [0]*(p)
M[0] = 1
m = 0
d = 1

for i in range(n):
  m = (m + int(s[-i-1])*d ) % p  
  M[m] += 1
  d = (d*10) % p
  
ans = 0  
for m in M:
  if m>=2:
    ans += m*(m-1)//2
    
print(ans)    

Measured memory_bytes: 9172
#include<iostream>
using namespace std;
long long gcd(long long a,long long b,long long r){
 return r?gcd(b,r,b%r):b;
}
int main(){
 long long N,a,b;
 a = 1;
 cin>>N;
 for(;N--;){
  cin >> b;
  a = a*(b/(a>b?gcd(a,b,a%b):gcd(b,a,b%a)));
 }
 cout<<a;
}

Measured memory_bytes: 256
import sys
from copy import copy


def main():
    length = int(sys.stdin.readline())
    given_cards = []
    for i in range(length):
        given_cards.append(sys.stdin.readline().strip())
    cards = []
    for i in ('S ', 'H ', 'C ', 'D '):
        for j in range(13):
            cards.append(i + str(j + 1))
    for card in copy(cards):
        if card in given_cards:
            del cards[cards.index(card)]
    for card in cards:
        print(card)
    return


if __name__ == '__main__':
    main()



Measured memory_bytes: 6336
import sys

n = int(input())
a = [list(map(int, input().split())) for i in range(2)]

candy_list = []
for i in range(n):
    sum_candy = 0
    
    for j in range(n-i):
        sum_candy += a[0][j]
    
    for j in range(n-i-1, n):
        sum_candy += a[1][j]

    candy_list.append(sum_candy)

print("{}".format(max(candy_list)))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)

#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int a,b,q;

int main()
{
    cin >> a >> b >> q;
    vll s(a+2), t(b+2);
    rep(i, a) cin >> s[i+1];
    rep(i, b) cin >> t[i+1];
    s[0] = -infl;
    s[a+1] = infl;
    t[0] = -infl;
    t[b + 1] = infl;
    rep(i,q){
        ll x;
        cin >> x;
        int sidx = lower_bound(all(s), x) - s.begin();
        int tidx = lower_bound(all(t), x) - t.begin();
        ll res = infl;
        res = min(res, min(
            max(s[sidx] - x, t[tidx] - x), 
            max(x - s[sidx - 1], x - t[tidx - 1])));
        res = min(res, min(
            (t[tidx] - x) + (x - s[sidx - 1]) + min((t[tidx] - x) , (x - s[sidx - 1])),
            (s[sidx] - x) + (x - t[tidx - 1]) + min((s[sidx] - x), (x - t[tidx - 1]))
                     ));
        cout << res << endl;
    }
}


Measured memory_bytes: 2944
#include<stdio.h>
main(){
  int n;
  long ans=100000;
  scanf("%d",&n);
  int i;

  for(i=0;i<n;i++){
    ans*=1.05;
    if(ans-((ans/1000)*1000) !=0)
      ans=((ans/1000)*1000)+1000;

  }

  printf("%ld\n",ans);
  return 0;

}

Measured memory_bytes: 592
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    X, K, D = [int(x) for x in input().split()]

    kcnt = abs(X) // D

    if kcnt >= K:
        print(abs(X) - (K * D))
        return

    ans1 = abs(X) % D
    ans2 = abs(ans1 - D)

    if (K - kcnt) % 2 == 0:
        print(ans1)
    else:
        print(ans2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9184
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	// int型配列の表示
	public static void printArray (int[] array) {
		for (int i = array.length - 1; i >= 0; i--) {
			System.out.print(array[i]);
			if (i != 0) System.out.print(" ");
		}
		System.out.println();
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] nums = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		Arrays.sort(nums);
		printArray(nums);

	}

}

Measured memory_bytes: 17172
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;

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;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	printf("%d \n", (1<<M)*(1900*M+100*(N-M)));
	return 0;
}


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

int main(){
  int n, l;
  cin >> n >> l;
  string s[n];
  for(int i = 0; i < n; i++)
    cin >> s[i];

  sort(s, s + n);

  for(int i = 0; i < n; i++)
    cout << s[i];

  cout << endl;
      
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305;
int n,s,be[N],a[N][N],b[N][N];
char S[N*N];
long double pi=acos(-1);
int main()
{
   // cout<<cos(pi/4)<<endl;
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    long double w1=0.5,w2=6.0;
    int tot=h*60+m;
    long double d1=w1*1.0*tot;
    while(fabs(d1-360.0)>1e-5){
            if(d1<359) break;
        d1-=360;
    }
   long  double d2=w2*tot;
    while(fabs(d2-361.0)>1e-5){
         if(d2<359) break;
         d2-=360;
    }
  //    cout<<d1<<" "<<d2<<endl;
    if(fabs(d1-d2)<=180.0) d1=fabs(d1-d2);
    else d1=360-fabs(d1-d2);
    //cout<<d1<<endl;
    double kk=cos(d1/180.0*pi);
   // cout<<kk<<endl;
    double ans=sqrt(1.0*a*a+1.0*b*b-2*a*b*kk);
    printf("%.20f\n",ans);
}


Measured memory_bytes: 4000
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

l = list(map(int, input().split()))

if any(v % 2 == 0 for v in l):
    print(0)
else:
    l = sorted(l)
    print(l[0]*l[1])


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll a[87];
  a[0]=2;a[1]=1;
  repi(i,2,87) a[i]=a[i-1]+a[i-2];
  int n;
  cin>>n;
  cout<<a[n]<<endl;

  return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int n, k;
    cin >> n;
    vector<int> a(n), ans(n);
    rep(i,n) {
        cin >> a[i];
        ans[a[i]-1] = i+1;
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
    return 0;
}

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

namespace Competition
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var C = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var AB = new List<Tuple<int, int>>();
            for(var i = 0; i < N; i++)
            {
                AB.Add(new Tuple<int, int>(a[i] - 1, b[a[i] - 1]));
            }
            var res = 0;
            var n = AB[0].Item1;
            foreach(var ab in AB)
            {
                res += ab.Item2;
                if ((n + 1) == ab.Item1) res += C[n];
                n = ab.Item1;
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll
#define endl '\n'

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> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

pii visit(int p, int v, const vector<vi> &g) {
    pii r(0, v);
    for(int e : g[v]) if (e != p) {
            pii t = visit(v, e, g);
            t.first += 1;
            if (r.first < t.first) r = t;
        }
    return r;
}
int diameter(const vector<vi> &g) {
    pii r = visit(-1, 0, g);
    pii t = visit(-1, r.second, g);
    return t.first; // (r.second, t.second) is farthest pair
}

int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    while(cin >> n){
        vector<vi> g(n);
        REP(i, n - 1) {
            int u, v;
            cin >> u >> v; u--; v--;
            g[u].push_back(v);
            g[v].push_back(u);
        }
        int d = diameter(g);
        puts(d % 3 == 1 ? "Second" : "First");
    }
    return 0;
}


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

int main() {
    int h, w;
    cin >> h >> w;
    rep(i, h) {
        string str;
        cin >> str;
        rep(j, 2) cout << str << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int a[1000];
int n;
int mizu = 0;

int mizuyari(int start, int end)
{
    bool flag = true;
    if (start >= end)
    {
        return 0;
    }
    for (int i = start; i < end; i++)
    {
        if (a[i] == 0)
        {
            flag = false;
            return mizuyari(start, i) + mizuyari(i + 1, end);
        }
    }
    if (flag)
    {
        for (int i = start; i < end; i++)
        {
            a[i]--;
        }
        return mizuyari(start, end) + 1;
    }
}

int main(void)
{
    cin >> n;
    REP(i, n)
    {
        cin >> a[i];
        //cout << a[i];
    }
    cout << mizuyari(0, n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n,i,j;
  	long long ans=0;
    cin >> n;
    vector<long long> v(n);
  	for(i=0;i<n;i++) cin >> v[i];
    sort(v.begin(),v.end());

    vector<long long> v2(1010);
    for(i=0;i<1010;i++) v2[i] = 0;
    for(i=0;i<n;i++) v2[v[i]] += 1;
    for(i=1;i<1010;i++) v2[i] = v2[i-1]+v2[i];
	
  	/*
    for(int i=0;i<1010;i++) {

        cout << v2[i] << " ";
    }
    cout << endl;*/

    for(i=0;i<n;i++) {
        for(j=0;j<n;j++) {
          	if(i==j) continue;
          	long long c=0;
            long long mx = min((long long)1010,v[i]+v[j])-1;
            long long mn = max(v[i],v[j]) - min(v[i],v[j]);
          	c += (v2[mx] - v2[mn]);
          	
          	if(v[i] <= mx && mn < v[i]) c-=1;
          	if(v[j] <= mx && mn < v[j]) c-=1;
          	ans+=max((long long)0,c);
        }
    }
 	cout << ans/6 << endl;
}
//

Measured memory_bytes: 3552
N = int(input())
V_list = [int(i) for i in input().split()]
C_list = [int(i) for i in input().split()]

max_point = 0
for i in range(N) :
    p = V_list[i] - C_list[i]
    if (p > 0) :
        max_point += p

print(max_point)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
 
typedef long long ll;

#define rep(i,n) for(ll i = 0; i < n; i++)
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

ll m[2000000] = {};
 
int main(){
  ll n, all=0;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) m[a[i]]++;
  rep(i,300000) all += (m[i]*(m[i]-1))/2;

  rep(i,n){
    cout << all - (m[a[i]]*(m[a[i]]-1)/2) + ((m[a[i]]-1)*(m[a[i]]-2)/2) << endl;
  }
}


Measured memory_bytes: 4736
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

// konoshita kara kaku

int main(void){
	int a=in(),b=in(),x=in();
	puts(a<=x&&x<=a+b?"YES":"NO");
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


N = int(input())
DATA = [list(map(int, input().split())) for i in range(N)]

dp = [[0 for _ in range(3)] for _ in range(N + 1)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + DATA[i][k])

res = 0

for v in range(3):
    res = max(res, dp[N][v])

print(res)


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

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

/*-------------------------------------------*/

int n,a[100009];
ll sum;

int main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    sort(a,a+n);
    int ans=0;
    rep(i,n-1){
        sum+=a[i];
        if(sum*2<a[i+1])ans=i+1;
    }
    cout<<n-ans<<endl;
}

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

#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define haha(j,a,n) for(ll j=a;j<n;i++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bhand(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define bhar(a) rep(i,n) cin>>a[i];
#define show(a) rep(i,n) cout<<a[i]<<" ";
#define sott(a) sort(bhand(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(ll a, ll b){if(b==0) return a; else return gcd(b,a%b);}
int main(){
    ios
    string s;
    cin>>s;
    rep(i,s.size()-1) if(s[i]==s[i+1]) {cout<<"Bad"; return 0; } 
    cout<<"Good";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int S=0,T=1;
struct bian{int nxt,to,f;}bi[400040];
int n,p[100010],q[100010],blp[100010],blq[100010],cnt=1,head[200020],num=1,cur[200020],dep[200020],ans;
bool vis[100010];
inline void add(int from,int to,int f){bi[++num]=bian{head[from],to,f};head[from]=num;}
inline void ADD(int from,int to,int f){add(from,to,f),add(to,from,0);}
bool bfs()
{
	queue<int>q;
	memset(dep,0,cnt+1<<2);
	memcpy(cur,head,cnt+1<<2);
	dep[S]=1,q.push(S);
	int x,y;
	while(!q.empty())
	{
		x=q.front();q.pop();
		for(int i=head[x];i;i=bi[i].nxt)
			if(bi[i].f)
			{
				y=bi[i].to;
				if(!dep[y])dep[y]=dep[x]+1,q.push(y);
			}
	}
	return dep[T]!=0;
}
int dfs(int v,int last)
{
	if(v==T)
	{
		ans-=last;
		return last;
	}
	int now=0;
	for(int &i=cur[v],u;i;i=bi[i].nxt)
	{
		u=bi[i].to;
		if(!bi[i].f||dep[u]!=dep[v]+1)continue;
		int dmin=dfs(u,min(last,bi[i].f));
		now+=dmin,last-=dmin;
		bi[i].f-=dmin,bi[i^1].f+=dmin;
		if(!last)break;
	}
	return now;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&p[i]),++p[i];
	for(int i=1;i<=n;++i)scanf("%d",&q[i]),++q[i];
	for(int i=1,x;i<=n;++i)
		if(!vis[i])
		{
			++cnt;x=i;
			while(!vis[x])vis[x]=1,blp[x]=cnt,x=p[x];
		}
	memset(vis+1,0,n);
	for(int i=1,x;i<=n;++i)
		if(!vis[i])
		{
			++cnt;x=i;
			while(!vis[x])vis[x]=1,blq[x]=cnt,x=q[x];
		}
	for(int i=1;i<=n;++i)
	{
		if(p[i]==i&&q[i]==i)continue;
		++ans;
		if(p[i]==i)ADD(blq[i],T,1);
		else if(q[i]==i)ADD(S,blp[i],1);
		else if(p[i]==q[i])ADD(blp[i],blq[i],1),ADD(blq[i],blp[i],1);
		else ADD(blq[i],blp[i],1);
	}
	while(bfs())while(dfs(S,0x3f3f3f3f));
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;

template<typename Value>
class segment_tree {
    size_t n;
    vector<Value> nodes;
    function<Value(Value, Value)> bin_op;
    Value zero_elem;
public:
    template<typename Iter>
    segment_tree(Iter iter, size_t size,
                 const function<Value(Value, Value)>& bin_op = std::min,
                 const Value& zero_elem = numeric_limits<Value>::max())
            : bin_op(bin_op), zero_elem(zero_elem) {
        n = 1;
        while (n < size) {
            n <<= 1;
        }
        nodes.resize(2 * n - 1, zero_elem);
        for (size_t i = 0; i < size; i++) {
            nodes[n - 1 + i] = *iter;
            ++iter;
        }
        for (size_t i = n - 1; i > 0; i--) {
            nodes[i - 1] = bin_op(nodes[2 * i - 1], nodes[2 * i]);
        }
    }
    Value find_in(size_t begin, size_t end) {
        return find_in(begin, end, 0, 0, n);
    }
    void update(size_t index, const Value& value) {
        update(index, [&](Value) { return value; });
    }
    void update(size_t index, const function<Value(Value)>& unary_op) {
        index += n - 1;
        nodes[index] = unary_op(nodes[index]);
        while (index > 0) {
            index = (index - 1) / 2;
            nodes[index] = bin_op(nodes[2 * index + 1], nodes[2 * index + 2]);
        }
    }
private:
    Value find_in(size_t begin, size_t end, size_t index, size_t left, size_t right) {
        if (right <= begin || end <= left) {
            return zero_elem;
        }
        if (begin <= left && right <= end) {
            return nodes[index];
        }
        auto left_value = find_in(begin, end, 2 * index + 1, left, (left + right) / 2);
        auto right_value = find_in(begin, end, 2 * index + 2, (left + right) / 2, right);
        return bin_op(left_value, right_value);
    }
};



uint32_t c2mask(char c) {
    return 1ull << (c - 'a');
}

int main() {
    int N;
    cin >> N;
    vector<uint32_t> masks(N);
    for (int i : irange(0, N)) {
        char c;
        cin >> c;
        masks[i] = c2mask(c);
    }
    segment_tree<uint32_t> stree(masks.begin(), N,
        [](uint32_t a, uint32_t b){ return a | b; }, 0u);
    int Q;
    cin >> Q;
    for (int i : irange(0, Q)) {
        int type;
        cin >> type;
        if (type == 1) {
            size_t j;
            char c;
            cin >> j >> c;
            stree.update(j-1, c2mask(c));
        } else if (type == 2) {
            size_t l, r;
            cin >> l >> r;
            uint32_t mask = stree.find_in(l-1, r);
            cout << __builtin_popcount(mask) << '\n';
        }
    }
}


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

int main()
{
	int a, b, c, sum{};
	scanf("%d%d%d", &a, &b, &c);
	sum = a + b + c;
	if (sum == a * 2 || sum == b * 2 || sum == c * 2)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int X, a, b;
    cin >> X >> a >> b;
    cout << ( X - a ) % b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
using namespace std;
int inf = 1e9;
int main(){

  int n; cin >> n;
  vector<long long int> a(n);

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

  long long int sum = 0;
  for(int i=0; i<n; i++){
    sum += (a[i]-1);
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] a = new int[3];
		for (int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		int ans = a[2] * 10 + a[1] + a[0];
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<std::pair<long long, long long>> e;
    for (int i = 0; i < n; i++) {
        long long x, l; std::cin >> x >> l;
        e.emplace_back(x - l, x + l);
    }
    std::sort(e.begin(), e.end(), [](auto &a, auto &b) {
        return a.second < b.second;
    });
    long long ans = 0, prev = -1e18;
    for (int i = 0; i < n; i++) {
        if (prev <= e[i].first) {
            ans++;
            prev = e[i].second;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int a, b;
  cin >> a >> b;
  if (a * b % 2 == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n, a, b;
    cin >> n >> a >> b;
    if (a + b > n + 1 || (ll)a * b < n) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> ans;
    vector<int> now;
    int cnt = 0;
    rep(i, n) {
        if (n + 1 - i == a) {
            reverse(ALL(now));
            for (auto t : now) {
                ans.emplace_back(t);
            }
            now.resize(0);
            a--;
        } else if (cnt == b) {
            reverse(ALL(now));
            for (auto t : now) {
                ans.emplace_back(t);
            }
            now.resize(0);
            a--;
            cnt = 0;
        }
        now.emplace_back(i + 1);
        cnt++;
    }
    reverse(ALL(now));
    for (auto t : now) {
        ans.emplace_back(t);
    }
    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4080
#include<iostream>  
#include<cstdio>  
#include<cstring>  
#include<algorithm>  
#include<queue>  
  
using namespace std;  
const int MAXN = 210;  
const int  INF = 0x3f3f3f;  
  
int dirt[4][2]={{1,0},{-1,0},{0,-1},{0,1}};  
char map[MAXN][MAXN];  
int vis[MAXN][MAXN];  
int n,m;//,flag;  
int sx,sy;  
int num1 = INF,num2 = INF;  
  
  
struct node{  
    int x,y,num;  
};  
void BFS(){  
    vis[sx][sy]=1;  
    queue<node>q;  
    node a,b;  
    a.x=sx,a.y=sy,a.num = 0;  
    q.push(a);  
    while(!q.empty()){  
        a = q.front();  
        q.pop();  
        for(int i=0;i<4;i++){  
            b.x = a.x+dirt[i][0];  
            b.y = a.y+dirt[i][1];  
            b.num = a.num+1;  
            if(b.x<0||b.x>=n||b.y<0||b.y>=m){  
                continue;  
            }  
            if(map[b.x][b.y] == '#'){  
                continue;  
            }  
            if(map[b.x][b.y]=='@'){  
                //flag=1;  
                num1 = min(num1,b.num);  
                //continue;  
                continue;  
            }  
            if(map[b.x][b.y] == '$'){  
                //flag=0;  
                num2 = min(num2,b.num);  
                continue;  
                //continue;  
            }  
            if(map[b.x][b.y] == '.' && !vis[b.x][b.y]){  
                vis[b.x][b.y] = 1;  
                q.push(b);  
            }  
  
        }  
        //if(flag){  
            //return;  
        //}  
  
  
  
    }  
}  
int main(){  
  
    char s[210];  
    scanf("%d%d",&n,&m);  
    for(int i=0;i<n;i++){  
        scanf("%s",s);  
        //int l = strlen(s);  
        for(int j=0;s[j] != '\0';j++){  
            map[i][j] = s[j];  
            if(map[i][j]=='%'){  
                sx = i,sy=j;  
            }  
        }  
    }  
    BFS();  
    if(num1 < num2)  
        printf("Yes\n");  
    else  
        printf("No\n");  
    return 0;  
}

Measured memory_bytes: 3368
def check(n, da):
    for i in da:
        if i%2 == 0:
            if not(i%3 == 0 or i%5 == 0):
                return False
    return True


n = int(input())
#s = input()
#a, b, c = map(int,input().split())
da = list(map(int,input().split()))

if check(n, da):
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 2940
# -*- coding: utf-8 -*-

import sys


def eratosthenes_sieve(n):
    table = [0]*(n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return prime_list


def prime(n):
    return eratosthenes_sieve(n)

def main():
    inp = [int(n) for n in sys.stdin]
    for n in inp:
        n_pn = len(prime(n))
        print(n_pn)

if __name__ == '__main__':
    main()

Measured memory_bytes: 18968
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <numeric>

using namespace std;


class ListNode {
public:
    int val;
    ListNode *next;
    ListNode(int val) {
        this->val = val;
        this->next = NULL;
    }
};

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};



int main() {
  int n; cin >> n;
  vector<int> vi(n);
  for (int i = 0; i < n; ++i) cin >> vi[i];
  long long sum = 0LL;
  for (int num : vi) sum += num;
  long long left = vi[0];
  long long res = abs(sum - left - left);
  for (int i = 1; i + 1 < n; ++i) {
    left += vi[i];
    long long tmp = abs(sum - left - left);
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1024
def solve():
    s = input()

    invs = ''.join(list(reversed(s)))

    while 1:
        for f in map(lambda x: ''.join(list(reversed(x))), ["erase", "eraser", "dream", "dreamer"]):
            if invs.startswith(f):
                invs = invs[len(f):]
                break
            if invs == "":
                print("YES")
                return
        else:
            print("NO")
            return


if __name__ == '__main__':
    solve()


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

#define rep(i,n) for(ll i=0; i<(n); i++)
#define reps(i,x,n) for(ll i=x; i<(n); i++)
#define rrep(i,n) for(ll i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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 A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;


int main(){
	//ios_base::sync_with_stdio(0);
	ll N, A, B, C, D;

	cin >> N >> A >> B >> C >> D;

	bool ans = false;
	rep(i,N){
		//cout << "top: " << A + C*i << ":" << A + D*i << endl;
		ll upper = A + D*i - C*(N-i-1);
		ll lower = A + C*i - D*(N-i-1);
		if( lower <= B && B <= upper ){
			//cout << i << " " << lower << ":" << upper << endl;
			ans = true;
		}
	}

	cout << (ans ? "YES" : "NO" ) << endl;

	return 0;
}


Measured memory_bytes: 256