Problem p02606 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
#define ll long long
#define iiMPQ priority_queue<ii, vector<ii>, greater<ii>>
#define MPQ priority_queue<int, vector<int>, greater<int>>
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin >> n
#define scan2(a, b) cin >> a >> b
#define scan3(a, b, c) cin >> a >> b >> c
#define print(n) cout << n
#define println(n) cout << n << "\\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, s, e) for (int i = s; i < e; ++i)
#define REPS(i, s, e, st) for (int i = s; i < e; i += st)
#define rep(i, n) for (int i = n - 1; i >= 0; --i)
#define repr(i, s, e) for (int i = s; i >= e; --i)
#define reps(i, s, e, st) for (int i = s; i >= e; i -= st)
#define SET(arr, k) memset(arr, k, sizeof arr)
#define speed                                                                  \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";

void m1() {
  int l, r, d;
  cin >> l >> r >> d;
  int res = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0)
      ++res;
  }
  print(res);
}
/*
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/

signed main() {
  speed;
  // freopen("in.txt","r",stdin);
  m1();
  // m2();
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
#define ll long long
#define iiMPQ priority_queue<ii, vector<ii>, greater<ii>>
#define MPQ priority_queue<int, vector<int>, greater<int>>
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin >> n
#define scan2(a, b) cin >> a >> b
#define scan3(a, b, c) cin >> a >> b >> c
#define print(n) cout << n
#define println(n) cout << n << "\\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, s, e) for (int i = s; i < e; ++i)
#define REPS(i, s, e, st) for (int i = s; i < e; i += st)
#define rep(i, n) for (int i = n - 1; i >= 0; --i)
#define repr(i, s, e) for (int i = s; i >= e; --i)
#define reps(i, s, e, st) for (int i = s; i >= e; i -= st)
#define SET(arr, k) memset(arr, k, sizeof arr)
#define speed                                                                  \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";

void m1() {
  int l, r, d;
  int res = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0)
      ++res;
  }
  print(res);
}
/*
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/

signed main() {
  speed;
  // freopen("in.txt","r",stdin);
  m1();
  // m2();
}