akhauriyash/Code-Regression huggingface dataset:
/*input
3 3
abc


*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
inline ll add(ll a,ll b){
	return ((a%MOD)+(b%MOD))%MOD;
}
inline ll sub(ll a,ll b){
	a -= b;
	if(a < 0)a += MOD;
	return a%MOD;
}
ll dp[105][maxn],pref[105][maxn],arr[maxn];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
    	cin>>arr[i];
    }
    for(int i=0;i<=n;i++) dp[i][0]=pref[i][0]=1;
    for(int i=0;i<=k;i++) pref[0][i]=1;
    for(int i=1;i<=n;i++){
    	for(int j=1;j<=k;j++){
    		ll x=(j-arr[i]-1)>=0? pref[i-1][j-arr[i]-1]: 0;
    		dp[i][j]=sub(pref[i-1][j],x);
    		pref[i][j]=add(pref[i][j-1],dp[i][j]);
    	}
    }
    cout<<dp[n][k];
}

Measured memory_bytes: 159232
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(x) (ll)x.size()
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> osSet;

using pll = pair<ll, ll>;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

ll func(ll x){
	return (x*(x+1))/2;
}

ll _pow(ll b, ll p){
	if(p == 0) return 1;
	if(p == 1) return b;
	ll exB = b*b;
	if(p&1) return b*_pow(exB, p/2);
	return _pow(exB, p/2);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	string s[n];
	for(ll i=0; i<n; i++)
		cin >> s[i];
	map<char, ll> mcl;
	for(ll i=97; i<123; i++){
		ll mn = INF;
		for(ll j=0; j<n; j++){
			ll cur = 0;
			for(ll k=0; s[j][k]; k++)
				if(s[j][k] == char(i))
					cur++;
			mn = min(mn, cur);
		}
		mcl[char(i)] = mn;
	}
	for(ll i=97; i<123;i++){
		for(ll j=0; j<mcl[char(i)]; j++)
			cout << char(i);
	}
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	string ans = "AC";
	if (s[0] != 'A') {
		ans = "WA";
	}
	int cnt = 0;
	for (int i = 1;i < n;++i) {
		if (isupper(s[i])) {
			if (i == 1 || i == n - 1 || s[i] != 'C') {
				ans = "WA";
			}
			++cnt;
		}
	}
	if (cnt != 1) {
		ans = "WA";
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
def f(num,l):
    k=0
    p=[0 for i in range(len(l))]
    for i in range(len(l)):
        if k>-1:
            p[i]=num
            if l[i]=='#':
                num+=1
                k=-1
        else:
            if l[i]!='#':
                p[i]=p[i-1]
            else:
                p[i]=num
                num+=1
    return p,num
h,w,k=map(int,input().split())
j=0
num=1
p=[[0 for i in range(w)] for i in range(h)]
for i in range(h):
    l=list(input())
    if j>-1:
        if '#' not in l:
            j+=1
        else:
            p[i],num=f(num,l)
            for k in range(j):
                p[k]=p[i]
            j=-1
    else:
        if '#' not in l:
            p[i]=p[i-1]
        else:
            p[i],num=f(num,l)
for i in range(h):
    print(*p[i])

Measured memory_bytes: 7504
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	int e = 0,w = 0;
	for(int i = 0;i < n;i++){
		if(s[i] == 'E'){
			e++;
		}else{
			w++;
		}
	}
	
	int ans = 1e9;
	int le = 0,lw = 0;
	for(int i = 0;i < n;i++){
		int re = e - le;
		int rw = w - rw;
		if(s[i] == 'E'){
			re--;
		}else{
			rw--;
		}
		ans = min(ans,lw+re);
		if(s[i] == 'E'){
			le++;
		}else{
			lw++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

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

ll dp[3010][3010] = {};

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

    int N;
    scanf("%d", &N);

    Vl a(N);
    for (int i = 0; i < N; ++i) {
        scanf("%lld", &a[i]);
    }

    for (int i = 0; i <= N; ++i) {
        for (int j = i; j <= N; ++j) {
            bool f_Taro = ((N - (j - i)) & 1) == 1;
            if (f_Taro) {
                dp[i][j] = L_INF;
            }
            else {
                dp[i][j] = -L_INF;
            }
        }
    }

    for (int i = 0; i <= N; ++i) {
        dp[i][i] = 0;
    }
    for (int len = 0; len < N; ++len) {
        for (int l = 0; l <= N - len; ++l) {
            int r = l + len;
            bool f_Taro = ((N - (r - l)) & 1) == 1;

            int nl, nr;
            if (f_Taro) {
                nl = l - 1;
                nr = r;
                if (nl >= 0) {
                    dp[nl][nr] = max(dp[nl][nr], dp[l][r] + a[nl]);
                }

                nl = l;
                nr = r + 1;
                if (nr <= N) {
                    dp[nl][nr] = max(dp[nl][nr], dp[l][r] + a[nr - 1]);
                }
            }
            else {
                nl = l - 1;
                nr = r;
                if (nl >= 0) {
                    dp[nl][nr] = min(dp[nl][nr], dp[l][r] - a[nl]);
                }

                nl = l;
                nr = r + 1;
                if (nr <= N) {
                    dp[nl][nr] = min(dp[nl][nr], dp[l][r] - a[nr - 1]);
                }
            }
        }
    }

    cout << dp[0][N] << endl;

    return 0;
}


Measured memory_bytes: 70016
#include<stdio.h>
#include<math.h>
int main(){
int n,d;
  scanf("%d %d",&n,&d);
  int count=0;
  for(int i=0;i<n;i++){
    long long int x,y;
    long double z;
  scanf("%lld %lld",&x,&y);
  z=x*x+y*y;
    z=sqrt(z);
    if(z<=d)
      count++;
  }
  printf("%d",count);
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	ll n, ans = 0;
	cin >> n;
	ll n_tmp = n;
	bool is_prime = true;
	for (ll i = 2; i * i <= n_tmp; i++)
	{
		ll tmp = i;
		while (n % tmp == 0)
		{
			n /= tmp;
			tmp *= i;
			ans++;
		}
		while (n % i == 0)
		{
			n /= i;
		}
	}
	if (n <= 1)
		is_prime = false;
	cout << ans + is_prime << endl;
	return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC161B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = RInt;
            var M = RInt;
            var A = RInts;

            int meyasu = A.Sum() / (4 * M);
            if (A.Sum() % (4 * M) == 0) meyasu--;
            int count = A.Count(x => x > meyasu);

            if (count >= M) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 28176
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>

typedef long long ll;

using namespace std;

int main() {
	char c;
	scanf("%c", &c);
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		printf("vowel\n");
	} else {
		printf("consonant\n");
	}
	
	return 0;
}

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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

i64 n;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFIN
    freopen("input.txt", "r", stdin);
#endif

    cin >> n;
    vi64 a(n);
    forn(i, n) cin >> a[i];
    sort(all(a));
    i64 p;
    i64 ans = LLONG_MAX;
    for (i64 i = a[0]; i <= a[n - 1]; ++i) {
        p = i;
        i64 sum = 0;
        for (i64 j = 0; j < n; ++j) {
            sum += (p - a[j]) * (p - a[j]);
        }
        ans = min(ans, sum);
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        if(S.equals("ARC"))
        {
            System.out.println("ABC");
        }
        else
        {
            System.out.println("ARC");
        }
    }
}


Measured memory_bytes: 35728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,q;
    cin >> a >> b >> q;
    vector<ll> s,t;
    s.push_back(-1e12);
    t.push_back(-1e12);
    for(ll i = 1;i <= a;i++){ll x;cin >> x;s.push_back(x);}
    for(ll i = 1;i <= b;i++){ll x;cin >> x;t.push_back(x);}
    s.push_back(1e12);
    t.push_back(1e12);
    a+=2,b+=2;
    while(q--){
        ll x;
        cin >> x;
        auto itr = lower_bound(s.begin(),s.end(),x);
        auto idx = itr - s.begin();
        ll rights = labs(s[idx] - x);
        ll lefts = labs(s[idx-1] - x);
        itr = lower_bound(t.begin(),t.end(),x);
        idx = itr - t.begin();
        ll rightt = labs(t[idx] - x);
        ll leftt = labs(t[idx-1] - x);

        //cout << "S " << lefts << ", " << rights << endl;
        //cout << "T " << leftt << ", " << rightt << endl;

        ll cost1 = max(rights,rightt);
        ll cost2 = max(lefts,leftt);
        ll cost3 = min(2 * rights + leftt,2 * rightt + lefts);
        ll cost4 = min(2 * lefts + rightt,2 * leftt + rights);
        cout << min({cost1,cost2,cost3,cost4}) << endl;
        
    }
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
	 int n ,m,ans=0;
	 cin>>n>>m;
	 int a[m],b[m];
	 for (int i = 0; i < m; ++i)
	 {
	 	cin>>a[i]>>b[i];
	 }
	 
	 sort(a,a+m);
	 sort(b,b+m);
	 ans=b[0]-a[m-1];

	 if(ans >0)
	 {
	 	cout<<ans+1;
	 }
	 else if(ans==0)
	 	cout<<1;
	 else
	 	cout<<0;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
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; }


int main(){
    ll a[2], b[2];
    cin >> a[0] >> a[1] >> b[0] >> b[1];
    ll ans = -1 * INF;
    rep(i, 2) {
        rep(j, 2) {
            chmax(ans, a[i] * b[j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n;
    double m;
    cin>>n>>m;
    vector<int> v(n,0);
    rep(i,n) cin>>v[i];
    int sum=0;
    rep(i,n) sum+=v[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        if(v[i]>=sum/(4*m)){
            cnt++;
        }
    }
    if(cnt>=m){
                cout<<"Yes"<<endl;
                return 0;
            }
    else cout<<"No"<<endl;
    return 0;
}


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

const long MOD=998244353;
const long INF=100000000000000000;
int main(){
    string S,T;
    cin>>S>>T;
    
    long N=S.size();
    
    bool ans=false;
    for(int s=0;s<N;s++){
        bool flag=true;
        for(int i=0;i<N;i++){
            if(S.at((i+s)%N)!=T.at(i)) flag=false;
        }
        ans |=flag;
    }
    
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  long int output = 0, sum;
  string s;
  cin >> s;
  int n[s.length()];
  for (int i = 0; i < s.length(); i++) {
    n[i] = int(s[i]) - 48;
  }
  for (int bit = 0; bit < (1 << (s.length() - 1)); bit++) {
    sum = 0;
    for (int i = 0; i < s.length(); i++) {
      sum *= 10;
      sum += n[i];
      if (bit & (1 << i)) {
        output += sum;
        sum = 0;
      }
    }
    output += sum;
  }
  cout << output << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <string>
#include <algorithm>
#define CHAR_NUM 80
using namespace std;

int main(void) {
    int i = 0;
    char str[256];
    
    while((str[i] = getchar()) != '\n') {
        str[i] = toupper(str[i]);
        i++;
    }
    cout << str;
    
    return(0);
}

Measured memory_bytes: 1092
#include<bits/stdc++.h>
#include<string.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1<<29;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n;
	cin>>n;
	int a[21]={},b[21],c[21];

	rep(i,n){
		cin>>a[i];
	}
	rep(i,n){
		cin>>b[i];
	}
	rep(i,n-1){
		cin>>c[i];
	}
	ll t=0;
	rep(i,n){
		t+=b[a[i]+-1];
		if(a[i+1]-a[i]==1)t+=c[a[i+1]-2];
	}

	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int n,m,t,i,j;
V e,x,z,w;
void Me(const V &_x,const V &_y){
	for(i=0;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_y[slice(j,n,n)]).sum()%m;
	e=z;
}
void Mx(const V &_x){
	for(i=0;i<n;i++)for(j=0;j<n;j++)w[i*n+j]=(_x[slice(i*n,n,1)]*_x[slice(j,n,n)]).sum()%m;
	x=w;
}
void O(const V &r,const V &s){
	int i=0;
    for(;i<n-1;i++)printf("%d ",(r[slice(i*n,n,1)]*s).sum()%m);
    printf("%d\n",(r[slice(i*n,n,1)]*s).sum()%m);
}
main(){
	int a,b,c;
	for(;scanf("%d%d%d%d%d%d",&n,&m,&a,&b,&c,&t),n;){
		x.resize(0);
		x.resize(n*n);
		e.resize(0);
		e.resize(n*n);
		z.resize(n*n);
		w.resize(n*n);

		x[0]=b;
		x[1]=c;
		e[0]=1;
		for(i=1;i<n-1;i++){
			x[i*n+i-1]=a;
			x[i*n+i]=b;
			x[i*n+i+1]=c;
			e[i*n+i]=1;
		}
		x[i*n+i-1]=a;
		x[i*n+i]=b;
		e[i*n+i]=1;
		for(;t;t>>=1){
			if(t&1)Me(e,x);
			Mx(x);
		}
		V s(n);
		for(i=0;i<n;i++)scanf("%d",&s[i]);
		O(e,s);
	}
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, d, a[202020], b[202020];
void solve(){
	cin >> n >> d;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		if(a[i]*a[i]+b[i]*b[i] <= d*d) cnt++;
	}
	cout << cnt <<  endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int MOD=(int)1e9+7;
int dp[101][4][4][4];

int main() {
  int N; cin >> N;
  // size == 0 => 1
  dp[0][3][3][3] = 1;
  for(int len = 0; len < N; ++len) {
    for(int c1 = 0; c1 < 4; c1++) {
      for(int c2 = 0; c2 < 4; c2++) {
        for(int c3 = 0; c3 < 4; c3++) {
          if(dp[len][c1][c2][c3] == 0) continue;
          for(int a = 0; a < 4; ++a) {
            if(a == 2 && c1 == 1 && c2 == 0) continue;
            if(a == 2 && c1 == 0 && c2 == 1) continue;
            if(a == 1 && c1 == 2 && c2 == 0) continue;
            if(a == 2 && c1 == 1 && c3 == 0) continue;
            if(a == 2 && c2 == 1 && c3 == 0) continue;

            dp[len+1][a][c1][c2] += dp[len][c1][c2][c3];
            dp[len+1][a][c1][c2] %= MOD;
          }
        }
      }
    }
  }

  int ans = 0;
  for(int c1 = 0; c1 < 4; c1++) {
    for(int c2 = 0; c2 < 4; c2++) {
      for(int c3 = 0; c3 < 4; c3++) {
        ans += dp[N][c1][c2][c3];
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
# define int long long
const int M = 300005 ;
const int mod = 1e9 + 7 ;
using namespace std ;


int b , w , fac[M] ;
int fb[M] , fw[M] , inv2 ;
// fb[i] 表示前i回合黑色用完的概率 
// fw[i] 表示前i回合白色用完的概率 
inline int Fpw(int Base , int k) {
	int temp = 1 ;
	while(k) {
		if(k & 1) temp = 1LL * temp * Base % mod ;
		Base = 1LL * Base * Base % mod ; k >>= 1 ;
	}
	return temp ;
}
inline int Inv(int x) {
	return Fpw(x , mod - 2) ;
}
inline int C(int n , int m) {
	return 1LL * fac[n] * Inv(fac[m]) % mod * Inv(fac[n - m]) % mod ;
}
# undef int
int main() {
# define int long long
	cin >> b >> w ; inv2 = Inv(2) ;
	fac[0] = 1 ; for(int i = 1 ; i <= 200000 ; i ++) fac[i] = 1LL * fac[i - 1] * i % mod ;
	for(int i = b ; i <= b + w ; i ++) 
		fb[i] = (fb[i - 1] + C(i - 1 , b - 1) * Inv(Fpw(2 , i)) % mod) % mod ;
	for(int i = w ; i <= b + w ; i ++) 
		fw[i] = (fw[i - 1] + C(i - 1 , w - 1) * Inv(Fpw(2 , i)) % mod) % mod ;
	for(int i = 1 ; i <= b + w ; i ++) 
		printf("%lld\n",  ((fw[i - 1] + ((1 - fw[i - 1] - fb[i - 1] + mod) % mod + mod) * inv2 % mod) % mod + mod ) % mod ) ;
	return 0 ;
}

Measured memory_bytes: 7168
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int T[1000];
int A[1000];

int main()
{
	int N;
	ll TS, AS, mul1, mul2;

	cin >> N;
	rep(i, N) cin >> T[i] >> A[i];

	TS = T[0];
	AS = A[0];

	repc(i, 1, N - 1) {
		mul1 = (TS - 1) / T[i] + 1;
		mul2 = (AS - 1) / A[i] + 1;
		TS = T[i] * max(mul1, mul2);
		AS = A[i] * max(mul1, mul2);
	}

	cout << TS + AS << endl;

	return 0;
}


Measured memory_bytes: 256
#
# abc080 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """12"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """57"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """148"""
        output = """No"""
        self.assertIO(input, output)


def resolve():
    N = input()
    s = 0
    for i in range(len(N)):
        s += int(N[i])
    if int(N) % s == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16136
import sys
from copy import deepcopy
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read

def main():
    n=int(readline())
    a=np.array([list(map(int,l.split())) for l in read().splitlines()])
    cost=deepcopy(a)
    for k in range(n):
        arr=np.stack([cost,[cost[k]]+np.transpose([cost[k]])])
        cost=np.amin(arr,axis=0)
    f=np.sum(cost<a)
    if f:
        print(-1)
        return
    filt=np.sum([([cost[k]]+np.transpose([cost[k]]))==cost for k in range(n)],axis=0)==2
    print(np.sum(a[filt])//2)

if __name__=='__main__':
    main()


Measured memory_bytes: 84376
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 510000;
const int INF = 1e9;
const double pi=acos(-1);

int main(){
  ll n,k;
  cin >> n >> k;
  vector<pair<int,int>>vec;
  
  rep(i,n){
    ll a,b;
    cin >> a >>b;
    vec.push_back(make_pair(a,b));
  }
  sort(vec.begin(),vec.end());
  
  ll now=0;
  rep(i,n){
    if(now+vec[i].second<k){
      now+=vec[i].second;
    }
    else{
      cout << vec[i].first << endl;
      return 0;
    }
  }
  
  
  return 0;
}


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

int main() {
	string s;
	int ok = 0;
	cin >> s;
	for (int i = 0; i < s.size() - 1; i++) {
		if (s[i] == 'C')
			for (int j = i + 1; j < s.size(); j++)
				if (s[j] == 'F') ok = 1;
	}
	if (ok) cout << "Yes\n";
	else cout << "No\n";
}

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



int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s1,s2;
    cin >> s1 >> s2;
    if(s1 == s2.substr(0,s2.length()-1))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 3620
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let S: Vec<char> = sc.chars();
    let mut ans = S.iter().map(|&c| c).collect::<VecDeque<char>>();
    let mut s = Vec::new();
    let mut ccnt = 0;
    let mut ocnt = 0;
    for i in 0..N {
        if S[i] == '(' {
            s.push(S[i]);
        } else {
            if let Some(_) = s.pop() {
            } else {
                ccnt += 1;
            }
        }
    }
    if !s.is_empty() {
        ocnt += s.len();
    }
    for _ in 0..ccnt {
        ans.push_front('(');
    }
    for _ in 0..ocnt {
        ans.push_back(')');
    }
    println!("{}", ans.into_iter().collect::<String>());
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    long long int ans = 0;
    string check[] = {"RGB", "RBG", "GRB", "GBR", "BRG", "BGR"};
    rep(i, 6)
    {
        char a, b, c;
        a = check[i][0];
        b = check[i][1];
        c = check[i][2];
        vector<int> aa, bb, cc;

        rep(j, n)
        {
            if (s[j] == a)
                aa.push_back(j);
            if (s[j] == b)
                bb.push_back(j);
            if (s[j] == c)
                cc.push_back(j);
        }
       // cout << "size"
        //     << "\t" << aa.size() << "\t" << bb.size() << "\t" << cc.size() << endl;

        rep(x, aa.size())
        {
            //int second_start = distance(upper_bound(bb.begin(), bb.end(), aa[x]), bb.begin());
            // cout << "DBUG1\t"<<second_start << endl;
            rep(y, bb.size())
            {
                if (aa[x] > bb[y])
                    continue;
                auto larger_y_itr = upper_bound(cc.begin(), cc.end(), bb[y]);
                long kazu = distance(larger_y_itr, cc.end());
                auto dame = bb[y] + bb[y] - aa[x];
                //  cout << "DBUG2\t"<<kazu <<"\t"<<dame<< endl;

                bool bins = binary_search(larger_y_itr, cc.end(), dame);
                if (bins)
                {
                    ans += kazu - 1;
                }
                else
                {
                    ans += kazu;
                }
            }
        }
        //cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3684
N = int(input())
task = [0]*N
for i in range(N):
    a, b = map(int,input().split())
    task[i] = (b, a)
task.sort()

#print(task)

time = 0
for t in task:
    limit, required = t
    if time + required > limit:
        print('No')
        break
    time += required
else:
    print('Yes')

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

int main(){
  int n;
  long long ans=0;

  cin >> n;
  
  for(int i=1;i<=n;i++){
    long long first = i;
    long long last = n-n%i;
    long long num = n/i;
    ans += (first+last)*num/2;
  }

  cout << ans;
  return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,p,q;
  ll n,k; cin>>n>>k;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = -1 * INF;
  ll buf = 0;
  ll buf2 = 0;
  ll buf3 = 0;
  bool judge = true;
  //cout<<<<endl;
  vector<ll> v(n);
  ll sum = 0;
  for(i=0;i<n;i++){
    cin>>v[i];
    sum += v[i];
  }
  ll sumbuf;
  priority_queue<ll,vector<ll>,greater<ll>> w;
  
  for(i=0;i<=k&&i<=n;i++){
    for(j=0;j<=i;j++){
      sumbuf=0;
      for(p=0;p<j;p++){
        //cout<<p<<endl;
        w.push(v[p]);
        sumbuf-=v[p];
      }
      for(p=0;p<i-j;p++){
        //cout<<p<<endl;
        w.push(v[n-1-p]);
        sumbuf-=v[n-1-p];
      }
      
      for(p=0;p<k-i&&!w.empty();p++){
        //cout<<p<<endl;
        if(w.top()<0){
        sumbuf+=w.top();
        w.pop();
        }
      }
      //cout<<sumbuf<<endl;
      while(!w.empty())w.pop();
      chmax(result,-sumbuf);

    }
  }
  
  
  
  cout<<result<<endl;
  

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
    string s;
    cin >> s;
    int start, end;
    rep(i, s.length())
    {
        if (s[i] == 'A')
        {
            start = i;
            break;
        }
    }
    for (int i = s.length() - 1; i >= 0; i--)
    {
        if (s[i] == 'Z')
        {
            end = i;
            break;
        }
    }
    cout << end - start + 1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#define NIL -1

typedef struct{
  int left, right, par, dep, hei;
}tree;

tree t[100000];

void depth(int id, int d)
{
  if (id == NIL)
    return;
  t[id].dep = d;
  depth(t[id].left,d+1);
  depth(t[id].right,d+1);
}

int height(int id)
{
  int h1 = 0, h2 = 0;

  if (t[id].left != NIL)
    h1 = height(t[id].left)+1;
  if (t[id].right != NIL)
    h2 = height(t[id].right)+1;
  if (h1 >= h2)
    return t[id].hei = h1;
  return t[id].hei = h2;
}

int sibling(int id)
{
  if (t[id].par == NIL)
    return NIL;
  if (t[t[id].par].left != id && t[t[id].par].left != NIL)
    return t[t[id].par].left;
  if (t[t[id].par].right != id && t[t[id].par].right != NIL)
    return t[t[id].par].right;
  return NIL;
}

int main()
{
  int n, i, id, l, r, root, deg;

  scanf("%d",&n);
  for (i = 0; i < n; i++){
    t[i].par = NIL;
    t[i].dep = t[i].hei = 0;
  }
  for (i = 0; i < n; i++){
    scanf("%d%d%d",&id,&l,&r);
    t[id].left = l;
    t[id].right = r;
    if (l != NIL)
      t[l].par = id;
    if (r != NIL)
      t[r].par = id;
  }
  for (i = 0; i < n; i++)
    if (t[i].par == NIL)
      root = i;
  depth(root,0);
  height(root);
  for (i = 0; i < n; i++){
    deg = 0;
    if (t[i].left != NIL)
      deg++;
    if (t[i].right != NIL)
      deg++;
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,t[i].par,sibling(i),deg,t[i].dep,t[i].hei);
    if (t[i].par == NIL)
      printf("root\n");
    else if (t[i].left == NIL && t[i].right == NIL)
      printf("leaf\n");
    else
      printf("internal node\n");
  }
    
  return 0;
}



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

using namespace std;

typedef tuple<string, int, int> sii;

char str[105];

string A[105];
int B[105];

sii AB[105];

int main(){
	int N;
	scanf("%d", &N);
	
	for(int i = 0; i < N; i ++){
		int x;
		scanf(" %s %d", str, &x);
		AB[i] = sii(string(str), -x, i+1);
	}
	
	sort(AB, AB+N);
	for(int i = 0; i < N; i ++){
		printf("%d\n", get<2>(AB[i]));
	}
	
	return 0;
}


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

struct vertex {
    vector<lint> edge;
    lint num = -1;
};

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

    vector<vertex> g(n);
    for(lint i=0; i<n; i++)
    for(lint j=0; j<n; j++) {
        char s;
        cin >> s;
        s -= '0';
        if(s == false)  continue;
        if(i < j)  continue;
        g[i].edge.push_back(j);
        g[j].edge.push_back(i);
    }

    lint ans = -1;
    for(lint i=0; i<n; i++) {
        // init
        for(lint k=0; k<n; k++)  g[k].num = -1;

        queue<pair<lint, lint>> q;
        q.emplace(i, 1);
        while(!q.empty()) {
            lint node, num;
            tie(node, num) = q.front(); q.pop();

            if(g[node].num == num)  continue;
            if(g[node].num == num-1) {
                q.emplace(-1, -1); // dummy
                break;
            }
            g[node].num = num;

            for(auto next : g[node].edge) {
                if(g[next].num != -1)  continue;
                q.emplace(next, num+1);
            }
        }
        if(!q.empty())  continue;
        for(lint k=0; k<n; k++)  ans = max(ans, g[k].num);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1036
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

map<char, int> str_to_map(vector<char> c){
    map<char, int> res;
    for(int i = 0; i < c.size(); i++){
        res[c[i]]=1; 
    }
    return res;
}

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = -1;
    for(int i = 0; i < s.size()-1; i ++){
        vector<char> x;
        vector<char> y;
        for(int j = 0; j < i+1; j++){
            x.push_back(s[j]);
        }
        for(int j = i+1; j < s.size(); j++){
            y.push_back(s[j]);
        }
        map<char, int> x_map = str_to_map(x);
        map<char, int> y_map = str_to_map(y);
        int sum = 0;
        for(auto elm = x_map.begin(); elm != x_map.end() ; ++elm){
            char key = elm->first;
            sum += min(x_map[key], y_map[key]);
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
#define taskname "A"
#define pb	push_back
#define mp  make_pair

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 2500 + 5;
const int mod = 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	if(fopen(taskname".INP","r")){
        freopen(taskname".INP", "r",stdin) ,
        freopen(taskname".OUT", "w",stdout);
	}
    int n ,k;cin >> n >> k;
    if(n >= 10)cout << k;
    else cout << k + (10 - n) * 100;
}



Measured memory_bytes: 256
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int[] p = new int[n];

    int ans = 0;

    for(int i=0;i<n;i++){
      p[i] = nextInt();
    }

    int min = p[0]; //最初はok

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

      //0～(i)までの最大値より(以下)p[i]が小さいなら、ok
      if(p[i]<=min){
        ans++;
      }

      //0～(i)までの最大値を更新
      min = Math.min(min,p[i]);

    }




    System.out.println(ans);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 64860
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    print(["YES","NO"][len([1 for i in A if i&1])%2])
if __name__ == '__main__':
    main()

Measured memory_bytes: 85100
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(void){
  	cin.tie(0);ios::sync_with_stdio(false);
    int n,k;cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    sort(a.begin(),a.end());

    ll facl = 1;
    for(ll i = 1;i <= n;i++)facl = (facl * i) % mod;

    vector<mint> dp(100010,0);
    dp[k] = (mint)1;
    for(ll x = k;x >= 1;x--){
        if(dp[x].x == 0)continue;
        mint cnt = 0;
        ll l = -1,r = n;
        while(l+1!=r){
            ll m = (l+r)/2;
            if(a[m] > x)r = m;
            else l = m;
        }
        cnt = (mint)(l + 1);
        if(cnt.x == 0){
            continue;
        }
        for(ll i = 0;i < cnt.x;i++){
            dp[x % a[i]] += dp[x]/cnt;
        }
        dp[x] = 0;
    }
    mint sum = 0;
    for(ll x = k;x >= 0;x--){
       sum += (mint)x * dp[x];
    }
    sum *= facl;
    cout << sum.x << '\n';
}


Measured memory_bytes: 1152
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
         Scanner sc = new Scanner(System.in);
         String w = sc.nextLine();
         int j=0;
         while(true)
         {
             String s =sc.next();
             if(s.compareTo("END_OF_TEXT")==0)break;
             if(s.compareToIgnoreCase(w)==0) j++;
         }
         System.out.println(j);
    }
}


Measured memory_bytes: 26152
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


int main(){
	int N,M,h,m;
	vi d;
	cin>>N;
	rep(i,0,N){
		cin>>h>>m;
		d.push_back(h*60+m);
	}
	cin>>M;
	rep(i,0,M){
		cin>>h>>m;
		d.push_back(h*60+m);
	}
	sort(all(d));
	rep(i,0,N+M){
		if(i && d[i]==d[i-1]) continue;
		h=d[i]/60;
		m=d[i]%60;
		if(i) cout<<" ";
		printf("%d:%02d",h,m);
	}
	cout<<endl;
}

Measured memory_bytes: 1256
#include<stdio.h>
int Partition(int, int);
int A[100001], Q;

int main(void){
  int i, n, x;
  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d",&A[i]);
  }
  x = A[n];
  Partition(1, n);
  for(i=1; i<=n; i++){
    if(i == Q) printf("[");
    printf("%d",A[i]);
    if(i == Q) printf("]");
    if(i < n) printf(" ");
  }
  printf("\n");
  return 0;
}


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

Measured memory_bytes: 804