akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

int get_max(const V<int>& A, int K, int MIN, int Q) {
   priority_queue<int, vector<int>, greater<int>> tmp, que;
   FOR(i, 0, SZ(A)+1) {
      if (i < SZ(A) && A[i] >= MIN) {
         tmp.push(A[i]);
         continue;
      }
      while (SZ(tmp) >= K) {
         que.push(tmp.top()); tmp.pop();
      }
      tmp = priority_queue<int, vector<int>, greater<int>>();
   }
   if (SZ(que) < Q) {
      return -1;
   }
   REP(i, Q-1) que.pop();
   return que.top();
}

signed main()
{
   int N, K, Q; cin >> N >> K >> Q;
   V<int> A(N);
   REP(i, N) {
      cin >> A[i];
   }

   V<int> B(N);
   COPY(A, B);
   UNIQUE(B);

   int ans = INF;
   FOR(i, 0, N) {
      int MIN = B[i];
      int MAX = get_max(A, K, MIN, Q);
      if (MAX == -1) continue;
      ans = min(ans, MAX - MIN);
   }
   cout << ans << endl;

   return 0;
}

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

class Guidebook {
  string s;
  int p;
  int i;

public:
  Guidebook(string s, int p, int i)
    : s(s), p(p), i(i) {}

  bool operator <(const Guidebook& a) const {
    return s == a.s ? p < a.p : s > a.s;
  }

  friend ostream& operator <<(ostream& os, const Guidebook& a) {
    os << a.i;
    return os;
  }
};

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

  priority_queue<Guidebook> pq;

  for (int i = 1; i <= n; i++) {
    string s;
    int p;
    cin >> s >> p;
    pq.emplace(s, p, i);
  }

  while (!pq.empty()) {
    cout << pq.top() << endl;
    pq.pop();
  }
}


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

int main(int argc, const char * argv[]) {
    int N;
    int H[100] = {0};
    int result = 1;
    
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    
    for (int i = 1; i < N; i++) {
        int check = 0;
        for (int j = 0; j < i; j++) {
            if (H[j] > H[i]) {
                check = 1;
            }
        }
        if (check == 0) {
            result++;
        }
    }
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5 * 1e3 + 10;
const int MOD = 1e9 + 7;
int n, k;
int dp[N][N];
string s;
int powe(int x, int y){
	if(!y) return 1ll;
	int mid = powe(x, y/2);
	if(y % 2) return mid * mid % MOD * x % MOD;
	else return mid * mid % MOD;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> s;
	k = s.length();
	dp[0][0] = 1; 
	for(int i = 1; i <= n; ++i)	for(int j = 0; j <= n; ++j){
		dp[i][j] = dp[i - 1][j + 1];
		if(j > 0) dp[i][j] = (dp[i][j] + 2*dp[i - 1][j - 1]) % MOD;
		else dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
	}
	int ans = dp[n][k];
	ans = ans * powe(powe(2, k), MOD - 2) % MOD;
	cout << ans;
}

Measured memory_bytes: 195968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    string a, b; cin >> a >> b;
    int n = a.size() + b.size();
    int j = 0; int k = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            cout << a[j];
            j++;
        } else {
            cout << b[k];
            k++;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#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++)

int main() {
  int X,Y,Z;
  cin>>X>>Y>>Z;
  cout<<Z<<" "<<X<<" "<<Y<<endl;
}


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

int main() {
    string s;
    cin >> s;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R') cout << 3 << endl;
    else if((s[0]=='R' && s[1]=='R') || (s[1]=='R' && s[2]=='R')) cout << 2 << endl;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vl a(n);
	cin>>a;
	int cnt=0,val=0;
	rep(i,n){
		if(val<=a[i])cnt++;
		val=max(val,a[i]);
	}
	puta(cnt);
	return 0;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
res =1
z = False

for i in range(n ) :
    if l[i] == 0  :
        res= 0
        break
if res == 0 :
    print(0)
else :

    for i in range(n) :
        res *= l[i]

        if res > 10**18 :
            res = -1
            break
    print(res)
    

    


Measured memory_bytes: 21792
#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;

typedef pair<ll,ll> Hash;

struct RollingHash {

    ll base1,base2;
    ll mod1,mod2;
    vector<ll> hash1,hash2;
    vector<ll> pow1,pow2;

    RollingHash() : base1(1009), base2(1007), mod1(1000000007), mod2(1000000009) {}

    void init(const string &s) {
        int n = s.size();
        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);

        for(int i=0;i<n;i++) {
            hash1[i+1] = (hash1[i]+s[i]) * base1 % mod1;
            hash2[i+1] = (hash2[i]+s[i]) * base2 % mod2;
            pow1[i+1] = pow1[i] * base1 % mod1;
            pow2[i+1] = pow2[i] * base2 % mod2;
        }
    }

    Hash get(int l,int r) {//[l,r)
        ll t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
        ll t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
        return make_pair(t1, t2);
    }
};

int N;
string S;

RollingHash rs;

bool judge(int mid){
  map<pair<ll,ll>,int> mp;
  for(int i=0;i+mid-1<N;i++){
    if(0+mid-1<i) mp[rs.get(i-mid,i)]++;;
    pair<ll,ll> val=rs.get(i,i+mid);
    if(mp[val]>0) return true;
  }
  return false;
}

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

  rs.init(S);

  int ok=0,ng=N;
  while(ng-ok>1){
    int mid=(ok+ng)/2;
    if(judge(mid)) ok=mid;
    else ng=mid;
  }

  cout<<ok<<endl;

  return 0;
}


Measured memory_bytes: 768
import numpy as np

ABCK=np.array(input().split(" "),dtype=np.int64)

A=ABCK[0]
B=ABCK[1]
C=ABCK[2]
K=ABCK[3]

total=0
cnt=1

if(A<=K):
    total+=1*A
    K=K-A
    if(B<=K):
        K=K-B
        if(0<K):
            total+=-1*K
        else:
            pass
    else:
        pass
else:
    total+=1*K

print(total)

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

int main(){
  int N, K;
  cin >> N >> K;
  int sum = 0;
  int x;
  
  for(int i = 0; i < N; i++){
    cin >> x;
    if(x <= K - x){
      sum += 2 * x;
    }
    else{
      sum += 2 * (K - x);
    }
  }
  cout << sum << endl;
}

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

int main(){

	int N,t,sum=0;
	vector<int> L;
	cin >> N;
	for(int i=0;i<(2*N);i++){
		cin >> t;
		L.push_back(t);
	}

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



	for(int i=0;i<2*N;i++){
		if(i%2==0)sum+=L[i];
	}

	cout << sum <<endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
   val list: List<Int> = readLine()!!.split(" ").map { it.toInt() }
   val a = list[0]
   val b = list[1]
   val com = when {
      a < b -> "a < b"
      a > b -> "a > b"
      else -> "a == b"
   }
   println(com)
}


Measured memory_bytes: 31984
#include<iostream>
#include<utility>
#include<vector>
using namespace std;

int main(){
    int n,m; cin>>n>>m;
    vector<int> c(n,0);
    for(int i=0;i<2*m;i++){
        int n; cin>>n;
        c[n-1]++;
    }
    for(int i=0;i<n;i++){
        cout<<c[i]<<endl;
    }
}


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


ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M)%M;
}
  

int main(){
  long long int n,a,b;
  cin>>n>>a>>b;
  long long int f=7+1000000000;
  
  ll s=0;
  ll sa=1;
  ll sb=1;
  rep(i,a){
    sa=((n-i)*RS(i+1,f-2,f)%f*sa)%f;
  }
  
  rep(i,b){
    sb=((n-i)*RS(i+1,f-2,f)%f*sb)%f;
  }
  
  s=RS(2,n,f)-1-sa%f-sb%f;
  s=s%f;
  cout<<(s+f)%f<<endl;
  
}
  

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		boolean[] su=new boolean[n];
		for(int i=0; i<k; i++){
			int d=sc.nextInt();
			for(int j=0; j<d; j++){
				int a=sc.nextInt()-1;
				su[a]=true;
			}
		}
		int ans=0;
		for(int i=0; i<n; i++){
			if(!su[i]){
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 46212
#include <iostream>
#include <algorithm>
#include<string.h>  
using namespace std;
int main()
{
    char str[11];
    scanf("%s",str);
    int a,b,c,num,arr[11],i;
    for(i=2;i<strlen(str);i++)
    {
        a=str[i-2]-48;
        b=str[i-1]-48;
        c=str[i]-48;
        num=100*a+b*10+c;
        if(num>753)
        arr[i-2]=num-753;
        else
        arr[i-2]=753-num;
    }
    sort(arr,arr+strlen(str)-2);
    printf("%d",arr[0]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P = pair<int64_t,int64_t>;
int main(){
  int64_t N;
  cin >> N;
  
  bool flag = true;
  int64_t cnt = 0;
  int64_t t_cnt = 0;
  priority_queue<P> PQ;
  
  vector<int64_t> A(N);
  for(int64_t i=0; i<N; i++){
    cin >> A[i];
  }
  vector<int64_t> B(N);
  for(int64_t i=0; i<N; i++){
    cin >> B[i];
    if(A[i] == B[i]){
      t_cnt++;
    }
    else{
      P add = {B[i],i};
      PQ.push(add);
    }
  }
  
  P d = {0,-1};
  PQ.push(d);
  
  while(PQ.size()){
    P p = PQ.top();
    PQ.pop();
    if(p.second == -1){
      break;
    }
    int64_t a, b, c;
    if(p.second == 0){
      a = B[N-1] + B[1];
      b = p.second;
      c = max({A[b], B[N-1], B[1]});
    }
    else if(p.second == N-1){
      a = B[N-2] + B[0];
      b = p.second;
      c = max({A[b], B[N-2], B[0]});
    }
    else{
      a =  B[p.second + 1] + B[p.second - 1];
      b = p.second;
      c = max({A[b], B[b+1], B[b-1]});
    }
    c = p.first - c;
    int64_t num =  (c+a-1)/a;
    cnt += num;
    if(num == 0){
      break;
    }
    B[p.second] = p.first - a*num;
    if(B[p.second] == A[p.second]){
      t_cnt++;
    }
    else if(B[p.second] < A[p.second]){
      flag = false;
      break;
    }
    else{
      P add = {B[p.second],b};
      PQ.push(add);
    }
  }
  
  if(flag && t_cnt == N){
    cout << cnt << endl;
  }
  else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 10524
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	int N, K;
	string S;
	cin >> N >> S >> K;

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

		if (S[i] != S[K-1]) S[i] = '*';
	}

	cout << S;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int r[202020], t[202020];
LL m[3030];

int main(){
    
    // 1. 入力情報.
    char c[202020];
    scanf("%s", c);
    int l = strlen(c);
    
    // 2. 10 の 冪乗 について, 2019 で 割った余りを保存.
    t[0] = 1;
    repx(i, 1, 202020) t[i] = 10 * t[i - 1] % 2019;
    // rep(i, 10) printf("t[%d]=%d\n", i, t[i]);
    
    // 3. 2019 で 割った余りを 保存.
    // i文字目までで, 2019で割った余りを保存.
    repr(i, l - 1, 0){
        r[i] = r[i + 1] + (c[i] - '0') * t[l - 1 - i];
        r[i] %= 2019;
    }
    // rep(i, l + 1) printf("r[%d]=%d\n", i, r[i]);
    
    // 4. 余りの個数を集計.
    rep(i, l + 1) m[r[i]]++;
    
    // 5. 条件を満たす整数の組は？
    LL ans = 0;
    rep(i, 2020) ans += m[i] * (m[i] - 1LL) / 2LL;
    
    // 6. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 5416
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		Card[] cards = new Card[N + M];
		for (int i = 0; i < N; i++) {
			cards[i] = new Card(1, Integer.parseInt(sc.next()));
		}

		for (int i = N; i < M + N; i++) {
			cards[i] = new Card(Integer.parseInt(sc.next()), Integer.parseInt(sc.next()));
		}
		sc.close();

		Arrays.sort(cards, new Comparator<Card>() {
			public int compare(Card t1, Card t2) {
				return (int) (t2.num - t1.num);
			}
		});

		long ans = 0;
		long remain = N;
		for (Card card : cards) {
			if (remain <= card.count) {
				ans += remain * card.num;
				break;
			}
			ans += card.num * card.count;
			remain -= card.count;
		}

		System.out.println(ans);

	}

	static class Card {
		long num;
		int count;

		Card(int count, int num) {
			this.count = count;
			this.num = num;
		}
	}

}

Measured memory_bytes: 68612
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; i++)
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
#define MOD (int)(1e9+7)
using namespace std;
typedef pair<int, int> P;
struct edge {
    int to, cost;
};

class dijkstra {
private:
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<>> que;

public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first)
                continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

    int find(int e) {
        return d[e];
    }
};

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

bool prime(int a) {
    if (a == 1)
        return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)
            return false;
    }
    return true;
}

class Union_Find {
private:
    vector<int> t, s;

public:
    Union_Find(int max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(int x, int y) {
        if (same(x, y))
            return;
        int tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        } else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        } else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        } else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }

    int Find(int n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

    bool same(int x, int y) {
        return Find(x) == Find(y);
    }

    int get_Size(int a) {
        return s[a];
    }
};

vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}
signed main() {
    /*dout:デバッグ用、提出時は出力されない*/
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    dout<<"debug on"<<endl;
    int n,a,b;
    cin>>n>>a>>b;
    dout<<n*a<<" "<<b<<endl;
    cout<<min(n*a,b)<<endl;
}


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

const int MOD = 1000000007;

int main(void){
    int N, M;
    cin >> N >> M;

    vector<int> S(N, 0);
    vector<int> T(M, 0);

    for(int i=0; i<N; i++)cin >> S[i];
    for(int i=0; i<M; i++)cin >> T[i];

    vector<vector<long long>> dp(N, vector<long long>(M, 0LL));
    vector<vector<long long>> sum(N, vector<long long>(M, 0LL));

    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            if(S[i] == T[j]){
                if((i>0)&&(j>0)){
                    dp[i][j] = sum[i-1][j-1]+1;
                }else dp[i][j] = 1;
                dp[i][j] = dp[i][j] % MOD;
            }else dp[i][j] = 0;
            if(i>0){
                if(j>0){
                    sum[i][j] = ((sum[i-1][j] + sum[i][j-1])%MOD + (MOD-sum[i-1][j-1]))%MOD+ dp[i][j];
                }else sum[i][j] = sum[i-1][j] + dp[i][j];
            }else if(j>0){
                sum[i][j] = sum[i][j-1] + dp[i][j];
            }else{
                sum[i][j] = dp[i][j];
            }
            sum[i][j] = sum[i][j] % MOD;
        }
    }

    cout << sum[N-1][M-1]+1 << endl;

    return 0;
}

Measured memory_bytes: 62976
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

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

    vector<ll> H(N);
    rep(i, N) { cin >> H[i]; }

    ll counter = 0;
    ll max_counter = 0;
    rep(i, N - 1) {
        if (H[i] >= H[i + 1]) {
            counter++;
            if (i == N - 2) {
                if (counter > max_counter) {
                    max_counter = counter;
                }
            }
        } else {
            if (counter > max_counter) {
                max_counter = counter;
            }
            counter = 0;
        }
        debug(counter);
    }

    cout << max_counter << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int n;
    double a[101];
    double x;

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

    cin >> a[i];
    
    }

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

    x += 1 / a[i];
    
    }

    cout << 1 / x << endl;

    return 0;
}


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

int n;
int a, b, c, d;
string s;

bool can_reach(int start, int goal) {
    for(int i = start; i+1 <= goal; i++) {
        if(s.substr(i, 2) == "##")
            return false;
    }
    return true;
}

int main() {
    cin >> n >> a >> b >> c >> d >> s;
    a--;b--;c--;d--;

    if( !can_reach(a, c) || !can_reach(b, d) ) {
        cout << "No" << endl;
        return 0;
    }

    bool ok = true;
    if( d < c ) {
        ok = false;
        for(int i = b-1; i+2 <= d+1; i++) {
            if(s.substr(i, 3) == "...") {
                ok = true;
                break;
            }
        }
    }

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <cstring>

#define rep(i, j) for(int i = 0; i < j; i++)
// sprep
#define sprep(i, j) for(int i = 1; i <= j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

string Num2Str(int num)
{
	stringstream ss;
	ss << num;
	return ss.str();
}

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

	// code
	int m, cnt;
	while (cin>>m) {

		cnt = 0;
		string s;
		string sf, sb, sfr, sbr;

		rep(i, m) {
			vector<string> wzken;
			cin >> s;
			rep(j, s.size()) {
				sf = s.substr(0, j + 1);
				sb = s.substr(j + 1);
				sfr = sf;
				sbr = sb;
				reverse(all(sfr));
				reverse(all(sbr));

				wzken.push_back(sf + sb);
				wzken.push_back(sfr + sb);
				wzken.push_back(sf + sbr);
				wzken.push_back(sfr + sbr);
				wzken.push_back(sb + sf);
				wzken.push_back(sbr + sf);
				wzken.push_back(sb + sfr);
				wzken.push_back(sbr + sfr);
			}
			sort(all(wzken));
			wzken.erase(unique(all(wzken)), wzken.end());
			cout << wzken.size() << endl;
		}
	}

	return 0;
}

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

const int maxn = 1e7+1;

int n;
long long d[maxn];

void sieve() {
	for (int i = 1; i < maxn; ++i) {
		for (int j = i; j < maxn; j += i) {
			d[j]++;
		}
	}
}

void p() {
	int n; cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = i; j <= n; j += i) {
			ans += j;
		}
	}
	cout << ans << '\n';
}

int main() {
	p(); return 0;
	cin >> n;
	sieve();
	long long ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans += d[i] * i;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=2e5+5;
set<int>P[MAX];
int32_t main()
{
  BOOST;
  int n,m;
  cin>>n>>m;
  for (int i=1;i<=m;i++){
  	int a,b;
  	cin>>a>>b;
  	P[a].insert(b);
  	P[b].insert(a);
  }
  
  for (int i=1;i<=n;i++){
  	if (P[i].find(1)!=P[i].end() && P[i].find(n)!=P[i].end()){
  		cout<<"POSSIBLE";
  		return 0;
  	}
  }
  
  cout<<"IMPOSSIBLE";
  return 0;
}


Measured memory_bytes: 31756
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<list>
using namespace std;

long long p[1] = {};

int main()
{
	int A,B,T;
	cin >> A>>B>>T;
	int temp = T / A;
	cout << temp * B << endl;
	

}

Measured memory_bytes: 256
import sys

S = list(input())
Sr = S[::-1]

if S != Sr:
    print("No")
    sys.exit()

N = len(S)
C1 = int(((N - 1) / 2))
C2 = int(((N + 3) / 2) - 1)

C1Str = S[0:C1]
C2Str = S[C2:N]

if C1Str != C1Str[::-1]:
    print("No")
    sys.exit()

if C2Str != C2Str[::-1]:
    print("No")
    sys.exit()

print("Yes")

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



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

    int max=1;

    for(int i=1;i<=33;i++){
      for(int j=2;j<=10;j++){
        if (pow(i,j) > x)break;
        if (max < pow(i,j))max = pow(i,j);
      }
    }

  cout << max <<endl;

    
    return 0;
}






Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using namespace std;
using pii=pair<int,int>;

struct din{
	struct edge{
		int t,c,r;
		edge() {}
		edge(int t,int c):t(t),c(c){}
	};
	vector<vector<edge>> adj;
	vector<int> iter,lev;

	void init(int n) {
		adj.resize(n); iter.resize(n); lev.resize(n);
	}
	void addEdge(int u,int v,int c1,int c2) {
		adj[u].push_back(edge(v,c1));
		adj[v].push_back(edge(u,c2));
		adj[u].back().r = sz(adj[v])-1;
		adj[v].back().r = sz(adj[u])-1;
	}
	bool bfs(int src,int sik) {
		fill(lev.begin(), lev.end(), 0);
		
		queue<int> que;
		que.push(src);
		lev[src]=1;
		while(!que.empty()) {
			int cur=que.front();que.pop();
			for(auto &it:adj[cur]) if(it.c && !lev[it.t]) {
				lev[it.t]=lev[cur]+1;
				que.push(it.t);
			}
		}
		return lev[sik];
	}
	int dfs(int cur,int des,int f) {
		if(cur==des) return f;
		for(int &i=iter[cur];i<sz(adj[cur]);i++) {
			auto &it=adj[cur][i];
			if(it.c && lev[it.t] == lev[cur]+1) {
				int df=dfs(it.t,des,min(f,it.c));
				if(df) {
					it.c-=df;
					adj[it.t][it.r].c+=df;
					return df;
				}
			}
		}
		return 0;
	}
	int flow(int src,int sik ){
		int tf=0;
		while(bfs(src,sik)) {
			fill(iter.begin(),iter.end(),0);
			
			int f=0;
			while( (f=dfs(src,sik,10000)) ) tf+=f;
		}
		return tf;
	}
}g;

int n,m;
char str[101][101];

inline int IN(int v) {
	return v;
}
inline int OUT(int v) {
	return v+n*m;
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++) scanf("%s",str[i]);

	g.init(2*n*m+2);
	int src=2*n*m,sik=2*n*m+1;
	for(int i=0;i<n;i++) for(int a=0;a<m;a++) if(str[i][a]!='.') for(int b=a+1;b<m;b++) if(str[i][b]!='.') {
		g.addEdge(OUT(i*m+a), IN(i*m+b), 1, 0);
		g.addEdge(OUT(i*m+b), IN(i*m+a), 1, 0);
	}
	for(int j=0;j<m;j++) for(int a=0;a<n;a++) if(str[a][j]!='.') for(int b=a+1;b<n;b++) if(str[b][j]!='.') {
		g.addEdge(OUT(a*m+j), IN(b*m+j), 1, 0);
		g.addEdge(OUT(b*m+j), IN(a*m+j), 1, 0);
	}
	
	int si,sj,ti,tj;
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(str[i][j]!='.') {
		g.addEdge(IN(i*m+j), OUT(i*m+j),1,0);
		if(str[i][j]=='S') si=i,sj=j;
		else if(str[i][j]=='T') ti=i,tj=j;
	}
	if(si==ti || sj==tj) {
		puts("-1");
		return 0;
	}
	
	g.addEdge(src, OUT(si*m+sj), 300, 0);
	g.addEdge(IN(ti*m+tj), sik, 300, 0);
	
	printf("%d\n",g.flow(src,sik));
	
	return 0;
}


Measured memory_bytes: 61824
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      int i=0;
      for (String var : br.readLine().split(" "))
        seq[i++] = Integer.parseInt(var);

      int q = partition(seq, 0, n-1);
      dispIntArrayPartition(seq, q);
    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }

  public int partition(int[] seq, int p, int r) {

    int x = seq[r];
    int i = p-1;
    int t;

    for(int j=p; j<r; j++) {
      if(seq[j] <= x) {
        t = seq[++i]; seq[i] = seq[j]; seq[j] = t;
      }
    }
    t = seq[i+1]; seq[i+1] = seq[r]; seq[r] = t;

    return i+1;
  }

public void dispIntArrayPartition(int[] target, int q) {
  StringBuilder s = new StringBuilder();
  int l=target.length-1;

  for (int i=0; i<q; i++) { s.append(target[i]).append(" "); }
  s.append("[").append(target[q]).append("] ");
  for (int i=q+1; i<l; i++) { s.append(target[i]).append(" "); }
  s.append(target[l]);

  System.out.println(s);
  }
}


Measured memory_bytes: 40180
/*input
4
3 1 3 2

*/
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define int long long
using namespace std;
main () {
	int n; cin >> n;
	map<int, int> a, b;
	for(int i = 1; i <= n; i ++) {
		int in; cin >> in;
		if(i & 1) a[in] ++;
		else      b[in] ++;
	}
	pii mxa = {0, -1}, mxb = {0, -1};
	pii GGa = {0, -1}, GGb = {0, -1};
	for(auto it: a) {
		pii tmp = {it.S, it.F};
		if(tmp > mxa) {
			GGa = mxa;
			mxa = tmp;
		}
		else GGa = max(GGa, tmp);
	}		
	for(auto it: b) {
		pii tmp = {it.S, it.F};
		if(tmp > mxb) {
			GGb = mxb;
			mxb = tmp;
		}
		else GGb = max(GGb, tmp);
	}
	if(mxa.S == mxb.S) {
		cout << min(n / 2 - mxa.F + n - (n / 2) - GGb.F, n / 2 - GGa.F + n - (n / 2) - mxb.F);
	}
	else {
		cout << n / 2 - mxa.F + n - (n / 2) - mxb.F;
	}
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
void printbin(ll v) { REP(i, 64) { cout << ((v >> (63-i)) & 1L); } cout << endl; }
const ll DVSR = 1e9+7;


bool rec(ll v, ll par, ll goal, ll &path, unordered_map<ll, vector<pair<ll,ll>>> &graph) {
  if (v == goal) {
    return true;
  }
  for (auto edge : graph[v]) {
    if (edge.first == par) continue;
    if (rec(edge.first, v, goal, path, graph)) {
      path |= (1LL << edge.second);
      return true;
    }
  }
  return false;
}

int main(int argc, char const *argv[])
{
  unordered_map<ll, vector<pair<ll,ll>>> mp;
  ll N, M;
  cin >> N;
  REP(i, N-1) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    auto itr = mp.find(a);
    if (itr == mp.end()) mp[a] = vector<pair<ll,ll>>();
    itr = mp.find(b);
    if (itr == mp.end()) mp[b] = vector<pair<ll,ll>>();

    mp[a].push_back(pair<ll, ll>(b, i));
    mp[b].push_back(pair<ll, ll>(a, i));
  }

  cin >> M;
  vector<ll> paths(M, 0);
  REP(i, M) {
    ll u, v;
    cin >> u >> v;
    u--; v--;
    rec(u, -1, v, paths[i], mp);
  }
  ll res = 0;
  for (ll bit = 0; bit < (1<<M); ++bit) {
    ll val = 0;
    REP(i, M) if (bit & (1LL<<i)) val |= paths[i];
    ll rest = N-1 - __builtin_popcountl(val);
    if (__builtin_popcountl(bit) % 2 == 0) res += (1LL<<rest);
    else res -= (1LL<<rest);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N=300;

int h, w, k, ans[N][N];
V<P<int, int>> v;
void f(int hl, int hr, int wl, int wr, int cl, int cr){
//cout << hl << "," << hr << "," << wl << "," << wr << "," << cl << "," << cr << endl;
  if(cr-cl==1){
    FOR(i, hl, hr) FOR(j, wl, wr) ans[i][j] = cr;
    return;
  }
  int cm = (cl+cr)/2;
  if(v[cl].fi==v[cr-1].fi){
    int wm = v[cm].se;
    if(v[cl].se == wm) cm++, wm++;
    f(hl, hr, wl, wm, cl, cm);
    f(hl, hr, wm, wr, cm, cr);
  }else{
    int hm = v[cm].fi;
    if(v[cl].fi == hm) hm++;
    cm = lower_bound(all(v), mp(hm, -1))-v.begin();
    f(hl, hm, wl, wr, cl, cm);
    f(hm, hr, wl, wr, cm, cr);
  }
}
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w >> k;
  FOR(i, 0, h){
    cin >> s;
    FOR(j, 0, w) if(s[j]=='#') v.pb(mp(i, j));
  }
  sort(all(v));
  f(0, h, 0, w, 0, k);
  FOR(i, 0, h){
    FOR(j, 0, w) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n;
int a[500];

int main()
{
	IOS;
	cin >> n;
	int s = 0, m = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		m = max(m, a[i]);
	}
	if (m < s-m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

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

    ll n;
    ld d;
    cin >> n >> d;
    ll ans = 0;
    REP(i,n){
        ld x, y;
        cin >> x >> y;
        if(x*x + y*y <= d*d) ans++;
    }
    cout << ans <<endl;

    
    return 0;
}



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

#define INF 1234567890
#define ll long long

int res = INF;

vector<bool> Col(string &a, string &b)
{
	vector<bool> ret(6060, false);
	for(int i=0; i<a.size(); i++) // b를 i칸 시프트
		for(int j=i; j<a.size() && j-i<b.size(); j++) //
			if (a[j]!='?'&&b[j-i]!='?'&&a[j]!=b[j-i])
			{
				ret[i] = true;
				break;
			}
	return ret;
}

void Solve(string &a, string &b, string &c)
{
	vector<bool> ab, ac, bc;
	ab = Col(a, b);
	bc = Col(b, c);
	ac = Col(a, c);
	for(int i=0; i<=a.size(); i++) // b의 스타팅
		for(int j=i; j<=max(a.size(), i+b.size()); j++) // c의 스타팅
		{
			if (ab[i] || ac[j] || bc[j-i]) continue;
			int val = max({a.size(), i+b.size(), j+c.size()});
			res = min(res, val);
		}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string a, b, c;
	cin >> a >> b >> c;
	Solve(a, b, c);
	Solve(a, c, b);
	Solve(b, a, c);
	Solve(b, c, a);
	Solve(c, a, b);
	Solve(c, b, a);
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){


char number[1001];


int i,sum;


while(1){


scanf("%s",number);


if(number[0]=='0')


break;


sum=0;


for(i=0;number[i]!='\0';i++){


sum+=number[i]-'0';


}


printf("%d\n",sum);


}


return 0;


}

Measured memory_bytes: 536
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,c=0;
    string str;
    cin>>str;


    if(str=="RRR")
    {
        c=3;
    }
    else if(str=="RRS")
    {
        c=2;
    }
   else if(str=="RSR")
    {
        c=1;
    }
     else if(str=="RSS")
    {
        c=1;
    }
     else if(str=="SRS")
    {
        c=1;
    }
     else if(str=="SRR")
    {
        c=2;
    }
     else if(str=="SSR")
    {
        c=1;
    }
     else if(str=="SSS")
    {
        c=0;
    }
    cout<<c<<endl;

  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>
#define INF 1000000007
#define PI 3.14159265
const int mod=998244353;
using namespace std;
using namespace __gnu_pbds;

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

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}
bool cmp(int a, int b){
	return a>b;
}
int32_t main(){
	
	FIO();
	
		float r;cin>>r;
		float ans=2.00*PI*r;
		cout<<fixed<<setprecision(6)<<ans;
	
	return 0;
	
		
}


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

long long int gcd(long long int l, long long int r) {
	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}

int main() {
	int T; cin >> T;
	while (T--) {
		long long int h, w; cin >> h >> w;
		long long int agcd(gcd(h, w));
		h /= agcd; w /= agcd;
		long long int a, b;
		if (h == w) {
			a = 1;
			b = 0;
		}
		else if((h+w)%2){
			a = 1; b = 1;
		}
		else {
			long long int mul(h*w);
			a = mul / 2+1;
			b = a- 1;
		}
		cout << a << " " << b << endl;
	}
	return 0;
}

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

const int MAX = 2e5 + 111;

int n, m;

string s[111];

int cnt[33];

int cnt1, cnt2, cnt4;

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        for (int j = 0; j < m; ++j) {
            cnt[s[i][j] - 'a']++;
        }
    }
    for (int i = 0; i < 26; ++i) {
        cnt4 += cnt[i] / 4;
        cnt[i] %= 4;
        cnt2 += cnt[i] / 2;
        cnt[i] %= 2;
        cnt1 += cnt[i];
    }
    if (n % 2 == 0 && m % 2 == 0) {
        if (cnt4 == n * m / 4)
            cout << "Yes";
        else
            cout << "No";
    } else if (n * m % 2 == 0) {
        if (n % 2 == 1)
            swap(n, m);
        if (cnt4 >= n * (m - 1) / 4 && cnt1 == 0)
            cout << "Yes";
        else
            cout << "No";
    } else {
        if (cnt4 >= (n - 1) * (m - 1) / 4 && cnt1 == 1)
            cout << "Yes";
        else
            cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int k, x;
    cin >> k >> x;
    if(k * 500 >= x)cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000000

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}
//A  40s
//B 
//C
//D

void solve(void){
    int n;
    cin >> n;
    cout << n*(n+1)/2;
}

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


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(s: String);
    let vs: Vec<char> = s.chars().collect();
    let mut count_even = 0;
    let mut count_odd = 0;

    for i in 0..vs.len() {
        if i % 2 == 0 {
            if vs[i] == '0' {
                count_even += 1;
            } else {
                count_odd += 1;
            }
        } else if vs[i] == '0' {
            count_odd += 1;
        } else {
            count_even += 1;
        }
    }

    println!(
        "{}",
        if count_even < count_odd {
            count_even
        } else {
            count_odd
        }
    );
}


Measured memory_bytes: 2692
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))
c = [[0,0,0],
     [0,0,0],
     [0,0,0]]
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            c[i][j] = 1

flag = 0
for i in range(3):
    if c[i] == [1,1,1]:
        flag = 1
for i in range(3):
    if c[0][i] == c[1][i] == c[2][i] == 1:
        flag = 1
if c[0][0] == c[1][1] == c[2][2] == 1:
    flag = 1
if c[2][0] == c[1][1] == c[0][2] == 1:
    flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384