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

typedef long long ll;

int main(){
  ll N, M, V, P; cin >> N >> M >> V >> P;
  vector<ll> a(N, 0);
  for(ll i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  ll bgn = -1, end = N;
  while(end - bgn > 1){
    ll mid = bgn + (end - bgn) / 2;
    vector<ll> b(N, 0);
    
    for(ll i = 0; i < N; i++){
      b[i] = a[i];
  	}
    
    ll cnt = 0;
    for(ll i = 0; i <= mid; i++){
      b[i] += M;
      cnt++;
  	}
    for(ll i = 1; i < P; i++){
      b[N - i] += M;
      cnt++;
  	}
    
    if(b[N - P] > b[mid]){
      bgn = mid;
    }else if(cnt >= V){
      end = mid;
    }else{
      ll s = cnt * M;
      for(ll i = mid+1; i <= N - P; i++){
        s += b[mid] - b[i];
      }
      if(s < M * V){
        bgn = mid;
      }else{
        end = mid;
      }
    }
  }
  while(bgn < N - 1 && a[bgn] == a[bgn+1]){
    bgn++;
  }
  cout << max(N - bgn - 1, 1LL) << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}


long long int a[3][100001];

struct mise {
	int number;
	string name;
	int value;
};

bool biggerthan(mise a, mise b) {
	if (a.name != b.name)  return a.name < b.name;
	return a.value > b.value;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}
	int maxer = imax(a);
	bool flag = false;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int b = a.at(i);
		if (b == maxer && flag == false) {
			b =  b / 2;
			flag = true;
		}
		sum += b;
	}
	cout << sum << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
int32_t main()
{
   fastio
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   int num=b-a+1;
   int div1=(b/d)-((a-1)/d);
   int div2=(b/c)-((a-1)/c);
   int lc=c*d/__gcd(c,d);
   int div3=(b/lc)-((a-1)/lc);
   cout<<num-(div1+div2-div3)<<endl;

   return 0;
}


Measured memory_bytes: 256
/**
*    created: 03.07.2020 18:33:51
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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 long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    rep2(i,1,100001) {
        if (i*i <= n && n < (i+1)*(i+1)) {
            cout << i*i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int inf = 1012345678;
int V, E, s, a[2009], b[2009], c[2009], dist[2009];
int main() {
	scanf("%d%d%d", &V, &E, &s);
	for(int i = 0; i < E; i++) scanf("%d%d%d", &a[i], &b[i], &c[i]);
	fill(dist, dist + V, inf); dist[s] = 0;
	for(int i = 0; i < V; i++) {
		for(int j = 0; j < E; j++) {
			dist[b[j]] = min(dist[b[j]], dist[a[j]] + c[j]);
		}
	}
	bool flag = false;
	for(int i = 0; i < E; i++) {
		if(dist[b[i]] < inf / 2 && dist[a[i]] + c[i] < dist[b[i]]) flag = true;
	}
	if(flag) puts("NEGATIVE CYCLE");
	else for(int i = 0; i < V; i++) {
		if(dist[i] >= inf / 2) puts("INF");
		else printf("%d\n", dist[i]);
	}
	return 0;
}

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

typedef unsigned long long ll;

int main() {
	int n;
	cin >> n;
	vector<pair<ll, ll>> data;
	for(int i=0; i<n; i++){
		ll a, b;
		cin >> a >> b;
		data.push_back(make_pair(b, a));
	}
	sort(data.begin(), data.end());
	ll now=0;
	bool ans = true;
	for(int i=0; i<n; i++){
		now += data.at(i).second;
		if(now > data.at(i).first){
			ans = false;
			break;
		}
	}
	if(ans){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 6384
#include<stdio.h>
int main()
{
   int i,a,b;
   scanf("%d%d",&a,&b);
   if(a>b)
    for(i=1;i<=a;i++)
    printf("%d",b);
   else if(a<b)
    for(i=1;i<=b;i++)
    printf("%d",a);
   else
    for(i=0;i<a;i++)
    printf("%d",a);
   return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,m,cnt;
bool vis[202020];
vi ed[202020];
void dfs(int x){
	vis[x]=1;
	fo(i,0,ed[x].size()) if(!vis[ed[x][i]])dfs(ed[x][i]);
	cnt++;
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>m;
	fo(i,0,m){
		int u,v;
		cin>>u>>v;
		--u;--v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	int ans=0;
	fo(i,0,n) if(!vis[i]){
		cnt=0;
		dfs(i);
		ans=max(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 20952
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N>>S;
    set<char> memo, rmemo;
    vec alp(26,0), ralp(26,0);
    rep(i,N){
        if(memo.find(S[i]) == memo.end()) {
            alp[S[i] - 'a'] = i;
            memo.insert(S[i]);
        }
    }
    for(int i = N-1; i >= 0; --i){
        if(rmemo.find(S[i]) == rmemo.end()) {
            ralp[S[i] - 'a'] = i;
            rmemo.insert(S[i]);
        }
    }
    ll temp = 0, ans = 0;
    rep(i,N){
        rep(j,26){
            temp += i == alp[j];
            temp -= i == ralp[j];
        }
        ans = max(ans, temp);
    }
    cout<<ans<<endl;
}


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

using P = pair<int, int>;
bool custom(vector<int> &p, vector<int> &q) {
  if(p[0] == q[0]) return (p[1] < q[1]);
  else return (p[0] < q[0]);
}
int main() {
  int n, m;
  cin >> n >> m;
  int total = 0;
  for(int i=0;i<m;i++) {
    int a;
    cin >> a;
    total += a;
  }
  if(total > n) cout << -1 << endl;
  else cout << n - total << endl;
  return 0;
}



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

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

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

	string S, T;
	cin >> S >> T;
	int ans = 0, n = S.size();
	for(int i = 0; i < n; ++i) if(S[i] != T[i]) ++ ans;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3764
#include<iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,1,n)

int x;

int main(){
  cin >> x ;
  int ans=1;

  FOR(i,2,x){
    int tmp = i;
    FOR(j,2,11){
      tmp *= i;
      if(tmp<=x){
        ans = max(ans,tmp);
      }
      else break;
    }

  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    x: usize1,
    y: usize1,
  }
  let mut ans = vec![0; n];
  for i in 0 .. n {
    for j in i+1 .. n {
      let d1 = j - i;
      let d2 = (i as i64 - x as i64).abs() + (j as i64 - y as i64).abs() + 1;
      ans[cmp::min(d1, d2 as usize)] += 1;
    }
  }

  for i in 1 .. n {
    puts!("{}\n", ans[i]);
  }
}


Measured memory_bytes: 4352
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <set>

using namespace std;

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

typedef long long ll;

bool check(const vector<string>& board, int shift) {
  int n = board.size();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      char cur = board[i][j];
      char rev = board[(j+n-shift)%n][(i+shift)%n];
      if (cur != rev) return false;
    }
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  vector<string> board(n);
  for (string &s: board) {
    cin >> s;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (check(board, i)) {
      ans += n;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;


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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        // ビジネスロジックここから
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ans = a*b;
        
        if (a <= 9 & b <= 9 ) {
            System.out.println(ans);
        }else {
            System.out.println(-1);
        }
        
        
        // ビジネスロジックここまで

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 24916
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ll long long int
#define PI 3.141592653589793
using namespace std;

int main(void){
    int a,b,c,d,start,end,ans;

    cin >> a >> b >> c >> d;
    
    start = max(a,c);
    end = min(b,d);
    ans = max(0, end - start);
    
    cout << ans << endl;

    return 0;
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	cout << s.substr(0, 5) << " ";
	cout << s.substr(6, 7) << " ";
	cout << s.substr(14) << endl;
	return 0;
}


Measured memory_bytes: 256
import scala.math.sqrt
import scala.annotation.tailrec

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, d = sc.nextInt()
  val xy = List.fill(n)(sc.nextDouble, sc.nextDouble)
  println(countResult(xy, 0))
    
  @tailrec
  def countResult(xy: List[(Double, Double)], acc: Int): Int = {
    val ret = if (judge(calcDistance(xy.head._1, xy.head._2), d.toDouble)) 1 else 0
    if (xy.tail.isEmpty) {
      acc + ret
    } else {
      countResult(xy.tail, acc + ret)
    }    
  }
    
  def calcDistance(x: Double, y: Double): Double = {
    sqrt(x * x  + y * y)
  }
  def judge(target: Double, credencial: Double): Boolean = target <= credencial
}

Measured memory_bytes: 74264
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        if n == 0:
            break

        a = [LI() for _ in range(n)]
        s = [set() for _ in range(n)]
        d = collections.defaultdict(list)
        for i in range(n):
            d[a[i][3]].append(i)
            for j in range(i):
                k = (a[i][0] - a[j][0]) ** 2 + (a[i][1] - a[j][1]) ** 2
                l = (a[i][2] + a[j][2]) ** 2
                if k < l:
                    s[i].add(j)

        ps = None
        for v in d.values():
            l = len(v) // 2
            vs = set(map(lambda x: tuple(sorted([tuple(sorted([x[i*2], x[i*2+1]])) for i in range(l)])), itertools.permutations(v)))
            vl = list(vs)
            if ps is None:
                ps = vl
            else:
                ps = list(map(lambda x: list(x[0]) + list(x[1]),itertools.product(ps,vl)))

        r = 0
        for pa in ps:
            f = True
            ts = set(range(n))
            pas = set(pa)
            tr = 0
            while f:
                f = False
                for p in list(pas):
                    if len(ts & s[p[0]]) == 0 and len(ts & s[p[1]]) == 0:
                        ts.remove(p[0])
                        ts.remove(p[1])
                        pas.remove(p)
                        f = True
                        tr += 2
            if r < tr:
                r = tr

        rr.append(r)

    return '\n'.join(map(str, rr))



print(main())



Measured memory_bytes: 18060
#include <stdio.h>

int n;
int A[100000];//記録用の外部配列

int partition(int ,int);

int main(){
  int i;
  int index;
  
  scanf("%d", &n);
  for(i = 0;i < n; i++){
    scanf("%d", &A[i]);
  }
  
  index = partition(0, n - 1);
  
  for(i = 0;i < n; i++){
    if(i == index){
      printf("[%d]",A[i]);
    }else{
      printf("%d",A[i]);
    }
    //空白作成
    if(i < n - 1) printf(" ");
  }
  
  printf("\n");
  return 0;
}

int partition(int p, int r){
  int i, j;
  int x, temp;
  
  x = A[r];
  i = p - 1;
  
  for(j = p; j <= r - 1; j++){
    if(A[j] <= x){
      i = i +1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  
  temp = A[i + 1];
  A[i + 1] = A[r];
  A[r] = temp;
  
  return i + 1;
}



Measured memory_bytes: 2144
#include <iostream>
using namespace std;
int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  int val = a * x + b * y;
  if (x > y) {
    for (int i = y; i <= x; i++) {
      if (val > (x - i) * a + c * 2 * i) {
        val = (x - i) * a + 2 * c * i;
      }
    }
  } else {
    for (int i = x; i <= y; i++) {
      if (val > (y - i) * b + 2 * i * c) {
        val = (y - i) * b + 2 * i * c;
      }
    }
  }
  cout << val << endl;
  return 0;
}


Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto A = readAs!(int[]);
	if(A.filter!(v => v % 2 == 0).all!(v => (v % 3 == 0 || v % 5 == 0))) writeln("APPROVED");
	else writeln("DENIED");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
count=0
ba=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    ba[a]+=b
 
for i in range(len(ba)):
    k-=ba[i]
    if k<=0:
        print(i)
        break

Measured memory_bytes: 11748
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,v[100001]={},a,q,b,c,s{};
    cin>>n;
    fr(i,n){
        cin>>a;
        ++v[a];
        s+=a;
    }
    cin>>q;
    fr(i,q){
        cin>>b>>c;
        s+=(c-b)*v[b];
        v[c]+=v[b];
        v[b]=0;
        cout<<s<<'\n';
    }
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 1e5+5;

int main() {
    int N, K;
    scanf("%d%d", &N, &K);
    int ans = K;
    REP(i, 2, N) ans *= (K-1);
    printf("%d\n", ans);
    return 0;
}


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

int main() {
int A,B,C,D,R,F,G;
cin >> A >> B >> C >> D >> R;
F = A-R;
G = B-R;
if (R <= C && F >= C && R <= D && G >= D) {
cout <<"Yes"<< endl;
} else {
cout <<"No"<< endl;
}

return 0;
}


Measured memory_bytes: 3092
//クラス名は必ずMainにする必要があります。

import java.util.*;

public class Main {
  	public static void main(String args[] ) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		
		if(400 <=n && n < 600){
			System.out.println("8");
		}else if(600 <=n && n < 800){
			System.out.println("7");
		}else if(800 <=n && n < 1000){
			System.out.println("6");
		}else if(1000 <=n && n < 1200){
			System.out.println("5");
		}else if(1200 <=n && n < 1400){
			System.out.println("4");
		}else if(1400 <=n && n < 1600){
			System.out.println("3");
		}else if(1600 <=n && n < 1800){
			System.out.println("2");
		}else if(1800 <=n && n < 2000){
			System.out.println("1");
		}
		 
		
	}
	
}


Measured memory_bytes: 35932
H, W = map(int, input().split())

P = [[0 if x == "#" else 1 for x in input()]+[0] for _ in range(H)]
C = [[-1*P[x][y] for y in range(W)] + [0] for x in range(H)]
W += 1
H += 1
P.append([0] * W)
C.append([0] * W)


for i in range(H):
    cnt = 0
    for j in range(W):
        if P[i][j] == 0:
            for k in range(cnt):
                C[i][j-1-k] += k
            cnt = 0
        else:
            cnt += 1
        C[i][j] += cnt

for j in range(W):
    cnt = 0
    for i in range(H):
        if P[i][j] == 0:
            for k in range(cnt):
                C[i-1-k][j] += k
            cnt = 0
        else:
            cnt += 1
        C[i][j] += cnt


print(max((x for ci in C for x in ci)))


Measured memory_bytes: 120028
#n = int(input())
#a = int(input())
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
a,b,c = list(map(int,input().split(" ")))
#string = input()

if a <= c <= b:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
    cout<<"hon";
  else if(n%10==0||n%10==1||n%10==6||n%10==8)
    cout<<"pon";
  else
    cout<<"bon";
  return 0;
}

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

struct unionfind{
    vector<int> par;
    vector<int> size;
    unionfind(int n):par(n),size(n,1){
        rep(i,n)par[i]=i;
    }
    
    int root(int x){
        if(par[x]==x)return x;
        return par[x]=root(par[x]);
    }
    
    void unit(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y)return;
        if(size.at(x)<size.at(y)) swap(x,y);
        par[y]=x;
        size.at(x)+=size.at(y);
    }
    
    bool same(int x,int y){
        x=root(x);
        y=root(y);
        return x==y;
    }
    
    int sizes(int x){
        return size.at(root(x));
    }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
    int n,m,k;
    cin>>n>>m>>k;
    vector<int> d(n+1,0);
    unionfind tree(n+1);
    rep(i,m){
        int x,y;
        cin>>x>>y;
        d.at(x)++;
        d.at(y)++;
        tree.unit(x,y);
    }
    vector<vector<int>> c(n+1);
    rep(i,k){
        int x,y;
        cin>>x>>y;
        c.at(x).push_back(y);
        c.at(y).push_back(x);
    }

    for(int i=1;i<=n;i++){
        int tot=tree.sizes(i)-d.at(i)-1;
        for(int j=0;j<c.at(i).size();j++)if(tree.root(i)==tree.root(c.at(i).at(j)))tot--;
       if(i!=1)cout<<' ';
       cout<<tot;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 7168
n = int(input())

seq = [[0] * (n) for i in range(n)]

for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        if y:
            seq[i][x-1] = 1
        else:
            seq[i][x-1] = -1

ans = 0
for i in range(2 ** n):
    cnt = [0] * (n)
    for j in range(n):
        if (i >> j) & 1:
            cnt[j] = 1
    tot = True
    for k in range(n):
        if cnt[k]:
            for l in range(n):
                if seq[k][l] == 1 and not cnt[l]:
                    tot = False
                elif seq[k][l] == -1 and cnt[l]:
                    tot = False
    if tot:
        ans = max(ans, cnt.count(1))

print(ans)

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

int main(){
  string s,t;cin>>s>>t;
  ll cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i))cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    ll N, A, B;
    cin>>N>>A>>B;
    if(A==0){
        cout<<0<<endl;
        return 0;
    }
    if(B==0){
        cout<<N<<endl;
        return 0;
    }
    ll Ans=N/(A+B)*A;
  	ll Am=N%(A+B);
  	Ans+=min(Am, A);
  	cout<<Ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()

int main(){
	int N;cin>>N;
	vector<pair<int,int>> s(N);
	rep(i,0,N) cin>>s[i].first>>s[i].second;
	sort(range(s));
	map<int,map<int,int>> count;
	int a,b,c,d;int ans=0;
	rep(i,0,N){
		a=s[i].first;
		b=s[i].second;
		rep(j,0,i){
			c=s[j].first;
			d=s[j].second;
			count[a-c][b-d]++;
			ans=max(ans,count[a-c][b-d]);
		}
	}cout<<N-ans<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
using namespace std;
typedef long long int LL;
typedef vector<int> VI;
 
int main(){
  string S;
  int dest[2];
  cin >> S >> dest[0] >> dest[1];
  int len = S.size();
  int mode = 0, cdist = 0, firstmove = 1;
  int visited[2][16001] = {};
  visited[0][8000] = 1; visited[1][8000] = 1;
  REP(i,len) {
    if(S[i] == 'T') {
      if(cdist != 0) {
        int nvisited[16001] = {};
        if(firstmove) {
          nvisited[8000 + cdist] = 1;
        } else {
          REP(j, 16001) {
            if(visited[mode][j]) {
              nvisited[j + cdist] = 1;
              nvisited[j - cdist] = 1;
            }
          }
        }
        REP(j, 16001) {
          visited[mode][j] = nvisited[j];
        }
      }
      mode = !mode;
      cdist = 0;
      firstmove = 0;
    } else {
      cdist++;
    }
  }
  if(cdist != 0) {
    int nvisited[16001] = {};
    if(firstmove) {
      nvisited[8000 + cdist] = 1;
    } else {
      REP(j, 16001) {
        if(visited[mode][j]) {
          nvisited[j + cdist] = 1;
          nvisited[j - cdist] = 1;
        }
      }
    }
    REP(j, 16001) {
      visited[mode][j] = nvisited[j];
    }
  }
  
  int ret = 1;
  REP(m, 2) {
    ret &= visited[m][8000 + dest[m]];
  }
  cout << (ret ? "Yes" : "No") << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void write(int h,int w){
    for(int i=0;i<h;i++){
        if((i+1)%2==1){
            for(int j=0;j<w;j++){
                if((j+1)%2==1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            cout<<endl;
        }else{
            for(int j=0;j<w;j++){
                if((j+1)%2==1){
                    cout<<".";
                }else{
                    cout<<"#";
                }
            }
            cout<<endl;
        }
    }
    cout<<endl;
    return;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int h,w;
    cin>>h>>w;
    while(h!=0){
        write(h,w);
        cin>>h>>w;
    }
    return 0;
}


Measured memory_bytes: 3108
""" E
    https://atcoder.jp/contests/abc173/tasks/abc173_e
"""
import sys
import math
from functools import reduce

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return reduce(lambda acc, _: acc + [readIntegerSet(m)], range(0, n), [])

def main(N, X, M):
    A = X
    m = {A: A}
    i = -1
    for j in range(1, M):
        A = (A * A) % M if M > 0 else 0
        if A in m:
            i = list(m.keys()).index(A)
            break
        else:
            m[A] = A

    if i == -1:
        return sum(m.values())
    else:
        l = list(m.values())
        s1 = sum(l[:i])
        len_repeat = len(l) - i
        s2 = sum(l[i:])

        return s1 + int((N-i)/len_repeat) * s2 + sum(l[i:(N-i)%len_repeat+i])

if __name__ == "__main__":
    _N, _X, _M = readIntegerSet(3)

    print(main(_N, _X, _M))

Measured memory_bytes: 14592
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mt make_tuple
#define pb push_back
const int N = 1e5 + 10;

int main(){
    int n,k,heights[N],dp[N];
    cin>>n>>k;
    for(int i=1;i<=n;i++)    cin>>heights[i];
    dp[1] = 0;
    for(int i=2;i<=n;i++){
        dp[i] = INT32_MAX;
        for(int j=1;j<=k;j++){
            if(i-j>0){
                dp[i] = min(dp[i],dp[i-j] + abs(heights[i]-heights[i-j]));
            }
            else    break;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<list>

int main(){
    int n;
    std::cin >> n;
    if(n == 0){
        std::cout << 0 << std::endl;
        return 0;
    }
    
    std::list<int> ans;
    while(std::abs(n) > 0){
        ans.push_front(std::abs(n % 2));
        n = (n - std::abs(n % 2)) / (-2);
    }
    
    for(auto a : ans) std::cout << a;
    std::cout << "\n" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

struct P {
  vector<int> v;
  P(vector<int> &v) : v(v) {}
  P rotate1() {
    P r = *this;
    REP(i,3) swap(r.v[i],r.v[(i+1)%4]);
    REP(i,3) swap(r.v[4+i],r.v[4+(i+1)%4]);
    return r;
  }
  P rotate2() {
    vector<int> w = this->v;
    swap(w[0],w[4]);swap(w[4],w[5]);swap(w[5],w[1]);
    swap(w[2],w[3]);swap(w[3],w[7]);swap(w[7],w[6]);
    return P(w);
  }
  P rotate3() {
    vector<int> w = this->v;
    swap(w[0],w[4]);swap(w[4],w[7]);swap(w[7],w[3]);
    swap(w[1],w[5]);swap(w[5],w[6]);swap(w[6],w[2]);
    return P(w);
  }
  vector<P> all() {
    P r = *this;
    vector<P> res;
    for (int i=0; i<6; ++i,r=(i&2?r.rotate2():r.rotate3())) {
      for (int j=0;j<4; ++j,r=r.rotate1())
        res.push_back(r);
    }
    return res;
  }
};
int main() {
  string s;
  while(cin>>s) {
    map<string, int> mp;
    int num = 0;
    vector<int> v;
    mp[s] = num++;
    v.push_back(mp[s]);
    REP(i,7) {
      cin >> s;
      if (mp.count(s) == 0) mp[s] = num++;
      v.push_back(mp[s]);
    }
    vector<int> cnt(24);
    sort(ALL(v));
    do {
      vector<P> ret = P(v).all();
      REP(i,24) {
        if (ret[i].v == v) cnt[i]++;
      }
    } while(next_permutation(ALL(v)));
    int ans = 0;
    REP(i,24) ans += cnt[i];
    cout << ans/24 << endl;
  }
}

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

int main()
{
    int n, m, k, ans = 0;
    cin >> n >> m >> k;
    vector<int> a(n), b(m);

    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    ll t = 0;
    rep(i, m) t += b[i];

    int j = m;
    rep(i, n+1) {
        while (j > 0 && t > k) {
            --j;
            t -= b[j];
        }
        if (t > k) break;
        ans = max(ans, i + j);
        if (i == n) break;
        t += a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    vector<int>safe;
    vector<int>out;
    for(int i=0;i<=n;i++){
        if(s[i]=='0')safe.push_back(i);
        else out.push_back(i);
    }
    int p=n;
    vector<int>move;
    while(true){
        if(p<=m){
            move.push_back(p);
            break;
        }
        int x=*lower_bound(safe.begin(),safe.end(),p-m);
        if(x==p){
            cout<<"-1"<<endl;
            return 0;
        }
        move.push_back(p-x);
        p=x;
    }
    for(int i=move.size()-1;i>=0;i--)cout<<move[i]<<endl;
    return 0;
}

Measured memory_bytes: 1592
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<vector<long long>> job;
	job.resize(N);

	for (int i = 0; i < N; ++i) {
		long long a, b;
		cin >> a >> b;
		job[i].resize(2);
		job[i][0] = b;
		job[i][1] = a;
	}
	sort(job.begin(), job.end());

	long long time = 0;
	for (int i = 0; i < N; ++i) {
		time += job[i][1];
		if (time > job[i][0]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

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

    string ans;
    vector<string> str(N);

    for(int i=0;i<N;i++){
        cin >> str[i];
    }
    string cmp;
    int del;
    while(str.size()!=0){
        for(int i=0;i<str.size();i++){
            if(i==0){
                cmp=str[i];
                del=0;
            }else if(cmp<str[i]){
                cmp=str[i];
                del=i;
            }
            if(i==str.size()-1){
                ans=str[del]+ans;
                str.erase(str.begin()+del,str.begin()+del+1);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
function Main(input){ 
  var H = input.split("\n")[0].split(" ")[0];
  var W = input.split("\n")[0].split(" ")[1];
  var h = input.split("\n")[1].split(" ")[0];
  var w = input.split("\n")[1].split(" ")[1];
  var twice = parseInt(h,10)*parseInt(w,10);
  var row = parseInt(H,10)*parseInt(w,10);
  var col = parseInt(h,10)*parseInt(W,10);
  var S = parseInt(H,10)*parseInt(W,10);
  var answer = S -(row + col -twice);

  console.log(answer);

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

Measured memory_bytes: 7624
from itertools import permutations
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

i = 0
for x in permutations(range(1, n+1)):
	i += 1
	if list(x) == p:
		a = i
	if list(x) == q:
		b = i
print(abs(a-b))

Measured memory_bytes: 3064
n = int(input())

testimony = []

for i in range(n):
    a = int(input())
    test = []
    for j in range(a):
        x,y = map(int,input().split())
        test.append([x-1,y])
    testimony.append(test)

ans = 0

for i in range(2**n):
    good = [0]*n
    f = 1
    for j in range(n):
        if (i>>j)&1:
            good[j] = 1

    for k in range(n):
        if good[k]:
            for l,m in testimony[k]:
                if good[l] != m:
                    f = 0
    
    if f:
        ans = max(ans,sum(good))

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
  int N,K;
  cin>>N>>K;
  long long counter=0;
  if(((N-1)*(N-2))/2 < K){
    cout<<-1<<"\n";
  }  
  else{
    cout<<(N*(N-1)/2 - K)<<"\n";
    for(int i=1;i<N;++i){
      if(counter==(N*(N-1)/2 - K)){
        break;}
      for(int j=i+1;j<=N;++j){
        if(counter==(N*(N-1)/2 - K)){
          break;}
        cout<<i<<" "<<j<<"\n";
        counter+=1;
        }
      }
    }
return 0;
}


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

#define INF 1e9

int DPX[20000];
int DPY[20000];

int main() {
	string S; cin >> S;
	int x, y; cin >> x >> y;
	vector<int>vx, vy;
	int cnt = 0;
	bool f = true;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'F')cnt++;
		else {
			if (f)vx.push_back(cnt);
			else vy.push_back(cnt);

			cnt = 0;
			f ^= 1;
		}
	}
	if (f)vx.push_back(cnt);
	else vy.push_back(cnt);

	for (int j = 0; j < 20000; j++) {
		DPX[j] = DPY[j] = INF;
	}

	DPX[10000] = 0;
	for (int i = 0; i < vx.size(); i++) {
		vector<int>tmp;
		for (int j = 19000; j > 1000; j--) {
			if (DPX[j] != i)continue;

			tmp.push_back(j + vx[i]);
			if(i!=0)tmp.push_back(j - vx[i]);
		}

		for (int j = 0; j < tmp.size(); j++)DPX[tmp[j]] = i + 1;
	}

	DPY[10000] = 0;
	for (int i = 0; i < vy.size(); i++) {
		vector<int>tmp;
		for (int j = 19000; j > 1000; j--) {
			if (DPY[j] != i)continue;

			tmp.push_back(j + vy[i]);
			tmp.push_back(j - vy[i]);
		}

		for (int j = 0; j < tmp.size(); j++)DPY[tmp[j]] = i + 1;
	}

	if (DPX[10000 + x] == vx.size() && DPY[10000 + y] == vy.size())cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    long long N,D;
    cin>>N>>D;
    int count=0;
    for(int i=0;i<N;i++){
        long long X,Y;
        cin>>X>>Y;
        if(X*X+Y*Y<=D*D) count++;
    }
    printf("%d\n",count);
    return 0;
    
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    while (true){
        int m,a,b;
        cin >> m >> a >> b;
        if (m==0 && a==0 && b==0) break;
        vector<int> n(m);
        for (int i=0;i<m;i++){
            cin >> n.at(i);
        }
        int u=0,ans=0;
        for (int i=a-1;i<b;i++){
            if (n.at(i)-n.at(i+1)>=u) {u=n.at(i)-n.at(i+1);ans=i+1;}
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 100005
#define PI 2*acos(0.0)
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;

ll d[305][305], h[305][305];

void FloyedWarshall1(int n)
{
    for(int k=1; k<=n; k++)
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
                d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
}

void FloyedWarshall2(int n)
{
    for(int k=1; k<=n; k++)
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
                h[i][j] = min(h[i][j],h[i][k]+h[k][j]);
}

void init()
{
    for(int i = 0; i < 305; i++)
        for(int j = 0; j < 305; j++)
            d[i][j] = h[i][j] = (i==j?0LL:infLL);
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    init();
    int n, m;
    ll L;
    cin>>n>>m>>L;
    for(int i = 0; i < m; i++)
    {
        int u, v;
        ll c;
        cin>>u>>v>>c;
        d[u][v] = d[v][u] = c;
    }
    FloyedWarshall1(n);
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            if(d[i][j]<=L)
                h[i][j] = 1LL;
    FloyedWarshall2(n);
    int q;
    cin>>q;
    while(q--)
    {
        int u, v;
        cin>>u>>v;
        ll ans = h[u][v];
        if(ans==infLL)
            cout<<"-1"<<endl;
        else
            cout<<ans-1<<endl;
    }

    return 0;
}


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

int main() {
	int N, M, X, Y; cin >> N >> M >> X >> Y;
	int x[110], y[110];
	for(int i=0; i<N; ++i) cin >> x[i];
	for(int i=0; i<M; ++i) cin >> y[i];
	sort(x, x+N, greater<int>());
	sort(y, y+M);
	X=max(X, x[0]); Y=min(Y, y[0]);
	if(X<Y) cout << "No War" << endl;
	else cout << "War" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==1&&b==2||a==2&&b==1){
		printf("3\n");
	}
	else if(a==1&&b==3||a==3&&b==1){
		printf("2\n");
	}
	else{
		printf("1\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
#include <math.h>
#include <tgmath.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}

ll comb2(ll a) {
    ll b = a / 2;
    if (a % 2) {
        b = (a - 1) / 2;
        return (b * a);
    }
    return (b * (a - 1));
}

int dfs(int x, int y, int z) {
    if (x == a && y == b && z == c) return 1;
    
    int ans = 0;
    if (x != a) ans += dfs(x + 1, y, z);
    if (x >= y + 1/* && y != b*/) ans += dfs(x, y + 1, z);
    if (y >= z + 1/* && z != c*/) ans += dfs(x, y, z + 1); 

    return ans;
}

uint64_t gcd_impl( uint64_t n, uint64_t m ) {
        for( int i = 0; i < 10; ++i ) {
                uint64_t t = n - m;
                bool q = m > t;
                n = q ? m : t;
                m = q ? t : m;
                if( m == 0 ) { return n; }
        }
        return gcd_impl( m, n % m );
}

uint64_t gcd( uint64_t n, uint64_t m ) {
        return n > m ? gcd_impl( n, m ) : gcd_impl( m, n );
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    unordered_map<string, int> um;
    rep (i, 0, n) {
        string s;
        cin >> s;
        if (um[s] == 0) um[s] = 1;
    }
    m = 0;
    for(auto itr = um.begin(); itr != um.end(); ++itr) {
        m += itr->second;
    }
    cout << m << endl;

    return 0;
}



Measured memory_bytes: 17644
#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 n, x;
  cin >> n >> x;
  vi ans(2 * n - 1, 0);
  if (x == 1 || x == 2 * n - 1) {
    cout << "No" << endl;
    return 0;
  }
  if (x == 2 || x == 2 * n - 2) {
    ans[(2 * n - 1) / 2] = x;
    ans[(2 * n - 1) / 2 - 1] = 1;
    ans[(2 * n - 1) / 2 + 1] = 2 * n - 1;
    int c = 2 == x ? 3 : 2;
    REP(i, 2 * n - 1) {
      if (ans[i] != 0) {
        continue;
      }
      ans[i] = c;
      c++;
      if (c == x)
        c++;
    }
  } else {
    ans[(2 * n - 1) / 2] = x;
    ans[(2 * n - 1) / 2 - 1] = 1;
    ans[(2 * n - 1) / 2 + 1] = 2 * n - 1;
    ans[(2 * n - 1) / 2 - 2] = 2 * n - 2;
    ans[(2 * n - 1) / 2 + 2] = 2;
    int c = 3 == x ? 4 : 3;
    REP(i, 2 * n - 1) {
      if (ans[i] != 0)
        continue;
      ans[i] = c;
      c++;
      if (c == x) {
        c++;
      }
    }
  }
  cout << "Yes" << endl;
  REP(i, 2 * n - 1) { cout << ans[i] << endl; }
}


Measured memory_bytes: 2304