alexjercan/bugnet huggingface dataset:
Problem p02594 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main() {

  int T;
  cin >> T;

  if (T >= 30) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {

  long num, distance, x, y;
  long cnt = 0;

  cin >> num >> distance;

  long dis_lst[num][2];

  for (long i = 0; i < num; i++) {
    cin >> dis_lst[i][0] >> dis_lst[i][1];
  }

  for (long i = 0; i < num; i++) {
    x = dis_lst[i][0] * dis_lst[i][0];
    y = dis_lst[i][1] * dis_lst[i][1];

    if (x + y <= distance * distance) {
      cnt++;
    }
  }

  cout << cnt;

  return 0;
}
Problem p02594 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll int
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  ll n;
  cin >> n;
  if (n >= 30) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int

ll solve() {
  ll n;
  cin >> n;
  if (n >= 30) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

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

  ll t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
}
Problem p02594 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef long double ld;

int main() {
  ll N, K;
  cin >> N;

  if (N >= 30) {
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef long double ld;

int main() {
  string s;
  ll N, K;
  cin >> N;
  vector<ll> A(N, 0);
  ll ans;
  if (N >= 30) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02594 (C++) — buggy submission, verdict: Runtime Error

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define per(i, n, a) for (ll i = n - 1; i >= a; i--)
#define nl "\\n"
#define LLMAX 1e18
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define fastread                                                               \\
  cin.tie(0);                                                                  \\
  cout.tie(0);                                                                 \\
  ios::sync_with_stdio(false);
#define online_judge

const ll MOD = 1e9 + 7;

ll pow(ll n, ll e) {
  if (e == 0)
    return 1;
  else if (e == 1)
    return n;
  else if (e % 2 == 0)
    return pow(n, e / 2);
  else
    return pow(n, e / 2) * n;
}

bool prime(ll n) {
  ll ct = 0;
  rep(i, 2, sqrt(n) + 1) {
    if (n % i == 0)
      return false;
  }
  return true;
}

void solve() {
  fastread;
  ll n, m, temp, mi, q, ma = 0, t;

  cin >> n;
  (n >= 30) ? cout << "Yes" : cout << "No";
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
  clock_t start, end;
  start = clock();
  solve();
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
  cerr << "Time taken by program is : " << fixed << time_taken
       << setprecision(5);
  cerr << " sec " << endl;
  return 0;
}

Error: WA

Fixed submission:

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define per(i, n, a) for (ll i = n - 1; i >= a; i--)
#define nl "\\n"
#define LLMAX 1e18
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define fastread                                                               \\
  cin.tie(0);                                                                  \\
  cout.tie(0);                                                                 \\
  ios::sync_with_stdio(false);
#define online_judge

const ll MOD = 1e9 + 7;

ll pow(ll n, ll e) {
  if (e == 0)
    return 1;
  else if (e == 1)
    return n;
  else if (e % 2 == 0)
    return pow(n, e / 2);
  else
    return pow(n, e / 2) * n;
}

bool prime(ll n) {
  ll ct = 0;
  rep(i, 2, sqrt(n) + 1) {
    if (n % i == 0)
      return false;
  }
  return true;
}

int solve() {
  fastread;
  ll n, m, temp, mi, q, ma = 0, t;

  cin >> n;
  (n >= 30) ? cout << "Yes" : cout << "No";
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
  clock_t start, end;
  start = clock();
  solve();
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
  cerr << "Time taken by program is : " << fixed << time_taken
       << setprecision(5);
  cerr << " sec " << endl;
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

long long N, D;
long long X[210000];
long long Y[210000];

int main(void) {

  cin >> N >> D;
  for (int i = 1; i <= N; i++)
    cin >> X[i] >> Y[i];

  int ans;
  ans = 0;
  D = D * D;

  for (int i = 1; i <= N; i++) {
    long long dist = X[i] * X[i] + Y[i] * Y[i];
    if (D >= dist)
      ans++;
  }

  cout << ans << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

long long N, D;
long long X[110000];
long long Y[110000];

int main(void) {

  cin >> N >> D;
  for (int i = 1; i <= N; i++)
    cin >> X[i] >> Y[i];

  int ans;
  ans = 0;
  D = D * D;

  for (int i = 1; i <= N; i++) {
    long long dist = X[i] * X[i] + Y[i] * Y[i];
    if (D >= dist)
      ans++;
  }

  cout << ans << endl;

  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const ll mod = 1e9 + 7;
int n, m;
ll a[maxn], b[maxn];
double c[maxn];
int ans = 0;
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    c[i] = sqrt(a[i] * a[i] + b[i] * b[i]);
    // cout<<c[i]<<endl;
    if (c[i] <= m)
      ans++;
  }
  cout << ans << endl;
}

int main() {
  std::ios::sync_with_stdio(false);
  int test = 1;
  while (test--) {
    solve();
  }
  return 0;
}


Error: 0

Fixed submission:


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;
int n, m;
int a[maxn], b[maxn];
double c[maxn];
int ans = 0;
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    c[i] = sqrt(a[i] * a[i] + b[i] * b[i]);
    // cout<<c[i]<<endl;
    if (c[i] <= m)
      ans++;
  }
  cout << ans << endl;
}

int main() {
  std::ios::sync_with_stdio(false);
  int test = 1;
  while (test--) {
    solve();
  }
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using ml = map<ll, ll>;

#define ff first
#define ss second
#define endl '\\n'
#define ins insert
#define eb emplace_back
#define sz(c) (ll) c.size()
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define itr(x, c) for (auto &x : c)
#define tc                                                                     \\
  ll t;                                                                        \\
  cin >> t;                                                                    \\
  while (t--)
#define rep(i, a, n) for (ll i = a; i < n; ++i)
#define per(i, a, n) for (ll i = n - 1; i >= a; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c)                                                                  \\
  itr(x, c) cout << x << " ";                                                  \\
  cout << endl;
#define dm(m) itr(x, m) cout << x.ff << " -> " << x.ss << endl;
#define godspeed cin.tie(0)->sync_with_stdio(0);

int main() {
  godspeed;
  ll n;
  cin >> n;
  ll d;
  cin >> d;

  ll x, y, cnt = 0;
  while (n--) {
    cin >> x >> y;
    ld dis = sqrt(x * x + y * y);
    if (dis <= d)
      cnt++;
  }

  cout << cnt;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using ml = map<ll, ll>;

#define ff first
#define ss second
#define endl '\\n'
#define ins insert
#define eb emplace_back
#define sz(c) (ll) c.size()
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define itr(x, c) for (auto &x : c)
#define tc                                                                     \\
  ll t;                                                                        \\
  cin >> t;                                                                    \\
  while (t--)
#define rep(i, a, n) for (ll i = a; i < n; ++i)
#define per(i, a, n) for (ll i = n - 1; i >= a; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c)                                                                  \\
  itr(x, c) cout << x << " ";                                                  \\
  cout << endl;
#define dm(m) itr(x, m) cout << x.ff << " -> " << x.ss << endl;
#define godspeed cin.tie(0)->sync_with_stdio(0);

int main() {
  godspeed;
  ll n, d, count = 0;
  ld a[100], b[100];
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (sqrt(a[i] * a[i] + b[i] * b[i]) <= d)
      count++;
  }
  cout << count;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, d;
  cin >> n >> d;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    ll x, y;
    cin >> x >> y;
    double dx = sqrt(x * x + y * y * 1.0);
    if (dx <= d)
      cnt++;
  }
  cout << cnt;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
p c[20001];
double d[20001] = {0};
int main() {
  int n, dx;
  cin >> n >> dx;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    cin >> c[i].first >> c[i].second;
    d[i] = sqrt(pow(c[i].first, 2) * 1.0 + pow(c[i].second, 2));
    if (d[i] <= dx)
      cnt++;
  }
  cout << cnt;
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int ans, n, d;
int main() {
  cin >> n >> d;
  while (n--) {
    int x, y;
    cin >> x >> y;
    double t = sqrt(pow(x, 2) + pow(y, 2));
    if (t <= d) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
ll a[N][2], ans, n, d;
int main() {
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
  }
  /*for(int i = 0; i < n-1; i++){
      for(int j = 0; j < n-1-i; j++){
          if(a[j][0] > a[j+1][0]){
              int t = a[j][0];
              a[j][0] = a[j+1][0];
              a[j+1][0] = t;
              t = a[j][1];
              a[j][1] = a[j+1][1];
              a[j+1][1] = t;
          }
      }
  }*/
  for (int i = 0; i < n; i++) {
    double t = sqrt(pow(a[i][0], 2) + pow(a[i][1], 2));
    if (t <= d) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#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++)
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  ll n, d;
  cin >> n >> d;
  vector<ll> x(n);
  vector<ll> y(n);
  rep(i, n) { cin >> x[i] >> y[i]; }
  ll count = 0;
  rep(i, n) {
    ll rr = x[i] * x[i] + y[i] * y[i];
    if (rr <= d * d) {
      count++;
    }
  }
  cout << count << endl;
}

Error: -11

Fixed submission:

#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++)
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  int n, d;
  cin >> n >> d;
  vector<int> x, y;
  rep(i, n) { cin >> x[i] >> y[i]; }
  int count = 0;
  rep(i, n) {
    rep(j, n) {
      if (i == j) {
        continue;
      }
      int rr = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      if (rr <= d * d) {
        count++;
      }
    }
  }
  cout << count << endl;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define optimizar_io                                                           \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);

typedef long long int ll;

int main() {
  optimizar_io int n;
  ll d, x[200010], y[200010];

  cin >> n >> d;
  d = d * d;
  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    ll dist = x[i] * x[i] + y[i] * y[i];
    if (dist <= d)
      cnt++;
  }
  cout << cnt << "\\n";
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define optimizar_io                                                           \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);

typedef long long int ll;

int main() {
  optimizar_io int n;
  ll d, x[100010], y[100010];

  cin >> n >> d;
  d = d * d;
  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    ll dist = x[i] * x[i] + y[i] * y[i];
    if (dist <= d)
      cnt++;
  }
  cout << cnt << "\\n";
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int n, m, j = 0;
  double a[300000], b[300000], f[300000], g[300000];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    f[i] = a[i];
    g[i] = b[i];
    for (int l = 0; l < i; l++) {
      if (a[i] == f[l] && b[i] == b[l]) {
        break;
      }
    }
    if (sqrt(a[i] * a[i] + b[i] * b[i]) <= m) {
      j++;
    } else {
      j += 0;
    }
  }
  cout << j << '\\n';
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int n, m, j = 0;
  double a[1000], b[1000];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (sqrt(a[i] * a[i] + b[i] * b[i]) <= 5) {
      j++;
    } else {
      j += 0;
    }
  }
  cout << j << '\\n';
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  double n, k, a, b, sum = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (sqrt(a * a + b * b) <= k)
      sum++;
  }
  cout << sum << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[101], b[101], sum = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (sqrt(a[i] * a[i] + b[i] * b[i]) <= k)
      sum++;
  }
  cout << sum << endl;
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, D;
  cin >> N >> D;
  long long A[2][300000];
  for (int i = 0; i < N; i++) {
    cin >> A[0][i] >> A[1][i];
  }

  long long cnt = 0;
  for (int i = 0; i < N; i++) {
    if (sqrt(A[0][i] * A[0][i] + A[1][i] * A[1][i]) <= D)
      cnt++;
  }
  cout << cnt << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  long double N, D;
  cin >> N >> D;
  long double A[2][30000];
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[0][i] >> A[1][i];
  }
  for (int i = 0; i < N; i++) {
    if ((A[0][i] * A[0][i]) + (A[1][i] * A[1][i]) <= D * D)
      cnt++;
  }

  cout << cnt << endl;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <cmath>
#include <iostream>

#define L 200005

using namespace std;

double x[L], y[L];

double dist(double x, double y) {
  double s = (double)(x * x) + (double)(y * y);
  return sqrt(s);
}

int main() {
  int N, D;
  cin >> N >> D;
  int cnt = 0;
  for (int i = 0; i < N; i++)
    cin >> x[i] >> y[i];
  for (int i = 0; i < N; i++) {
    if (dist(x[i], y[i]) <= (double)(D))
      cnt++;
  }
  cout << cnt << "\\n";
  return 0;
}

Error: 0

Fixed submission:

#include <cmath>
#include <iostream>

#define L 20005

using namespace std;

double x[L], y[L];

double dist(double x, double y) {
  double s = (double)(x * x) + (double)(y * y);
  return sqrt(s);
}

int main() {
  int N, D;
  cin >> N >> D;
  int cnt = 0;
  for (int i = 0; i < N; i++)
    cin >> x[i] >> y[i];
  for (int i = 0; i < N; i++) {
    if (dist(x[i], y[i]) <= (double)(D))
      cnt++;
  }
  cout << cnt << "\\n";
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {

  int n;
  long long d;
  cin >> n >> d;
  int ans = 0;

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

    long long x, y;
    cin >> x >> y;

    long long sq = x * x + y * y;
    if (sqrt(sq) <= d)
      ans++;
  }

  cout << ans << ' ';

  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {

  double n, d;
  cin >> n >> d;

  double x[100001], y[100001];

  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i];

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

    double sq = x[i] * x[i] + y[i] * y[i];
    if (sqrt(sq) <= d)
      ans++;
  }

  cout << ans << ' ';

  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  ll d;
  cin >> n >> d;
  int ans = 0;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, D;
  int point[N][3];
  int CNT = 0;

  cin >> N >> D;

  for (int i = 0; i < N; i++) {
    cin >> point[i][0] >> point[i][1];
    if (point[i][0] < 0)
      point[i][0] *= -1;
    if (point[i][1] < 0)
      point[i][1] *= -1;
    point[i][2] = point[i][0] * point[i][0] + point[i][1] * point[i][1];
    if (point[i][2] <= D * D)
      CNT++;
  }

  cout << CNT << endl;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int n;
long long d;
int ans = 0;

int main() {
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d)
      ans++;
  }
  cout << ans << "\\n";
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
long long int n, d;
struct td {
  long long int x, y;
};
int main() {
  int k = 1, dem = 0;
  cin >> n >> d;
  td a[20005];
  double b[20005];
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
  }
  for (int i = 1; i <= n; i++) {
    b[i] = sqrt(a[i].x * a[i].x + a[i].y * a[i].y);
  }
  sort(b + 1, b + n + 1);
  while (b[k] <= d) {
    dem++;
    k++;
  }
  cout << dem;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
  long long int n, d;
  int count = 0;
  long double x[200000];
  long double y[200000];
  scanf("%lld%lld", &n, &d);
  for (int i = 1; i <= n; i++) {
    scanf("%Lf", &x[i]);
    scanf("%Lf", &y[i]);
  }

  for (int i = 1; i <= n; i++) {
    if (sqrt(x[i] * x[i] + y[i] * y[i]) <= d) {
      count++;
    }
  }
  printf("%d\\n", count);
  return 0;
}

Error: 0

Fixed submission:

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
  long long int n, d;
  int count = 0;
  long double x[20000];
  long double y[20000];
  scanf("%lld%lld", &n, &d);
  for (int i = 0; i < n; i++) {
    scanf("%Lf", &x[i]);
    scanf("%Lf", &y[i]);
  }

  for (int i = 0; i < n; i++) {
    if (sqrt(x[i] * x[i] + y[i] * y[i]) <= d) {
      count++;
    }
  }
  printf("%d\\n", count);
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

// Function to calculate distance
double distance(double x1, double y1) {
  // Calculating distance
  return sqrt(pow(x1 - 0, 2) + pow(y1 - 0, 2) * 1.0);
}

// Drivers Code
int main() {
  // cout << distance(3, 4, 4, 3);
  int n;
  int d;
  cin >> n;
  cin >> d;
  double x, y;
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    cin >> y;
    double t = distance(x, y);
    if (t <= d)
      count++;
  }
  cout << count;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
// Function to calculate distance
double distance(int x1, int y1) {
  // Calculating distance
  sqrt(x1 * x1 + y1 * y1);
}

// Drivers Code
int main() {
  // cout << distance(3, 4, 4, 3);
  ll n;
  double d;
  cin >> n;
  cin >> d;
  ll x, y;
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    cin >> y;
    double t = distance(x, y);
    if (t >= d)
      count++;
  }
  cout << count << endl;
  return 0;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define int long long int

int32_t main() {

  int n, d;
  cin >> n >> d;

  int count = 0;

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

    int x, y;
    scanf("%lld %lld", &x, &y);

    if (x * x + y * y <= d * d)
      count++;
  }
  cout << count << endl;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long int

int32_t main() {

  int n, d;
  cin >> n >> d;

  int count = 0;

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

    int x, y;
    scanf("%d %d");

    if (x * x + y * y <= d * d)
      count++;
  }
  cout << count << endl;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)

using namespace std;
using ll = long long;

void solve(ll N, ll D, vector<ll> X, vector<ll> Y) {
  int ans = 0;
  rep(i, N) { ans += (X[i] * X[i] + Y[i] * Y[i]) <= D * D; }
  cout << ans << '\\n';
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll D;
  scanf("%lld", &D);
  vector<ll> X(N);
  vector<ll> Y(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &X[i]);
    scanf("%lld", &Y[i]);
  }
  solve(N, D, move(X), move(Y));
  return 0;
}


Error: 4

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N, D;
  cin >> N >> D;
  int X[N];
  int Y[N];
  int Sum = 0;
  int i = 0;
  int k;
  while (cin >> X[i] >> Y[i]) {
    k = X[i] ^ 2 + Y[i] ^ 2;
    if (k <= D ^ 2) {
      Sum++;
    }
    i++;
  }
  return Sum;
}
Problem p02595 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int N, count = 0;
  static double X[200000], Y[200000];
  double D, x;
  cin >> N;
  cin >> D;
  for (int i = 0; i < N; i++) {
    cin >> X[i];
    cin >> Y[i];
    x = X[i] * X[i] + Y[i] * Y[i];
    x = sqrt(x);

    if (D >= x)
      count++;
  }
  cout << count;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int N, count = 0;
  double X[20000], Y[20000], D, x;
  cin >> N;
  cin >> D;
  for (int i = 0; i < N; i++) {
    cin >> X[i];
    cin >> Y[i];
    x = X[i] * X[i] + Y[i] * Y[i];
    x = sqrt(x);

    if (D >= x)
      count++;
  }
  cout << count;
  return 0;
}