akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

int main(void){
    int N, ans=0;
    std::cin >> N;
    std::vector<int> a(N);

    for (int i=0; i<N; ++i){
        std::cin >> a.at(i);
    }

    std::sort(a.begin(), a.end(), std::greater<int>());

    for (int i=0; i<N; ++i){
        if (i % 2 == 0) ans += a.at(i);
        else ans -= a.at(i);
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
typedef long long ll;
typedef std::pair<ll, ll> P;

#define rep(i,n) for(int i = 0; i < int(n); i++)
using namespace std;

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

struct Point {
	double x, y;
	int id;
	bool operator <(const Point& p) const {
		return x < p.x || (x == p.x && y < p.y);
	}
};

struct ConvexHullRunner {
	typedef double coord_t;
	typedef double coord2_t;

	coord2_t cross(const Point& O, const Point& A, const Point& B)
	{
		return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
	}

	vector<Point> convex_hull(vector<Point> P)
	{
		size_t n = P.size(), k = 0;
		if (n <= 3) return P;
		vector<Point> H(2 * n);

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

		for (size_t i = 0; i < n; ++i) {
			while (k >= 2 && cross(H[k - 2], H[k - 1], P[i]) <= 0) k--;
			H[k++] = P[i];
		}

		for (size_t i = n - 1, t = k + 1; i > 0; --i) {
			while (k >= t && cross(H[k - 2], H[k - 1], P[i - 1]) <= 0) k--;
			H[k++] = P[i - 1];
		}

		H.resize(k - 1);
		return H;
	}
};

int main() {
	ll n;
	cin >> n;
	vector<Point> as(n);
	rep(i, n) {
		cin >> as[i].x >> as[i].y;
		as[i].id = i;
	}
	ConvexHullRunner r;
	auto hull = r.convex_hull(as);
	ll s = hull.size();
	hull.insert(hull.end(), hull.begin(), hull.end());
	vector<double> ans(n, 0);
	for (int i = 1; i < s + 1; i++) {
		auto prev = hull[i - 1];
		auto current = hull[i];
		auto next = hull[i + 1];
		auto dx1 = current.x - prev.x;
		auto dy1 = current.y - prev.y;
		auto dx2 = next.x - current.x;
		auto dy2 = next.y - current.y;
		auto t2 = atan2(dy2, dx2);
		if (t2 < 0) t2 += 2 * M_PI;
		auto t1 = atan2(dy1, dx1);
		if (t1 < 0) t1 += 2 * M_PI;
		auto t = t2 - t1;
		if (t < 0) {
			t += 2 * M_PI;
		}
		while(t > 2 * M_PI) {
			t -= M_PI;
		}
		if (t > M_PI) {
			t = 2 * M_PI - t;
		}
		ans[hull[i].id] = t / (2 * M_PI);
	}
	cout << setprecision(10) << fixed;
	for (auto p : ans) {
		cout << p << endl;
	}
	return 0;
}


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

using namespace std;

long long inf=1000000007;

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

	if(s.size()>k) for(int i=0;i<k;i++) cout<<s.at(i);
	if(s.size()>k) cout<<"...";
	else cout<<s;
	cout<<endl;

	return 0;
}


Measured memory_bytes: 3624
p = [True for i in range(1000001)]
p[0] = False
p[1] = False
for i in range(2,500000):
  for j in range(2, 1000000//i + 1):
    p[i * j] = False

while True:
  n = int(input())
  if n == 0:
     break
  cnt = 0
  for i in range(1, n//2 + 1):
    if (p[i] and p[n-i]):
      cnt += 1
  print(cnt)


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

int main() {
  string S;
  cin >> S;
  bool isSimular = false;
  if(S.at(2) == S.at(3)){
    if(S.at(4) == S.at(5)) isSimular = true;
  }
  if(isSimular){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
input = gets
sum_areas = []
local_areas = []
sum = 0

input.each_char.with_index do |c, index|
  if c == "\\"
    sum_areas.push(index)
  elsif c == "/" && sum_areas.size > 0
    j = sum_areas.pop
    sum += index - j
    a = index - j
    while(local_areas.size > 0 && local_areas.last[:index] > j)
      a += local_areas.last[:area]
      local_areas.pop
    end
    local_areas.push({ index: j, area: a })
  end
end

puts sum
areas = local_areas.map { |l| l[:area] }.join(' ')
if areas.length > 0
  puts local_areas.size.to_s + " " + areas
else
  puts local_areas.size.to_s
end



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

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

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define For(i, a, b) for (ll i = (a); i < (b); i++)
#define all(A) (A).begin(), (A).end()

int main(){
    int N, R;
    cin >> N >> R;
    if (N >= 10) cout << R << endl;
    else cout << R + 100 * (10 - N) << endl;

    return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  sort(h.begin(), h.end(), greater<int>());
  long long ans = 0;
  for (int i = k; i < max(n, k); i++) ans += h[i];
  cout << ans << endl;
}

Measured memory_bytes: 1024
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn dfs(node: usize, nodes: &Vec<Vec<usize>>) -> usize {
    let child_num = nodes[node].len();
    if child_num == 0 {
        return 1;
    }
    let mut depths = Vec::new();
    for &next in &nodes[node] {
        depths.push(dfs(next, nodes));
    }
    depths.sort();
    let mut mx = 0;
    for i in 0..child_num {
        mx = max!(mx, child_num-i+depths[i]);
    }
    mx
}

fn solve() {
    let n = get!(usize);
    let a = get!(usize;n-1);
    let mut nodes = vec![Vec::new(); n+1];
    for i in 0..n-1 {
        nodes[a[i]].push(i+2);
    }
    println!("{}", dfs(1, &nodes)-1);
}


Measured memory_bytes: 37244
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// ****************************************CODE***************************************//


ll n;
ll abc[110000][3];
ll dp[110000][3];

int main() {
    cin >> n;
    for(int i = 0; i < n; i++)for(int j = 0; j < 3; j++) cin >> abc[i][j];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + abc[i][k]);
            }
        }
    }

    ll res = 0;
    for(int i = 0; i < 3; i++){
        res = max(res, dp[n][i]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5120
N=int(input())
ans=0
flag=0

for i in range(N):
    a,b=map(int,input().split())
    if a==b:
        ans+=1
        if ans==3:
            print("Yes")
            flag=1
            break
    else:
        if ans!=0:
            ans=0

if flag==0:
    print("No")

Measured memory_bytes: 62276
a = list(map(int,input().split()))
n = a[0]
k = a[1]

count = 0

#10**100の係数のリスト作成,bは係数の個数。
b=n+1-k+1
keisu=[0]*b
for i in range(b):
  keisu[i]=k+i

#係数毎に個数を求める,iは係数。
for i in keisu:
  mn = (i-1)*i/2
  mx = ((n-i+1)+n)*i/2
  count += (mx-mn+1)
  count %= (10**9+7)
  
print(int(count))

Measured memory_bytes: 16716
package main

import "fmt"

func main() {
        var n, l, r int
        fmt.Scan(&n)

        sum := 0
        for i := 0; i < n; i++ {
                fmt.Scan(&l)
                fmt.Scan(&r)

                sum = sum + (r - l + 1)
        }

        fmt.Printf("%d\n", sum)
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
unsigned long long int K;

int func(int x){
  if(x == 0){
    return 0;
  }

  if(x >= K){
    return func(x - K);
  }else{
    if( K-x <= x){
      return func(K - x);
    }else{
      return x;
    }
  }
}


unsigned long long int func_2(unsigned long long int x){

  if(x >= K){
    x = x - (x / K)*K;
  }
  
  while(true){
   if(x == 0){
     break;
   }

   if(x >= K){
     x = x - K;
     continue;
   }else{
     if( K-x <= x){
       x = K - x;
       continue;
     }else{
       break;
     }
   }
  }
  return x;
}


int main(){
  unsigned long long int N;
  cin >> N >> K;
  cout << func_2(N) << endl;
  return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())

MIN,MAX=-1,10**6
for m in range(M):
	L,R=map(int,input().split())
	if MIN < L:
		MIN = L
	if R < MAX:
		MAX = R

if MAX < MIN:
	ans = 0
else:
	ans = MAX - MIN + 1

print( ans )


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

class tsort {
public:
  int V;
  vector<vector<int>> G;
  vector<int> deg, res;
  tsort(int node_size) : V(node_size), G(V), deg(V, 0) {}
  void add(int from, int to) {
    G.at(from).push_back(to);
    deg.at(to)++;
  }
  bool solve() {
    queue<int> que;
    for(int i = 0; i < V; i++) {
      if(deg.at(i) == 0) {
        que.push(i);
      }
    }
    while(!que.empty()) {
      int p = que.front();
      que.pop();
      res.push_back(p);
      for(int v : G.at(p)) {
        if(--deg.at(v) == 0) {
          que.push(v);
        }
      }
    }
    return (*max_element(deg.begin(),deg.end()) == 0);
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  tsort TS(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    TS.add(--a, --b);
  }
  TS.solve();
  vector<int> rank = TS.res;
  reverse(rank.begin(), rank.end());
  vector<int> DP(N);
  for (int i = 0; i < N; i++) {
    for (auto g :TS.G.at(rank.at(i))) {
      DP.at(rank.at(i)) = max(DP.at(rank.at(i)), DP.at(g) + 1);
    }
  }
  cout << *max_element(DP.begin(), DP.end()) << "\n";
}


Measured memory_bytes: 7416
#include<stdio.h>

int main(void){
  int a, b, c, d;
  int sum=0;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  sum += (a>b)?b:a;
  sum += (c>d)?d:c;
  printf("%d", sum);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
const int INF = 1001001001;

int main()
{
    int n,k; cin >> n >> k;
    vector<int> l(n); rep(i, n) cin >> l[i];
    Sort2(l);
    int sum = 0;
    rep(i,k) sum += l[i];
    cout << sum << endl;
}

/*
Ctrl+@
g++ a.cpp
./a.out
*/

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>	
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>	
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <fstream>
#include <cstdio>
#include <memory.h>

using namespace std;

int main(void)
{
	int c[3][3];
	int b[3][3];
	int a[3][3];
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> c[i][j];
		}
	}

	for (int i = 0; i < 3; i++)
	{
		a[i][0] = c[1][i] - c[0][i];
		a[i][1] = c[2][i] - c[0][i];
		a[i][2] = c[2][i] - c[1][i];
	}

	for (int i = 0; i < 3; i++)
	{
		b[i][0] = c[i][1] - c[i][0];
		b[i][1] = c[i][2] - c[i][0];
		b[i][2] = c[i][2] - c[i][1];
	}

	bool ok = true;
	for (int i = 0; i < 3; i++)
	{
		if (a[0][i] != a[1][i] || a[0][i] != a[2][i] || a[2][i] != a[1][i])
		{
			ok = false;
			break;
		}

		if (b[0][i] != b[1][i] || b[0][i] != b[2][i] || b[2][i] != b[1][i])
		{
			ok = false;
			break;
		}
	}
	if (ok == true)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
M = list(map(int,input().split()))
X = [i for i in M if i % 2 == 0]
Y = [i for i in X if i % 3 ==0 or i % 5 ==0]

if len(X) == len(Y):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define maxn 110
int b[maxn];
int c[maxn];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&b[i]);
        b[i]--;
        c[i]=0;
    }
    vector<int>ans;
    int t = n;
    while(t--){
        for(int i=n-1;i>=0;i--){
            if(c[i]==b[i]){
                ans.push_back(b[i]);
                for(int j=i;j<n;j++)c[j]++;
                break;
            }
        }
    }
    if(ans.size()<n){
        puts("-1");
        return 0;
    }
    for(int i=0;i<n;i++)printf("%d\n",ans[i]+1);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

void initialize(void);
int isEmpty(void);
int isFull(void);
void enqueue(P);
P dequeue(void);

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  if(isFull() == 1){
    fprintf(stderr,"?????????????????????\n");
    exit(1);
  }

    Q[tail] = x;

    if((tail + 1) == (LEN+1)) tail = 0;
    else tail++;
}

P dequeue(void){
  P x;
  if(isEmpty() == 1){
    fprintf(stderr,"??¢??????????????????\n");
    exit(1);
  }
   
  x = Q[head];

  if((head + 1) == (LEN+1)) head = 0;

  else head++;

  return x;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  initialize();
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  head = 1;
  tail = n+1;

  while(1){
    u = dequeue();
    c = u.t;
    if((u.t -= q) > 0){
      enqueue(u);
      elaps += q;
    }
    else {
      elaps += c;
      printf("%s %d\n",u.name,elaps);
    }
    if(isEmpty() == 1) break;
  }
  
  return 0;
}

 void initialize(void)
 {
   head  = 0;
   tail  = 0;
 }

 int isEmpty(void)
 {
   if(head == tail) return 1;
   return 0;
 }

 int isFull(void)
 {
   if(head == (tail + 1) % (LEN+1)) return 1;
   return 0;
 }

Measured memory_bytes: 10756
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1e9;
const int mod = 1000000007;

int main(){
  int N,L;
  cin>>N>>L;
  int MIN=INF,sum=0;
  for(int i=1;i<=N;i++){
    sum+=L+i-1;
  }
  int ans=0;
  for(int i=1;i<=N;i++){
    int x=sum-(L+i-1);
    if(abs(sum-x)<MIN){MIN=abs(sum-x);ans=x;}
  }
  cout<<ans<<endl;
  return 0;                       
}

Measured memory_bytes: 3592
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = IntArray(n) { readLine()!!.toInt() }
  var ng = false
  if (a[0] != 0) ng = true
  for (i in 0 until n - 1) {
    if (a[i] + 1 < a[i + 1]) ng = true
  }
  if (ng) {
    println(-1)
    return
  }
  var ans = 0L
  for (i in 0 until n - 1) {
    if (a[i] + 1 == a[i + 1]) {
      ans++
    } else {
      ans += a[i + 1]
    }
  }
  println(ans)
}


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

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

  int ac, wa, tle, re;
  ac = wa = tle = re = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if (s == "AC")
      ac++;
    else if (s == "WA")
      wa++;
    else if (s == "TLE")
      tle++;
    else if (s == "RE")
      re++;
  }

  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


Measured memory_bytes: 3620
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#include <bits/stdc++.h>

#define mod 104857601
#define pb push_back
#define ep emplace_back
#define fr first
#define sc second
#define linf  (((1ll << 62) - 1) << 1)
#define inf (((1 << 30) - 1) << 1)

const double eps = 0.000000001;
#define ll long long
#define leps 1e-18
#define mkp make_pair
#define mpi unordered_map<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) begin(v), end(v)
#define vi vector<int>
#define vvi vector<vi>

using namespace std;

// Utils
random_device rd;
mt19937 mt(rd());

const int N_ = 100001;
vector<int> primes;
int *least_prime;
void cieve() {
  least_prime = new int[N_];
  fill(least_prime, least_prime + N_, -1);

  for (int i = 2; i < N_; i++) {
    if (least_prime[i] == -1) {
      least_prime[i] = i;
      primes.pb(i);
    }
    for (auto &c: primes) {
      if (c * i >= N_ || c > least_prime[i]) break;
      least_prime[c * i] = c;
    }
  }
}

template<typename NType>
NType gcd(NType a, NType b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template<typename NType>
NType lcm(NType a, NType b) { return a / gcd(a, b) * b; }
template<typename NType>
NType phi(NType n_) {
  NType ans = n_;
  for (NType i = 2; i * i <= n_; i++) {
    if (n_ % i == 0) {
      while (n_ % i == 0) n_ /= i;
      ans -= ans / i;
    }
  }
  if (n_ > 1) ans -= ans / n_;
  return ans;
}

int binpow(ll a, int n, const int M = mod) {
  ll res = 1;
  while (n) {
    if (n & 1) {
      res = (a * res) % M;
      n--;
    } else {
      a = (a * a) % M;
      n >>= 1;
    }
  }
  ((res %= M) += M) %= M;
  return res;
}
// End of Utils

//ofstream cout("/Users/user/Desktop/test.txt");

void solve(int T) {
  ll n, d;
  cin >> n >> d;
  ll x, y;
  int ans = 0;
  for(int i = 0; i < n; i ++){
    cin >> x >> y;
    if(x * x + y * y <= d * d) ans ++;
  }
  cout << ans << endl;
}

#define MULTIPLE_TEST 0
#define PRECALC_CIEVE 0
int main(int argc, char const *argv[]){
  if (PRECALC_CIEVE) cieve();
  int t{1};
  if (MULTIPLE_TEST) scanf("%d\n", &t);
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int i = 1;
  while (t-- > 0) {
    solve(i++);
  }
}


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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a==5 && b==5 && c==7){
		cout<<"YES";
	}
	else if(a==5 && b==7 && c==5){
		cout<<"YES";
	}
	else if(a==7 && b==5 && c==5){
		cout<<"YES";
	}
	else{
		cout<<"NO";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
def main():
    n=int(input())
    ans=[]
    if n==0:
        print(0)
        return
    while n != 0:
        MOD=n%(-2)
        if MOD <0:
            MOD+=2
        ans.append(str(MOD))
        n=(n-MOD)//(-2)
    ans.reverse()
    print(''.join(ans))

if __name__=='__main__':
    main()


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;
//ll mod = 998244353;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	//t %= mod;
	if (n % 2 == 1)t *= a;
	return t /*% mod*/;
}

//const int INF = 1001001001;
const ll INF = 1e18;

int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };

ll cal_gcd(ll a, ll b) {
	ll m = max(a, b);
	ll n = min(a, b);
	while (m%n != 0) {
		ll b = m % n;
		m = n;
		n = b;
	}
	return n;
}

vector<pair<ll, ll>> prime_factorize(ll N) {
	vector<pair<ll, ll>> res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0;
		while (N % a == 0) {
			++ex;
			N /= a;
		}
		res.push_back({ a, ex });
	}
	if (N != 1) res.push_back({ N, 1 });
	return res;
}


int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ll ans = a[0];
	for (int i = 2; i < n; i++) {
		ans += a[i/2];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 4820
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
ll n;
cin >> n;
vector<ll>a(n),b(n),c(n);
for(int i=0;i<n;i++){cin>>a.at(i);}
for(int i=0;i<n;i++){cin>>b.at(i);}
for(int i=0;i<n;i++){cin>>c.at(i);}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
sort(c.begin(),c.end());
ll ans = 0;
for(int i=0;i<n;i++){
    ll key = b.at(i);
    ll al = -1,ar=n;
    while(ar-al>1){
        ll mid = al+(ar-al)/2;
        if(a.at(mid)<key)al = mid;
        else ar =mid;
    }
    ll cl=-1,cr=n;
    while(cr-cl>1){
        ll mid = cl+(cr-cl)/2;
        if(c.at(mid)>key)cr=mid;
        else cl =mid;
    }
    ans+=(n-cr)*(ar);
}
cout << ans << endl;
}




Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#define FOR(i,a,n) for(i=a;i<n;i++)
//int *v,*e;
int *par;
int *rank;
void init_union(int size){
	int i;
	par = (int*)calloc(size,sizeof(int));
	rank = (int*)calloc(size,sizeof(int));
	//v = (int*)calloc(size,sizeof(int));
	//e = (int*)calloc(size,sizeof(int));
	FOR(i,0,size) par[i]=i;
	return;
}

int root(int a){
 	if(par[a]==a) return a;
 	else{
 		par[a]=root(par[a]);
 		return par[a];
 	}
}
 
int is_same(int a,int b){
 	return root(a)==root(b);
}
 
void unite(int a,int b){
	a=root(a);
	b=root(b);
	if(a==b){
		//e[a]++;
		return;
	}
	if(rank[a]>rank[b]){
		par[b]=a;
		//v[a]++,e[a]++;
	}
	else{
		par[a]=b;
		//v[b]++,e[b]++;
		if(rank[a]==rank[b]) rank[b]++;
	}
	return;
}
int main(void)
{
	int n,m,k,l,i;
	scanf("%d%d",&n,&m);
	init_union(n+m);
	FOR(i,0,n){
		scanf("%d",&k);
		while(k-->0){
			scanf("%d",&l);
			unite(i,n+l-1);
		}
	}
	FOR(i,1,n){
		if(!is_same(0,i)){
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 1152
/**
 * Author RDP
 * 
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#define endl '\n'
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0);
typedef long long ll;
using namespace std;

void test_case()
{
    FAST_IO
    double r;
    cin >> r;
    cout <<3.141 * 2 * r <<endl;
    return ;
}
int main()
{
    FAST_IO
    test_case();
    return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define int long long
#define double long double
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

signed main(void){

    int n, k; string s;
    cin >> n >> s >> k;
    rep(i, s.size())if(s[i] != s[k-1])s[i] = '*';
    cout << s << endl;
    
}

Measured memory_bytes: 256
def ceil(X, Y):  # 天井関数 ceil(X/Y) Y>1
    return (X + Y - 1) // Y


def binary(N):  # 二分探索 # N:探索要素数
    l, r = -1, N
    while r - l > 1:
        if (l + r) // 2 == 0:
            return 1
        cnt = sum(ceil(ai, (l + r) // 2) - 1 for ai in a)
        if cnt <= k:  # 条件式を代入
            r = (l + r) // 2
        else:
            l = (l + r) // 2
    return r


n, k = map(int, input().split())
a = list(map(int, input().split()))

print(binary(max(a)))


Measured memory_bytes: 93816
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1e+9 + 7;
// constexpr int mod = 998244353;

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

    int n;
    ll x, d;
    cin >> n >> x >> d;
    
    if(d == 0){
        if(x == 0)  cout << 1 << endl;
        else    cout << n + 1 << endl;
        return 0;
    }

    map<int, vector<Pll>> mp;
    for(int i = 0; i <= n; ++i){
        ll st = x * i;
        ll lb = (ll)i * (i - 1) / 2;
        ll ub = lb + (ll)i * (n - i);
        st += lb * d;
        ub -= lb;
        mp[(st % d + d) % d].emplace_back(st, ub);
    }

    ll ans = 0;
    for(auto p : mp){
        vector<Pll> a = p.second;
        int sz = a.size();
        for(int i = 0; i < sz; ++i) a[i].first = (a[i].first - p.first) / d;
        vector<Pll> events;
        for(int i = 0; i < sz; ++i){
            events.emplace_back(a[i].first, 1);
            events.emplace_back(a[i].first + a[i].second + 1, -1);
        }
        sort(events.begin(), events.end());
        ll cnt = 0, pre = -1e+17;
        for(auto e : events){   // imos 法のようなもの
            ll len = e.first - pre;
            if(cnt) ans += len;
            cnt += e.second;
            pre = e.first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 22144
N,Y = map(int,input().split())
para = [10000,5000,1000]
cnt = 0
for i in range(N+1):
    for j in range(N-i+1):
        k = N - i - j 
        if para[0]*i + para[1]*j + para[2]*k == Y and k >= 0:
            print("{} {} {}".format(i,j,k))
            cnt += 1
            exit()
if cnt == 0 : print("-1 -1 -1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 21;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n;
bool a[N][N];
int dp[2][1<<21];
inline void add(int &x, int y) { x += y; if(x>=mod) x -= mod; }
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=0; i<n; i++)
 		for(int j=0; j<n; j++)
 			cin >> a[i][j];
 	for(int i=0; i<n; i++)
 		dp[0][1<<i] = a[0][i];
 	int cur = 1;
 	for(int i=1; i<n; i++)
 	{
 		for(int j=1; j<(1<<n); j++)
 		{
 			if(!dp[cur^1][j]) continue;
 			for(int k=0; k<n; k++)
 			{
 				if((j>>k)&1) continue;
 				if(!a[i][k]) continue;
 				add(dp[cur][j^(1<<k)], dp[cur^1][j]);
 			}
 		}
 		cur ^= 1;
 	}
 	int ans = dp[cur^1][(1<<n)-1];
 	cout << ans;
	return 0;
}


Measured memory_bytes: 16640
#include <cstdint>
#include <iostream>

void Call_A_CirclePond(std::istream &input_stream) {
  input_stream.tie(0);
  std::ios::sync_with_stdio(false);
  try {
    double input;
    input_stream >> input;
    std::cout << (6.28318530717958623200 * input);
  } catch (...) {
    std::cerr << "ERROR: Call_A_CirclePond()" << std::endl;
    throw;
  }
}

int main() {
  try {
    Call_A_CirclePond(std::cin);
  } catch (...) {
    std::cerr << "ERROR: main()" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3868
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int MAXN = 20;

int n, a[MAXN];
char s[MAXN];

int main(){
	scanf( "%s", s+1 );
	n = (int)strlen( s+1 );
	int ans = 0;
	for( int i = 1; i <= n; ++i ){
		a[i] = a[i-1] + s[i] - '0';
		ans += s[i] - '0';
	}
	for( int i = n; i >= 1; --i )
		ans = max( ans, 9 * ( n - i ) + a[i-1] + s[i] - '0' - 1 );
	printf( "%d\n", ans );
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();
            String[] split = s.split(",");
            System.out.println(split[0] + " " + split[1] + " " + split[2]);
        }
    }
}


Measured memory_bytes: 21844
#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	if(n==3){
		puts("2 5 63");
		return 0;
	}
	int a=n%3?n-2:n-4;
	if(a>15000) a=n%2?14999:15000;
	for(int i=1;i<=a;i++) printf("%d ",i*2);
	for(int i=0;i<n-a;i++) printf("%d ",i*6+3);
}

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();
      int y = scan.nextInt();

      int bill10000=-1;
      int bill5000=-1;
      int bill1000=-1;
      for(int i=0;i<=n;i++){
        for(int j=0;j+i<=n;j++){
          int k = n-i-j;
          if(i*10000+j*5000+k*1000==y){
          bill10000=i;
          bill5000=j;
          bill1000=k;
          }
          }
        }

        System.out.println(bill10000+" "+bill5000+" "+bill1000);
      }
    }


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

long long k , mod , inf=3234566667;
vector<long long> vec;

void dfs(long long x){
    if(x <= inf){
        vec.push_back(x);
        mod = x%10;
        if(mod > 0){
            dfs(x*10+mod-1);
        }
        
        mod = x%10;
        if(mod < 9){
            dfs(x*10+mod+1);
        }
        
        mod  = x%10;
        dfs(x*10+mod);
    }
}

int main(){
    cin>>k;
    for(long long i=1;i<10;i++){
        dfs(i);
    }
    
    sort(vec.begin(),vec.end());
    
    cout<<vec[k-1]<<endl;
    return(0);
}

Measured memory_bytes: 1400
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

unordered_map<int, PII> dp;
signed main(void)
{
  while(true) {
    int n;
    cin >> n;
    if(!n) break;

    dp.clear();
    dp[0] = {INF, -1};

    REP(i, n) {
      char c;
      cin >> c;
      int l, r;
      if(c == 'W') {
        cin >> l >> r;
        int idx = 0, cnt = r;
        while(true) {
          // cout << idx << " " << cnt << endl;
          // if(dp.find(idx) == dp.end()) assert(false);
          if(dp[idx].second == -1) {
            if(idx + cnt - 1 <= dp[idx].first) {
              if(dp.find(idx+cnt) == dp.end()) dp[idx+cnt] = {dp[idx].first, -1};
              dp[idx] = {idx+cnt-1, l};
              break;
            } else {
              dp[idx].second = l;
              cnt -= dp[idx].first - idx + 1;
            }
          }
          // assert(idx < dp[idx].first + 1);
          idx = dp[idx].first + 1;
        }
      } else if(c == 'D') {
        cin >> l;
        for(auto& j: dp) if(j.second.second == l) j.second.second = -1;
      } else if(c == 'R') {
        cin >> l;
        int idx = 0;
        while(true) {
          // if(dp.find(idx) == dp.end()) assert(false);
          if(dp[idx].first >= l) {
            cout << dp[idx].second << endl;
            break;
          }
          assert(idx < dp[idx].first + 1);
          idx = dp[idx].first + 1;
        }
      }
      // for(auto& j: dp) cout << j.first << " " << j.second << " "; cout << endl;
    }
    cout << endl;
  }

  return 0;
}

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

string s;
vector<string> vs; 
bool f[26];

void dfs(string t, int now){
    if(now == s.size()){
        // string r = t;
        // memset(f, false, sizeof(f));
        // rep(i, 0, r.size()){
        //     if(f[r[i] - 'a'] == false && r[i] != 'a'){
        //         r[i] = r[i] - 1;
        //     }
        //     f[t[i] - 'a'] |= true;
        // }
        /*if(r == s)*/ vs.push_back(t);
        return;
    }
    int d[26] = {};
    rep(i, 0, now) d[t[i] - 'a']++;
    if(t[now] != 'z' && d[t[now] + 1 - 'a'] == 0){
        string tmp = t;
        tmp[now] = tmp[now] + 1;
        dfs(tmp, now + 1);
    }
    if(t[now] == 'a' || d[t[now] - 'a'] != 0) dfs(t, now + 1);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    while (1) {
        cin >> s;
        if(s == "#") break;
        vs.clear();
        dfs(s, 0);
        int ans = vs.size();
        sort(vs.begin(), vs.end());
        cout << ans << endl;
        if(ans <= 10){
            rep(i, 0, ans){
                cout << vs[i] << endl;
            }
        }else{
            rep(i, 0, 5){
                cout << vs[i] << endl;
            }
            rep(i, ans - 5, ans){
                cout << vs[i] << endl;
            }
        }
    }
}


Measured memory_bytes: 4276
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        
        if (Math.abs(a-c) <= d){   //aとcが直接会話できるか
            System.out.println("Yes");
        } else if (Math.abs(a-b) <= d && Math.abs(c-b) <= d){ //aとcが間接的に会話できるか
            System.out.println("Yes");
        } else {
             System.out.println("No");
        }
        
    }
}

Measured memory_bytes: 35700
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
 
int main(void){
   int a,b,c;
   cin >> a >> b >> c;
   double PI = acos(-1);
   double rad = c*PI/180;
   cout << fixed << setprecision(5);
   cout << a*b*sin(rad)/2 << endl << a + b + sqrt(a*a + b*b - 2*a*b*cos(rad)) << endl << b*sin(rad) << endl;
}


Measured memory_bytes: 3436
#line 1 "template.cpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  REP(i, 10000) {
    if (floor(i * 0.08) == a && floor(i * 0.10) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


ll n,m;

int main(){
  cin>>n>>m;
  vector<pair<ll,ll>> v(n);

  rep(i,n){
    cin>>v[i].F>>v[i].S;
  }

  sort(all(v));

  ll ans=0;
  rep(i,n){
    ans+=min(m,v[i].S)*v[i].F;
    m-=min(m,v[i].S);
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


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

ll lcm(ll a,ll b){
    ll g =gcd(a,b);
    return a/g*b;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;

    ll n;
    ll a[200];
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    bool ok=1;
    rep(i,n){
        if(a[i]%2==0){
            if(a[i]%3==0||a[i]%5==0){}
            else{
                ok=0;
            }
        }
    }
    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <cctype>
#define rgi register int
#define il inline
#define ll long long

using namespace std;

int A, B;

il int read()
{
	rgi x = 0, f = 0, ch;
	while(!isdigit(ch = getchar())) f |= ch == '-';
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

int main()
{
	A = read(), B = read();
	if(!((A + B) & 1))
		printf("%d", (A + B) >> 1);
	else
		puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
//const int MOD=1000000007;//1e9+7
const int MOD=998244353;
const int INTMAX=2147483647;//2e9
const ll LLMAX=9223372036854775807;//9e17

ll modadd(ll a,ll b,ll mod=MOD){
    return (a%mod+b%mod)%mod;
}

ll modsub(ll a,ll b,ll mod=MOD){
    a%=mod;
    b%=mod;
    if(a>=b) return a-b;
    else return mod-b+a;
}

ll modmul(ll a,ll b,ll mod=MOD){
    return ((a%mod)*(b%mod))%mod;
}

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

ll moddiv(ll a,ll b,ll mod=MOD) {
    return modmul(a, modpow(b, mod-2));
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,S;
    cin>>N>>S;
    vll A(N);
    for(ll i=0;i<N;i++)cin>>A[i];
    
    vvll dp(N,vll(S+1,0));
    
    for(ll i=0;i<N;i++){
        if(i==0){
            if(A[i]<=S)dp[0][A[i]]=1;
            dp[0][0]=2;
        }else{
            for(ll j=0;j<=S;j++){
                dp[i][j]=modmul(dp[i-1][j],2);
            }
            for(ll j=0;j<=S;j++){
                if(j+A[i]<=S)dp[i][j+A[i]]=modadd(dp[i][j+A[i]],dp[i-1][j]);
            }
        }
    }
    cout<<dp[N-1][S]<<endl;
    
    return 0;
}


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int a[100];
int cells[100][100]; // r * c

int main() {
  string  S;
  cin >> S;
  int N = S.size() + 1;

  vector<ll> a(N, -1);
  vector<ll> b(N, -1);
  ll m = 0;
  rep(i, 0, N - 1) {
    if (S[i] == '<') {
      if (a[i] == -1) a[i] = 0;
      a[i + 1] = a[i] + 1;
    }
  }

  repR(i, 0, N - 1) {
    if (S[i] == '>') {
      if (b[i + 1] == -1) b[i + 1] = 0;
      b[i] = b[i + 1] + 1;
    }
  }

  ll s = 0;
  rep0(i, N) s += max(a[i], b[i]);

  cout << s << BR;
  return 0;
}

Measured memory_bytes: 8708
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const int N=2010,P=1e9+7;

int n,m,cnt,G[N],a[N],b[N],w[N],id[N],fa[N];
struct edge{
  int t,nx,w;
}E[N];

int dis[N][N];

ll x;

inline bool cmp(const int &a,const int &b){
  return w[a]<w[b];
}

int getfa(int x){
  return x==fa[x]?x:fa[x]=getfa(fa[x]);
}

int fat[N];

int getfat(int x){
  return fat[x]==x?x:fat[x]=getfat(fat[x]);
}

ll mst;

inline int calc(ll x){
  int cnt=m;
  for(int i=1;i<=m;i++)
    if(mst+w[i]-dis[a[i]][b[i]]<x) cnt--;
  int ans=1; cnt=cnt==m?cnt:cnt+1;
  for(int i=1;i<=cnt;i++) ans=2LL*ans%P;
  return ans;
}

inline void addedge(int x,int y,int w){
  E[++cnt].t=y; E[cnt].nx=G[x]; E[cnt].w=w; G[x]=cnt;
  E[++cnt].t=x; E[cnt].nx=G[y]; E[cnt].w=w; G[y]=cnt;
}

void dfs(int x,int f,int d,int s){
  dis[x][s]=d;
  for(int i=G[x];i;i=E[i].nx)
    if(E[i].t!=f) dfs(E[i].t,x,max(d,E[i].w),s);
}

int main(){
  scanf("%d%d",&n,&m);
  scanf("%lld",&x);
  for(int i=1;i<=m;i++)
    scanf("%d%d%d",&a[i],&b[i],&w[i]);
  for(int i=1;i<=m;i++) id[i]=i;
  sort(id+1,id+1+m,cmp);
  for(int i=1;i<=m;i++) fa[i]=fat[i]=i;
  for(int i=1;i<=m;i++){
    int x=getfa(a[id[i]]),y=getfa(b[id[i]]);
    if(x==y) continue;
    mst+=w[id[i]]; fa[x]=y;
    addedge(a[id[i]],b[id[i]],w[id[i]]);
  }
  for(int i=1;i<=n;i++) dfs(i,0,0,i);
  printf("%d\n",(calc(x)+P-calc(x+1))%P);
  return 0;
}

Measured memory_bytes: 8576
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(let* ((n (read))
	  (line (loop repeat n collect (read)))
	  (ans 0))
  (reduce (lambda (mins x)
			(if (< mins x)
			  mins
			  (progn
				(incf ans)
				x)))
			line 
			:initial-value (expt 10 10))
  (princ ans))


Measured memory_bytes: 62524