prithivMLmods/Coder-Stat huggingface dataset:
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

#define N_MAX (100000)
#define LL_MAX_NUM (1LL << 60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
  lli a, b, x, ans;
  cin >> a >> b >> x;
  ans = 0;
  for (int i = a; i <= b; i++) {
    if (i % x == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

#define N_MAX (100000)
#define LL_MAX_NUM (1LL << 60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
  lli a, b, x, ans;
  cin >> a >> b >> x;
  ans = (b / x + 1) - (a == 0 ? 0 : (a - 1) / x + 1);
  cout << ans << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdbool>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

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 long long INF = 1LL << 60;
char s[60][60];
int bomb[60][60];
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long res = 0;
  for (long long i = a; i <= b; i++) {
    if (i % x == 0) {
      res++;
    }
  }

  cout << res << endl;
}


Fixed submission:
#include <algorithm>
#include <cstdbool>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

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 long long INF = 1LL << 60;
char s[60][60];
int bomb[60][60];
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long res = 0;
  if (a)
    a = (a - 1) / x + 1;
  b = b / x + 1;
  cout << b - a << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iomanip>
#include <iostream>

using namespace std;

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

int main() {
  long long int a, b;
  long long int x;
  cin >> a >> b >> x;
  if (x % a == 0) {
    cout << b / x - a / x + 1;
  } else {
    cout << b / x - a / x;
  }
}

Fixed submission:
#include <algorithm>
#include <iomanip>
#include <iostream>

using namespace std;

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

int main() {
  long long int a, b;
  long long int x;
  cin >> a >> b >> x;
  if (a % x == 0) {
    cout << b / x - a / x + 1;
  } else {
    cout << b / x - a / x;
  }
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main() {

  // freopen("input.txt","r",stdin);

  int x, y, z;

  cin >> x >> y >> z;

  if (x % z != 0) {
    x = x + (z - x % z);
  }
  if (y % z != 0) {
    y = y - y % z;
  }

  if (x > y)
    cout << 0 << endl;

  else
    cout << (y - x) / z + 1 << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main() {

  // freopen("input.txt","r",stdin);

  long long int x, y, z;

  cin >> x >> y >> z;

  if (x % z != 0) {
    x = x + (z - x % z);
  }
  if (y % z != 0) {
    y = y - y % z;
  }

  if (x > y)
    cout << 0 << endl;

  else
    cout << (y - x) / z + 1 << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int a, b, c, tmp = 0;
  cin >> a >> b >> c;
  for (int i = a; i <= b; i++)
    if (i % c == 0)
      tmp++;
  cout << tmp << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  unsigned long long int a, b, x, m, n;
  cin >> a >> b >> x;
  if (a % x == 0) {
    m = a / x;
  } else {
    m = a / x + 1;
  }
  n = b / x;
  cout << n - m + 1 << endl;
  // system("pause");
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  long long a, b, x;
  long long temp, count = 0;

  cin >> a >> b >> x;

  temp = b - a;
  for (int i = 0; i <= temp; i++)
    if ((a + i) % x == 0)
      count++;

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

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  long long a, b, x;
  long long temp, count = 0;

  cin >> a >> b >> x;

  if (a % x == 0)
    count = b / x - a / x + 1;
  else
    count = b / x - a / x;

  cout << count << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  long a, b, x;
  cin >> a >> b >> x;
  long ans = 0;
  for (long i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  long a, b, x;
  cin >> a >> b >> x;
  long ans = b / x + 1;
  if (a - 1 != -1)
    ans -= (a - 1) / x + 1;
  cout << ans << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

long long a, b, x, cnt = 0;

int main() {
  cin >> a >> b >> x;
  for (long long i = a; i <= b; ++i)
    if (i % x == 0)
      ++cnt;
  cout << cnt << endl;
  return 0;
}

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

long long a, b, x, cnt = 0;

int main() {
  cin >> a >> b >> x;
  if (a == 0)
    ++cnt;
  cout << b / x - max(0LL, (a - 1)) / x + cnt << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  int ans = 0;
  for (int i = a; i < b + 1; i++) {
    if (i % x == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  int64_t ans = b / x - (a + x - 1) / x + 1;
  cout << ans << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define mod 10000007
#define ff first
#define ss second
#define ll long long
#define int long long
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pb push_back
#define mp make_pair
#define sp(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \
  ll x;                                                                        \
  cin >> x;                                                                    \
  while (x--)
#define endl '\n'
#define str string
#define all(v) v.begin(), v.end()
void kehsihba() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {
  // kehsihba();
  ll a, b, x;
  cin >> a >> b >> x;
  if (a == b) {
    if (a % x == 0) {
      cout << 1;
    } else {
      cout << 0;
    }
  } else {
    for (int i = a; i < b; i++) {
      if (i % x == 0) {
        a = i;
        break;
      }
    }
    for (int i = b; i > a; i--) {
      if (i % x == 0) {
        b = i;
        break;
      }
    }
    cout << ((b - a) / x) + 1;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define mod 10000007
#define ff first
#define ss second
#define ll long long
#define int long long
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pb push_back
#define mp make_pair
#define sp(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \
  ll x;                                                                        \
  cin >> x;                                                                    \
  while (x--)
#define endl '\n'
#define str string
#define all(v) v.begin(), v.end()
void kehsihba() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {
  // kehsihba();
  ll a, b, x;
  cin >> a >> b >> x;
  if (a == b) {
    if (a % x == 0) {
      cout << 1;
    } else {
      cout << 0;
    }
  } else {
    ll m = a % x;
    if (m)
      a += (x - m);
    ll n = b % x;
    if (n)
      b -= (n);
    cout << ((b - a) / x) + 1;
  }
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  long long a, b, x;
  cin >> a >> b, x;
  if (x > b) {
    cout << 0;
    return 0;
  }
  long long k = a / x;
  if (a % x != 0)
    k++;
  long long t = b / x;
  cout << t - k + 1;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  if (x > b && a != 0) {
    cout << 0;
    return 0;
  }
  if (a == b && b % x != 0) {
    cout << 0;
    return 0;
  }
  long long k = a / x;
  if (a % x != 0)
    k++;
  long long t = b / x;
  cout << t - k + 1;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)

typedef long long ll;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b, x;
  cin >> a >> b >> x;

  ll d = (b - a) / x;
  ll r = (b - a) % x;
  ll cnt = 0;
  for (ll i = a; i < a + x; ++i) {
    if (i % x == 0)
      ++cnt;
  }
  cnt *= d;
  for (ll i = b - r; i <= b; ++i) {
    if (i % x == 0)
      ++cnt;
  }
  cout << cnt << "\n";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)

typedef long long ll;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b, x;
  cin >> a >> b >> x;
  if (a % x == 0)
    cout << b / x - a / x + 1 << "\n";
  else
    cout << b / x - a / x << "\n";
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  long long cnt = 0;
  for (long long i = a; i <= b; i++) {
    if (i % k == 0) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  long long cnt = 1;
  b = (b / k) * k;
  a = ((a + k - 1) / k) * k;
  cnt += (b - a) / k;
  cout << cnt << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  int64_t ans = (b / x) - ((a - 1) / b);
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  if (a != 0) {
    int64_t ans = (b / x) - ((a - 1) / x);
    cout << ans << endl;
  } else {
    int64_t ans = 1 + (b / x);
    cout << ans << endl;
  }
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (a % x == 0) {
    cout << b / x - a / x + 1 << endl;
  } else {
    cout << b / x - a / x << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  if (a % x == 0) {
    cout << b / x - a / x + 1 << endl;
  } else {
    cout << b / x - a / x << endl;
  }
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  long a, b, x;
  long ans;

  cin >> a >> b >> x;

  while (a % x != 0) {
    a++;
  }

  while (b % x != 0) {
    b--;
  }

  ans = (b - a) / x;

  if (a % x == 0 && b % x == 0) {
    ans++;
  }

  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  long a, b, x;
  long ans;

  cin >> a >> b >> x;

  if (a != 0) {
    ans = b / x - (a - 1) / x;
  } else {
    ans = b / x + 1;
  }

  cout << ans << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a, b, x;
int main() {
  cin >> a >> b >> x;
  ll f = a, l = b;
  while (f % x != 0)
    f++;
  while (l % x != 0)
    l--;
  cout << (l - f) / x + 1;
}
// solved  problems for today:3


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a, b, x;
int main() {
  cin >> a >> b >> x;
  cout << (b / x + 1) - (a > 0 ? (a - 1) / x + 1 : 0);
}
// solved  problems for today:3
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll n, l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
    cin >> s[i];
  sort(s.begin(), s.end());
  for (int i = 0; i < n; i++)
    cout << s[i];
  cout << endl;
}

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

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans;
  if (a > 0)
    ans = b / x - ((a - 1) / x);
  else
    ans = b / x + 1;
  cout << ans << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include "bits/stdc++.h"
using namespace std;

int main() {

  long long a, b, x;
  cin >> a >> b >> x;

  long long res = 0;
  for (long long i = a; i <= b; i++) {
    if (i % x == 0)
      res++;
  }

  cout << res << endl;

  return 0;
}


Fixed submission:
#include "bits/stdc++.h"
using namespace std;

int main() {

  long long a, b, x;
  cin >> a >> b >> x;

  long long res;
  if (a == b) {
    if (a % x == 0)
      res = 1;
    else
      res = 0;
  } else if (a == 0)
    res = b / x + 1;
  else
    res = (b / x + 1) - ((a - 1) / x + 1);

  cout << res << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int a, b, x;
  cin >> a >> b >> x;
  a != 0 ? cout << b / x - (a - 1) / x << endl : cout << b / x + 1 << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  a != 0 ? cout << b / x - (a - 1) / x << endl : cout << b / x + 1 << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, y, z, count = 0;
  scanf("%lld%lld%lld", &x, &y, &z);
  while (x <= y) {
    if (x % z == 0) {
      count++;
      x++;
    } else
      x++;
  }
  printf("%lld", count);
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x, n;
  scanf("%lld %lld %lld", &a, &b, &x);

  n = (b / x) - (a / x);
  if (a % x == 0)
    ++n;
  printf("%lld\n", n);
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int a, b, c, d = 0;
  cin >> a >> b >> c;
  for (int i = a; i < (b + 1); i++) {
    if (a % c == 0) {
      d++;
    }
    a++;
  }
  cout << d << "\n";
}


Fixed submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int a, b, c, d = 0;
  cin >> a >> b >> c;
  if (a % c == 0)
    d = 1;
  cout << b / c - a / c + d << "\n";
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 7;
int main() {
  ll a, b, c, x;
  scanf("%lld %lld %lld", &a, &b, &x);
  ll ans = 0;
  for (ll i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  printf("%lld\n", ans);
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 7;
int main() {
  ll a, b, c, x;
  scanf("%lld %lld %lld", &a, &b, &x);
  ll ans = 0;
  if (a == 0)
    ans = b / x + 1;
  else
    ans = (b / x) - (a - 1) / x;
  printf("%lld\n", ans);
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long ans = 0;
  for (long long i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  cout << ans << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long s = a / x, e = b / x, sl = a % x, el = b % x;
  if (s == e && sl != 0 && el != 0)
    cout << 0 << endl;
  else if (s == e)
    cout << 1 << endl;
  else if (sl == 0)
    cout << e - s + 1 << endl;
  else if (sl != 0)
    cout << e - s << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;

  int64_t ans = 0;
  for (int i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
    else
      continue;
  }
  cout << ans << endl;
}


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

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;

  int64_t ans = 0;
  if (a == 0)
    ans = b / x + 1;
  else
    ans = b / x - (a - 1) / x;
  cout << ans << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main() {
  int a, b, x, ans = 0;
  cin >> a >> b >> x;

  if (a <= b) {
    ans = (b / x) - ((a / x));
  }
  if (a % x == 0) {

    ans++;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  long long a, b, x, ans = 0;
  cin >> a >> b >> x;

  if (a <= b) {
    ans = (b / x) - ((a / x));
  }
  if (a % x == 0) {

    ans++;
  }
  cout << ans << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  int a, b, x;
  cin >> a >> b >> x;
  if (a == 0)
    cout << b / x + 1;
  else
    cout << b / x - (a - 1) / x;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  long long int a, b, x;
  cin >> a >> b >> x;
  if (a == 0)
    cout << b / x + 1;
  else
    cout << b / x - (a - 1) / x;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

#define pb push_back

#define ll long long

// download zambak book volume 1 phisics pdf free download

#define ft first

#define sd second

using namespace std;

const int N = 5050;

bool used[N];

ll z, r, w;

ll p = -1;

int main() {

  ll n, m, k;
  cin >> n >> m >> k;
  for (ll i = n; i <= m; i++) {
    if (i % k == 0) {
      z++;
    }
  }
  cout << z;
}


Fixed submission:
#include <bits/stdc++.h>

#define pb push_back

#define ll long long

// download zambak book volume 1 phisics pdf free download

#define ft first

#define sd second

using namespace std;

const int N = 5050;

bool used[N];

ll z, r, w;

ll p = -1;

int main() {
  ll a, b, cnt1 = 0, cnt2 = 0, x;
  cin >> a >> b >> x;
  cnt1 = a / x;
  cnt2 = b / x;
  if (a % x == 0)
    cnt1--;
  cout << cnt2 - cnt1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = 0;
  while (b % x) {
    b--;
  }
  ll c = b / x;
  if (a % x) {
    cout << c - (a / x);
  } else {
    cout << c - (a / x) + 1;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = 0;
  ll c = b / x;
  if (a % x) {
    cout << c - (a / x);
  } else {
    cout << c - (a / x) + 1;
  }
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
//  cout << char(i+48) <<
//  endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) <<
//  endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
// cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
// int64_t a;
// 10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (a % x == 0) {
    cout << (b / x + 1) - (a / x + 1) + 1 << endl;
  } else
    cout << (b / x + 1) - (a / x + 1) << endl;
}


Fixed submission:
//  cout << char(i+48) <<
//  endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) <<
//  endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
// cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
// int64_t a;
// 10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  if (a % x == 0) {
    cout << (b / x + 1) - (a / x + 1) + 1 << endl;
  } else
    cout << (b / x + 1) - (a / x + 1) << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long rel;
  for (int i = a; i <= b; ++i) {
    if (i % x == 0)
      rel++;
  }
  cout << rel << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  cout << b / x - a / x + !(a % x) << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long X = 1000000000 + 7;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long ans = (b - a + 1) / x;
  if ((b - a + 1) % x != 0) {
    while (true) {
      if (b % x == 0)
        ans++;
      if ((b - a) % x == 0)
        break;
      b--;
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long X = 1000000000 + 7;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long ans = b / x - a / x;
  if (a % x == 0)
    ans++;
  cout << ans << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

long long a, b, x;

int main() {
  cin >> a >> b >> x;
  long long ans = 0;
  for (int i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

long long a, b, x;

int main() {
  cin >> a >> b >> x;
  long long ans = ((b / x) + 1) - ((a - 1) < 0 ? 0 : (a - 1) / x + 1);
  cout << ans << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include "bits/stdc++.h"
#include "math.h"
using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll cnt = 0;
  while (a % x != 0) {
    a++;
  }

  while (b % x != 0) {
    b--;
  }
  cout << (b - a) / x + 1 << endl;
}


Fixed submission:
#include "bits/stdc++.h"
#include "math.h"
using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  if (a > 0) {
    cout << b / x - (a - 1) / x;
  } else
    cout << b / x + 1;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x;
  double ans = 0;
  cin >> a >> b >> x;
  for (int i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c;
  cin >> a >> b >> c;
  long long int res = abs((a / c) - (b / c));
  if (!(a % c))
    res++;
  cout << res << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  int64_t cnt = 0;

  for (int i = a; b >= i; i++) {
    if (i % x == 0) {
      ++cnt;
    }
  }

  cout << cnt << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int64_t a, b, x;
  cin >> a >> b >> x;
  int64_t cnt = 0;

  if (a == 0) {
    cnt = b / x + 1;
  } else {
    cnt = b / x - (a - 1) / x;
  }

  cout << cnt << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  long a, b, x;
  cin >> a >> b >> x;
  long i;
  long count = 0;
  for (i = a; i < b + 1; i++) {
    if (i % x == 0)
      count++;
  }
  cout << count << endl;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  long a, b, x;
  cin >> a >> b >> x;
  long count;
  if (a == 0)
    count = b / x + 1;
  else
    count = b / x - (a - 1) / x;

  cout << count << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long long a, b, x;
inline long long f(long long n) {
  if (-1 == n) {
    return 0;
  } else {
    return n / x + 1;
  }
}
int main() {
  cin >> a >> b;
  cout << f(b) - f(a - 1) << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
long long a, b, x;
inline long long f(long long n) {
  if (-1 == n) {
    return 0;
  } else {
    return n / x + 1;
  }
}
int main() {
  cin >> a >> b >> x;
  cout << f(b) - f(a - 1) << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
long long int a = 0, b = 0, x = 0;
int main(void) {
  std::cin >> a >> b >> x;
  while (a % x != 0)
    a++;
  while (b % x != 0)
    b--;
  std::cout << b / x - a / x + (a % x == 0) << std::endl;
}


Fixed submission:
#include <algorithm>
#include <iostream>
long long int a = 0, b = 0, x = 0;
int main(void) {
  std::cin >> a >> b >> x;
  std::cout << b / x - a / x + (a % x == 0) << std::endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long count = 0;
  for (int i = a; i <= b; i++) {
    if (i % x == 0) {
      count++;
    }
  }
  cout << count << endl;
}


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

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long count = 0;
  count += b / x;
  count -= a / x;
  if (a % x == 0) {
    count++;
  }
  cout << count << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;

  int count = 0;
  while (a <= b) {
    if (a % x == 0)
      count++;
    a++;
  }

  cout << count << endl;
}

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

int main() {
  long long a, b, x;
  cin >> a >> b >> x;

  if (a != 0)
    cout << b / x - (a - 1) / x << endl;
  else
    cout << b / x + 1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define rep(i, x) for (int i = 0; i < (int)(x); ++i)
#define reps(i, x) for (int i = 1; i <= (int)(x); ++i)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)

string n, a, b, c;
long long int i, j, k;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> i >> j >> k;

  for (long long int x = i; x <= j; ++x) {
    if (x % k == 0) {
      cout << j / x << '\n';
      break;
    }
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define rep(i, x) for (int i = 0; i < (int)(x); ++i)
#define reps(i, x) for (int i = 1; i <= (int)(x); ++i)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)

string n, a, b, c;
long long int i, j, k;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> i >> j >> k;

  int cnt = 0;
  if (i == 0) {
    ++cnt;
  }

  if (i <= k) {
    cout << cnt + (j / k) << '\n';
  } else {
    if (i % k == 0) {
      cout << cnt + (j / k - i / k) + 1 << '\n';
    } else {
      cout << cnt + (j / k - i / k) << '\n';
    }
  }

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
  uint64_t a, b, x;
  cin >> a >> b >> x;
  for (; a < b; a++)
    if (a % x == 0)
      break;
  if (a == b) {
    if (a % x == 0)
      cout << 1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  cout << 1 + ((b - a) / x) << endl;
}


Fixed submission:
#include <algorithm>
#include <array>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
  uint64_t a, b, x;
  cin >> a >> b >> x;
  if (a % x != 0)
    a += x - (a % x);
  if (a >= b) {
    if (b % x == 0)
      cout << 1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  cout << 1 + ((b - a) / x) << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  while (a % x != 0)
    a++;
  if (a > b) {
    cout << "0\n";
    return 0;
  }
  cout << 1 + (b - a) / x << "\n";
}

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

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  if (a != 0) {
    for (int i = 1; i <= b / x; i++) {
      if (a <= i * x && i * x <= b) {
        a = i * x;
        break;
      }
    }
  }
  if (a % x != 0) {
    cout << "0\n";
    return 0;
  }
  cout << 1 + (b - a) / x << "\n";
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define ED return 0;
#define SORT(vec) sort(vec.begin(), vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(), vec.end());
#define ipow(x, y) int(pow(x, y))
const long long mod = 1000000007;

int main() {
  while (true) {
    long long int a, b, x;
    cin >> a >> b >> x;
    long long int sa = b - a;
    long long int amari1 = a % x;
    long long int amari2 = b % x;
    sa -= amari1 + amari2;
    cout << sa / x + 1 << endl;
  }
}


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

#define ED return 0;
#define SORT(vec) sort(vec.begin(), vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(), vec.end());
#define ipow(x, y) int(pow(x, y))
const long long mod = 1000000007;

int main() {
  long long int a, b, x;
  cin >> a >> b >> x;
  long long int sa = b - a;
  long long int amari1 = (x - a % x) % x;
  long long int amari2 = b % x;
  long long int amari = amari1 + amari2;
  sa -= amari;
  cout << sa / x + 1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
using namespace std;
int main() {
  long long int a, b, x;
  scanf("%lld%lld%lld", &a, &b, &x);
  int i;
  long long int s = 0;
  for (i = a; i <= b; i++) {
    if (i % x == 0)
      s++;
  }
  printf("%lld\n", s);
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
using namespace std;
int main() {
  long long int a, b, x;
  scanf("%lld%lld%lld", &a, &b, &x);
  long long int s = (b / x - a / x);
  if (a % x == 0)
    s++;
  printf("%lld\n", s);
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include "bits/stdc++.h"
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;

  long long cnt = 0;
  for (long long i = a; i <= b; i++) {
    if (i % x == 0)
      cnt++;
  }
  cout << cnt << endl;
}

Fixed submission:
#include "bits/stdc++.h"
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;

  long long cnt = 0;
  long long y, z;
  if (a % x == 0)
    y = a / x - 1;
  else
    y = a / x;
  cnt = b / x - y;
  cout << cnt << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long sum;

  for (long long i = a; i <= b; i++) {
    if (i % x == 0)
      sum++;
  }

  cout << sum << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  long long ans = 0;
  ans += (b / x - a / x);
  if (a % x == 0)
    ans++;
  cout << ans << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (a == 0)
    cout << b / x + 1 << endl;
  else
    cout << b / x - (a - 1) / x << endl;
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  if (a == 0)
    cout << b / x + 1 << endl;
  else
    cout << b / x - (a - 1) / x << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  int ans = 0;
  for (int i = a; i <= b; i++) {
    for (int j = 0; j <= b; j++) {
      if (i == x * j)
        ans++;
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  if (a != 0)
    cout << b / x - ((a - 1) / x) << endl;
  else
    cout << (b / x) + 1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {

  unsigned long long a, b;
  unsigned long long x;

  cin >> a >> b >> x;

  unsigned long long num = 0;
  for (unsigned long long i = a; i <= b;) {
    if ((i % x) == 0) {
      num++;
      i += x;
      continue;
    }
    i++;
  }

  cout << num;

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {

  unsigned long long a, b;
  unsigned long long x;

  cin >> a >> b >> x;

  unsigned long long num = 0;
  /*
  for(unsigned long long i = a; i <= b;){
          if((i%x) == 0){
                  num++;
                  i += x;
                  continue;
          }
          i++;
  }
  */

  unsigned long long ans1, ans2;
  if (a == 0) {
    ans1 = 1;
  } else {
    ans1 = a / x + 1;
  }

  if (b == 0) {
    ans2 = 1;
  } else {
    ans2 = b / x + 1;
  }

  num = ans2 - ans1 + 1;

  if (a % x != 0) {
    num -= 1;
  }

  cout << num;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <math.h>
#include <memory.h>
#include <numeric>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
ll cnt = 0LL;
int ans = 0;
int tmp;
int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  for (ll i = a; i <= b; i++) {
    if (i % x == 0)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <math.h>
#include <memory.h>
#include <numeric>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
ll cnt = 0LL;
int ans = 0;
int tmp;
int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  cnt += b / x;
  if (a >= 1)
    cnt -= (a - 1) / x;
  else
    cnt += 1;

  cout << cnt << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {

  long long a, b;
  cin >> a >> b;
  long long x;
  cin >> x;

  long long d = b - a;
  long long haha1, haha2;
  bool flag = true;

  for (int i = 0; i <= d + 1; i++) {

    if (i == d + 1)
      flag = false;
    if ((a + i) % x == 0) {
      haha1 = a + i;
      break;
    }
  }

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

    // cout<<"this is d from haha2  "<<i<<endl;
    if ((b - i) % x == 0) {
      haha2 = b - i;
      break;
    } else
      haha2 = b;
  }

  // cout<<"haha1  "<<haha1<<"   haha2  "<<haha2<<endl;

  // cout<<"##"<<flag<<endl;

  if (!flag)
    cout << 0 << endl;
  else {
    cout << (haha2 - haha1) / x + 1 << endl;
  }

  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

signed main() {
  long long int a, b, x;
  cin >> a >> b >> x;
  long long int ans = 0;
  if (a % x == 0) {
    cout << b / x - a / x + 1 << endl;
    return 0;
  } else {
    cout << b / x - a / x << endl;
  }

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long a, b, x;

  cin >> a >> b >> x;
  long long temp = a;
  while (1) {
    if (temp % x == 0)
      break;
    temp++;
  }
  long long re = (b - temp) / x;
  temp = temp + re * x;
  while (temp <= b) {
    temp = temp + x;
    re++;
  }

  cout << re << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long a, b, x;

  cin >> a >> b >> x;
  long long temp;
  if (a % x == 0)
    temp = a;
  else
    temp = x * (a / x) + x;

  long long re = (b - temp) / x;
  temp = temp + re * x;
  while (temp <= b) {
    temp = temp + x;
    re++;
  }

  cout << re << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <stdlib.h>
#include <vector>
using namespace std;
using ll = long long;

int main(void) {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = 0;
  if (a == 0) {
    return b / x + 1;
  }
  ans = b / x - (a - 1) / x;
  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <stdlib.h>
#include <vector>
using namespace std;
using ll = long long;

int main(void) {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = 0;
  if (a == 0) {
    cout << b / x + 1;
    return 0;
  }
  ans = b / x - (a - 1) / x;
  cout << ans;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  if (a % n == 0)
    a /= n;
  else
    a = a / n + 1;
  b = b / n;
  cout << b - a + 1 << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  if (a % n == 0)
    a /= n;
  else
    a = a / n + 1;
  b = b / n;
  cout << b - a + 1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  long long a, b, x, ans = 0;
  cin >> a >> b >> x;

  for (long long i = a; i <= b; i++) {
    if (i % x == 0) {
      ans++;
      ans += (b - i) / x;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  long long a, b, x, ans = 0;
  cin >> a >> b >> x;

  long long vv = (a / x);
  if (a % x == 0)
    vv -= 1;
  long long v2 = (b / x);

  cout << v2 - vv << endl;
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

int main(void) {
  long long a, b, x;
  cin >> a >> b >> x;
  while (a % x != 0) {
    // cout<<"a = "<<a<<", x = "<<x<<endl;
    a++;
  }
  while (b % x != 0) {
    b--;
  }
  if (a > b) {
    cout << 0 << endl;
    return 0;
  }
  long long c = b - a;
  cout << c / x + 1 << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main(void) {
  long long a, b, x;
  cin >> a >> b >> x;
  long long c = b / x;
  long long d = a / x;
  if (a % x == 0)
    c++;
  cout << c - d << endl;

  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long int a, b, c;
  cin >> a >> b >> c;
  long long int count = 0;
  for (long long int i = a; i <= b; i++) {
    if (i % c == 0)
      count++;
  }
  cout << count << endl;
}

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

int main() {
  long long int a, b, c;
  cin >> a >> b >> c;
  // instead of single for use sub method
  long long c1 = 0, c2 = 0;
  c1 = a / c;
  c2 = b / c;
  if (a % c == 0)
    cout << c2 - c1 + 1 << endl;
  else
    cout << c2 - c1 << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  ll sum = 0;
  ll a, b, x;
  cin >> a >> b >> x;
  for (ll i = a; i <= b; i++) {
    if (i % x == 0)
      sum++;
  }
  cout << sum << endl;
}

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

int main() {
  ll sum = 0;
  ll a, b, x;
  cin >> a >> b >> x;
  if (a == 0)
    cout << b / x + 1 << endl;
  else
    cout << b / x - (a - 1) / x << endl;
}
Problem p03861 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x, s = 0;
  cin >> a >> b >> x;
  for (int i = a; i <= b; i++) {
    if (i % x == 0)
      s++;
  }
  cout << s << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x;
  scanf("%lld%lld%lld", &a, &b, &x);
  printf("%lld\n", a % x == 0 ? b / x - a / x + 1 : b / x - a / x);
  return 0;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using namespace std;

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = 0;
  for (ll i = a; i <= b; i++) {
    if (i % x == 0)
      ans++;
  }
  cout << ans << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using namespace std;

int main() {
  ll a, b, x;
  cin >> a >> b >> x;

  ll bn = b / x;
  ll an = a / x;
  if (a % x == 0)
    cout << bn - an + 1 << endl;
  else
    cout << bn - an << endl;
}
Problem p03861 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll cnt = 0;
  for (int i = a; i <= b; ++i) {
    if (i % x == 0)
      cnt++;
  }
  cout << cnt << endl;
}


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

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll cnt = 0;
  if (a == 0)
    cout << b / x + 1;
  else
    cout << b / x - (a - 1) / x;
}