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

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

#include <map>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e18, flag;

int main() {
  ll l, r;
  cin >> l >> r;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll flag = (i * j) % 2019;
      mn = min(mn, flag);
    }
  }
  cout << mn << endl;
}


Fixed submission:
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <math.h>
#include <string>

#include <map>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e18, flag;

int main() {
  ll l, r;
  cin >> l >> r;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll flag = (i * j) % 2019;
      mn = min(mn, flag);
      if (mn == 0) {
        cout << mn << endl;
        return 0;
      }
    }
  }
  cout << mn << endl;
}
Problem p02983 (C++)

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;

#define all(x) (x).begin(), (x).end()
#define Sort(x) sort(all(x))
#define sep ' '

#define endl '\n'
#define tab '\t'
#define X first
#define Y second
#define fast_io                                                                \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define file_io                                                                \
  freopen("in.txt", "r", stdin);                                               \
  freopen("out.txt", "w", stdout);
#define set_random                                                             \
  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18;
ll l, r, ans = INF;
int main() {
  fast_io;
  cin >> l >> r;
  if (l <= 2019 && r >= 2019)
    return cout << 0 << endl, 0;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, i * j % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;

#define all(x) (x).begin(), (x).end()
#define Sort(x) sort(all(x))
#define sep ' '

#define endl '\n'
#define tab '\t'
#define X first
#define Y second
#define fast_io                                                                \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define file_io                                                                \
  freopen("in.txt", "r", stdin);                                               \
  freopen("out.txt", "w", stdout);
#define set_random                                                             \
  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18;
ll l, r, ans = INF;
int main() {
  fast_io;
  cin >> l >> r;
  if ((l <= 2019 && r >= 2019) || (r - l + 1 >= 2019))
    return cout << 0 << endl, 0;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, i * j % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

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

int main() {

  long long int l, r;
  cin >> l >> r;
  long long int ans = 2019;

  for (long long int i = l; i < r; ++i) {
    for (long long int j = i + 1; j <= r; ++j) {
      ans = min((i * j) % 2019, ans);
      if (ans == 0)
        break;
    }
  }

  cout << ans << endl;
}

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

int main() {

  long long int l, r;
  cin >> l >> r;
  long long int ans = 2019;

  for (long long int i = l; i < r; ++i) {
    for (long long int j = i + 1; j <= r && j < l + 2019; ++j) {
      ans = min((i * j) % 2019, ans);
      if (ans == 0)
        break;
    }
  }

  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <math.h>

int main() {

  long long int L, R, sum, i, j, tmp, tmp_i, tmp_j, min;

  scanf("%lld %lld", &L, &R);

  min = (L % 2019) * (R % 2019) % 2019;

  for (i = L; i < R; i++) {
    for (j = i + 1; j <= R; j++) {
      tmp_i = i % 2019;
      tmp_j = j % 2019;
      tmp = tmp_i * tmp_j % 2019;
      if (min > tmp)
        min = tmp;
    }
  }

  printf("%lld\n", min);

  return 0;
}


Fixed submission:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <math.h>

int main() {

  long long int L, R, sum, i, j, tmp, tmp_i, tmp_j, min;

  scanf("%lld %lld", &L, &R);

  min = (L % 2019) * (R % 2019) % 2019;

  for (i = L; i < R; i++) {
    for (j = i + 1; j <= R; j++) {
      tmp_i = i % 2019;
      tmp_j = j % 2019;
      tmp = tmp_i * tmp_j % 2019;
      if (min > tmp)
        min = tmp;
      if (min == 0) {
        printf("0\n");
        return 0;
      }
    }
  }

  printf("%lld\n", min);

  return 0;
}
Problem p02983 (C++)

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

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

using namespace std;
typedef long long ll;

int main() {
  ll l, r;
  cin >> l >> r;
  int ans = 2018;
  r = min(r, l + 4038); // rのサイズが小さくなるため通常ループで計算可能になる
  for (ll i = l; i < r + 1; i++) {
    for (ll j = i + 1; i < r + 1; j++) {
      int x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
}


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

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

using namespace std;
typedef long long ll;

int main() {
  ll l, r;
  cin >> l >> r;
  int ans = 2018;
  r = min(r, l + 4038); // rのサイズが小さくなるため通常ループで計算可能になる
  for (ll i = l; i < r + 1; i++) {
    for (ll j = i + 1; j < r + 1; j++) {
      int x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto &i : a)
#define all(x) (x).begin(), (x).end()
// #pragma GCC optimize ("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
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;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main() {
  ll L, R;
  cin >> L >> R;
  if (L - R + 1 >= 2019) {
    cout << 0 << endl;
    return;
  }

  ll ans = 100000000;
  for (ll i = L; i <= R; ++i) {
    for (ll j = i + 1; j <= R; ++j) {
      chmin(ans, (i * j) % 2019);
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto &i : a)
#define all(x) (x).begin(), (x).end()
// #pragma GCC optimize ("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
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;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main() {
  ll L, R;
  cin >> L >> R;
  if (R - L + 1 >= 2019) {
    cout << 0 << endl;
    return;
  }

  ll ans = 100000000;
  for (ll i = L; i <= R; ++i) {
    for (ll j = i + 1; j <= R; ++j) {
      chmin(ans, (i * j) % 2019);
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {

  long long l, r;
  cin >> l >> r;
  long long ans = 9223372036854775807;
  long long mod = 2019;
  for (int i = l; i < r + 1; i++) {
    for (int j = l; j < i; j++) {
      ans = min(((i % mod) * (j % mod)) % mod, ans);
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {

  long long l, r;
  cin >> l >> r;
  long long ans = 9223372036854775807;
  long long mod = 2019;
  for (int i = l; i < r + 1; i++) {
    for (int j = l; j < i; j++) {
      ans = min(((i % mod) * (j % mod)) % mod, ans);
      if (ans == 0) {
        break;
      }
    }
    if (ans == 0) {
      break;
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n, x) for (int i = n; i < x; i++)
#define rem(i, n, x) for (int i = n; i > x; i--)
#define SORT(x) sort(x.begin(), x.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
  LL l, r;
  cin >> l >> r;

  if (r - l >= 2019) {
    cout << 0 << endl;
    return 0;
  }

  vector<LL> ans;
  LL mod = 2019;
  rep(i, l, r + 1) { ans.pb(i); }
  rep(i, 0, r - l) {
    rep(j, i + 1, r) {
      LL a = (ans[i] % 2019) * (ans[j] % 2019) % 2019;
      mod = min(mod, a);
    }
  }

  cout << mod << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n, x) for (int i = n; i < x; i++)
#define rem(i, n, x) for (int i = n; i > x; i--)
#define SORT(x) sort(x.begin(), x.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
  LL l, r;
  cin >> l >> r;

  if (r - l >= 2019) {
    cout << 0 << endl;
    return 0;
  }

  vector<LL> ans;
  LL mod = 2019;
  rep(i, l, r + 1) { ans.pb(i); }
  int siz = ans.size();
  rep(i, 0, siz - 1) {
    rep(j, i + 1, siz) {
      LL a = (ans[i] % 2019) * (ans[j] % 2019) % 2019;
      mod = min(mod, a);
    }
  }

  cout << mod << endl;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;

typedef long long int ll;
typedef long double ld;

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

  ll l, r;

  cin >> l >> r;

  ll ans = 2019;

  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, (i * j) % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef long double ld;

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

  ll l, r;

  cin >> l >> r;

  ll ans = 2019;

  if (r - l >= 2019) {
    ans = 0;
  } else {
    for (ll i = l; i <= r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        ans = min(ans, (i * j) % 2019);
      }
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using V = vector<int>;
using P = pair<int, int>;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = INF;
  int m = 2019;
  if (r - l + 1 >= m)
    ans = 0;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {

      ans = min(ans, ((i % m) * (j % m) % m));
    }
  }

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


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

using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using V = vector<int>;
using P = pair<int, int>;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = INF;
  int m = 2019;
  if (r - l + 1 >= m)
    ans = 0;
  else {
    for (ll i = l; i < r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        ans = min(ans, ((i % m) * (j % m) % m));
      }
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll L, R;
  cin >> L >> R;
  ll a = L % 2019;
  ll b = R - L + 1;
  bool c = false, d = false;
  int ans = a * (a + 1);
  FOR(i, a, a + b) {
    FOR(j, i + 1, a + b) { ans = min(ans, (i * j) % 2019); }
  }

  cout << ans;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll L, R;
  cin >> L >> R;
  ll a = L % 2019;
  ll b = R - L + 1;
  bool c = false, d = false;
  int ans = a * (a + 1);
  if (a + b > 2019) {
    cout << 0;
    return 0;
  }
  FOR(i, a, a + b) {
    FOR(j, i + 1, a + b) { ans = min(ans, (i * j) % 2019); }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

ll l, r, cnt1;
ll cnt2;
ll tmp = 2018;
bool judge;

int main() {

  cin >> l >> r;
  REP(i, l, r + 1) {
    REP(j, i + 1, r + 1) {

      if (tmp > (ll)(i) * (ll)(j) % 2019) {
        tmp = (ll)(i) * (ll)(j) % 2019;
      }
    }
    if (tmp == 0)
      break;
  }

  cout << tmp << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

ll l, r, cnt1;
ll cnt2;
ll tmp = 2018;
bool judge;

int main() {

  cin >> l >> r;
  REP(i, l, r + 1) {
    REP(j, i + 1, r + 1) {

      if (tmp > (ll)(i) * (ll)(j) % 2019) {
        tmp = (ll)(i) * (ll)(j) % 2019;
      }
      if (tmp == 0)
        break;
    }
    if (tmp == 0)
      break;
  }

  cout << tmp << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
int main() {
  using namespace std;
  int L, R, now_min;
  now_min = 2019;
  cin >> L >> R;
  for (int i = L; i < R; i++) {
    for (int j = i + 1; j <= R; j++) {
      now_min = min(((i % 2019) * (j % 2019)) % 2019, now_min);
      if (now_min == 0) {
        break;
      }
    }
  }
  cout << now_min << endl;
}


Fixed submission:
#include <iostream>
int main() {
  using namespace std;
  int L, R, now_min;
  now_min = 2019;
  cin >> L >> R;
  if (R - L + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = L; i < R; i++) {
    for (int j = i + 1; j <= R; j++) {
      now_min = min(((i % 2019) * (j % 2019)) % 2019, now_min);
      if (now_min == 0) {
        break;
      }
    }
  }
  cout << now_min << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <iomanip>
#include <iostream>
using namespace std;
long long l, r;
int main() {
  ios::sync_with_stdio(false);
  cin >> l >> r;
  int min1 = (1 << 30);
  for (long long i = l; i <= r; i++)
    for (long long j = i + 1; j <= r; j++) {
      if (min1 > i % 2019 * (j % 2019) % 2019)
        min1 = i % 2019 * (j % 2019) % 2019;
    }
  cout << min1 << endl;
  return 0;
}

Fixed submission:
#include <cstdio>
#include <iomanip>
#include <iostream>
using namespace std;
long long l, r;
int main() {
  ios::sync_with_stdio(false);
  cin >> l >> r;
  int min1 = (1 << 30);
  int l1 = l % 2019, r1 = r % 2019;
  if (l / 2019 != r / 2019) {
    cout << "0";
    return 0;
  } else {
    for (long long i = l; i <= r; i++)
      for (long long j = i + 1; j <= r; j++) {
        if (min1 > i * j % 2019)
          min1 = i * j % 2019;
      }
    cout << min1 << endl;
  }
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>

int main() {
  long L, R;
  std::cin >> L >> R;

  if (R / 2019 != L / 2019 || L % 2019 == 0) {
    std::cout << "0\n";
  }

  long result = 2018;
  for (long i = L; i < R; ++i) {
    for (long j = i + 1; j <= R; ++j) {
      result = std::min(result, (i * j) % 2019);
    }
  }

  std::cout << result << "\n";
}


Fixed submission:
#include <algorithm>
#include <array>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>

int main() {
  long L, R;
  std::cin >> L >> R;

  if (R / 2019 != L / 2019 || L % 2019 == 0) {
    std::cout << "0\n";
    return 0;
  }

  long result = 2018;
  for (long i = L; i < R; ++i) {
    for (long j = i + 1; j <= R; ++j) {
      result = std::min(result, (i * j) % 2019);
    }
  }

  std::cout << result << "\n";
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 100100100;
  ll cnt = 0;
  bool flag = false;
  if (r - l < 1000000) {
    for (ll i = l; i < r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        ll pre = ans;
        ans = min((i * j) % 2019, ans);
        if (pre == ans) {
          cnt++;
          if (cnt > 100000)
            flag = true;
        } else {
          cnt = 0;
        }
      }
    }
  } else {
    for (ll i = r; i > l; i--) {
      ll pre = ans;
      ans = min(i * (i - 1) % 2019, ans);
      if (ans == pre) {
        cnt++;
        if (cnt == 10000)
          break;
      }
    }
  }

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

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

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 100100100;
  ll cnt = 0;
  bool flag = false;
  if (r - l < 100000) {
    for (ll i = l; i < r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        ll pre = ans;
        ans = min((i * j) % 2019, ans);
        if (pre == ans) {
          cnt++;
          if (cnt > 100000)
            flag = true;
        } else {
          cnt = 0;
        }
      }
    }
  } else {
    for (ll i = r; i > l; i--) {
      ll pre = ans;
      ans = min(i * (i - 1) % 2019, ans);
      if (ans == pre) {
        cnt++;
        if (cnt == 10000)
          break;
      }
    }
  }

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

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

int main() {
  long long a, b, t, res = 2020;

  cin >> a >> b;
  b = min(b, b + 2019);
  for (long i = a; i <= b; i++) {
    for (long j = i + 1; j <= b; j++) {
      t = (i * j) % 2019;
      res = min(t, res);
    }
  }
  cout << res;

  return 0;
}


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

int main() {
  long long a, b, t, res = 2020;

  cin >> a >> b;
  b = min(b, a + 2019);
  for (long i = a; i <= b; i++) {
    for (long j = i + 1; j <= b; j++) {
      t = (i * j) % 2019;
      res = min(t, res);
    }
  }
  cout << res;

  return 0;
}
Problem p02983 (C++)

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

int main() {
  long long L, R;
  std::cin >> L >> R;

  const long long mod = 2019;

  auto ret = std::numeric_limits<long long>::max();
  for (long long i = L; i < R; ++i) {
    const auto i_mod = i % mod;

    const auto j_max = std::min(R, i + mod);
    for (long long j = i + 1; j <= j_max; ++j) {
      const auto j_mod = j % mod;

      const auto i_j_mod = (i_mod * j_mod) % mod;
      ret = std::min(ret, i_j_mod);
    }
  }

  std::cout << ret << std::endl;
}


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

int main() {
  long long L, R;
  std::cin >> L >> R;

  const long long mod = 2019;

  auto ret = std::numeric_limits<long long>::max();
  const auto i_max = std::min(R, L + mod - 1);
  for (long long i = L; i < i_max; ++i) {
    const auto i_mod = i % mod;

    const auto j_max = std::min(R, i + mod);
    for (long long j = i + 1; j <= j_max; ++j) {
      const auto j_mod = j % mod;

      const auto i_j_mod = (i_mod * j_mod) % mod;
      ret = std::min(ret, i_j_mod);
    }
  }

  std::cout << ret << std::endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  if (l - r + 1 >= 2020)
    printf("0");
  else {
    int ans = 2019;
    for (int i = l; i <= r; i++)
      for (int j = i + 1; j <= r; j++)
        if (((i % 2019) * (j % 2019)) % 2019 < ans)
          ans = ((i % 2019) * (j % 2019)) % 2019;
    printf("%d", ans);
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  if (r - l + 1 >= 2020)
    printf("0");
  else {
    int ans = 2019;
    for (int i = l; i <= r; i++)
      for (int j = i + 1; j <= r; j++)
        if (((i % 2019) * (j % 2019)) % 2019 < ans)
          ans = ((i % 2019) * (j % 2019)) % 2019;
    printf("%d", ans);
  }
  return 0;
}
Problem p02983 (C++)

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 2020;
  for (ll i = l; i <= r - 1; ++i) {
    for (ll j = l + 1; j <= r; ++j) {
      ans = min(ans, i * j % 2019);
    }
  }

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


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 2020;
  if (r - l >= 2019) {
    r = l + 2019;
  }
  for (ll i = l; i <= r - 1; ++i) {
    for (ll j = l + 1; j <= r; ++j) {
      ans = min(ans, i * j % 2019);
    }
  }

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

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

int main() {
  ll l, r;
  cin >> l >> r;

  set<int> mods;
  for (ll i = l; i <= r; i++) {
    mods.insert(i % 2019);
  }

  vector<int> m;
  for (auto itr = mods.begin(); itr != mods.end(); itr++) {
    m.push_back(*itr);
  }

  int ans = 2020;
  for (int i = 0; i < m.size(); i++) {
    for (int j = i + 1; j < m.size(); j++) {
      ans = min(ans, (m[i] * m[j]) % 2019);
    }
  }

  cout << ans << endl;
}


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

int main() {
  ll l, r;
  cin >> l >> r;

  set<int> mods;
  for (ll i = l; i <= r; i++) {
    int mod = i % 2019;
    mods.insert(mod);
    if (mods.size() >= 2019)
      break;
  }

  vector<int> m;
  for (auto itr = mods.begin(); itr != mods.end(); itr++) {
    m.push_back(*itr);
  }

  int ans = 2020;
  for (int i = 0; i < m.size(); i++) {
    for (int j = i + 1; j < m.size(); j++) {
      ans = min(ans, (m[i] * m[j]) % 2019);
    }
  }

  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
// #define int long long int
using namespace std;

int main() {
  ll L, R;
  ll ans = 10000;
  cin >> L >> R;
  for (ll i = L; i <= R; i++) {
    ll a = i * i % 2019;
    if (i + 2019 > R)
      break;
    ans = min(a, ans);
  }
  L = L % 2019;
  R = R % 2019;

  ll r = max(L, R);
  ll l = min(L, R);

  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      ll seki = i * j;
      // cout<<i<<" "<<j<<endl;
      seki = seki % 2019;
      ans = min(seki, ans);
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
// #define int long long int
using namespace std;

int main() {
  ll L, R;
  ll ans = 10000;
  cin >> L >> R;
  for (ll i = L; i <= min(R, L + 3000); i++) {
    ll a = i * i % 2019;
    if (i + 2019 > R)
      break;
    ans = min(a, ans);
  }
  L = L % 2019;
  R = R % 2019;

  ll r = max(L, R);
  ll l = min(L, R);

  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      ll seki = i * j;
      // cout<<i<<" "<<j<<endl;
      seki = seki % 2019;
      ans = min(seki, ans);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

#define ll long long

int main() {
  ll L, R;
  cin >> L >> R;
  ll ans = 2019;
  for (int i = L; i < R && i - L <= 2019; i++) {
    for (int j = i + 1; j <= R && j - R <= 2019; j++) {
      ans = min(ans, (ll)i * j % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define ll long long

int main() {
  ll L, R;
  cin >> L >> R;
  ll ans = 2019;
  for (int i = L; i < R && i - L <= 2019; i++) {
    for (int j = i + 1; j <= R && j - L <= 2019; j++) {
      ans = min(ans, (ll)i * j % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;
typedef long long int ll;
#define MOD 2019

int main() {

  ll L, R;
  cin >> L >> R;

  ll ans = 2999999999;
  for (int i = L; i < R; i++) {
    for (int j = L + 1; j <= R; j++) {
      ll tmp = ((i % MOD) * (j % MOD)) % MOD;
      ans = min(ans, tmp);
      if (ans == 0)
        break;
    }
  }

  cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
#define MOD 2019

int main() {

  ll L, R;
  cin >> L >> R;

  ll ans = 2999999999;
  for (int i = L; i < R; i++) {
    for (int j = L + 1; j <= R; j++) {
      ll tmp = ((i % MOD) * (j % MOD)) % MOD;
      ans = min(ans, tmp);
      if (ans == 0)
        break;
    }
    if (ans == 0)
      break;
  }

  cout << ans << endl;
}
Problem p02983 (C++)

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

using namespace std;

const int mod = 2019;
int main() {
  int l, r;
  cin >> l >> r;

  long long ans = mod;
  if (l - r >= mod) {
    ans = 0;
  } else {
    for (long long i = l; i <= r; i++) {
      for (long long j = i + 1; j <= r; j++) {
        ans = min(ans, i * j % mod);
      }
    }
  }

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


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

using namespace std;

const int mod = 2019;
int main() {
  int l, r;
  cin >> l >> r;

  long long ans = mod;
  if (r - l >= mod) {
    ans = 0;
  } else {
    for (long long i = l; i <= r; i++) {
      for (long long j = i + 1; j <= r; j++) {
        ans = min(ans, i * j % mod);
      }
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
/**
        ������������ Author : Avi J Patel ������������
        ������������ University : DA-IICT ������������
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001

#define For(i, m, n) for (long long i = m; i < n; i++)
#define st(x) sort(x.begin(), x.end())
#define re(x, i) reverse(x.begin() + i, x.end())
#define FAST                                                                   \
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);                   \
  srand(time(NULL));

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
/*void calc()
{
        for(int i=0;i<2005;i++)
        {
                a[i][0]=1;
                a[i][i]=1;
                for(int j=1;j<i;j++)
                {
                        a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;
                }
        }
}*/
int main() {
  ll l, r;
  cin >> l >> r;
  if ((r - l + 1) >= 2019) {
    cout << 0;
  }
  ll min1 = INT_MAX;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      min1 = min(min1, ((i % 2019) * (j % 2019)) % 2019);
    }
  }
  cout << min1;
  return 0;
}


Fixed submission:
/**
        ������������ Author : Avi J Patel ������������
        ������������ University : DA-IICT ������������
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001

#define For(i, m, n) for (long long i = m; i < n; i++)
#define st(x) sort(x.begin(), x.end())
#define re(x, i) reverse(x.begin() + i, x.end())
#define FAST                                                                   \
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);                   \
  srand(time(NULL));

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
/*void calc()
{
        for(int i=0;i<2005;i++)
        {
                a[i][0]=1;
                a[i][i]=1;
                for(int j=1;j<i;j++)
                {
                        a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;
                }
        }
}*/
int main() {
  ll l, r;
  cin >> l >> r;
  if ((r - l + 1) >= 2019) {
    cout << 0;
    return 0;
  }
  l %= 2019;
  r %= 2019;
  if (r <= l) {
    cout << 0;
    return 0;
  }
  ll min1 = INT_MAX;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      min1 = min(min1, ((i % 2019) * (j % 2019)) % 2019);
    }
  }
  cout << min1;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
// A Naive recursive C++ program to find minimum of coins
// to make a given change V
#include <bits/stdc++.h>
using namespace std;
int main() {
  long int l, r;
  cin >> l >> r;
  int a[2019] = {0};
  for (long int i = l; i <= r; i++)
    a[i % 2019]++;

  int min1 = INT_MAX;
  // cout<<a[4]<<" "<<a[5]<<endl;
  if (a[0] != 0)
    cout << 0;
  else {
    for (int i = 1; i < 2019; i++) {
      for (int j = i + 1; j < 2019; j++) {
        if (a[i] != 0 && a[j] != 0)
          if (min1 > ((i * j) % 2019))
            min1 = ((i * j) % 2019);
      }
    }

    cout << min1 << endl;
  }
}

Fixed submission:
// A Naive recursive C++ program to find minimum of coins
// to make a given change V
#include <bits/stdc++.h>
using namespace std;
int main() {
  long int l, r;
  cin >> l >> r;
  int a[2019] = {0};
  for (long int i = l; i <= min(r, l + 2020); i++)
    a[i % 2019]++;

  int min1 = INT_MAX;
  // cout<<a[4]<<" "<<a[5]<<endl;
  if (a[0] != 0)
    cout << 0;
  else {
    for (int i = 1; i < 2019; i++) {
      for (int j = i + 1; j < 2019; j++) {
        if (a[i] != 0 && a[j] != 0)
          if (min1 > ((i * j) % 2019))
            min1 = ((i * j) % 2019);
      }
    }

    cout << min1 << endl;
  }
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char *argv[]) {
  ll L, R;
  cin >> L >> R;
  if (L - R >= 2018) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = numeric_limits<ll>::max();
  for (ll x = L; x <= R; x++) {
    for (ll y = x + 1; y <= R; y++) {
      ans = min(ans, (x * y) % 2019);
    }
  }
  cout << ans << endl;
}


Fixed submission:
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char *argv[]) {
  ll L, R;
  cin >> L >> R;
  if (R - L >= 2018) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = numeric_limits<ll>::max();
  for (ll x = L; x <= R; x++) {
    for (ll y = x + 1; y <= R; y++) {
      ans = min(ans, (x * y) % 2019);
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vl = vector<ll>;
using Map = map<ll, ll>;
using T = tuple<ll, ll, ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout << v << endl
#define first(v) get<0>(v)
#define second(v) get<1>(v)
#define third(v) get<2>(v)
template <typename T> bool chmax(T &a, T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> bool chmin(T &a, T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
  ll L;
  cin >> L;
  ll R;
  cin >> R;
  Map M;
  for (ll i = L; i <= R; i++) {
    ll k = i % 2019LL;
    M[k]++;
    ;
  }
  ll ans = INF;
  for (ll i = 0; i < 2018; i++) {
    for (ll j = i + 1; j < 2019; j++) {
      if (M[i] && M[j]) {
        ll k = (i * j) % 2019;
        chmin(ans, k);
      };
    };
  }
  print(ans);

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vl = vector<ll>;
using Map = map<ll, ll>;
using T = tuple<ll, ll, ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout << v << endl
#define first(v) get<0>(v)
#define second(v) get<1>(v)
#define third(v) get<2>(v)
template <typename T> bool chmax(T &a, T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> bool chmin(T &a, T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
  ll L;
  cin >> L;
  ll R;
  cin >> R;
  Map M;
  if (R - L > 2020) {
    print(0);
    return 0;
  }
  for (ll i = L; i <= R; i++) {
    ll k = i % 2019LL;
    M[k]++;
    ;
  }
  ll ans = INF;
  for (ll i = 0; i < 2018; i++) {
    for (ll j = i + 1; j < 2019; j++) {
      if (M[i] && M[j]) {
        ll k = (i * j) % 2019;
        chmin(ans, k);
      };
    };
  }
  print(ans);

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define CHAL_BC_APNE_BAAP_KO_MAT_SIKHA                                         \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define pb push_back
#define fr first
#define se second
signed main() {
  CHAL_BC_APNE_BAAP_KO_MAT_SIKHA;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int l, r;
  cin >> l >> r;
  if (r - l + 1 >= 2019) {
    cout << 0 << endl;
  } else {
    l = l % 2019;
    int mn = INT_MAX;
    r = r % 2019;
    if (r < l) {
      cout << 0 << endl;
      return 0;
    }
    for (int i = l; i <= r; i++) {
      for (int j = i + 1; j <= r; j++)
        mn = min(mn, (i * j) % 2019);
    }
    cout << mn << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define CHAL_BC_APNE_BAAP_KO_MAT_SIKHA                                         \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define pb push_back
#define fr first
#define se second
signed main() {
  CHAL_BC_APNE_BAAP_KO_MAT_SIKHA;
  int l, r;
  cin >> l >> r;
  if (r - l + 1 >= 2019) {
    cout << 0 << endl;
  } else {
    l = l % 2019;
    int mn = INT_MAX;
    r = r % 2019;
    if (r < l) {
      cout << 0 << endl;
      return 0;
    }
    for (int i = l; i <= r; i++) {
      for (int j = i + 1; j <= r; j++)
        mn = min(mn, (i * j) % 2019);
    }
    cout << mn << endl;
  }
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = 1e9;
  if (r < l + 2019) {
    for (long long i = l; i <= r; i++) {
      for (long long j = i + 1; j <= r; j++) {
        if ((i * j) % 2019 < ans)
          ans = (i * j) % 2019;
        // cout<<ans;
      }
    }
  } else {
    for (long long i = l; l <= l + 2019; i++) {
      for (long long j = l + 1; j < l + 2019; j++) {
        if ((i * j) % 2019 < ans)
          ans = (i * j) % 2019;
      }
    }
  }
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = 1e9;
  if (r < l + 2019) {
    for (long long i = l; i <= r; i++) {
      for (long long j = i + 1; j <= r; j++) {
        if ((i * j) % 2019 < ans)
          ans = (i * j) % 2019;
        // cout<<ans;
      }
    }
  } else {
    for (long long i = l; i <= l + 2019; i++) {
      for (long long j = l + 1; j < l + 2019; j++) {
        if ((i * j) % 2019 < ans)
          ans = (i * j) % 2019;
      }
    }
  }
  cout << ans;
}
Problem p02983 (C++)

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

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

using namespace std;

inline int max(int a, int b) {
  if (b > a)
    swap(a, b);
  return a;
}

inline int min(int a, int b) {
  if (a > b)
    swap(a, b);
  return a;
}

int main() {
  int l, r;
  int ans = 2019;
  cin >> l >> r;
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j <= r; j++) {
      ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

using namespace std;

inline int max(int a, int b) {
  if (b > a)
    swap(a, b);
  return a;
}

inline int min(int a, int b) {
  if (a > b)
    swap(a, b);
  return a;
}

int main() {
  int l, r;
  int ans = 2019;
  cin >> l >> r;
  int num = min(r - l, 2019);
  for (int i = l; i < l + num; i++) {
    for (int j = i + 1; j <= l + num; j++) {
      ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, j, n) for (ll i = j; i < n; i++)
#define all(vec) vec.begin(), vec.end()
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
  ll l, r;
  cin >> l >> r;
  l %= 2019, r %= 2019;
  vector<ll> v;
  Rep(i, l, r + 1) v.push_back(i);
  sort(all(v));
  cout << v[0] * v[1] % 2019 << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, j, n) for (ll i = j; i < n; i++)
#define all(vec) vec.begin(), vec.end()
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
  ll l, r;
  cin >> l >> r;
  if (l / 2019 != r / 2019) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = INF;
  Rep(i, l, r) Rep(j, i + 1, r + 1) chmin(ans, i * j % 2019);
  cout << ans << endl;
}
Problem p02983 (C++)

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

int main() {
  long long L, R;
  // vector<int> vp;
  // int vp[12][12];

  cin >> L >> R;
  // for (int j=0; j<N; j++){
  //     for (int i=0; i<D; i++){
  //         cin >> vp[j][i];
  //     }
  // }

  long long res = 2020;
  long long mod2019;

  for (long long i = L; i <= R - 1; i++) {
    for (long long j = i + 1; j <= R; j++) {
      // mod2019 = (i * j) % 2019;   // TLE
      mod2019 = ((i % 2019) * (j % 2019)) % 2019;

      if (mod2019 < res)
        res = mod2019;

      if (res == 0)
        break;
    }
  }

  cout << res << endl;
  return 0;
}


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

int main() {
  long long L, R;
  // vector<int> vp;
  // int vp[12][12];

  cin >> L >> R;
  // for (int j=0; j<N; j++){
  //     for (int i=0; i<D; i++){
  //         cin >> vp[j][i];
  //     }
  // }

  long long res = 2020;
  long long mod2019;

  for (long long i = L; i <= R - 1; i++) {
    for (long long j = i + 1; j <= R; j++) {
      // mod2019 = (i * j) % 2019;   // TLE
      mod2019 = ((i % 2019) * (j % 2019)) % 2019;

      if (mod2019 < res)
        res = mod2019;

      if (res == 0)
        break;
    }
    if (res == 0)
      break;
  }

  cout << res << endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); i++)
#define rep_s(i, o) for (int i = 1; i < (o); i++)
#define REP(i, a, b) for (int i = (int)(a); (i) < (int)(b); i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

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

int main() {
  ull l, r;
  cin >> l >> r;

  ull mini = 1e9 + 2;
  for (ull i = l; i < r; i++) {
    for (ull j = i + 1; j <= r; j++) {
      /* code */
      mini = min(mini, (i * j) % 2019);
    }
  }
  // n = (m + n)/2;
  cout << mini << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); i++)
#define rep_s(i, o) for (int i = 1; i < (o); i++)
#define REP(i, a, b) for (int i = (int)(a); (i) < (int)(b); i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

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

int main() {
  ull l, r;
  cin >> l >> r;

  if (r - l >= 2019) {
    cout << 0 << endl;
    return 0;
  }

  ull mini = 1e9 + 2;
  for (ull i = l; i < r; i++) {
    for (ull j = i + 1; j <= r; j++) {
      /* code */
      mini = min(mini, (i * j) % 2019);
    }
  }
  // n = (m + n)/2;
  cout << mini << endl;
  return 0;
}