akhauriyash/Code-Regression huggingface dataset:
N, K, Q = map(int, input().split())

acc_list = []
for i in range(Q):
    acc_list.append(int(input()))

point_dict = {}
for i in range(1, N+1):
    point_dict[i] = 0

for a in acc_list:
    point_dict[a] += 1

for key, valu in point_dict.items():
    if (K - Q + valu) <= 0:
        print('No')
    elif (K - Q + valu) > 0:
        print('Yes')


Measured memory_bytes: 19104
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define srtarr(x, n) sort(x, x+n)
#define dsrtarr(x, n) sort(x, x+n, greater<>());
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007

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;
/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */


int w[100];
int st[100];
int sa[101];

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        cin >> w[i];
        st[i] = w[i];
    }
    srtarr(st,n);
    int ans = 1 << 30;
    reps(i, n) {
        sa[i] += w[i-1] + sa[i-1];
    }
    reps(i, n){
        chmin(ans, abs(sa[i] - (sa[n] -sa[i])));
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#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()
typedef long long ll;

int dp[210][210];

int main(){
    int D,N;
    cin >> D >> N;
    vector<int> T(D);
    rep(i,D){
        cin >> T[i];
    }
    vector<int> A(N),B(N),C(N);
    rep(i,N){
        cin >> A[i] >> B[i] >> C[i];
    }

    rep(i,110)rep(j,210)dp[i][j]=-1;
    rep(i,N)if(A[i]<=T[0]&&T[0]<=B[i])dp[1][i]=0;

    for(int i=2;i<=D;i++){
        for(int j=0;j<N;j++){
            if(A[j]<=T[i-1]&&T[i-1]<=B[j])
                for(int k=0;k<N;k++){
                    if(dp[i-1][k]==-1)continue;
                    dp[i][j]=max(dp[i][j],dp[i-1][k]+abs(C[j]-C[k]));
                }
            else dp[i][j]=-1;
        }
    }
    int res = 0;
    rep(i,N){
        res = max(res,dp[D][i]);
    }
    cout << res << endl;
    return 0;
}


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

ll n;
string s;

int main() {
	cin>>n;
	cin>>s;
	ll g=0;
	vector <ll> r, b;
	for (int i=0; i<n; i++) {
		if (s[i]=='G') g++;
		else if (s[i]=='R') r.push_back(i);
		else b.push_back(i);
	}
	ll ans=0;
	for (auto i: r) {
		for (auto j: b) {
			ans+=g;
			ll l=min(i,j), r=max(i,j), d=abs(i-j);
			if ((i+j)%2==0) {
				if (s[(i+j)/2]=='G') ans--;
			}
			if ((l-d)>=0&&s[l-d]=='G') ans--;
			if ((r+d)<n&&s[r+d]=='G') ans--;
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 3632
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

const MOD: i64 = 1_000_000_000 + 7;

fn main() {
    input! {
        n: usize,
        A: [i64; n],
    }
    let mut ans: i64 = 0;
    let mut sums: i64 = A.iter().sum();
    sums %= MOD;
    for i in 0..n {
        sums -= A[i];
        if sums < 0 {
            sums += MOD;
        }
        ans += A[i] * sums;
        ans %= MOD;
    }

    println!("{}", ans % MOD);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define PRINT(a)   cout << (a) << endl
#define RALL(v) rbegin(v), rend(v)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  string S;
  cin >> S;
  PRINT(S.substr(0,3));
}



Measured memory_bytes: 3604
from collections import deque

H, W = map(int, input().split())
sy, sx = map(lambda x: int(x)-1, input().split())
gy, gx = map(lambda x: int(x)-1, input().split())
maze = [input() for _ in range(H)]

INF = float("INF")
cnt = [[INF]*W for _ in range(H)]

q = deque()
q.append([sy, sx])
cnt[sy][sx] = 0
move = [[1, 0], [-1, 0], [0, 1], [0, -1]]

while q:
    y, x = q.popleft()
    for dy, dx in move:
        ny = y + dy
        nx = x + dx
        if ny < 0 or ny > H-1 or nx < 0 or nx > W-1:
            continue
        if maze[ny][nx] == "." and cnt[ny][nx] > cnt[y][x]:
            cnt[ny][nx] = cnt[y][x]
            q.appendleft([ny, nx])
        for i in range(-2, 2+1):
            for j in range(-2, 2+1):
                wy = y + i
                wx = x + j
                if wy < 0 or wy > H-1 or wx < 0 or wx > W-1:
                    continue
                if maze[wy][wx] == "." and cnt[wy][wx] > cnt[y][x] + 1:
                    cnt[wy][wx] = cnt[y][x] + 1
                    q.append([wy, wx])

ans = cnt[gy][gx] if cnt[gy][gx] != INF else -1
print(ans)

Measured memory_bytes: 131520
#include <stdio.h>
#include <memory.h>
int main(void){
  int n,i,c,t,p[51]={0};
  while(1){
    scanf("%d",&n);
    if(!n)
      break;
    memset(p,0,sizeof(p));
    for(i=0;i<n;i++)
      scanf("%d",&p[i]);
    for(i=0;i<n;i++){
      t=p[i];
      c=0;
      if(i!=0)
	printf(" ");
      for(;p[i]+1==p[i+1];i++)
	c++;
      if(c)
	printf("%d-%d",t,t+c);
      else
	printf("%d",p[i]);
    }
    puts("");
  }
  return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(n, m);
    vector<string> funami(n);
    rep(i, funami.size()) {
        cin >> funami[i];
    }

    rep(i, n) {
        rep(j, m) {
            if (funami[i][j] == '#') {
                cout << "#";
            } else if ((i % 2 == 0 && j != m-1) || !j) {
                cout << "#";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }

    cout << endl;
    rep(i, n) {
        rep(j, m) {
            if (funami[i][j] == '#') {
                cout << "#";
            } else if ((i % 2 == 1 && j != 0) || j == m-1) {
                cout << "#";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
int a,b,c;//a[100005];
int main(){
	cin>>a>>b>>c;
	if(b-a==c-b)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 888
(defun solve (N)
  (let* ((sqrtN (isqrt N))
         (temp (loop for i from 1 to sqrtN
                     if (sb-int:positive-primep i) 
                     sum (loop for j from 1 with x
                               do (setf x (expt i j))
                               if (zerop (mod N x))
                               do (setf N (/ N x))
                               else return (1- j))))) 
       (if (> N sqrtN)
           (1+ temp) temp)))

(princ (solve (read)))

Measured memory_bytes: 24452
#include "iostream"
#include "algorithm"
#include "string"
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int max = 0, min = 100005;
	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		if (r < min)min = r;
		if (l > max)max = l;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (max <= i && i <= min)ans++;
	}
	cout << ans << endl;
}

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

int main(){
  int n,ans=0,i;
  long long x,y,d;
  scanf("%d %lld",&n,&d);
  for(i=0;i<n;i++){
    scanf("%lld%lld",&x,&y);
    if(x*x+y*y <= d*d){ans++;}
  }
  printf("%d\n",ans);
  return 0;
}

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

int A[5] = {},B[5] = {},a,b;
int main(){
	for(int i=1;i<=3;i++){
		cin >> a >> b;
		A[a]++; B[b]++;
	}
	int ma = 0;
	for(int i=1;i<=4;i++){
		ma = max(ma,A[i]+B[i]);
	}
	cout << (ma<3? "YES":"NO") << endl;
}

Measured memory_bytes: 256
import scala.io.Source

object Main {
  def main(args: Array[String]): Unit = {
    val lines = Source.stdin.getLines.toStream
    val Array(numLines, weightMax) = lines.head.split(" ").map(_.toInt)
    val valueWeight = lines.drop(1).take(numLines).map{ v =>
      val Array(value, weight) = v.split(" ").map(_.toInt)
      (value, weight)
    }.toArray
    val memo = (new Array[Int]((numLines+1) * (weightMax+1))).map(_ => -1)
    println(dp(numLines - 1, weightMax, valueWeight, memo, numLines, weightMax))
    // println(memo.toList)
  }

  def dp(i: Int, j: Int, arr: Array[(Int, Int)], memo: Array[Int], width: Int, height: Int): Int = {
    if (i < 0 || j == 0) {
      0
    } else if (memo(width*j + i) != -1) {
      memo(width*j + i)
    } else {
      if (j >= arr(i)._2) {
        memo(width*j + i) =
          math.max(
            dp(i - 1, j, arr, memo, width, height),
            dp(i - 1, j - arr(i)._2, arr, memo, width, height) + arr(i)._1
          )
      } else {
        memo(width*j + i) = dp(i - 1, j, arr, memo, width, height)
      }
      if (memo(width*j + i) == -1) memo(width*j + i) = 0
      memo(width*j + i)
    }
  }
}



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

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

    int hl;
    for(int i=1;i<s.size(); i++){
        hl = s.size()/2-i;
        if(s.substr(0, hl)==s.substr(hl, hl)){
            cout << 2*hl << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
MAX = 0xFFFFFFFF

(@n, @a, @b, @c) = gets.chomp.split(' ').map(&:to_i)

@l = [0] * @n
@n.times { |i| @l[i] = gets.chomp.to_i }

def dfs(i, a, b, c)
  if i == @n then
    if [a, b, c].min == 0 then
      return MAX
    else
      return (@a - a).abs + (@b - b).abs + (@c - c).abs
    end
  end
  
  return [
    dfs(i + 1, a, b, c),
    dfs(i + 1, a + @l[i], b, c) + (a > 0 ? 10 : 0),
    dfs(i + 1, a, b + @l[i], c) + (b > 0 ? 10 : 0),
    dfs(i + 1, a, b, c + @l[i]) + (c > 0 ? 10 : 0)
  ].min
end

puts dfs(0, 0, 0, 0).to_s

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

template<typename T>
struct List {
    struct Node {
        Node *prev, *next;
        T data;
        Node(Node* prev = nullptr, Node* next = nullptr, T data = T(0))
        : prev(prev), next(next), data(data) { }
    };
    Node *head, *tail;
    List() : head(new Node()), tail(new Node()) {
        head->next = tail, tail->prev = head;
    }
    Node* begin() { return head->next; }
    Node* end() { return tail; }
    Node* insert(Node* cur, T data) {
        cur = new Node(cur->prev, cur, data);
        return cur->prev->next = cur->next->prev = cur;
    }
    Node* push_front(T data) { return insert(begin(), data); }
    Node* push_back(T data) { return insert(end(), data); }
    Node* erase(Node* cur) {
        if (cur == head || cur == tail) return cur;
        cur->prev->next = cur->next, cur->next->prev = cur->prev;
        Node* tmp = cur->next;
        return free(cur), tmp;
    }
    Node* pop_front() { return erase(begin()); }
    Node* pop_back() { return erase(end()->prev); }
    Node* find(T data) {
        Node* cur = begin();
        while (cur != end() && cur->data != data) cur = cur->next;
        return cur;
    }
    friend ostream& operator<<(ostream& os, List& li) {
        Node* cur = li.begin();
        for (int cnt = 0; cur != li.end(); cur = cur->next) {
            if (cnt++) os << " "; os << cur->data;
        }
        return os;
    }
};

int main() {
    List<int> li;
    auto cur = li.end();
    int q; cin >> q;
    while (q--) {
        int com; cin >> com;
        if (com == 0) {
            int x; cin >> x;
            cur = li.insert(cur, x);
        }
        if (com == 1) {
            int d; cin >> d;
            if (d > 0) while (d--) cur = cur->next;
            else if (d < 0) while (d++) cur = cur->prev;
        }
        if (com == 2) {
            cur = li.erase(cur);
        }
    }
    cur = li.begin();
    while (cur != li.end()) cout << cur->data << endl, cur = cur->next;
	return 0;
}



Measured memory_bytes: 18640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define p_b push_back
#define pl pair<ll,ll>
#define m_p make_pair
#define MOD 1000000007
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,a,b) for(i=a;i>=b;i--)
#define nfs ios_base::sync_with_stdio(false);cin.tie(NULL)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll i;
    ll arr[n];
    ll b[n];
    ll c[n];
    for(i=0;i<n;i++)
    {
        cin >> arr[i];
        arr[i]--;



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

        cin >> b[i];
    }
    for(i=0;i<n-1;i++)
    {

        cin >> c[i];
    }

    ll ans = 0;
    for(i=0;i<n;i++)
    {
        if(i<n-1)
        {

            if(arr[i+1] == arr[i]+1)
            {

                ans += c[arr[i]];
            }
        }
        ans += b[arr[i]] ;

    }
    cout << ans << endl;




    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}

signed _main(){
  string S,T; cin >> S >> T;
  rep(i,S.size()){
    if(S[i]==T[i]);
    else{
      No
      return 0;
    }
  }
  Yes
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int h=sc.nextInt();
    int a=sc.nextInt();
    int count=0;
    while(h>0){
      h=h-a;
      count++;
    }

    System.out.println(count);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> b(N), order;
  for (int &x: b) cin >> x;
  while(!b.empty()) {
    bool erased{};
    for (int i = b.size()-1; i >= 0; --i) {
      if (b[i] == i + 1) {
        b.erase(begin(b)+i);
        erased = 1;
        order.push_back(i+1);
        break;
      }
    }
    if (!erased) break;
  }
  if (b.size()) {
    cout << -1 << endl;
  } else {
    for_each(rbegin(order),rend(order),[](int x){cout << x << endl;});
  }
}


Measured memory_bytes: 3644
a = int(input())
ans = 0
if a <= 599:
  ans = 8
elif a <= 799:
  ans = 7
elif a <= 999:
  ans = 6
elif a <= 1199:
  ans = 5
elif a <= 1399:
  ans = 4
elif a <= 1599:
  ans = 3
elif a <= 1799:
  ans = 2
else:
  ans = 1
print(ans)

Measured memory_bytes: 9184
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

inline string bool_to_string(bool b, const string &tval, const string fval) { return b ? tval : fval; } 
string YESNO(bool b) { return bool_to_string(b, "YES", "NO"); }
string YesNo(bool b) { return bool_to_string(b, "Yes", "No"); }
string yesno(bool b) { return bool_to_string(b, "yes", "no"); }

int main() {
  int n;
  while (cin >> n) {
    set<int> st;
    int c = 0;
    REP(i,n) {
      int t; cin >> t;
      if (t >= 3200) c++;
      else { t /= 400; st.insert(t); }
    }
    cout << max(1, (int)st.size()) << ' ' << st.size() + c << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,n) for(int i=s;i<n;i++)
const ll INF=1e16;

struct edge{
    ll to,time,money;
};

#define P pair<ll,pair<ll,ll>> //{cost,{place,money}}

struct graph{
    vector<vector<ll>> dis;
    vector<vector<edge>> g;
    graph(int n) : dis(n,vector<ll>(3001,INF)),g(n) {};
    //3000は銀貨を3000枚くらい持っていれば一切困らずに行き来できるから
    void addedge(int x,int y,ll time,ll money){
        edge e;
        e.to=y;e.time=time;e.money=money;
        g[x].emplace_back(e);
        e.to=x;
        g[y].emplace_back(e);
    }

    void dijkstra(int s,int firstmon){
        dis[s][firstmon]=0;
        priority_queue<P,vector<P>,greater<P>> q;
        q.push({0,{s,firstmon}});
        while(!q.empty()){
            P now=q.top();q.pop();
            ll place=now.second.first,money=now.second.second,time=now.first;
            if(dis[place][money] < time)continue;
            for(edge e : g[place]){//placeから行ける場所探索 (i,i)みたいな辺でのループは注意
                if(money==3000&&e.to==place)continue;
                //行先は(e.to , money - e.money)
                if(money-e.money < 0)continue;
                if(dis[e.to][min(3000LL,money - e.money)] <= dis[place][money] + e.time)
                    continue;
                dis[e.to][min(3000LL,money - e.money)] = dis[place][money] + e.time;
                q.push({dis[e.to][min(3000LL,money - e.money)],{e.to,money - e.money}});
            }
        }
    }
};

ll MIN(vector<ll> &a){
    ll res=INF;
    rep(i,a.size())res=min(res,a[i]);
    return res;
}

int main(){
    int n,m,s;cin >> n >> m >> s;
    s=min(s,3000);
    graph g(n);
    rep(i,m){
        int u,v;ll a,b;cin >> u >> v >> a >> b;
        g.addedge(u-1,v-1,b,a);
    }
    rep(i,n){
        ll c,d;cin >> c >> d;
        g.addedge(i,i,d,-c);
    }
    g.dijkstra(0,s);
    rep2(i,1,n)cout << MIN(g.dis[i]) << endl;
}

Measured memory_bytes: 7520
program One_dimentional_reverse
    implicit none
    character(100000):: s
    integer(4)ls, i, cnt

    read*, s
    ls = len_trim(s)
    cnt=0
    do i=1, ls-1
        if(s(i:i) /= s(i+1:i+1)) cnt=cnt+1
    end do

    print*, cnt
    
end program One_dimentional_reverse

Measured memory_bytes: 828
#include <bits/stdc++.h>
using namespace std;
std::vector<tuple<long long int,long long int,long long int>> v;

// x*8,4,2,1 : x : litres
int main() { 
     long long int arr[] = {8,4,2,1};
     long long int litres[] = {1,2,4,8};
     for(long long int i=0;i<4;i+=1){
          long long int x;
          cin >> x;
          v.push_back(make_tuple(arr[i]*x,x,litres[i]));
     }
     sort(v.begin(),v.end());
     long long int L;
     cin >> L;
     L*=4;
     long long int i=0;
     long long int ans = 0;
     while(L!=0 && i<4){
          // for(long long int i=0;i<4;i+=1){
               if(L-get<2>(v[i])>=0){
                    L-=get<2>(v[i]);
                    ans+=get<1>(v[i]);
                    // cout << get<1>(v[i]) << endl;
               }
               else{
                    i+=1;
               }
          // }
     }
     cout << ans;
}


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

int solve(vector<int> const &height)
{
    vector<int> dp(height.size(),0);
    dp[1]=abs(height[0]-height[1]);
    for(int i=2 ; i<height.size() ; ++i)
    {
        dp[i]=min(dp[i-1]+abs(height[i]-height[i-1]), dp[i-2]+abs(height[i]-height[i-2]));
    }
    return dp[height.size()-1];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin>>n;
    vector<int> height(n);
    for(int i=0 ; i<n ; ++i)
    cin>>height[i];
    cout<<solve(height)<<endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main() {
  ll n,m;cin >> n >> m;
  ll ans = abs(n-2)* abs(m-2);
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <cstdio>

int n;
long long int ans;
int mod = 1e9+7;

int main(){
	scanf("%d", &n);
	ans = 1;
	for(int i=1; i<=n; ++i){
		ans *= i;
		ans %= mod;
	}
	printf("%lld\n", ans);
}

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

int main(void){
    unsigned long n,m=0;
    int k=0;


    cin >> n >> k;
    if(n<1||1000000000<n||k<2||10<k)
        return 0;
    for(int i=0;i<n;i++){
        if(i==0)
            m+=k;
        else if(i!=0)
            m*=k;
        if(m>n){
                cout << i+1 << endl;
            break;
        }
    }
    return 0; 
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int H, W, h, w;
int main() {
    cin >> H >> W >> h >> w;

    ll b_g = (H / h) * (W / w);
    ll w_g = H * W - b_g;
    ll w_s = h * w - 1;
    if(h == 1 && w == 1){
        cout << "No" << endl;
        return 0;
    }

    ll nw = 999999990LL / ll(w_s);
    ll nb = (-1LL) * (nw * ll(w_s) + 1LL);

    if(nb * b_g + nw * w_g <= 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        rep(y, H){
            rep(x, W){
                if(((y+1) % h == 0) && ((x+1) % w == 0)) printf("%lld", nb);
                else printf("%lld", nw);
                if(x + 1 == W) cout << endl;
                else cout << " ";
            }
        }
    }

}

Measured memory_bytes: 2816
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int point_num = sc.nextInt();
		int dis = sc.nextInt();
		ArrayList<String> ar = new ArrayList<>();
		int ans = 0;
		String v = sc.nextLine();

		int count = 0;
		while(count < point_num) {
			ar.add(sc.nextLine());
			count++;
		}



		for(String b : ar) {
			String bb[] = b.split(" ");
			int x = Integer.parseInt(bb[0]);
			int y = Integer.parseInt(bb[1]);

			double dist = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));

			if (dist <= dis) {
				ans++;
			}
		}

		System.out.println(ans);


//		Scanner sc = new Scanner(System.in);
//
//		int num = sc.nextInt();
//		int cut_num = sc.nextInt();
//		String v = sc.nextLine();
//		String l = sc.nextLine();
//		String len[] = l.split(" ");
//		ArrayList<String> ar = new ArrayList<>();
//		ArrayList<Double> ar2 = new ArrayList<>();
//
//		long ans = Long.MAX_VALUE;
//
//		for (int j = 0; j<1000; j++) {
//
//			for (int i = 0; i<len.length; i++) {
//				ar2.add((double)Integer.parseInt(len[i]));
//			}
//
//			long ret = cut(num, cut_num, ar2);
//
//			if (ans > ret) {
//				ans = ret;
//			}
//		}
//
//		System.out.println(ans);
//
//		}
//
//	static ArrayList<Double> sort(ArrayList<Double> ar2){
//		Collections.sort(ar2);
//		Collections.reverse(ar2);
//
//		return ar2;
//	}
//
//
//	static long cut(int num, int cut_num, ArrayList<Double> ar2) {
//		Random r = new Random();
//
//		for (int i=0; i<cut_num; i++) {
//
//			sort(ar2);
//			double result = ar2.get(0) / r.nextGaussian() * ar2.get(0);
//			ar2.set(0, result);
//
//		}
//
//		sort(ar2);
//
//		return Math.round(ar2.get(0));
	}

}


Measured memory_bytes: 75384
from math import factorial as fc

N,K = map(int,input().split())
MOD = (10 ** 9)+ 7

for i in range(1,K+1):
    if N-K+1<i:
        print(0)
        continue
    bunbo = fc(i)*fc(N-K+1-i)*fc(i-1)*fc(K-i)
    bunsi = fc(N-K+1)*fc(K-1)
    print((bunsi//bunbo)%MOD)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 2e3 + 10;
inline int Max(int a, int b) { return a > b ? a : b; }
inline int Min(int a, int b) { return a > b ? b : a; }
namespace FastIO {
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
};
using namespace FastIO;
int N, X, arr[maxn], seg[maxn << 2];
struct Node {
    int base, transe;
} nodes[maxn];
inline void build(int l, int r, int cur)
{
    if (l == r) {
        seg[cur] = arr[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(l, mid, cur << 1), build(mid + 1, r, cur << 1 | 1);
    seg[cur] = Min(seg[cur << 1], seg[cur << 1 | 1]);
}
inline int query(int l, int r, int L, int R, int cur)
{
    if (l >= L && r <= R) {
        return seg[cur];
    }
    int mn = inf, mid = (l + r) >> 1;
    if (mid >= L) {
        mn = query(l, mid, L, R, cur << 1);
    }
    if (mid < R) {
        mn = Min(mn, query(mid + 1, r, L, R, cur << 1 | 1));
    }
    return mn;
}
signed main()
{
    //freopen("C:\Users\hjw\Downloads\testdata (4).in", "r", stdin);
    N = read(), X = read();
    for (ri i = 1; i <= N; ++i) {
        arr[i] = read();
    }
    build(1, N, 1);
    int ans = inf;
    for (ri t = 0; t <= N; ++t) {
        int sum = t * X;
        if (sum > ans)
            break;
        for (ri i = 1; i <= N; ++i) {
            int left = i - t, right = i, mn = inf;
            if (left < 1) {
                mn = Min(mn, query(1, N, 1, right, 1));
                mn = Min(mn, query(1, N, N + i - t, N, 1));
            } else {
                mn = query(1, N, left, right, 1);
            }
            sum += mn;
        }
        ans = Min(ans, sum);
    }
    writeln(ans);
    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a.back() - a.front() << endl;
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int H, N;
    scan(H, N);
    auto a = readln.split.to!(int[]);
    writeln(H <= a.sum() ? "Yes" : "No");
}
















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

#define min(a,b)            (((a) < (b)) ? (a) : (b))


int main(void){

        int i;
        int n;
        int len_tmp;
        char str[50] = {0};
        scanf("%d", &n);
        scanf("%s", str);
        int len = strlen(str);
//      printf("%s\n", str);
        int ans[50]={0};
        for(i=0;i<len;i++){
                ans[str[i]-'a']++;
        }
        for(i=0;i<n-1;i++){
                int tmp[50] = {0};
//              printf("plz print new string\n");
                scanf("%s", str);
//              printf("new str is %s\n", str);
                len_tmp = strlen(str);

                for(int j=0;j<len_tmp;j++)
                {
                        tmp[str[j]-'a']++;
                }
                for(int k=0;k<26;k++)
                {
                        ans[k] = min(ans[k],tmp[k]);
                }

        }

        for(int p=0;p<26;p++){
                while(ans[p]!=0){
                        printf("%c",p+'a');
                        ans[p]--;
                }

        }
        printf("\n");
}


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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define Fix( x ) setprecision( x ) << fixed
#define mem( a , x ) memset( a , x , sizeof( a ) )
#define bug( a , b ) cerr<< #a <<" = "<<a<<" , "<< #b <<" = "<<b<<"\n";
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define FOR( i , a , b ) for( int i = a; i <= b; i++ )
#define ROF( i , a , b ) for( int i = a; i >= b; i-- )
#define sz( V ) (int)V.size( )
#define all( V ) V.begin( ),V.end( )
#define Found( S , val ) S.find( val ) != S.end( )
#define Unique( V ) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
typedef pair < int , int > ii;
typedef pair < int , ii > iii;
typedef long long int LL;
typedef unsigned long long uLL;
const int inf = (int)1e9;
const LL INF = (LL)1e18;
const int N = 100005;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );


int main( int argc, char const *argv[] ) {
        fast_io;
        LL n;
        cin >> n;
        if( n%2 == 0 ) return cout << n << endl,0;
        cout << n*2 << endl;
        return 0;
}








Measured memory_bytes: 256
<?php
  $stdin = fopen('php://stdin', "r");

  while(true) {
      fscanf($stdin, "%d %d", $inH, $inW);
      if($inH === 0 && $inW === 0) {
          break;
      }

      for ($i=0; $i<$inH; $i++) {
        $flg = $i % 2 == 0 ? 0 : 1;
        for ($j=0; $j<$inW; $j++ ) {
          if ($j % 2 == $flg) {
            echo '#';
          } else {
            echo '.';
          }
        }
        echo PHP_EOL;
      }
      echo PHP_EOL;
  }



Measured memory_bytes: 9220
function Main(input) {
let info = input.split('\n');
let container = [];
for (let i = 0; i < info.length; i++){
container[i] = info[i].split(' ');
}
let m,f,r,q,g,s
for (let i = 0; i < container.length - 1; i++){
m = container[i][0];
f = container[i][1];
r = container[i][2];
q = parseInt(m,10);
g = parseInt(f,10);
s = parseInt(r, 10);
let score = q + g;

if (q === -1 && g === -1 && s === -1) {
break;
} else {
if (q === -1 || g === -1) {
console.log('F');
} else if (score >= 80) {
console.log('A');
} else if (score >= 65) {
console.log('B');
} else if (score >= 50) {
console.log('C');
} else if (score >= 30 && s >=50) {
console.log('C');
} else if (score >= 30 && s < 50) {
console.log('D');
} else {
console.log('F');
}
}
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  int N,position=1,count=0;
  cin>>N;
  vector<int> s(N);
  
  for(int i;i<N;i++){
    cin>>s.at(i);
  }
  
    
  while(true){
    position=s.at(position-1);
    count++;
    if(position==2)break;
    else if(count>N){
      count=-1;
      break;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3700
#include "bits/stdc++.h"
using namespace std;

struct cust {
	int  m;
	int l;
	int k;
};
 
struct query {
	int type;
	int time;
	int id;
};
struct aa {
	int id;
	int time;
};
class Compare {
public:
	bool operator()(const query&l,const query&r) {
		return l.time==r.time?l.type==r.type?l.id>r.id:l.type>r.type:l.time > r.time;
	}
	bool operator()(const aa&l, aa&r) {
		return l.time > r.time;
	}
};

bool check(const int T, const vector<cust>&cus, const int n) {
	int waitnum = n;
	priority_queue<query,vector<query>,Compare>que;
	set<int>waits;
	for (int i = 0; i < cus.size(); ++i) {
		que.push(query{ 0,0,i });
	}
	while (!que.empty()) {
		query q(que.top());
		que.pop();
		if (q.type == 1) {
			auto it = waits.begin();
			if (it == waits.end()) {
				waitnum++;
			}
			else {
				const int cid = *it;
				const int nexttime = q.time + cus[cid].m;
				if (nexttime <= T) {
					waits.erase(it);
					que.push(query{ 1,nexttime,0 });
				}else {
					return false;
				}
			}
		}
		else if (q.type == 0) {
			const int cid = q.id;
			if (waitnum) {
				waitnum--;
				const int nexttime = q.time + cus[cid].m;
				if (nexttime <= T) {
					que.push(query{ 1,nexttime,0 });
				}else {
					return false;
				}
			}
			else {
				waits.emplace(cid);
				const int nexttime = q.time + cus[cid].l;
				que.push(query{ 2,nexttime,cid });
			}
		}
		else if (q.type == 2) {
			const int cid = q.id;
			auto it = waits.find(cid);
			if (it!=waits.end()) {
				waits.erase(it);
				const int nexttime = q.time + cus[cid].k;
				if (nexttime <= T-cus[cid].m) {
					que.push(query{ 0,nexttime,cid });
				}
				else {
					return false;
				}
			}
			else {

			}
		}
	}
	return true;
}

int main() {
	while (1) {
		int N, T; cin >> N >> T;
		if (!N)break;
		vector<cust>cus;
		int totalm = 0;
		for (int i = 0; i < N; ++i) {
			int m, l, k; cin >> m >> l >> k;
			totalm += m;
			cus.push_back(cust{ m,l,k });
		}
		int amin = (totalm-1) / T + 1;
		for (int n = amin; n <= N; ++n) {
			if (check(T, cus, n)) {
				cout << n << endl;
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000
using namespace std;
typedef pair<int, int> P;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main()
{
    int N, W, H;
    cin >> N >> W >> H;
    vector<int> h(H + 10, 0);
    vector<int> w(W + 10, 0);
    rep(i, N)
    {
        int x, y, p;
        //cin >> x >> y >> p;
        scanf("%d%d%d", &x, &y, &p);
        h[max(0, y - p)]++;
        h[min(y + p, H)]--;
        w[max(0, x - p)]++;
        w[min(x + p, W)]--;
    }
    for (int i = 0; i <= W; i++)
    {
        if (i == 0)
            continue;
        w[i] += w[i - 1];
    }
    for (int i = 0; i <= H; i++)
    {
        if (i == 0)
            continue;
        h[i] += h[i - 1];
    }
    bool flag = false;
    for (int i = 0; i < W; i++)
    {
        if (w[i] == 0)
            //0があったらもう片方を確認する
            flag = true;
    }
    if (flag == false)
    {
        cout << "Yes" << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i < H; i++)
        {
            if (h[i] == 0)
                flag = false;
        }
    }
    if (!flag)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    //return 0;
    /*rep(i, W + 1) cout << w[i] << " ";
    cout << endl;
    rep(i, H + 1) cout << h[i] << " ";
    cout << endl;*/
    return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>//２つの整数 x, y を読み込み、それらを値が小さい順に出力するプログラム
 
void temp(int *,int *);
int main(void){
 
	int x,y,i;
     
	while(1){
		scanf("%d%d",&x,&y);
		if(x==0&&y==0)
			break;
		if(x>y)
			temp(&x,&y);
		printf("%d %d\n",x,y);
 	}
	return 0;
}

void temp(int *a,int *b){
	int temp;

	temp=*a;
	*a=*b;
	*b=temp;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(){


	string str;
	map<char,int> list;

	list['N'] = 0;
	list['W'] = 1;
	list['S'] = 2;
	list['E'] = 3;

	cin>>str;

	int flag[4]={0,0,0,0};

	for(int i=0;i<str.size();i++){
		flag[list[str.at(i)]]++;
	}
/*
	for(int i=0;i<4;i++){
		cout<<flag[i]<<" "<<(flag[i]>0)<<endl;
	}
*/
	int ans=0;

	ans = (flag[0]>0) - (flag[2]>0) + (flag[1]>0)*10 - (flag[3]>0)*10;

	if(ans==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}

	return 0;

}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Pair = Tuple!(int, "a", int, "b");

void main() {
    int A, B;
    scan(A, B);
    auto ans = max(0, A - 2*B);
    writeln(ans);
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i,n) for(int64 i = 0; i < (n); i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define FORR(i,a,b) for(int64 i = (a); i >= (b);--i )
#define all(x) x.begin(),x.end()
#define fs first;
#define sc second;

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

template<typename A, typename B> inline void chmin(A &a, B b) { if(a > b) a = b; }
template<typename A, typename B> inline void chmax(A &a, B b) { if(a < b) a = b; }



int main(void){
  cin.tie(0);
  int b;
  while (cin >> b && b) {
    FORR(x , (int64)sqrt(2 * b), 1){
      int64 y = 2 * b / x;
      if(x * y != 2 * b || (y - x + 1) % 2 != 0)continue;
      cout << (y - x + 1) / 2 << " " << x << endl;
      break;
    }

  }
}


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

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

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>

typedef long long ll;
const ll INF = 1 << 30;

int main(int argc, char* argv[])
{
  ll n;
  std::string s,r;
  std::cin >> n >> s;

  r = s;
  std::reverse(r.begin(), r.end());

  std::vector< ll > west(n, 0);
  std::vector< ll > east(n, 0);

  std::string::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    ll idx = std::distance(s.begin(), it);
    if (idx > 0) {
      west[idx] = it[-1] == 'W' ? west[idx-1] + 1 : west[idx-1];
    }
    //std::cout << idx << " " << west[idx] << std::endl;
  }

  for (it = r.begin(); it != r.end(); it++) {
    ll idx = std::distance(r.begin(), it);
    if (idx > 0) {
      east[idx] = it[-1] == 'E' ? east[idx-1] + 1 : east[idx-1];
    }
    //std::cout << idx << " " << east[idx] << std::endl;
  }

  ll ans = INF;
  for (int i = 0; i < n; i++) {
    ans = std::min(ans, west[i] + east[n-i-1]);
  }
  std::cout << ans << std::endl;
  
  return 0;
}


Measured memory_bytes: 5636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();
		int max = 0;
		for (int i = A; i < A + K; i++) {
			if (i > B) {
				break;
			}
			max = i;
			System.out.println(max);
		}
		for (int i = B - K + 1; i <= B; i++) {
			if (A > i) {
				break;
			}
			if (max < i) {
				System.out.println(i);
			}
		}
		sc.close();
	}
}

Measured memory_bytes: 25044
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
Arr.shift();
var obj={};
Arr.forEach(function(v){
var arr=v.split(" ");
if(arr[0]=="insert")obj[arr[1]]=true;
if(arr[0]=="find")console.log(obj.hasOwnProperty(arr[1]) ? "yes":"no");
});



Measured memory_bytes: 248600
#include<bits/stdc++.h>
using namespace std;
char s[100100]; 
int main()
{
    bool b=0;
    int n,ans=0;
    cin>>s;
    n=strlen(s);
    for(int i=0;i<n;i++){
        bool t;
        b=!b;
        if(s[i]=='g'){
            t=1;
        }else if(s[i]=='p'){
            t=0;
        }
        if(t==b)
            continue;
        else if(t==1&&b==0){
            ans++;
        }else{
            ans--;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 384
<?php
fscanf(STDIN, '%s', $S);
fscanf(STDIN, '%s', $N);
$ans = 0;
if ($S[0] === $N[0]) $ans++;
if ($S[1] === $N[1]) $ans++;
if ($S[2] === $N[2]) $ans++;
echo($ans).PHP_EOL;


Measured memory_bytes: 4856
#include <iostream>
#include <cstdio>
#include <cstring>
#define il inline
#define ri register
#define Size 800050
using namespace std;
int D[Size];
struct graph{
	struct point{
		int next,to;
	}ar[Size];
	int head[Size],art=1;
	il void link(int u,int v){
		ar[++art]={head[u],v},head[u]=art;
		ar[++art]={head[v],u},head[v]=art;
	}
}G,G1;
int ans[Size],a[Size];
il void read(int&),dfs(int,bool);
int main(){
	//freopen("in","r",stdin);
	int N,M;read(N),read(M);
	for(int i(1);i<=N;++i)read(D[i]);
	for(int i(1),u,v;i<=M;++i)
		read(u),read(v),G.link(u,v),ans[i]=1e9;
	for(int i(1),j,i1;i<=N;++i){
		for(j=G.head[i],i1=0;j;j=G.ar[j].next)
			if(!i1||make_pair(D[G.ar[j].to],G.ar[j].to)<
			   make_pair(D[G.ar[i1].to],G.ar[i1].to))i1=j;
		if(D[G.ar[i1].to]>D[i])return puts("-1"),0;
		ans[i1>>1]=D[i],G1.link(i,G.ar[i1].to);
	}memset(a,-1,sizeof(a));
	for(int i(1);i<=N;++i)if(!~a[i])dfs(i,0);
	for(int i(1);i<=N;++i)putchar(a[i]?'B':'W');
	putchar('\n');
	for(int i(1);i<=M;++i)printf("%d\n",ans[i]);
	return 0;
}
il void dfs(int x,bool c){a[x]=c;
	for(int i(G1.head[x]),i1;i;i=G1.ar[i].next)
		if(!~a[i1=G1.ar[i].to])dfs(i1,c^1);
}
il void read(int&x){
	x^=x;ri char c;while(c=getchar(),c<'0'||c>'9');
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
}


Measured memory_bytes: 20864