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

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

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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

VI G[100010];
int reached[100010];
int color[100010];

bool ck[2019];

int main() {
  ll l, r;
  cin >> l >> r;
  int x = l;
  int y = r;
  while (l % 2019 != r % 2019) {
    ck[l % 2019] = 1;
    ++l;
  }
  ck[r] = 1;
  if (y - x >= 2018) {
    cout << 0 << endl;
    exit(0);
  }
  ll ans = 1e9 + 7;
  rep(i, 2019) rep(j, 2019) {
    if (!ck[i] || !ck[j])
      continue;
    if (i == j)
      continue;
    chmin(ans, (ll)i * j % 2019);
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;

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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

VI G[100010];
int reached[100010];
int color[100010];

bool ck[2019];

int main() {
  ll l, r;
  cin >> l >> r;
  int x = l;
  int y = r;
  while (l % 2019 != r % 2019) {
    ck[l % 2019] = 1;
    ++l;
  }
  ck[r % 2019] = 1;
  if (y - x >= 2018) {
    cout << 0 << endl;
    exit(0);
  }
  ll ans = 1e9 + 7;
  rep(i, 2019) rep(j, 2019) {
    if (!ck[i] || !ck[j])
      continue;
    if (i == j)
      continue;
    chmin(ans, (ll)i * j % 2019);
  }
  cout << ans << endl;
}
Problem p02983 (C++)

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

int main() {
  long L, R, ans = 0;
  cin >> L >> R;
  if (673 > L - R) {
    ans = LONG_MAX;
    for (long i = L; i < R; ++i) {
      for (long j = 1 + L; j <= R; ++j)
        ans = min(ans, i * j % 2019);
    }
  }
  cout << ans;
}

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

int main() {
  long L, R, ans = 0;
  cin >> L >> R;
  if (673 > R - L) {
    ans = LONG_MAX;
    for (long i = L; i < R; ++i) {
      for (long j = 1 + L; j <= R; ++j)
        ans = min(ans, i * j % 2019);
    }
  }
  cout << ans;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int l, r, i, j, res = 2019 * 2019;
  cin >> l >> r;
  for (i = l; i < min(l + 2019, r); i++) {
    for (j = i + 1; i <= min(l + 2019, r); j++) {
      res = min(res, ((i % 2019) * (j % 2019)) % 2019);
    }
  }
  cout << res << "\n";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int l, r, i, j, res = 2019 * 2019;
  cin >> l >> r;
  for (i = l; i < min(l + 2019, r); i++) {
    for (j = i + 1; j <= min(l + 2019, r); j++) {
      res = min(res, ((i % 2019) * (j % 2019)) % 2019);
    }
  }
  cout << res << "\n";
  return 0;
}
Problem p02983 (C++)

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

  cout << ou << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r, n, ou = 2018, tp = 0;
  cin >> l >> r;
  n = r - l + 1;
  if (n > 3000) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = l; i < r; i++) {
    for (long long j = i + 1; j < r + 1; j++) {
      tp = (i * j) % 2019;
      if (tp < ou)
        ou = tp;
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long minmod = 2019;
  for (long long i = l; i < r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      minmod = min(minmod, (i * j) % 2019);
      if (minmod == 0) {
        break;
      }
    }
  }
  cout << minmod << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long minmod = 2019;
  for (long long i = l; i < r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      minmod = min(minmod, (i * j) % 2019);
      if (minmod == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  cout << minmod << endl;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

int main() {
  long long l, r;
  cin >> l >> r;
  long long i = l, j = l + 1, d = ((i % 2019) * (j % 2019)) % 2019,
            k = ((r % 2019) + (l % 2019)) % 2019;
  if (k > 2019) {
    cout << 0;
    return 0;
  } else {
    for (i; i < r; i++) {
      for (j = i + 1; j <= r; j++) {
        d = min(((i % 2019) * (j % 2019)) % 2019, d);
      }
    }

    cout << d;
  }
  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

int main() {
  long long l, r;
  cin >> l >> r;
  long long i = l, j = l + 1, d = ((i % 2019) * (j % 2019)) % 2019, k = r - l;
  if (k >= 2019) {
    cout << 0;
    return 0;
  } else {
    for (i; i < r; i++) {
      for (j = i + 1; j <= r; j++) {
        d = min(((i % 2019) * (j % 2019)) % 2019, d);
      }
    }

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; // 1e18
const double EPS = 1e-10;

int main(void) {
  int L, R;
  cin >> L >> R;

  if (R - L > 3000) {
    cout << 0 << endl;
  }

  // (i * j) mod 2019
  // (i mod 2019) * (j mod 2019)

  ll num;
  ll mn = LINF;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      num = (i * j) % 2019;
      mn = min(mn, num);
    }
  }
  printf("%d\n", mn);
  return (0);
}

Fixed submission:
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; // 1e18
const double EPS = 1e-10;

int main(void) {
  int L, R;
  cin >> L >> R;

  if (R - L > 3000) {
    cout << 0 << endl;
    return (0);
  }

  // (i * j) mod 2019
  // (i mod 2019) * (j mod 2019)

  ll num;
  ll mn = LINF;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      num = (i * j) % 2019;
      mn = min(mn, num);
    }
  }
  printf("%d\n", mn);
  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;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

const int mod = 2019;

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

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

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 ld = long double;
using P = pair<int, int>;

const int mod = 2019;

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

  ll ans = 2019 * 2019;
  if (r - l >= mod) {
    cout << 0 << endl;
    return 0;
  } else {
    for (ll i = l; i < r; i++) {
      for (ll j = i + 1; j <= r; j++) {
        ll c = (i * j) % mod;
        ans = min(c, ans);
      }
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

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

int main() {
  ll L, R;
  cin >> L >> R;
  if (L - R >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 2018;
  for (ll i = L; i <= R; i++) {
    for (ll j = i + 1; j <= R; j++) {
      int x = (i * j) % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
}

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

int main() {
  ll L, R;
  cin >> L >> R;
  if (R - L >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 2018;
  for (ll i = L; i <= R; i++) {
    for (ll j = i + 1; j <= R; 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>
using namespace std;

#define ll long long

void solve() {
  ll l, r;
  cin >> l >> r;
  ll mod = 2019;
  ll mini = 1LL << 60;
  int cnt = 0;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll x = i % mod;
      ll y = j % mod;
      ll e = x * y % mod;
      mini = min(mini, e);
      cnt++;
      if (cnt > 2019 * 2019)
        break;
    }
  }
  cout << mini << endl;
}

signed main() {
  // while(1)
  solve();
}

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

#define ll long long

void solve() {
  ll l, r;
  cin >> l >> r;
  ll mod = 2019;
  ll mini = 1LL << 60;
  int cnt = 0;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll x = i % mod;
      ll y = j % mod;
      ll e = x * y % mod;
      mini = min(mini, e);
      cnt++;
      if (cnt > 2019 * 2019) {
        cout << mini << endl;
        return;
      }
    }
  }
  cout << mini << endl;
}

signed main() {
  // while(1)
  solve();
}
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 P = pair<int, int>;

int main() {
  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>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  if (r - l >= 2019) {
    l %= 2019;
    r = l + 2019;
  }

  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;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end)                                                     \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end)                                                    \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

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

  lint min = INT_MAX;
  FOR(i, l, r) {
    FOR(j, i + 1, r + 1) {
      lint tmp = ((i % 2019) * (j % 2019)) % 2019;
      if (tmp < min)
        min = tmp;
    }
  }

  cout << min << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end)                                                     \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end)                                                    \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

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

  lint min = INT_MAX;
  if (r - l >= 2019) {
    min = 0;
  } else {
    FOR(i, l, r) {
      FOR(j, i + 1, r + 1) {
        lint tmp = ((i % 2019) * (j % 2019)) % 2019;
        if (tmp < min)
          min = tmp;
      }
    }
  }

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

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

int main() {
  ll L, R;
  cin >> L >> R;
  int a[2019];
  for (ll i = 0; i < 2019; i++) {
    a[i] = 0;
  }
  for (ll i = L; i <= R; i++) {
    ll temp = i % 2019;
    a[temp]++;
  }
  ll min_value = 2020;
  for (ll i = 0; i < 2019; i++) {
    for (ll j = 0; j < 2019; j++) {
      if (i == j) {
        if (a[i] >= 2) {
          min_value = min(min_value, i * j % 2019);
        }
      } else if (a[i] >= 1 && a[j] >= 1) {
        min_value = min(min_value, i * j % 2019);
      }
    }
  }
  cout << min_value << endl;
  return 0;
}

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

int main() {
  ll L, R;
  cin >> L >> R;
  int a[2019];
  for (ll i = 0; i < 2019; i++) {
    a[i] = 0;
  }
  for (ll i = L; i <= R; i++) {
    ll temp = i % 2019;
    if (temp == 0) {
      cout << 0 << endl;
      return 0;
    }
    a[temp]++;
  }
  ll min_value = 2020;
  for (ll i = 0; i < 2019; i++) {
    for (ll j = 0; j < 2019; j++) {
      if (i == j) {
        if (a[i] >= 2) {
          min_value = min(min_value, i * j % 2019);
        }
      } else if (a[i] >= 1 && a[j] >= 1) {
        min_value = min(min_value, i * j % 2019);
      }
    }
  }
  cout << min_value << endl;
  return 0;
}
Problem p02983 (C++)

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

int main() {

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

  ll ans = 2018;

  for (ll i = L; i <= R; i++) {
    for (ll k = i + 1; k <= R; k++) {
      if (i >= k)
        continue;
      if (ans == 0)
        break;
      ans = min(ans, (i * k) % 2019);
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {

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

  ll ans = 2018;

  for (ll i = L; i <= R; i++) {
    for (ll k = i + 1; k <= R; k++) {
      if (i >= k)
        continue;
      if (ans == 0)
        break;
      ans = min(ans, (i * k) % 2019);
    }
    if (ans == 0)
      break;
  }

  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 REPV(iter, v)                                                          \
  for (auto(iter) = (v).begin(); (iter) != (v).end(); ++(iter))
#define ALL(v) (v).begin(), (v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main() {
  ll L, R;
  cin >> L >> R;
  const int p = 2019;
  ll ans;
  if (L - R + 1 >= p) {
    ans = 0;
  } else {
    ans = LONG_MAX;
    for (ll i = L; i <= R - 1; ++i) {
      for (ll j = i + 1; j <= R; ++j) {
        ans = min(ans, ((i % p) * (j % p)) % p);
      }
    }
  }

  cout << ans << endl;
}


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

#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define REPV(iter, v)                                                          \
  for (auto(iter) = (v).begin(); (iter) != (v).end(); ++(iter))
#define ALL(v) (v).begin(), (v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main() {
  ll L, R;
  cin >> L >> R;
  const int p = 2019;
  ll ans;
  if (R - L + 1 >= p) {
    ans = 0;
  } else {
    ans = LONG_MAX;
    for (ll i = L; i <= R - 1; ++i) {
      for (ll j = i + 1; j <= R; ++j) {
        ans = min(ans, ((i % p) * (j % p)) % p);
      }
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iomanip>
#include <iostream>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main() {
  int l, r;
  cin >> l >> r;
  ll ans = 2019;
  if (l - r >= 2019) {
    cout << 0 << endl;
  }
  repi(i, r + 1, l) {
    repi(j, r + 1, i + 1) { ans = min(ans, ((i % 2019) * (j % 2019)) % 2019); }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iomanip>
#include <iostream>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
// cout << setprecision(20) <<

int main() {
  ll L, R;
  cin >> L >> R;
  ll mod_min = 2019;
  for (ll i = L; i < R; i++) {
    for (ll j = i + 1; j <= R; j++) {
      mod_min = min(mod_min, i * j % 2019);
    }
    if (mod_min == 0)
      break;
  }
  cout << mod_min << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
// cout << setprecision(20) <<

int main() {
  ll L, R;
  cin >> L >> R;
  ll mod_min = 2019;
  for (ll i = L; i < R; i++) {
    for (ll j = i + 1; j <= R; j++) {
      mod_min = min(mod_min, i * j % 2019);
      if (mod_min == 0)
        break;
    }
    if (mod_min == 0)
      break;
  }
  cout << mod_min << endl;
}
Problem p02983 (C++)

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

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

using namespace std;

int main() {
  long long L, R;
  cin >> L >> R;
  bool a[2020] = {false};
  bool isZero = false;
  for (long long i = L; i <= R; i++) {
    a[i % 2019] = true;
  }
  if (a[0] || (a[3] && a[673]))
    cout << 0 << endl;
  else {
    int minV = 2020;
    repi(i, 1, 2019) {
      if (a[i % 2019]) {
        repi(j, i + 1, 2019) {
          if (a[j % 2019]) {
            int value = (i % 2019) * (j % 2019) % 2019;
            if (value < minV)
              minV = value;
            if (minV == 0)
              break;
          }
        }
        if (minV == 0)
          break;
      }
    }
    cout << minV << endl;
  }
}


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

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

using namespace std;

int main() {
  long long L, R;
  cin >> L >> R;
  bool a[2020] = {false};
  bool isZero = false;
  for (long long i = L; i <= min(R, L + 2019); i++) {
    a[i % 2019] = true;
  }
  if (a[0] || (a[3] && a[673]))
    cout << 0 << endl;
  else {
    int minV = 2020;
    repi(i, 1, 2019) {
      if (a[i % 2019]) {
        repi(j, i + 1, 2019) {
          if (a[j % 2019]) {
            int value = (i % 2019) * (j % 2019) % 2019;
            if (value < minV)
              minV = value;
            if (minV == 0)
              break;
          }
        }
        if (minV == 0)
          break;
      }
    }
    cout << minV << endl;
  }
}
Problem p02983 (C++)

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

int main() {
  ll l, r, a = 2019;
  cin >> l >> r;
  ll ans = inf;
  for (int i = l; i < r; i++) {
    for (int j = l + 1; j <= r; j++) {
      ans = min(ans, (i % a) * (j % a) % a);
    }
    if (ans == 0) {
      break;
    }
  }
  cout << ans;
  return 0;
}

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

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pa pair<int, int>
#define F first
#define S second
#define maxth 9999
#define d n % 3
typedef long long ll;

int main() {
  ll n, m;
  cin >> n >> m;
  ll MIN = 0x8000000;
  ll a, b;
  if (n - m >= 2019) {
    cout << "0";
    return 0;
  }
  for (ll i = n; i <= m; i++)
    for (ll j = i + 1; j <= m; j++)
      if (i * j % 2019 < MIN) {
        MIN = i * j % 2019;
        a = i;
        b = j;
      }
  cout << a * b % 2019 << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pa pair<int, int>
#define F first
#define S second
#define maxth 9999
#define d n % 3
typedef long long ll;

int main() {
  ll n, m;
  cin >> n >> m;
  ll MIN = 0x8000000;
  ll a, b;
  if (m - n >= 2019) {
    cout << "0";
    return 0;
  }
  for (ll i = n; i <= m; i++)
    for (ll j = i + 1; j <= m; j++)
      if (i * j % 2019 < MIN) {
        MIN = i * j % 2019;
        a = i;
        b = j;
      }
  cout << a * b % 2019 << endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
/*
ID: Nipun Paul
LANG: C++
PROB: God knows
*/

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

int main() {
  long long int a, b, c = 2019;
  cin >> a >> b;
  for (long long int i = a; i <= b; i++) {
    for (long long int j = i + 1; j <= b; j++) {
      c = min(c, (i * j) % 2019);
      if (c == 0) {
        break;
      }
    }
  }
  cout << c << endl;
  return 0;
}


Fixed submission:
/*
ID: Nipun Paul
LANG: C++
PROB: God knows
*/

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

int main() {
  long long int a, b, c = 2019;
  cin >> a >> b;
  for (long long int i = a; i <= b; i++) {
    for (long long int j = i + 1; j <= b; j++) {
      c = min(c, (i * j) % 2019);
      if (c == 0) {
        break;
      }
    }
    if (c == 0) {
      break;
    }
  }
  cout << c << endl;
  return 0;
}
Problem p02983 (C++)

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

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

  if (R - L >= 2019) {
    std::cout << 0 << std::endl;
    return 0;
  }

  long long l = L % 2019;
  long long r = R % 2019;

  long long min = 2019;
  for (long long i = l; i <= r; ++i, i %= 2019) {
    for (long long j = i + 1; j <= r; ++j, j %= 2019) {
      min = std::min(min, (i * j) % 2019);
    }
  }

  std::cout << min << std::endl;

  return 0;
}

Fixed submission:
#include <cmath>
#include <iostream>
#include <vector>

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

  if (R - L >= 2019) {
    std::cout << 0 << std::endl;
    return 0;
  }

  long long l = L % 2019;
  long long r = R % 2019;

  long long min = 2019;
  for (long long i = l; i <= r; ++i) {
    if (i >= 2019)
      i -= 2019;
    for (long long j = i + 1; j <= r; ++j) {
      // std::cout << i << " " << j << std::endl;
      if (j >= 2019)
        j -= 2019;
      min = std::min(min, (i * j) % 2019);
    }
  }

  std::cout << min << std::endl;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;
int main() {
  int l, r;
  cin >> l >> r;

  int x, y;
  int z;
  int ans = 2019;
  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      x = i % 2019;
      y = j % 2019;
      z = (x * y) % 2019;
      if (ans > z) {
        ans = z;
      }
    }
  }

  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;
int main() {
  int l, r;
  cin >> l >> r;

  int x, y;
  int z;
  int ans = 2019;
  if (r - l > 2020) {
    for (int i = 0; i <= 2019; i++) {
      for (int j = i + 1; j <= 2019; j++) {
        x = i % 2019;
        y = j % 2019;
        z = (x * y) % 2019;
        if (ans > z) {
          ans = z;
        }
      }
    }
  } else {
    for (int i = l; i <= r; i++) {
      for (int j = i + 1; j <= r; j++) {
        x = i % 2019;
        y = j % 2019;
        z = (x * y) % 2019;
        if (ans > z) {
          ans = z;
        }
      }
    }
  }

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

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

typedef long long ll;
typedef vector<pair<ll, ll>> pll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)

const long double PI = acos(-1);

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); }
bool isInteger(double x) { return floor(x) == x; }

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

  ll l, r;
  cin >> l >> r;
  ll ans = 2e10;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, (i * j) % 2019);
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;

  return 0;
}

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

typedef long long ll;
typedef vector<pair<ll, ll>> pll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)

const long double PI = acos(-1);

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); }
bool isInteger(double x) { return floor(x) == x; }

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

  ll l, r;
  cin >> l >> r;
  ll ans = 2e10;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, (i * j) % 2019);
      if (ans == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int l, r;
  cin >> l >> r;
  int mod = 2019;
  if (l % mod >= r % mod || l % mod == 0 || r % mod == 0) {
    cout << 0 << endl;
    return 0;
  }

  int mo = 2019;
  for (ll i = l; i < r; i++) {
    for (ll j = l + 1; j <= r; j++) {
      int lmo = i % mod;
      int rmo = j % mod;
      mo = min(mo, lmo * rmo % mod);
    }
  }

  cout << mo << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int l, r;
  cin >> l >> r;
  int mod = 2019;
  if (r - l >= 2019 || l % mod == 0 || r % mod == 0) {
    cout << 0 << endl;
    return 0;
  }

  int mo = 2019;
  for (ll i = l; i < r; i++) {
    for (ll j = l + 1; j <= r; j++) {
      int lmo = i % mod;
      int rmo = j % mod;
      mo = min(mo, lmo * rmo % mod);
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define M 1000000007
#define all(v) v.begin(), v.end()
long long pow(long long int a, long long int b, long long int MOD) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > MOD)
        x %= MOD;
    }
    y = (y * y);
    if (y > MOD)
      y %= MOD;
    b /= 2;
  }
  return x;
}
long long modInverse(long long int n, long long int MOD) {
  return pow(n, MOD - 2, MOD);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unordered_map<ll, ll> mp;
  ll l, r;
  cin >> l >> r;
  for (ll i = l; i <= r; i++) {
    mp[i % 2019]++;
  }
  ll ans = INT_MAX;
  for (auto x : mp) {
    if (x.Y >= 2) {
      ans = min(ans, (x.X * x.X) % 2019);
    }
  }
  vector<ll> v;
  for (auto x : mp)
    v.pb(x.X);
  sort(all(v));
  int n = v.size();
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = min(ans, (v[i] * v[j]) % 2019);
    }
  }
  cout << ans << el;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define M 1000000007
#define all(v) v.begin(), v.end()
long long pow(long long int a, long long int b, long long int MOD) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > MOD)
        x %= MOD;
    }
    y = (y * y);
    if (y > MOD)
      y %= MOD;
    b /= 2;
  }
  return x;
}
long long modInverse(long long int n, long long int MOD) {
  return pow(n, MOD - 2, MOD);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unordered_map<ll, ll> mp;
  ll l, r;
  cin >> l >> r;
  ll tmp;
  tmp = (r - l + 1) / 2019;
  if (tmp > 2) {
    cout << 0 << el;
    return 0;
  }
  for (ll i = l; i <= r; i++) {
    mp[i % 2019]++;
  }
  ll ans = INT_MAX;
  for (auto x : mp) {
    if (x.Y >= 2) {
      ans = min(ans, (x.X * x.X) % 2019);
    }
  }
  vector<ll> v;
  for (auto x : mp)
    v.pb(x.X);
  sort(all(v));
  int n = v.size();
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = min(ans, (v[i] * v[j]) % 2019);
    }
  }
  cout << ans << el;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

#define ll long long
#define v(dt) vector<dt>
#define pr(x, y) pair<x, y>
#define loop(x, s, e) for (int x = 0; x <= e; x++)
#define in_arr(n)                                                              \
  loop(i, 0, n - 1) { cin >> a[i]; }
#define out_arr(n)                                                             \
  loop(i, 0, n - 1) { cout << a[i]; }

const int N = 1e5 + 5;
const int INF = 1 << 30;
const int MOD = 2019;

inline void boost() {
  cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0);
}

int main() {
  boost();
  ll l, r;
  cin >> l >> r;
  if ((r / MOD) != (l / MOD)) {
    cout << 0;
    return 0;
  }
  l %= MOD;
  r %= MOD;
  ll mn = INF;
  ll s = min(l, r);
  ll e = max(l, r);
  for (ll i = s; s <= e; ++i) {
    for (ll j = i + 1; j <= e; ++j) {
      mn = min(mn, (i * j) % MOD);
    }
  }
  cout << mn;
  return 0;
}

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

using namespace std;

#define ll long long
#define v(dt) vector<dt>
#define pr(x, y) pair<x, y>
#define loop(x, s, e) for (int x = 0; x <= e; x++)
#define in_arr(n)                                                              \
  loop(i, 0, n - 1) { cin >> a[i]; }
#define out_arr(n)                                                             \
  loop(i, 0, n - 1) { cout << a[i]; }

const int N = 1e5 + 5;
const int INF = 1 << 30;
const int MOD = 2019;

inline void boost() {
  cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0);
}

int main() {
  boost();
  ll l, r;
  cin >> l >> r;
  if ((r / MOD) != (l / MOD)) {
    cout << 0;
    return 0;
  }
  l %= MOD;
  r %= MOD;
  ll mn = INF;
  ll s = min(l, r);
  ll e = max(l, r);
  for (ll i = s; i <= e; ++i) {
    for (ll j = i + 1; j <= e; ++j) {
      mn = min(mn, (i * j) % MOD);
    }
  }
  cout << mn;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define MOD 2019
int main() {
  long long l, r, minv;
  cin >> l >> r;
  minv = l * (l + 1) % MOD;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      minv = min(minv, (i * j) % MOD);
      if (minv == 0)
        break;
    }
  }
  cout << minv << '\n';
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MOD 2019
int main() {
  long long l, r, minv;
  cin >> l >> r;
  minv = l * (l + 1) % MOD;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      minv = min(minv, (i * j) % MOD);
      if (minv == 0)
        break;
    }
    if (minv == 0)
      break;
  }
  cout << minv << '\n';
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, j, n) for (ll i = (j); i < (n); i++)
#define per(i, n, j) for (ll i = (n); i >= (j); i--)
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 ll INF = 1LL << 60;

ll l, r;

int main() {
  cin >> l >> r;
  ll ans = INF;
  rep(i, l, min(l + 2019, r)) {
    rep(j, l + 1, min(l + 2020, r + 1)) {
      ll num = (i % 2019) * (j % 2019);
      while (num >= 2019)
        num % 2019;
      chmin(ans, (i % 2019) * (j % 2019));
    }
  }
  /*if(l%2019==0 ||l%2019>=r%2019 || r-l>=2019) ans=0;
  else{
      ll num;
      num=l%2019*(l+1)%2019;
      if(num<2019) ans=num;
      else ans=num%2019;
  }*/
  cout << ans << "\n";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, j, n) for (ll i = (j); i < (n); i++)
#define per(i, n, j) for (ll i = (n); i >= (j); i--)
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 ll INF = 1LL << 60;

ll l, r;

int main() {
  cin >> l >> r;
  ll ans = INF;
  rep(i, l, min(l + 2019, r)) {
    rep(j, l + 1, min(l + 2020, r + 1)) {
      ll num = (i * j) % 2019;
      chmin(ans, num);
    }
  }
  /*if(l%2019==0 ||l%2019>=r%2019 || r-l>=2019) ans=0;
  else{
      ll num;
      num=l%2019*(l+1)%2019;
      if(num<2019) ans=num;
      else ans=num%2019;
  }*/
  cout << ans << "\n";
  return 0;
}
Problem p02983 (C++)

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

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

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod (ll)2019
#define inf (ll)(3e18 + 7)
#define P pair<int, int>
#define PiP pair<int, pair<int, int>>
#define all(x) x.begin(), x.end()
using namespace std;

int main() {
  ll L, R, m = inf;
  cin >> L >> R;
  for (int i = 0; i < 1000000000; i += 2019) {
    if (i >= L && i <= R) {
      cout << 0;
      exit(0);
    }
  }
  int x = L % mod, y = R - (L - x);
  for (int i = x; i < y; i++) {
    for (int j = i + 1; j <= y; j++) {
      m = min(m, ((i % mod) * (j % mod)) % mod);
    }
  }
  cout << m;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod (ll)2019
#define inf (ll)(3e18 + 7)
#define P pair<int, int>
#define PiP pair<int, pair<int, int>>
#define all(x) x.begin(), x.end()
using namespace std;

int main() {
  ll L, R, m = inf;
  cin >> L >> R;
  if (R - L >= 2019) {
    cout << 0;
    exit(0);
  }
  int x = L % mod, y = R - (L - x);
  for (int i = x; i < y; i++) {
    for (int j = i + 1; j <= y; j++) {
      m = min(m, ((i % mod) * (j % mod)) % mod);
    }
  }
  cout << m;
}
Problem p02983 (C++)

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

typedef long long ll;

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {
  ll L;
  ll R;

  cin >> L >> R;

  if (R - L > 2019) {
    cout << 0 << endl;
  }
  ll ans = INF;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ll temp;
      temp = ((i % 2019) * (j % 2019)) % 2019;
      ans = min(ans, temp);
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {
  ll L;
  ll R;

  cin >> L >> R;

  if (R - L > 2019) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = INF;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ll temp;
      temp = ((i % 2019) * (j % 2019)) % 2019;
      ans = min(ans, temp);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

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

int main() {
  long long l, r;
  cin >> l >> r;
  if (r / 2019 - l / 2019) {
    cout << 0 << endl;
  }
  long long i, j;
  long long min = l * r % 2019;
  long long temp;
  for (i = l; i <= r - 1; ++i) {
    for (j = i + 1; j <= r; ++j) {
      temp = i * j % 2019;
      if (temp < min) {
        min = temp;
      }
    }
  }
  cout << min << endl;
  return 0;
}

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

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

Buggy submission (status: Time Limit Exceeded):
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void) { return; }
template <typename First, typename... Rest>
void ci(First &first, Rest &...rest) {
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void) {
  cout << "\n";
  return;
}
template <typename First, typename... Rest> void co(First first, Rest... rest) {
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define repll(i, n) repill(i, 0, n)
#define sz(v) ((int)(v).size())
#define each(i, n) for (auto &&i : n)
#define so(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数

int main() {
  ll L, R, a = 2018;
  ci(L, R);
  repill(i, L, R + 1) {
    repill(j, L, R + 1) {
      if (i % 2019 == 0) {
        co(0);
        rt;
      } else if (i != j) {
        a = min(a, ((i % 2019) * ((j) % 2019)) % 2019);
      }
    }
  }
  co(a);
}

Fixed submission:
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void) { return; }
template <typename First, typename... Rest>
void ci(First &first, Rest &...rest) {
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void) {
  cout << "\n";
  return;
}
template <typename First, typename... Rest> void co(First first, Rest... rest) {
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define repll(i, n) repill(i, 0, n)
#define sz(v) ((int)(v).size())
#define each(i, n) for (auto &&i : n)
#define so(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数

int main() {
  ll L, R, a = 2018;
  ci(L, R);
  repi(i, L, R) {
    if (i % 2019 == 0) {
      co(0);
      rt;
    }
  }
  repill(i, L % 2019, R % 2019 + 1) {
    repill(j, L % 2019, R % 2019 + 1) {
      if (i != j) {
        a = min(a, (i * j) % 2019);
      }
    }
  }
  co(a);
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
// 自称高知能系Vtuberの高井茅乃です。
// Twitter: https://twitter.com/takaichino
// YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i <= n; i++)
#define MODA 1000000007

int main() {
  int ans = 30000;
  int l, r;
  cin >> l >> r;
  int mo[2019] = {};
  if (l - r + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  } else {
    for (int i = l; i <= r; i++) {
      mo[i % 2019]++;
    }
    for (int j = 0; j < 2019; j++) {
      for (int k = j + 1; k < 2019; k++) {
        if (mo[j] == 0 || mo[k] == 0)
          continue;
        ans = min(ans, (j * k) % 2019);
      }
    }
    cout << ans << endl;
  }
}

Fixed submission:
// 自称高知能系Vtuberの高井茅乃です。
// Twitter: https://twitter.com/takaichino
// YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i <= n; i++)
#define MODA 1000000007

int main() {
  int ans = 30000;
  int l, r;
  cin >> l >> r;
  int mo[2019] = {};
  if (r - l + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  } else {
    for (int i = l; i <= r; i++) {
      mo[i % 2019]++;
    }
    for (int j = 0; j < 2019; j++) {
      for (int k = j + 1; k < 2019; k++) {
        if (mo[j] == 0 || mo[k] == 0)
          continue;
        ans = min(ans, (j * k) % 2019);
      }
    }
    cout << ans << endl;
  }
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main() {
  ll l, r;
  cin >> l >> r;
  r = min(r, r + 4038);
  int ans = 2018;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      int tmp = i * j % 2019;
      ans = min(ans, tmp);
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long l, r, i, j, ans = 100009;
  cin >> l >> r;
  for (i = l; i < r; i++) {
    for (j = i + 1; j <= r; j++) {
      ans = min(ans, (long long)(i * j) % 2019);
    }
  }
  cout << ans << '\n';
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long l, r, i, j, ans = 100009;
  cin >> l >> r;
  for (i = l; i <= min(l + 2020, r); i++) {
    for (j = i + 1; j <= min(i + 2020, r); j++) {
      ans = min(ans, (long long)(i * j) % 2019);
    }
  }
  cout << ans << '\n';
}
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 = 3000;
  for (long long int ii = L; ii <= R; ii++) {
    for (long long int jj = ii + 1; jj <= min(R, ii + 1 + 2019); jj++) {
      ans = min(ans, (ii * jj) % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  long long int L, R;
  cin >> L >> R;
  long long int ans = 3000;
  for (long long int ii = L; ii <= min(R, L + 2019); ii++) {
    for (long long int jj = ii + 1; jj <= min(R, ii + 1 + 2019); jj++) {
      ans = min(ans, (ii * jj) % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll L, R;
  cin >> L >> R;
  ll num;
  ll subLR = R - L;
  L %= 2019;
  R %= 2019;
  ll xmin = L * R;
  REP(i, L, L + subLR) {
    REP(j, i + 1, L + subLR + 1) {
      num = i * j;
      num %= 2019;
      xmin = min(num, xmin);
    }
  }
  cout << xmin % 2019 << endl;
  return 0;
}

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

using namespace std;

#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll L, R;
  cin >> L >> R;
  ll num;
  ll subLR = R - L;
  subLR = min(subLR, (ll)2019);
  L %= 2019;
  R %= 2019;
  ll xmin = L * R;
  REP(i, L, L + subLR) {
    REP(j, i + 1, L + subLR + 1) {
      num = i * j;
      num %= 2019;
      xmin = min(num, xmin);
    }
  }
  cout << xmin % 2019 << endl;
  return 0;
}