akhauriyash/Code-Regression huggingface dataset:
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(new string[]{" "}, StringSplitOptions.RemoveEmptyEntries);
        int N = Int32.Parse(input[0]);
        int L = Int32.Parse(input[1]);
        int total = 0;
        for (int i = 1; i <= N; i++)
        {
            total += L + i - 1;
        }
        // 全部が美味しい(正の値 || 0)
        if (L >= 0)
        {
            total -= L + 1 - 1;
        }
        else
        {
            // 全てまずい(負の値)
            total -= ((L + N - 1) < 0) ? L + N - 1 : 0;
        }
        Console.WriteLine(total);
    }
}


Measured memory_bytes: 11092
def main():
    N = int(input())

    x = [[int(a) for a in input().split()] for i in range(N - 1)]

    for i in range(N):
        time = 0
        for a in range(i, N-1):
            C = x[a][0]
            S = x[a][1]
            F = x[a][2]
            time = max(time, S)
            if time % F == 0:
                pass
            else:
                time = time + F - time % F
            time += C
        print(time)

main()

Measured memory_bytes: 3188
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a > b)cout << "a > b" << endl;
	else if (a < b)cout << "a < b" << endl;
	else cout << "a == b" << endl;
	return 0;
	
}

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

int main() {
  int N;
  scanf("%d", &N);
  char S[N];
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }

  int x = 0;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'I') {
      x++;
    } else if (S[i] == 'D') {
      x--;
    }
    ans = max(ans, x);
  }

  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S_list = [input() for _ in range(N)]

min_revr, min_revl = 10**20, 10**20
left, rev_l, rev_r, right = 0, 0, 0, 0
for S in S_list:
    stack = []
    l, r = 0, 0
    for s in S:
        if s == '(':
            if stack:
                if stack[-1] == ')':
                    stack.append('(')
                    l = 1
                else:
                    stack.append('(')
                    l += 1
            else:
                stack.append('(')
                l = 1
        else:   # s==')'
            if stack:
                if stack[-1] == '(':
                    stack.pop()
                    l -= 1
                else:
                    stack.append(')')
                    r += 1
            else:
                stack.append(')')
                r = 1
    if l == 0:
        right += r
    elif r == 0:
        left += l
    else:
        rev_r += r
        rev_l += l
        min_revr = min(min_revr, r)
        min_revl = min(min_revl, l)

if min_revr == 10**20:
    min_revr = 0
if min_revl == 10**20:
    min_revl = 0

if left+rev_l == rev_r+right and left >= min_revr and right >= min_revl:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 39948
#include <bits/stdc++.h>//クラスカル法
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define MAX 10000
#define vmax 10000
#define sentinel 2000000000
#define INF (1<<29)
constexpr long long int inf = 1000000000000;
constexpr long long int rinf = -(INT64_MAX);
static const int NIL=-1;

//cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);

class UnionFind{

    vector<int> par;
    int groupcount;

public:
// UnionFind uf(n)でn要素のUF木uf
    UnionFind(int n=0){
        init(n);
    }

    //n要素で初期化
    void init(int n=0){
        par.resize(n);
        fill(par.begin(),par.end(),-1);
        groupcount=n;
        return;
    }

    //xが属する集合の根を求める
    int root(int x){
        if(par[x]<0){
            return x;
        }
        return par[x]=root(par[x]);
    }

    //xとyが同じ集合に属するかどうか調べる
    bool same(int x,int y){
        return root(x)==root(y);
    }

    //xが属する集合の大きさを求める
    int size(int x){                
        return -par[root(x)];
    }

    //xが属する集合とyが属する集合を繋ぐ
    //既に繋がっていたらfalseが返る
    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y){
            return false;
        }
        if(par[y]<par[x]){ 
            swap(x,y);
        }
        par[x]+=par[y];     
        par[y]=x;
        --groupcount;
        return true;        
    }

    //UF内にある集合の個数を求める
    int size(void){
        return groupcount;
    }
};

class edge{
    public:
    int source,target,cost;
    edge(int source=0,int target=0,int cost=0):
    source(source),target(target),cost(cost) {}
    bool operator < (const edge &e) const{
        return cost < e.cost;
    }
};

int kruskal(int n,vector<edge> edges){
    int totalcost=0;
    sort(edges.begin(),edges.end());//コストが小さい順に辺をソートする

    UnionFind uf(n);              //unionfindの初期化

    for(auto e:edges){
        if(!uf.same(e.source,e.target)){
            //MST.push_back(e);
            totalcost+=e.cost;
            uf.unite(e.source,e.target);
        }
    }
    return totalcost;
}

int main(){
    int n,m;
    int source,target,cost;
    cin>>n>>m;

    vector<edge> edges;

    for(int i=0;i<m;i++){
        cin>>source>>target>>cost;
        edges.push_back(edge(source,target,cost));
    }

    cout<<kruskal(n,edges)<<endl;

    return 0;
}


Measured memory_bytes: 5452
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
area=0
deg=0
for i in range(n):
  if i == 0:
    min_d = abs(t-h[i]*0.006-a)
    area=i+1
  else:
    if abs(t-h[i]*0.006-a) < min_d:
      min_d = abs(t-h[i]*0.006-a)
      area=i+1
print(area)  

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll A, B, C; cin >> A >> B >> C;
  ll K; cin >> K;
  ll t = 0;
  while (A >= B) {
    B *= 2;
    t++;
  }
  while (B >= C) {
    C *= 2;
    t++;
  }
  if (t <= K) cout << "Yes\n";
  else cout << "No\n";

  return 0;
}



Measured memory_bytes: 3644
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> S;
  ll count0 = 0, count1 = 0;
  rep(i, S.length()){
    if (S[i] == '0') count0++;
    else count1++;
  }
  cout << min(count0, count1)*2 << endl;

}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<utility>
#include<queue>
#include<fstream>
using namespace std;
#define PI 3.14159265
long long gcd(long long a, long long b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
int main(){
	int n;
	cin>>n;
	int b[n-1];
	for(int i=0;i<n-1;i++)
		cin>>b[i];
	int sm=b[n-2];
	for(int i=n-2;i>0;i--){
		sm+=min(b[i], b[i-1]);
	}
	sm+=b[0];
	cout<<sm;
}

Measured memory_bytes: 256
#C問題
N = int(input())
H = list(map(int,input().split()))
MAX = 0
now = 0
nh = 0
for i in range(N):
    if i == 0:
        nh = H[i]
    else:
        if nh >= H[i]:
            nh = H[i]
            now+=1
        else:
            nh = H[i]
            MAX = max(MAX,now)
            now = 0
            
MAX = max(MAX,now)
print(MAX)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a);
#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 __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef double db;
const int N = 1e5+100;
const db EPS = 1e-9;
using namespace std;

void dbg() {cout << "\n";}
template<typename T, typename... A> void dbg(T a, A... x) {cout << a << ' '; dbg(x...);}
#define logs(x...) {cout << #x << " -> "; dbg(x);}

int n;
ll L,a[N],b[N];

int main()
{
	scanf("%d%lld",&n,&L);
	rep(i,1,n) scanf("%lld",&a[i]);
	ll maxx = 0;
	int pos = 0;
	rep(i,1,n-1){
		b[i] = a[i]+a[i+1];
		if(b[i] > maxx) maxx = b[i], pos = i;
	}
	if(maxx >= L){
		printf("Possible\n");
		rep(i,1,pos-1) printf("%d\n",i);
		per(i,n-1,pos+1) printf("%d\n",i);
		printf("%d\n",pos);
	}
	else printf("Impossible\n");
	return 0;
}
/*
7 5
2 2 2 7 2 2 2
*/

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>


using namespace std;

int main() {

    int N, Y;
    cin >> N >> Y;

    int mai10000 = -1;
    int mai5000 = -1;
    int mai1000 = -1;
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j + i <= N; ++j) {
            int k = N - i - j;
            int total = 10000 * i + 5000 * j + 1000 * k;
            if (total == Y) {
                mai10000 = i;
                mai5000 = j;
                mai1000 = k;
            }
        }
    }

    cout << mai10000 << " " << mai5000 << " " << mai1000 << endl;
}



Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

template<typename T>
class MaxFlow {
private:
  struct Edge {
    int v;
    int r;
    T c;
  };

private:
  std::vector<std::vector<Edge>> g;
  std::vector<int> d, it;

public:
  MaxFlow(int n) : g(n), d(n), it(n) {}

  void add(int u, int v, T c) {
    const int i = g[u].size();
    const int j = g[v].size();
    g[u].push_back({ v, j, c });
    g[v].push_back({ u, i, 0 });
  }

  T calc(int s, int t) {
    T sum = 0;
    while (bfs(s, t)) {
      T f;
      while ((f = dfs(s, t, std::numeric_limits<T>::max())) > 0) sum += f;
    }
    return sum;
  }

private:
  bool bfs(int s, int t) {
    std::fill(it.begin(), it.end(), 0);
    std::fill(d.begin(), d.end(), -1);
    d[s] = 0;
    std::queue<int> q;
    q.push(s);
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (Edge e : g[v]) {
        if (e.c > 0 && d[e.v] == -1) {
          d[e.v] = d[v] + 1;
          q.push(e.v);
        }
      }
    }
    return d[t] >= 0;
  }

  T dfs(int v, int t, T f) {
    if (v == t) return f;
    while (it[v] < g[v].size()) {
      Edge &e = g[v][it[v]++];
      if (e.c > 0 && d[v] < d[e.v]) {
        T ff = dfs(e.v, t, std::min(f, e.c));
        if (ff > 0) {
          e.c -= ff;
          g[e.v][e.r].c += ff;
          return ff;
        }
      }
    }
    return 0;
  }
};

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

  vector<int> a(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }

  MaxFlow<long long> mf(n * 2 + 2);
  int s = n * 2;
  int t = n * 2 + 1;

  const long long inf = 1e12;

  auto add = [&](int i, int j, long long c) {
    mf.add(i, j, -c + inf);
  };

  for (int i = 0; i < n; i++) {
    add(s, i, 0);
    add(i, i + n, a[i]);
    add(i + n, t, -inf);
    for (int j = i + 1; j < n; j++) {
      if ((j + 1) % (i + 1) == 0) {
        add(j, i, -inf);
      }
    }
  }

  cout << -mf.calc(s, t) + inf * n << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main()
	{
		int A = GetInt();
		int B = GetInt();
		int AB = A + B;
		Console.WriteLine((AB % 2 == 0) ? $"{AB / 2}" : "IMPOSSIBLE");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

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

  int N;
  cin>>N;
  int M=N*N;
  vector<int> P(M);
  rep(i,M) cin>>P[i];

  rep(i,M) P[i]--;

  vector<vector<int>> dp(N,vector<int> (N,MOD));
  rep(i,N) rep(j,N){
    dp[i][j]=min(min(i,N-1-i),min(j,N-1-j));
  }

  vector<vector<int>> board(N,vector<int> (N,1));
  int ans=0;
  rep(i,M){
    int a=P[i]/N;
    int b=P[i]%N;
    ans+=dp[a][b];
    board[a][b]=0;

    queue<pair<int,int>> Q;
    Q.push(mkp(a,b));
    while(!Q.empty()){
      int x,y;
      tie(x,y)=Q.front();
      Q.pop();

      for(int k=0;k<4;k++){
        int nx=x+dx[k];
        int ny=y+dy[k];
        if(nx<0||ny<0||nx>=N||ny>=N) continue;
        int neco=board[x][y];
        if(dp[x][y]+neco<dp[nx][ny]){
          dp[nx][ny]=dp[x][y]+neco;
          Q.push(mkp(nx,ny));
        }
      }
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 6064
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int n, m, cnt;
vector<int> a[10];
bool v[10];

void f(int p, int c) {
	int i;
	if (c == n) {
		cnt++;
		return;
	}
	for (i = 0; i < a[p].size(); i++) {
		if (v[a[p][i]]) continue;
		v[a[p][i]] = 1;
		f(a[p][i], c + 1);
		v[a[p][i]] = 0;
	}
}

int main()
{
	int i, t1, t2;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		scanf("%d %d", &t1, &t2);
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	v[1] = 1;
	f(1, 1);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

class program
{
    public static int Main()
    {
        string str = Console.ReadLine();
        var a = int.Parse(str.Split(' ')[0]);
        var b = int.Parse(str.Split(' ')[1]);
        Console.WriteLine("{0} {1}", a * b, a * 2 + b * 2);
        return 0;
    }
}

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

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

    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    vector<int> cnt(K+1);
    int kind = 0;
    int t = 0, ans = N + 1;
    for (int s = 0; s < N; s++) {
        for (; t < N && kind < K; t++) {
            if (a[t] > K) continue;
            if (cnt[a[t]] == 0) kind++;
            cnt[a[t]]++;
        }
        if (kind < K) break;
        ans = min(ans, t - s);
        if (a[s] > K) continue;
        cnt[a[s]]--;
        if (cnt[a[s]] == 0) kind--;
    }
    if (ans <= N) cout << ans << endl;
    else cout << 0 << endl;
}


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

int main() {
  int res = 0;
  int a[3];
  for(int i=0; i<3; i++) cin >> a[i];
  sort(a, a+3);
  for(int i=0; i<2; i++) res += a[i+1]-a[i];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int a ;
    cin >> a ;
    int r , l ;
    r = a % 100;
    l = a / 100;

    bool m[2] = {false, false} ;
    if(1<=l && l <=12) m[0] =true ;
    if(1<=r && r <=12) m[1] =true ;

    if(m[0]==true &&m[1]==false){
        cout <<"MMYY" <<endl;
    }else if(m[0]==false &&m[1]==true){
        cout <<"YYMM" << endl;
    }else if(m[0]==false&&m[1]==false){
        cout <<"NA" << endl;
    }else{
        cout <<"AMBIGUOUS" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;


int main(){
        _
        int n; cin >> n;
        int m = 2;
        vector<vector<int>>a(m,vector<int>(n));
        rep(i,m)rep(j,n){
            cin >> a[i][j];
        }
        int ans = 0;
        for(int i = 0; i<n; i++){
           int cnt = 0;
           for(int j = 0; j<=i;j++){
                cnt+=a[0][j];
           }
           for(int j = i; j<n; j++){
             cnt+=a[1][j];
           }
           ans = max(ans, cnt);
        }
        cout << ans << endl;

return 0;
}




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

int main(void) {
	char s[100001] = {0};
	int cnt = 0;
	
	scanf("%s", &s[0]);
	
	int s_cnt1 = 0, s_cnt2 = 0;
	for (int i = 0; i < strlen(s); i++) {
		if (i % 2 == 0) {
			if (s[i] == '0') {
				s_cnt1++;
			} else {
				s_cnt2++;
			}
		} else {
			if (s[i] == '0') {
				s_cnt2++;
			} else {
				s_cnt1++;
			}
		}
	}
	
	if (s_cnt1 > s_cnt2) {
		cnt = s_cnt2;
	} else {
		cnt = s_cnt1;
	}
	
	printf("%d\n", cnt);
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC051D
    {
        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static public void Main(string[] args)
        {
            var N = Console_.NextInt();
            var M = Console_.NextInt();
            var dist = new int[N, N];
            var checkPath = new List<Tuple<int, int, int>>();
            for (int i = 0; i < M; ++i)
            {
                var a = Console_.NextInt();
                var b = Console_.NextInt();
                var c = Console_.NextInt();
                dist[a - 1, b - 1] = c;
                dist[b - 1, a - 1] = c;
                checkPath.Add(Tuple.Create(a - 1, b - 1, c));
            }
            for (int k = 0; k < N; ++k)
            {
                for (int i = 0; i < N; ++i)
                {
                    for (int j = 0; j < N; ++j)
                    {
                        if (dist[i, k] != 0 && dist[k, j] != 0)
                        {
                            if (dist[i, j] == 0 || dist[i, j] > dist[i, k] + dist[k, j])
                            {
                                dist[i, j] = dist[i, k] + dist[k, j];
                            }
                        }
                    }
                }
            }
            var sum = 0;
            foreach (var item in checkPath)
            {
                if (dist[item.Item1, item.Item2] < item.Item3)
                {
                    ++sum;
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define hh puts("")
#define int long long
using namespace std;
int n,s,a[100005],cha[100005],m,k,t[100005];
inline int read(){
	int ret=0,ff=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch^48);ch=getchar();}
	return ret*ff;
}
inline void ksm(int p){
	while(p){
		if(p&1){
			for(int i=1;i<=n;i++) t[i]=cha[a[i]];
			for(int i=1;i<=n;i++) cha[i]=t[i];
		}
		p>>=1;
		for(int i=1;i<=n;i++) t[i]=a[a[i]];
		for(int i=1;i<=n;i++) a[i]=t[i];
	}
}
signed main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		cha[i]=a[i]-a[i-1];
	}
	for(int i=1;i<=n;i++) a[i]=i;//改存位置 
	m=read(),k=read();
	for(int i=1;i<=m;i++){
		int t=read();
		swap(a[t],a[t+1]);
	}
	//当前存的是一套体操后对应位置
	//b[i]表示原来在i位置,一套体操后的位置 
	ksm(k);
	for(int i=1;i<=n;i++){
		s+=cha[i];//把差分数组加上去
		printf("%lld.0\n",s);
	}
	return 0;
}

Measured memory_bytes: 3840
#include<stdio.h>

int main(void) {
    int i, n, k;
    while (scanf("%d", &n) == 1 && n != 0) {
        
        int nLess1Cnt = 0;
        int nZeroCnt = 0;
        
        i = n;
        while (i--) {
            scanf("%d", &k);
            if (k <= 1) ++nLess1Cnt;
            if (k == 0) ++nZeroCnt;
        }
        
        if (n == nLess1Cnt) printf("NA\n");
        else printf("%d\n", n - nZeroCnt + 1);
    }
    
    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

int main(){
  ll A,B,C,D,P;
  cin >> A >> B >> C >> D >> P;
  ll mini = A * P;
  if( P <= C ) mini = min(mini,B);
  else         mini = min(mini,B+(P-C)*D);
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <vector>
#include <cstring>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <map>
#include <stack>
#include <cmath>
#define LL long long 
using namespace std;

LL mod=1e9+7;

LL pow(LL base,LL times,LL mod)
{
	LL ans=1;
	LL tmp=base%mod;
	while(times>0)
	{
		if(times%2==1)
			ans=(ans*tmp)%mod;
		tmp=(tmp*tmp)%mod;
		times/=2;
	}
	return ans%mod;
}

bool cmp(long long a,long long b)
{
	return a>b;
}

int res[2005];

int main()
{
	long long x=0,y=0;
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&res[i]);
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
            if(res[i]>res[j])
                x++;
    sort(res+1,res+n+1,cmp);
    for(int i=1;i<n;i++)
    	for(int j=i+1;j<=n;j++)
    		if(res[i]>res[j])
    			y++;
    LL ans;
    ans=x*k%mod+y*(k-1)%mod*k%mod*pow((long long)(2),mod-2,mod)%mod;
	ans=ans%mod; 
    cout<<ans<<endl;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())
INF = 10**18
A = [INF] * 3
B = [INF] * 3
values = [abs(ga - gb), abs(sa - sb), abs(ba - bb)]
if ga < gb:
    A[0] = ga
elif ga > gb:
    B[0] = gb
if sa < sb:
    A[1] = sa
elif sa > sb:
    B[1] = sb
if ba < bb:
    A[2] = ba
elif ba > bb:
    B[2] = bb

def calc(X):
    dp = [0] * (N+1)
    dp[0] = 0
    for x, v in zip(X, values):
        for i in range(N+1-x):
            dp[i+x] = max(dp[i+x], dp[i] + v)
    return dp[-1]

N += calc(A)
N += calc(B)
print(N)

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

struct UnionFind{
    vector<int> d;
    UnionFind(int n=0): d(n, -1) {}
    int find(int x){
        if(d[x]<0)return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y){
        x = find(x); y = find(y);
        if(x==y) return false;
        if(d[x]>d[y]) swap(x,y);
        d[x] += d[y]; d[y] = x;
        return true;
    }
    bool same(int x, int y){return find(x) == find(y);}
    int size(int x){return -d[find(x)];}
};

int deg[100005];//友達の人数
vector<int> to[100005];

int main(){
    int n,m,k;cin>>n>>m>>k;
    UnionFind uf(n);
    
    rep(i,m){
        int a,b;
        cin>>a>>b;
        --a; --b;
        deg[a]++;
        deg[b]++;
        uf.unite(a,b);
    }
    rep(i,k){
        int a,b;
        cin>>a>>b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    
    rep(i,n){
        int ans = uf.size(i)-1-deg[i];
        for(int u: to[i]){
            if(uf.same(i,u)) --ans;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
    
    return 0;
}

Measured memory_bytes: 6784
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        var T = new long[N];
        var x = cin.nextlong;
        for (int i = 1; i < N; i++)
        {
            var y = cin.nextlong;
            long d = gcd(x, y);
            x = y / d * x;
            //WriteLine(x);
        }
        WriteLine(x);
        
    }

    long gcd(long x, long y)
    {
        if (x > y)
        {
            long t = x;
            x = y;
            y = t;
        }
        while (y > 0)
        {
            long r = x % y;
            x = y;
            y = r;
        }
        return x;
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

enum Form{null,oneP,twoP,threeC,straight,fullHouse,fourC};

int main()
{
    int card[5];
    bool cardFlag[5];
    while(scanf("%d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4]) != EOF){
        int cnt=0;
        Form f=null;
        for(int i=0;i<5;i++){
            cardFlag[i]=false;
        }
        sort(card,card+5);
        for(int i=0;i<5;i++){
            if(i!=0){
                if(card[i-1]==card[i]){
                    cardFlag[i-1]=true;
                    cardFlag[i]=true;
                }
            }
            if(i==4){
                for(int j=0;j<5;j++){
                    if(cardFlag[j]){
                        cnt++;
                    }
                }
            }
        }
        if(cnt>0){
            switch(cnt){
                case  2:
                    f=oneP;
                    break;
                case  3:
                    f=threeC;
                    break;
                case  4:
                    if(card[1]!=card[3]){
                        f=twoP;
                    }
                    else{
                        f=fourC;
                    }
                    break;
                case  5:
                    f=fullHouse;
                    break;
            }
        }
        else{
            if(card[1]+1==card[2] && card[2]+1==card[3] &&card[3]+1==card[4]){
                if(card[0]+1==card[1]) f=straight;
                else if(card[0]==1 && card[4]==13) f=straight;
            }
        }
        switch(f){
            case null :
                cout<<"null"<<endl;
                break;
            case oneP :
                cout<<"one pair"<<endl;
                break;
            case twoP :
                cout<<"two pair"<<endl;
                break;
            case threeC :
                cout<<"three card"<<endl;
                break;
            case straight :
                cout<<"straight"<<endl;
                break;
            case fullHouse :
                cout<<"full house"<<endl;
                break;
            case fourC :
                cout<<"four card"<<endl;
                break;
        }
    }
    return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()

unordered_map<i64, i64> mp;

i64 rec(i64 h){
    if(h == 1) return 1;
    else return 2 * rec(h / 2) + 1;
}

void solve(long long H){
    cout << rec(H) << endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    solve(H);
    return 0;
}


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

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

int main(){
  int r;
  cin >> r;
  cout << r * M_PI * 2 << endl;
  return 0;
}

Measured memory_bytes: 3784
# -*- coding: utf-8 -*-
s = input()
ans = 0
# 101010...に合わせる前提
for i in range(0, len(s), 2):
    if s[i] == '0':
        ans += 1
for j in range(1, len(s), 2):
    if s[j] == '1':
        ans += 1
# 101010...または010101...の最小値を取る
print(min(ans, len(s) - ans))


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

using namespace std;

int main(){
	string s; cin >> s;
	long long ans = 0, count = 0;
	for(int i = 0; i	 < s.size(); ++i){
		if(s[i] == 'B') count++;
		else ans += count;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
while True:
    s1 = raw_input()
 
    if s1 == '.':
        break
 
    s2 = raw_input()

    s1 = s1.split('"')
    s2 = s2.split('"')

    if s1 == s2:
        print "IDENTICAL"
 
    elif len(s1) != len(s2):
        print "DIFFERENT"

    else:
        cnt = 0
        for i in range(len(s1)):
            if s1[i] != s2[i] and i % 2 == 1:
                cnt += 1
            elif s1[i] != s2[i]:
                cnt += 2

        print "CLOSE" if cnt == 1 else "DIFFERENT"


Measured memory_bytes: 4648
#include<iostream>
#include<vector>
#include<cassert>
#include<numeric>
#include<algorithm>
// #include<bits/stdc++.h>
using namespace std;

typedef int Bit;
// using Bit = int;

const long long MOD = 100000;
class ModInt {
public:
  ModInt(long long n = 0) : n_(n % MOD) {while(n_ < 0) n_ += MOD;}
  long long value() const {return n_;}
  ModInt& operator+=(const ModInt& rhs);
private:
  long long n_;
};
const ModInt operator+(const ModInt& lhs, const ModInt& rhs) {
  return lhs.value() + rhs.value();
}
const ModInt operator-(const ModInt& lhs, const ModInt& rhs) {
  return lhs.value() - rhs.value();
}
ModInt& ModInt::operator+=(const ModInt& rhs) {return *this = *this + rhs;}

int count(const vector<string>& flag, char c) {
  return accumulate(begin(flag), end(flag), 0, [=](int sum, const string& s){
      return sum + count(begin(s), end(s), c);
    });
}

long long modpower(long long x, int n, long long mod) {
  if(!n) return 1;
  return n&1 ? x*modpower(x*x%mod, n>>1, mod)%mod : modpower(x*x%mod, n>>1, mod);
}

bool test(Bit bit, int i) {
  assert(0 <= i);
  return bit & (1 << i);
}

Bit set(Bit bit, int i) {
  assert(0 <= i);
  return bit | (1 << i);
}

Bit reset(Bit bit, int i) {
  assert(0 <= i);
  return bit & ((~0) ^ (1 << i));
}

long long solve(const vector<string>& flag) {
  ModInt all = modpower(3, count(flag, '?'), MOD);
  const int H = flag.size(), W = flag.front().size();
  const int BIT_MAX = 1 << W;
  vector<ModInt> cur(BIT_MAX);
  cur[0] = 1;
  for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
    vector<ModInt> nex(BIT_MAX);
    for(Bit bit = 0; bit < BIT_MAX; ++bit) {
      Bit nbit = reset(bit, j);
      if(flag[i][j] == 'J' || flag[i][j] == '?') {
        if(j == W-1 || flag[i][j+1] != 'O' || i == H-1 || flag[i+1][j] != 'I') {
          if(j) nex[set(reset(nbit, j-1), j)] += cur[bit];
          else nex[set(nbit, j)] += cur[bit];
        }
      }
      if(flag[i][j] == 'O' || flag[i][j] == '?') {
        if(!j || i == H-1 || !test(bit, j-1) || flag[i+1][j-1] != 'I') {
          nex[nbit] += cur[bit];
        }
      }
      if(flag[i][j] == 'I' || flag[i][j] == '?') {
        if(!i || j == W-1 || !test(bit, j)) {
          if(j) nex[reset(nbit, j-1)] += cur[bit];
          else nex[nbit] += cur[bit];
        }
      }
    }
    cur = nex;
  }
  return (all - accumulate(begin(cur), end(cur), ModInt(0))).value();
}

int main() {
  int M, N;
  cin >> M >> N;
  vector<string> flag(M);
  for(auto& i: flag) cin >> i;
  cout << solve(flag) << endl;
}

Measured memory_bytes: 17496
#include <iostream>
#include <bits/stdc++.h>
#define MOD 998244353
#define pb push_back
#define ll long long int
using namespace std;



int main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     ll i,j,n,k,m;
     ll t;
     cin>>n;
     cout<<2*(3.141592653589793238)*n;
}


Measured memory_bytes: 3800
n,m=map(int,input().split())
edges=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edges[a].append(b)
  edges[b].append(a)
list=[0]*n
for _ in range(m):
  p,q=map(int,input().split())
  list[p-1]+=q
stack=[0]
lity=[0]*n
while stack:
  x=stack.pop()
  lity[x]=1
  for y in edges[x]:
    if lity[y]==1:
      continue
    list[y]+=list[x]
    stack.append(y)
print(*list)

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}

int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll N, M; cin >> N >> M;
  vector<int> H(100010); for(int i = 1; i <= N; ++i) cin >> H[i];
  vector<int> A(M), B(M); REP(i, M) cin >> A[i] >> B[i];

  vector<int> ans(100010);
  for(int i = 1; i <= N; ++i) ans[i] = 0;

  REP(i, M) {
    ans[A[i]] = max(ans[A[i]], H[B[i]]);
    ans[B[i]] = max(ans[B[i]], H[A[i]]);
  }

  int cnt = 0;
  for(int i = 1; i <= N; ++i) {
    if(H[i] > ans[i]) cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 4760
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string tmp="012345678954321012345678954";
int main(){
  int n;
  char a,b;
  int min,mini,k,flg;
  for(cin >> n;n;n--){
    cin >> a >> b;
    min=1000000;
    for(int i=0,l=tmp.size();i<l;i++){
      if(a==tmp[i]){
	flg=0;
	for(int j=i+1;j<l;j++){
	  if(b==tmp[j]){
	    k=j;
	    flg=1;
	    break;
	  }
	}
	if(flg==1 && k-i<min){
	  min = k-i;
	  mini = i;
	}
      }
    }
    for(int i=mini;tmp[i]!=b;i++){
      cout << tmp[i] << " ";
    }
    cout << b;
    puts("");
  }
}

Measured memory_bytes: 1180
import numpy as np

N,K = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
dp = np.zeros(N, dtype=int)
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            j = max(i - K, 0)
            dp[i] = np.min(np.abs(A[i] - A[j:i]) + dp[j:i])
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Measured memory_bytes: 22904
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

ll mod(ll a) {
	if (a > 0) return a % MOD;
	if (a % MOD == 0) return 0;
	ll x = -a / MOD + 1;
	a += x * MOD;
	return a % MOD;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(double x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};
// ll pas[5001][5002];

int main() {
	IOS();
	ll n, m;
	cin >> n >> m;
	vector<vector<ll>> a(n, vector<ll>(m));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> a[i][j];
			a[i][j]--;
		}
	}
	vector<bool> use(m, true);
	ll ans = INF;
	for (int i = 0; i < m; ++i) {
		vector<ll> cnt(m, 0);
		for (int j = 0; j < n; ++j) {
			for (int k = 0; k < m; ++k) {
				if (use[a[j][k]]) {
					cnt[a[j][k]]++;
					break;
				}
			}
		}
		ll num, size = 0;
		for (int i = 0; i < m; ++i) {
			if (size < cnt[i]) {
				size = cnt[i];
				num  = i;
			}
		}
		ans		 = min(ans, size);
		use[num] = false;
	}
	dump(ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve() {
    int N, D;
    cin >> N >> D;

    VL X(N), Y(N);
    REP(i, N) cin >> X[i] >> Y[i];

    int cnt = 0;
    REP(i, N) {
        if (sqrtl(X[i] * X[i] + Y[i] * Y[i]) <= D) {
            cnt++;
        }
    }

    cout << cnt << endl;
}

int main(void) {
#ifndef ONLINE_JUDGE
    const auto in_stream = freopen("../in.txt", "r", stdin);
    if (in_stream == nullptr) {
        cerr << "ERROR!" << endl;
        return 1;
    }
#endif

    solve();

#ifndef ONLINE_JUDGE
    fclose(in_stream);
#endif
}


Measured memory_bytes: 6488
#include<iostream>

int main(){
	int n;
	while(std::cin >> n, n){
		while(n--){
			int pm, pe, pj;
			std::cin >> pm >> pe >> pj;
			int sum = pm + pe + pj;
			if(pm == 100 || pe == 100 || pj == 100){
				std::cout << "A" << std::endl;
			}else if(pm + pe >= 180){
				std::cout << "A" << std::endl;
			}else if(sum >= 240){
				std::cout << "A" << std::endl;
			}else if(sum >= 210){
				std::cout << "B" << std::endl;
			}else if(sum >= 150 && (pm >= 80 || pe >= 80)){
				std::cout << "B" << std::endl;
			}else{
				std::cout << "C" << std::endl;
			}
		}
	}
}

Measured memory_bytes: 1156
import std.functional,
       std.algorithm,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.math;

N gcd(N)(N a, N b) if (isNumeric!N || is (N == Biglong)) { return a ? gcd(b % a, a) : b; }
T read_num(T)() { return readln.chomp.to!T; }
T[] read_nums(T)() { return readln.chomp.split.to!(T[]); }
bool chmax(T)(ref T a, T b) {
  if (a < b) {
    a = b;
    return true;
  } else {
    return false;
  }
}

void main() {
  long N = read_num!long;
  long[] A = read_nums!long;
  long ans = -1;
  long[] L, R;
  L.length = N;
  R.length = N;

  L[0] = A[0];
  for (size_t i = 1; i < N; i++) {
    L[i] = gcd(L[i - 1], A[i]);
  }
  R[N - 1] = A[N - 1];
  for (size_t i = N - 2; i > 0; i--) {
    R[i] = gcd(R[i + 1], A[i]);
  }

  foreach (i; 0..N) {
    long l = i > 0 ? L[i - 1] : 0;
    long r = i < N - 1 ? R[i + 1] : 0;
    chmax(ans, gcd(l, r));
  }

  writeln(ans);
}

Measured memory_bytes: 7240
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int x=min(b,a);
	int sum=a+b;
	printf("%d ",x);
	if(sum>=n){
		printf("%d",sum-n);
	}else{
		printf("0");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		int d = b - a;
		int r = d * (d + 1) / 2;
		System.out.println(r - b);
	}
}


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

int main(){
  int n; cin >> n;
  vector<int> nums(n);
  for(int i=0; i<n; i++){
    cin >> nums[i];
  }
  int count = 0;
  for(int i=0; i<n; i+=2){
    if(nums[i]&1) count++;
  }
  cout << count << "\n";
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>

using namespace std;
int main()
{
	int K,S;
	cin >>K >>S;

	int count = 0;
	for (int x = 0; x <= K; x++) {
		for (int y = 0; y <= K; y++) {
			int z = S - y - x;
			if ((z <= K) && (z>=0)) {
				count++;
			}
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256