akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

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

  ll ans;
  if(k % 2 == 1) ans = pow(n/k, 3);
  else{
    int cnt_1 = 0, cnt_2 = 0;
    repm(i,1,n+1){
      if(i % k == 0) cnt_1++;
      if(i % k == k/2) cnt_2++;
    }
    ans = pow(cnt_1,3)+pow(cnt_2,3);
  }

  cout << ans << endl;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    for (int i=0; i<M; i++) cin >> a.at(i) >> b.at(i);

    for (int i=1; i<=N; i++){
        int sum = 0;
        for (int j=0; j<M; j++){
            if (a.at(j) == i || b.at(j) == i) sum++;
        }
        cout << sum << endl;
    }
}

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

int main(){
  int n;
  int num = 0;
  cin >> n;
  for(int i = 0;i<n;++i){
    int a,b;
    cin >> a >> b ;
    num += b - a + 1;
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n, flag=0;
    char s[101][11];
    
    scanf("%d", &n);
    rep(i, n){
        scanf("%s", s[i]);
    }
    
    rep(i, n-1){
        for (int j=i+1; j<n; j++) {
            if (!strcmp(s[i], s[j])) {
                printf("No\n");
                return 0;
            }
        }
    }
    
    for (int i=1; i<n ; i++) {
        int a=strlen(s[i-1]);
        if (s[i][0]!=s[i-1][a-1]) {
            printf("No\n", s[i]);
            return 0;
        }
    }
    
    printf("Yes\n");
    
    return 0;
}


Measured memory_bytes: 1728
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#x = int(input())
n, m = map(int, sys.stdin.readline().split())
#s = input()
h = list(map(int, sys.stdin.readline().split()))

l = []
for i in range(m):
    a, b = map(int, sys.stdin.readline().split())
    if h[a-1] > h[b-1]:
        l.append(b)
    elif h[b-1] > h[a-1]:
        l.append(a)
    else:
        l.append(a)
        l.append(b)


c = collections.Counter(l)
print(n-len(c))


Measured memory_bytes: 22416
a,b,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
l = []

M = min(A)+min(B)

for i in range(m):
    x,y,c = map(int,input().split())
    t = A[x-1]+B[y-1]-c
    M = min(M,t)

print(M)

Measured memory_bytes: 18736
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
typedef long long ll;
int a,b,c,ans,N,M,tt;
char x[7];
int main(){
	scanf("%d%d",&N,&a);
	if (a<=0&&a+N-1>=0) printf("%d\n",(a+a+N-1)*N/2);
	else if (abs(a)<abs(a+N-1)) printf("%d\n",(a+a+N-1)*N/2-a);
	else printf("%d\n",(a+a+N-1)*N/2-(a+N-1));
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      if(n%10==3){
      	System.out.println("bon");
      }else if(n%10==0||n%10==1||n%10==6||n%10==8){
        System.out.println("pon");
      }else{
      	System.out.println("hon");
      }
	}
}

Measured memory_bytes: 35892
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <numeric>
#include <list> 
#include <cmath>

using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(),x.end()
#define INF (1e9)

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

int main() {
	int n;
	cin >> n;
    int t, a;
    cin >> t >> a;
    double opt = INF;
    int ans;
    int h;
    REP(i, n) {
        cin >> h;
        double tmp = abs((t - h * 0.006) - a);
        if (opt > tmp) {
            opt = tmp;
            ans = i + 1;
        }
    }
    printf("%d\n", ans);
}

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

using namespace std;

#define long long long
#define INF ((long) 2e18)
#define MOD ((long) (1e9 + 7))
#define umap unordered_map

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

    long t = 1;
    //cin >> t;

    while (t--) {
        string s;
        cin >> s;

        bool ok1 = count(s.begin(), s.end(), 'A');
        bool ok2 = count(s.begin(), s.end(), 'B');
        if (ok1 and ok2) puts("Yes");
        else puts("No");
    }
}


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

using namespace std;
const int N = 1e5 + 10;

int a[N] , b[N] , f[N] , sz[N] , xorsuma , xorsumb , _a[N] , _b[N] , n , cnt;

int F(int x) {
	if (f[x] != x) {
		f[x] = F(f[x]);
	}
	return f[x];
}

int main() {
	scanf("%d",&n);
	for (int i = 1; i <= n; i++) {
		scanf("%d",a + i);

		_a[i] = a[i];
		xorsuma ^= a[i];
	}

	for (int i = 1; i <= n; i++) {
		scanf("%d",b + i);
		_b[i] = b[i];
		xorsumb ^= b[i];
	}
	n++;
	_a[n] = a[n] = xorsuma;
	_b[n] = b[n] = xorsumb;

	sort(_a + 1 , _a + 1 + n);
	sort(_b + 1 , _b + 1 + n);

	for (int i = 1; i <= n; i++) {
		if (_a[i] != _b[i]) {
			return puts("-1") , 0;
		}
	}
	cnt = unique(_a + 1 , _a + 1 + n) - _a - 1;

	for (int i = 1; i <= n; i++) {
		a[i] = lower_bound(_a + 1 , _a + 1 + cnt , a[i]) - _a;
		b[i] = lower_bound(_a + 1 , _a + 1 + cnt , b[i]) - _a;
	}

	for (int i = 1; i <= cnt; i++) f[i] = i , sz[i] = 1;

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] != b[i] || i == n) {
			ans += i < n;
			int fathera = F(a[i]) , fatherb = F(b[i]);
			if (fathera != fatherb) {
				sz[fathera] += sz[fatherb];
				f[fatherb] = fathera;
			}
		}
	}
	for (int i = 1; i <= cnt; i++) {
		if (sz[F(i)] == 1) {
			continue;
		} else if (F(i) == i && sz[F(i)] > 1) {
			ans ++;
		}
	}
	if (sz[F(a[n])] != 1) ans --;

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

Measured memory_bytes: 2560
//h w
//abc
//arc
#include <iostream>
#include <string>
using namespace std;
int main(){
 int h, w;
 cin >> h >> w;
 string result = "";
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 for(int i = 0; i < h; i++){
  string s; cin >> s;
  result += "#" + s + "#\n";
 }
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 cout << result << endl;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(void)
{
	int n,i,j,m,gen,c,cnt;
	int sizi[10001],me[10001];
	scanf("%d %d",&n,&m);
	while(!(n==0 && m==0)){
		gen=1;
		cnt=0;
		for(i=1;i<=n;i++){
			scanf("%d",&sizi[i]);
		}
		for(i=1;i<=m;i++){
			scanf("%d",&me[i]);
		}
		for(i=1;i<=m;i++){
			gen=gen+me[i];
			c=sizi[gen];
			gen=gen+c;
			cnt++;
			if(n<=gen){
				break;
			}
		}
		printf("%d\n",cnt);
		scanf("%d %d",&n,&m);
	}
	return 0;
}

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

vector<int64_t> get_divisors(int64_t n)
{
    vector<int64_t> list;
    for (int64_t i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            list.push_back(i);
            if (n / i != i)
                list.push_back(n / i);
        }
    }
    return list;
}

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

    int64_t res = 0;
    for (auto &&K : get_divisors(N))
    {
        if (K == 1)
        {
            continue;
        }
        int64_t n = N;
        while (n % K == 0)
        {
            n /= K;
        }
        if (n % K == 1)
        {
            res++;
        }
    }
    res += get_divisors(N - 1).size() - 1;

    cout << res << endl;
}

Measured memory_bytes: 384
Imports System

Module Program
    Sub Main(args As String())
        Dim iInput As Long = Console.ReadLine()
        Dim i As Long
        Dim iSum As Long = 0
        For i = 1 To iInput
            If (i Mod 3) = 0 And (i Mod 5) = 0 Then
            ElseIf (i Mod 5) = 0 Or (i Mod 3) = 0 Then
            Else
                iSum += i
            End If
        Next
        Console.WriteLine(iSum)
    End Sub
End Module


Measured memory_bytes: 28348
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S, T; cin >> S >> T;

  string result = "No";
  rep(i, S.length()) {
    string tmps = "";
    rep(j, S.length()) tmps += S[(i+j)%S.length()];
    if (tmps==T) result = "Yes";
  }

  cout << result << endl;
  return 0;
}

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

int	main() {
	int	N,M;
  	cin >> N >> M;
  	
  	vector<int> amount(N);
  	for (int i=0;i<M;i++) {
    	int	a, b;
      	cin >> a >> b;
      	amount.at(a-1)++;
      	amount.at(b-1)++;
    }
  	for (int i=0;i<N;i++) cout << amount.at(i) << endl;
}

Measured memory_bytes: 256
while 1:
    data=list(map(int,input().split()))
    
    if data[0]==0:break
    
    for i in range(data[0]):
        for j in range(data[1]):
            if i==0 or i==data[0]-1 or j==0 or j==data[1]-1:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7000
n=int(input())
a=list(map(int,input().split()))

l=[]
flag=0
for aa in a:
  if aa%2==0:
    flag=1
    l.append(aa)

if flag==1:   
  for ll in l:
    if ll % 3!=0 and ll % 5!=0:
	    flag=2

if flag==0:
  print('APPROVED')
elif flag==1:
  print('APPROVED')
elif flag==2:
  print('DENIED')


Measured memory_bytes: 61420
n=int(input())
A=['S','H','C','D']
C=[[0 for i in range(13)]for j in range(4)]

for i in range(n):
      ch,B=input().split()
      B=int(B)
      C[A.index(ch)][B-1]=1
for i in range(4):
    for j in range(13):
        if C[i][j]==0:
            print(A[i],j+1)


Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {
    private int n;
    private int k;
    private int[] w;

    public Main(int n, int k, int[] w) {
        this.n = n;
        this.k = k;
        this.w = w;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] w = new int[n];
        for (int i = 0; i < n; i++) {
            w[i] = in.nextInt();
        }
        Main test = new Main(n, k, w);
        System.out.println(test.solve());

    }

    public int solve() {
        int left = 0;
        int right = 100000 * 10000; // 货物数 * 1件货物的最大重量，即最大货物总重量
        int mid;
        while (right - left > 1) {
            mid = (left + right) / 2;
            if(check(mid) >= n) right = mid;
            else left = mid;
        }

        return right;
    }

    public int check(int p) {
        int count = 0;
        for (int i = 0; i < k; i++) {
            int s = 0;
            while (s + w[count] <= p) {
                s += w[count];
                count++;
                if (count == n) return n;
            }
        }
        return count;
    }
}



Measured memory_bytes: 70740
N,K = map(int,input().split())
S = input()
answer = 0


if S[K-1] == 'A':
    S = S[:K-1] + 'a' + S[K:]
    print(S)
elif S[K-1] == 'B':
    S = S[:K-1] + 'b' + S[K:]
    print(S)
elif S[K-1] == 'C':
    S = S[:K-1] + 'c' + S[K:]
    print(S)

Measured memory_bytes: 3064
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val l = in.readLine().toDouble

    val result = (l / 3.0) * (l / 3.0) * (l / 3.0)
    out.println(f"$result%.12f")

    out.flush()
  }
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    double ans = 0;
    while (n--) {
        double x;
        string s;
        cin >> x >> s;
        if (s == "JPY") {
            ans += x;
        } else {
            ans += x * 380000;
        }
    }
    printf("%.15f\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H, ".");
  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }
  
  // 横一列の圧縮
  for (int i = 0; i < H; i++) {
    bool erase_flag = true;
    
    for (int j = 0; j < W; j++) {
      if(a.at(i).at(j) == '#'){
        erase_flag = false;
        break;
      }
    }
    
    if(erase_flag) {
      for (int j = 0; j < W; j++) {
        a.at(i).at(j) = '-';
      }
    }
  }
  
  // 縦一列の圧縮
  for (int i = 0; i < W; i++) {
    bool erase_flag = true;
    
    for (int j = 0; j < H; j++) {
      if(a.at(j).at(i) == '#'){
        erase_flag = false;
        break;
      }
    }
    
    if(erase_flag) {
      for (int j = 0; j < H; j++) {
        a.at(j).at(i) = '-';
      }
    }
  }
  
  
  for (int i = 0; i < H; i++) {
    bool newline_flag = true;
    int char_count = 0;
    
    for (int j = 0; j < W; j++) {
      if(a.at(i).at(j) != '-'){
        cout << a.at(i).at(j);
      }
      else {
        char_count++;
        if(char_count >=W) {
          newline_flag = false;
        }
      }
    }
    if(newline_flag)
      cout << endl;
  }
}

Measured memory_bytes: 256
/*
在奇数位置中的每个字符（1个 -st，3 -rd，5个，\ ldots）是R，U，或D。
在偶数位置中的每个字符（2 -nd，4个，6个，\ ldots）是L，U，或D。
*/
#include <stdio.h>
#include <string.h>
int main()
{
	int i,n,t;
	t=0;
	char a[100];
	scanf("%s",a);
	for(i=0;i<strlen(a);i++)
	{
		if(i%2==0)
		{
			if(a[i]=='R'||a[i]=='U'||a[i]=='D')
				t++;
		}
		else
		{
			if(a[i]=='L'||a[i]=='U'||a[i]=='D')
				t++;
		}
	}
	if(t==strlen(a))
		printf("Yes");
	else
		printf("No");
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;

int main(void){
  string s;
  cin >> s;

  string wed[] = {"Sunny", "Cloudy", "Rainy"};

  for(int i = 0; i < 3; i++){
    if(s == wed[i]){
      cout << wed[(i+1)%3] << endl;
    }
  }
}

Measured memory_bytes: 256
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<double, double>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007;

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

int main() {
	int n, k;
	cin >> n >> k;
	ll a[n];
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, (a + n));

	ll c[n + 3];
	c[k - 1] = 1;

	for(ll i = k - 1; i <= n + 1; i++) {
		ll cur = ((i + 1) * c[i]) % mod;
		//cout << "i:" << i << " cur:" << cur << " :" << i + 1 - k + 1 << endl;

		c[i + 1] = cur * modinv(i + 1 - k + 1, mod) % mod;
	}
	

	ll plus = 0;
	ll minus = 0;

	for(int i = k - 1; i < n; i++) {
		plus = (plus + a[i] * c[i]) % mod;  
		
	}

	// min
	for (int i = 0; i <= n - k; i++) {

		minus = (minus + a[i] * c[n - i - 1]) % mod;  
	}
	cout << (plus - minus + mod) % mod << endl;

	return 0;
}


Measured memory_bytes: 4320
(def parse-input
  (fn [s]
    (mapv #(Integer/parseInt %) (clojure.string/split s #" "))))

(def res
  (fn [[h a]]
    (+ (quot h a)
       (if (zero? (rem h a)) 0 1))))

(println
 (-> (read-line)
     parse-input
     res))


Measured memory_bytes: 81260
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    t = 0
    for x in a:
        t += x

    ans = n - t
    if ans >= 0:
        print(ans)
    else:
        print(-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10008
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
int main(){
  int n, c=0;
  cin >> n;
  int64_t vec[n];
  rep(i, n) cin >> vec[i];
  rep(i, n){
    for(int j=i;j<n;j++){
      for(int k=j;k<n;k++){
        vector<int64_t> a(3);
        a.at(0)=vec[i];
        a.at(1)=vec[j];
        a.at(2)=vec[k];
        if(a[0]!=a[1] && a[1]!=a[2] && a[0]!=a[2]){
         if(a[0]+a[1]>a[2] && a[0]+a[2]>a[1] && a[1]+a[2]>a[0]) c++;
        }
      }
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define reo(i,n) for(int (i) = 1 ; (i) <= (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ 0,0,-1,1 }, dy{ 1,-1,0,0 };
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; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------------------
int n;
H a[200000];
int b[200000];
int c[200000];
signed main() {
	cin >> n;
	rep(i, n) {
		int u, v;
		cin >> u >> v;
		a[i].fs = u + v;
		a[i].sc = u - v;
	}
	sort(a, a + n);
	int res = -inf, ans = 0;
	rep(i, n) {
		if (a[i].sc >= res) {
			ans++;
			res = a[i].fs;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4352
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = Array(n) {
        readLine()!!.toInt()
    }
    val m = a.sortedDescending()
    val mInd = a.indexOf(m[0])
    for (i in 0 until n) {
        println(if (i == mInd) m[1] else m[0])
    }
}

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

int main()
{
  int cnt = 0;
  while (true)
  {
    int x;
    cin >> x;
    if (x == 0)
      break;
    else
    {
      cnt++;
      cout << "Case " << cnt << ": " << x << endl;
    }
  }
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <queue>

using namespace std;

#pragma GCC oprimize("Ofast")
#define rep(i,a,b) for(__typeof(b)i=a;i<b;++i)
#define fs first
#define sc second
#define pb emplace_back

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vl2;
typedef pair<ll,ll> pl;

const ll inf = ~((ll)1<<(ll)63);

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

    ll n;
    cin >> n;
    vector<ll> l(n);
    vector<ll> pfs(n+1);
    pfs[0] = 0;
    rep(i,0,n)
    {
        cin >> l[i];
        pfs[i+1] = l[i] + pfs[i];
    }
    ll ans = inf;
    rep(i,0,n+1)
    {
        //cout << i << " " << pfs[i] << " " << pfs[n]-pfs[i] << endl;
        ans = min(ans, abs(pfs[i]-(pfs[n]-pfs[i])));
    }
    cout << ans;

	return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i ++) {
        cin >> a[i];
        sum += a[i];
    }
    int v1 = sum/n;
    int v2 = (sum-1)/n + 1;
    int cost1 = 0;
    int cost2 = 0;
    for(int i = 0; i < n; i++) cost1 += pow(a[i]-v1, 2);
    for(int i = 0; i < n; i++) cost2 += pow(a[i]-v2, 2);
    cout << min(cost1, cost2) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<Integer> list = nextIntArray();
		Collections.sort(list);
		myout(list.get(N - 1) - list.get(0));
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 25368
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

const int maxn(1e6 + 10), Mod(1e9 + 7);
int N, M, K, ans, fac[maxn], inv[maxn], Pow[maxn];
int C(int n, int m) { return 1ll * fac[n] * inv[m] % Mod * inv[n - m] % Mod; }
int Minus(int x, int y) { return (x - y + Mod) % Mod; }
int Add(int x, int y) { return (x + y) % Mod; }
int Mul(int x, int y) { return 1ll * x * y % Mod; }
int fastpow(int x, int y)
{
	int ans = 1;
	for (; y; y >>= 1, x = 1ll * x * x % Mod)
		if (y & 1) ans = 1ll * ans * x % Mod;
	return ans;
}

int main()
{
	scanf("%d%d%d", &N, &M, &K), fac[0] = inv[0] = Pow[0] = 1; if (M < K) std::swap(M, K);
	for (int i = 1; i <= N + M + K; i++) fac[i] = 1ll * fac[i - 1] * i % Mod;
	for (int i = 1; i <= N + M + K; i++) Pow[i] = 1ll * Pow[i - 1] * 3 % Mod;
	inv[N + M + K] = fastpow(fac[N + M + K], Mod - 2);
	for (int i = N + M + K - 1; i; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % Mod;
	for (int i = 0, x = 1; i <= M + K; i++)
	{
		ans = Add(ans, Mul(Mul(C(N + i - 1, N - 1), Pow[M + K - i]), x));
		if (i < K) x = (x + x) % Mod; else if (i < M) x = Minus((x + x) % Mod, C(i, K));
		else x = Minus(Minus((x + x) % Mod, C(i, K)), C(i, M));
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 11520
/* ex 7_1
   TakayukiY*/

#include<stdio.h>

typedef struct point{
    int x_elem;
    int y_elem;
} point;

int main(void){
    //各頂点
    point p1,p2,p3,p4;
    //頂点1・2間の各成分の差分
    int x,y;
    //代入
    scanf("%d%d%d%d",&p1.x_elem,&p1.y_elem,&p2.x_elem,&p2.y_elem);
    //1と2の差分を計算
    x=p1.x_elem - p2.x_elem;
    y=p1.y_elem - p2.y_elem;
    //p3,p4を復元
    p3.x_elem=p2.x_elem+y;
    p3.y_elem=p2.y_elem-x;
    p4.x_elem=p1.x_elem+y;
    p4.y_elem=p1.y_elem-x;
    //出力
    printf("%d %d %d %d",p3.x_elem,p3.y_elem,p4.x_elem,p4.y_elem);

    return 0;
}

Measured memory_bytes: 1728
n, t = map(int, input().split())
sen = -1
gos = -1
man = -1
for i in range(n+1):
    for j in range(n-i+1):
        if i * 1000 + j*5000 + (n-i-j)*10000 == t:
            sen = i
            gos = j
            man = n-i-j
print(man, gos, sen)
        


Measured memory_bytes: 40812
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    if (n % 2 == 0 or n % 5 == 0) {
        cout << -1 << endl;
        return;
    }

    int r = 7;
    REP1(i, n + 1) {
        r %= n;
        if (r == 0) {
            cout << i << endl;
            return;
        }
        r = r * 10 + 7;
    }
    cout << -1 << endl;

}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
pll fill(vll v[],ll e[],ll q)
{
    e[q]=1;
    pll c;
    c.ff=1;
    c.ss=1;
    for(auto i:v[q])
    {
        if(e[i]==0)
        {
            pll f=fill(v,e,i);
            c.ff*=(f.ff+f.ss);
            c.ss*=(f.ff);
            c.ff%=mod;
            c.ss%=mod;
        }
    }
    return c;
}
int main()
{  
    FAST
    ll n;
    cin>>n;
    vll v[n+1];
    ll x,y;
    ll e[n+1]={0};
    for(ll i=1;i<n;i++)
    {
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    pll p=fill(v,e,1);
    cout<<((p.ff+p.ss)%mod);
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
const int M = 1e9 + 7;
const ll INF = 1e9;
const int MAX_V = 100000 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    repeat(i, 0, n - 2) {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
            ans++;
            i += 2;
        }
    }
    out(ans);
}


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

using ll=long long; 

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

void solve(){
	ll a,b;
	cin>>a>>b;
	if(a<b)swap(a,b);
	cout<<a*b/gcd(a,b)<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		//Initialization
		Scanner sc = new Scanner(System.in);

		while(true){

		int roads = sc.nextInt();
		if(roads == 0){
			break;
		}
		int[][] data = new int[20][20];
		for(int s = 0; s < data.length; s++){
			data[s] = new int[data.length];
			Arrays.fill(data[s], 2000000);
		}

		for(int i = 0; i < data.length; i++){
			data[i][i] = 0;
		}

		int flag = -1;

		for(int i = 1; i <= roads; i++){
			int end1 = sc.nextInt();
			int end2 = sc.nextInt();
		 	int dist = sc.nextInt();
			data[end1][end2] = dist;
			data[end2][end1] = dist;

			flag = Math.max(Math.max(end1,end2),flag);
		}

		//Warshall-Floyd method
		for(int k = 0; k <= flag; k++){
			for(int i = 0; i <= flag; i++){
				for(int j = 0; j <= flag; j++){
					data[i][j] = Math.min(data[i][j], data[i][k] + data[k][j]);
				}
			}
		}

		int res = Integer.MAX_VALUE;
		int ans = -1;

		for(int i = 0; i <= flag; i++){
			int sum = 0;
			for(int k = 0; k <= flag; k++){
				sum = sum + data[i][k];
			}

			if(sum < res){
				res = sum;
				ans = i;
			}
		}
		System.out.println(ans + " " + res);
	}
	}
}

Measured memory_bytes: 12000
n = int(input())
a = list(map(int, input().split()))
col = [0 for i in range(10)]
for i in range(n):
    if 1 <= a[i] and a[i] <= 399:
        col[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        col[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        col[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        col[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        col[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        col[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        col[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        col[7] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        col[8] = 1
    elif 3200 <= a[i]:
        col[9] += 1
s = 0
for i in range(len(col)-1):
    s += col[i]
if s == 0 and col[9] >= 1:
    print(1, col[9])
elif col[9] >= 1:
    print(s, s+col[9])
else:
    print(s, s)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N, X, M;
    cin >> N >> X >> M;
    ll shoki = X;
    set<ll> deta;
    deta.insert(X);
    vector<ll> itsu;
    itsu.push_back(X);
    ll loopl = -1;
    ll loops = 0;
    ll loopg = 0;
    rep(i, M-1){
        X = X * X;
        X %= M;
        if(deta.count(X)){
            rep(j, i+1){
                if(itsu.at(j) == X){
                    loops = j;
                    break;
                }
            }
            loopg = i;
            loopl = loopg - loops + 1;
            break;
        }
        deta.insert(X);
        itsu.push_back(X);
    }
    ll ans = 0;
    X = shoki;
    if(N-1 <= loopg){
        rep(i, N){
            ans += X;
            X = X * X;
            X %= M;
        }
        cout << ans << endl;
        return 0;
    }
    rep(i, loops){
        ans += X;
        X = X * X;
        X %= M;
    }
    N -= loops;
    ll ikkai = 0;
    rep(i, loopl){
        ikkai += X;
        X = X * X;
        X %= M;
    }
    ans += ikkai * (N / loopl);
    rep(i, N % loopl){
        ans += X;
        X = X * X;
        X %= M;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5984
A, B, K = gets.split.map &:to_i
a = [A, B]

K.times{|i|
  j = i & 1
  k = 1 ^ j
  a[j] -= 1 if a[j].odd?
  given = a[j] / 2
  a[j] -= given
  a[k] += given
}
puts a * " "


Measured memory_bytes: 1788
#include <bits/stdc++.h> 
    #include<ext/pb_ds/assoc_container.hpp> 
    #include<ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
    #define INF 1e18
    const int mod=1e9+7;
    int cnt=0; 
    
    
    signed main() {
 
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("INPUT.txt", "r", stdin);
    // for writing output to output.txt
    freopen("OUTPUT.txt", "w", stdout);
    #endif
    
    // -------------------------------------Code starts here--------------------------------------------------------------------- 
    int t=1;
    //cin>>t;
    while(t--)
    {
      int a,b,c,k;
      cin>>a>>b>>c>>k;
      if(a>=k)
      {
       cout<<k<<endl;
    }
    else if(a+b>=k)
    {
      cout<<a<<endl;
      }
      else
      {
        cout<<a-(k-(a+b))<<endl;
      }
    }
} 
 

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

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

    long long n, m;
    cin >> n >> m;
    vector<long long> A(m);
    for(long long i = 0; i < m; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end());

    vector<long long> B(m - 1);
    for(long long i = 1; i < m; i++){
        B[i - 1] = A[i] - A[i - 1];
    }

    sort(B.begin(), B.end());

    long long ans = 0;
    for(int i = 0; i < max(0LL, m - n); i++){
        ans += B[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
def main():
    input()
    ss = input().split()
    input()
    ts = input().split()

    nums = {}

    for t in ts:
        nums[t] = False

    for s in ss:
        if s in nums:
            nums[s] = True

    cnt = 0
    for val in nums.values():
        if val:
            cnt += 1

    print(cnt)

if __name__ == '__main__':
    main()



Measured memory_bytes: 6032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 998244353;
#pragma GCC optimize("Ofast")
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())


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

    int n, a, b;
    cin >> n >> a >> b;
    cout << min(b, a*n) << endl;
}

Measured memory_bytes: 256
# optimize output length

Q=[]
A=->*x{Q<<[?+,*x]*" "}
C=->*x{Q<<[?<,*x]*" "}

C[2,0,4]
0.upto(30){|i|
 A[4+i,4+i,5+i]
}

s=36
31.downto(0){|i|
 A[4+i,s+33,3]
 C[0,3,s+i]
 C[s+i,4,3]
 i.times{A[3,3,3]}
 A[3,s+33,s+33]
}

s=66
A[1,4,1]
31.downto(0){|i|
 A[4+i,s+33,3]
 C[3,1,s+i]
 C[2,s+i,3]
 i.times{A[3,3,3]}
 A[3,s+33,s+33]
}

58.downto(0){|k|
 [k-29,0].max.upto([k,29].min){|i|
  j=k-i
  C[36+i,66+j,3]
  A[2,3,2]
 }
 A[2,2,2] if k>0
}

puts Q.size,Q

Measured memory_bytes: 14504
#include<bits/stdc++.h>
//#include<cstdio>
//#include<algorithm>
//#include<cmath>
#define maxn 55
const double eps =1e-10;
const double g =9.8;
using namespace std;

int N,V,X,Y;
int L[maxn],B[maxn],R[maxn],T[maxn];

int dcmp(double d){
	if(d<-eps) return -1;
	else if(d>eps) return 1;
	else return 0;
}

double cal(double vy,double t){
	return vy*t-0.5*g*t*t;
}

int cmp(double lb,double ub,double a){
		return a<lb+eps?-1:ub<a+eps?1:0;
}

bool check(double qx,double qy){
	double a=0.25*g*g,b=g*qy-V*V,c=1.0*qx*qx+qy*qy;
	double D=b*b-4*a*c;
	if(dcmp(D)==0) D=0;
	if(D<0) return false;
	for(int d=-1;d<=1;d+=2){
		double t2=(-b+d*sqrt(D))/2/a;
		if(t2<=0) continue;
		double t=sqrt(t2);
		
		double vx=qx/t,vy=(qy+0.5*g*t*t)/t;
		double yt=cal(vy,X/vx);
		if(dcmp(yt-Y)<0) continue;
		
		bool ok=true;
		for(int i=0;i<N;i++){
			if(L[i]>=X) continue;
			if(R[i]==X&&Y<=T[i]&&B[i]<=yt) ok=false;
			
			int yL=cmp(B[i],T[i],cal(vy,L[i]/vx)),
		     	yR=cmp(B[i],T[i],cal(vy,R[i]/vx)),
		     	xH=cmp(L[i],R[i],vx*(vy/g)),
		     	yH=cmp(B[i],T[i],cal(vy,vy/g));
		    if(xH==0&&yH>=0&&yL<0) ok=false;
		    if(yL*yR<=0) ok=false;
		}
		if(ok) return true;
	}
	return false;
}

void slove(){
	for(int i=0;i<N;i++)
		R[i]=min(X,R[i]);
	bool ok=check(X,Y);
	for(int i=0;i<N;i++){
		ok|=check(L[i],T[i]);
		ok|=check(R[i],T[i]);
	}
	printf("%s\n",ok?"Yes":"No");
}

void MAIN()
{
	scanf("%d%d%d%d",&N,&V,&X,&Y);
	for(int i=0;i<N;i++) scanf("%d%d%d%d",&L[i],&B[i],&R[i],&T[i]);
	slove();
}

int main()
{
//	freopen("in#pro.txt","r",stdin);
//	freopen("out#pro.txt","w",stdout);
	MAIN();
	return 0;
}

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

def main():
    X, Y, Z = map(int, input().split(" "))

    # max_num = 0
    # for i in range(100000):
    #     if Y * i + Z * (i + 1) <= X:
    #         max_num = i
    #     else:
    #         break
    # print(max_num)

    print(int((X - Z) / (Y + Z)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<string>
int main() {
	std::string S;
	int a,i,ans;

	std::cin >> a >> S;
	ans = 0;

	for (i = 0; i < a; i++) {
		if (S[i] != S[i+1]) {
		ans++;
		}
	}
				
	std::cout << ans;
	return(0);
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define ll long long
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
using namespace std;
const int MAXN=1e5+9;
const long double INF=1e16;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll x;
	cin>>x;
	ll prev=100;
	for(int i=1;i<=100000000;i++)
	{
		long double new_val=(((long double)prev)*1.01);
		prev=floor(new_val);
		if(prev>=x)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
namespace KCLC
{
  class Program
  {
    static void Main()
    {
      int Input = int.Parse(Console.ReadLine());
      if(Input == 0){Console.WriteLine("1");}
      else{Console.WriteLine("0");}
    }
  }
}

Measured memory_bytes: 27280
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();
    
    if(S.equals(U)) A--;
    else B--;
    System.out.println(A + " " + B);
    
    
  }
}


Measured memory_bytes: 21844
#include<iostream>
using namespace std; //stdライブラリを明示的に使用する。std::とする必要がなくなる。
#define MAX 100000
typedef long long llong; //long long型をllong型と新たに定義する。

int n,k;//荷物の個数とトラックの台数

llong T[MAX];
//積載量Pトラックk台何個の荷物を詰めるか
int check(llong P){
    int i = 0;
    for(int j=0;j<k;j++){
        llong s = 0;
        while(s + T[i] <= P){
            s += T[i];
            i++;
            if(i==n)return n;
        }
    }
    return i;
}
//積載量を二分探索で求める。
int solve(){
    llong left = 0;
    llong right = 100000 * 10000;//荷物の数[n]×1つ中の最大重量[wi]
    llong mid;
    while(right-left > 1){//積載量が確定していない間
        mid =(left + right)/2;
        int v = check(mid); //mid==p最大積載量
        if(v>=n)right = mid;
        else left = mid;
    }
    return right;
    }

    main(){
        cin >> n >> k;//荷物の数とトラックの台数入力
        for(int i=0; i < n; i++)cin >> T[i];
        llong ans = solve();
        cout << ans << endl;
    }


Measured memory_bytes: 3880
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar('0'+aa%10);
	return;
}
const long long mod=1e9+7;
long long n,ans;
long long a[105],f[55][105][105],vis[105];
int main()
{
	n=read();
	for(long long i=1;i<=2*n-1;++i) a[i]=read();
	sort(a+1,a+2*n);
	for(int i=n-1;i;--i) if(a[i+1]==a[i]) vis[i]=1;
	for(int i=n+1;i<2*n;++i) if(a[i-1]==a[i]) vis[i]=1;
	f[1][1][0]=1;
	for(long long i=2;i<=n;++i) 
	{
		for(long long l=0;l<=2*n-1;++l)
		for(long long r=0;r<=2*n-1;++r) if(f[i-1][l][r])
		{
			int L=l+1-vis[n-i+1],R=r+1-vis[n+i-1];
			for(int k=1;k<=L+R;++k)
			{
				if(k<L) (f[i][k][R+1]+=f[i-1][l][r])%=mod;
				else if(k==L) (f[i][k][R]+=f[i-1][l][r])%=mod;
				else (f[i][L+1][R-k+L]+=f[i-1][l][r])%=mod;
			}
		}
	}
	for(long long i=0;i<=n*2-1;++i)
	for(long long j=0;j<=n*2-1;++j) (ans+=f[n][i][j])%=mod;
	write(ans);
	return 0;
}

Measured memory_bytes: 3072
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);



	void run() {

		for (;;) {

			int n = sc.nextInt();

			if(n==0) break;

			int[] sum = new int[n + 1];

			for (int i = 0; i < n; i++) {

				int sum2 = 0;

				for (int j = 0; j < n; j++) {

					int in = sc.nextInt();

					sum[j] += in;

					sum[n] += in;

					sum2 += in;

					System.out.printf("%5d", in);

				}

				System.out.printf("%5d\n", sum2);

			}

			for (int i = 0; i < n + 1; i++) {

				System.out.printf("%5d", sum[i]);

			}

			System.out.println();



		}



	}



	public static void main(String[] args) {

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 13000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  double r=0.0;
  cin>>n>>k;
  for(int i=1;i<=n;++i){
    int p=i,q=0;
    while(p<k){
      p*=2;
      q++;
    }
    r+=pow(2.0,-q);
  }
  cout<<fixed<<setprecision(15)<<r/(double)n<<endl;
  return 0;
}

Measured memory_bytes: 512
W,H,N = map(int,input().split())
w = W*[1]
h = H*[1]

for n in range(N):
  x,y,a = map(int,input().split())
  if a == 1:
    w[:x] = x*[0]
  elif a == 2:
    w[x:] = (W-x)*[0]
  elif a == 3:
    h[:y] = y*[0]
  else:
    h[y:] = (H-y)*[0]

print(w.count(1)*h.count(1))


Measured memory_bytes: 62636
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	VI D(N);
	REP(i, N) {
		cin >> D[i];
	}
	SORT(D);
	cout << D[N / 2] - D[N / 2 - 1] << endl;
	return 0;
}



Measured memory_bytes: 1024