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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k, i, n) for (ll i = k; i < n; ++i)
int main(void) {
  // Your code here!
  ll l, r, ans = 2019;
  cin >> l >> r;
  rep(l, i, r + 1) { rep(i + 1, j, r + 1) ans = min(ans, i * j % 2019); }
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k, i, n) for (ll i = k; i < n; ++i)
int main(void) {
  // Your code here!
  ll l, r, ans = 2019;
  cin >> l >> r;
  if (r - l > 2019) {
    cout << 0;
    return 0;
  }
  rep(l, i, r + 1) { rep(i + 1, j, r + 1) ans = min(ans, i * j % 2019); }
  cout << ans;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k, i, n) for (ll i = k; i < n; ++i)
int main(void) {
  // Your code here!
  const ll mod = 2019;
  ll L, R;
  cin >> L >> R;
  if (L - R > mod) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1e12;
  rep(L, i, R + 1) {
    rep(i + 1, j, R + 1) {
      ans = min(ans, (i * j) % mod);
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k, i, n) for (ll i = k; i < n; ++i)
int main(void) {
  // Your code here!
  const ll mod = 2019;
  ll L, R;
  cin >> L >> R;
  if (R - L > mod) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1e12;
  rep(L, i, R + 1) {
    rep(i + 1, j, R + 1) {
      ans = min(ans, (i * j) % mod);
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

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

typedef long long llong;

llong minq(llong minv, llong target) { return (minv > target) ? target : minv; }

int main() {
  llong L, R;
  cin >> L >> R;
  int minv = 2020;
  for (llong i = L; i < R; i++) {
    for (llong j = i + 1; j <= R; j++) {
      minv = minq(minv, (i * j) % 2019);
      if (minv == 0)
        break;
    }
  }
  cout << minv;
}


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

typedef long long llong;

llong minq(llong minv, llong target) { return (minv > target) ? target : minv; }

int main() {
  llong L, R;
  cin >> L >> R;
  int minv = 2020;
  for (llong i = L; i < R; i++) {
    for (llong j = i + 1; j <= R; j++) {
      minv = minq(minv, (i * j) % 2019);
      if (minv == 0)
        break;
    }
    if (minv == 0)
      break;
  }
  cout << minv;
}
Problem p02983 (C++)

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

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

  int ans = 2019;
  for (long long i = l; i < r && i <= l + 2019; ++i) {
    for (long long j = i + 1; j <= r && j <= r + 2019; ++j) {
      int x = i * j % 2019;

      ans = min(x, ans);
    }
  }

  cout << ans << endl;
}


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

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

  int ans = 2019;
  for (long long i = l; i < r && i <= l + 2019; ++i) {
    for (long long j = i + 1; j <= r && j <= i + 1 + 2019; ++j) {
      int x = i * j % 2019;

      ans = min(x, ans);
    }
  }

  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<int, int>;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = (s); i < (int)n; i++)
int INF = 1e9 + 7;

int main() {
  int L, R;
  cin >> L >> R;
  int ans = 2018;
  if (L - R >= 2018)
    ans = 0;
  else {
    int q = L / 2019;
    L -= q * 2019;
    R -= q * 2019;
    rep2(i, L, R) { rep2(j, i + 1, R + 1) ans = min(ans, i * j % 2019); }
  }
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = (s); i < (int)n; i++)
int INF = 1e9 + 7;

int main() {
  int L, R;
  cin >> L >> R;
  int ans = 2018;
  if (R - L >= 2018)
    ans = 0;
  else {
    int q = L / 2019;
    L -= q * 2019;
    R -= q * 2019;
    rep2(i, L, R) { rep2(j, i + 1, R + 1) ans = min(ans, i * j % 2019); }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

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

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll INF = 1e12;

int main() {
  ll L, R;
  cin >> L >> R;
  ll min = INF;
  for (ll i = L; i <= R - 1; ++i) {
    for (ll j = i + 1; j <= R; ++j) {
      chmin(min, (i * j) % 2019);
      if (min == 0) {
        break;
      }
    }
  }
  cout << min << endl;
  return 0;
}
/*
int main() {
  ll L, R;
  cin >> L >> R;
  if((R - L) / 2019 > 0) {
    cout << 0 << endl;
    return 0;
  }
  ll l = L % 2019;
  ll r = R % 2019;
  if(l > r) {
    cout << 0 << endl;
  } else {
    cout << l * (l + 1) << endl;
  }
  return 0;
}
*/

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

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll INF = 1e12;

int main() {
  ll L, R;
  cin >> L >> R;
  ll min = INF;
  for (ll i = L; i < L + 2019 && i <= R - 1; ++i) {
    for (ll j = i + 1; j < i + 1 + 2019 && j <= R; ++j) {
      chmin(min, (i * j) % 2019);
      if (min == 0) {
        break;
      }
    }
  }
  cout << min << endl;
  return 0;
}
/*
int main() {
  ll L, R;
  cin >> L >> R;
  if((R - L) / 2019 > 0) {
    cout << 0 << endl;
    return 0;
  }
  ll l = L % 2019;
  ll r = R % 2019;
  if(l > r) {
    cout << 0 << endl;
  } else {
    cout << l * (l + 1) << 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 a, b, minimum = 9999999999999999;
  for (long long int i = L; i < R; i++) {
    for (long long int j = i + 1; j <= R; j++) {
      long long int kake = i * j;
      minimum = min(kake % 2019, minimum);
    }
  }
  cout << minimum;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int L, R;
  cin >> L >> R;
  long long int a, b, minimum = 9999999999999999;
  for (long long int i = L; i < R; i++) {
    for (long long int j = i + 1; j <= R; j++) {
      long long int kake = i * j;
      minimum = min(kake % 2019, minimum);
      if (minimum == 0) {
        cout << minimum;
        return 0;
      }
    }
  }
  cout << minimum;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int l, r, ans = 999999999;
  cin >> l >> r;
  for (int i = l; i <= r && i <= i + 2500; i++)
    for (int j = i + 1; j <= r && j <= j + 2500; j++)
      ans = min(ans, ((i % 2019) * (j % 2019) % 2019));
  cout << ans << endl;
}

Fixed submission:
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int l, r, ans = 999999999;
  cin >> l >> r;
  for (int i = l; i <= r && i <= l + 2500; i++)
    for (int j = i + 1; j <= r && j <= l + 2500; j++)
      ans = min(ans, ((i % 2019) * (j % 2019) % 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 ull = unsigned long long;

void ABC133C() {
  int L, R;
  cin >> L >> R;
  int dx = R - L;
  if (dx >= 2019) {
    cout << 0 << endl;
  }

  int minX = 2018;
  for (int i = L; i < R; ++i) {
    int ii = i % 2019;
    for (int j = i + 1; j <= R; ++j) {
      int jj = j % 2019;
      int k = (ii * jj) % 2019;
      minX = min(k, minX);
    }
  }
  cout << minX << endl;
}
int main() {
  ABC133C();
  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC133C() {
  int L, R;
  cin >> L >> R;
  int dx = R - L;
  if (dx >= 2019) {
    cout << 0 << endl;
    return;
  }

  int minX = 2018;
  for (int i = L; i < R; ++i) {
    int ii = i % 2019;
    for (int j = i + 1; j <= R; ++j) {
      int jj = j % 2019;
      int k = (ii * jj) % 2019;
      minX = min(k, minX);
    }
  }
  cout << minX << endl;
}
int main() {
  ABC133C();
  return 0;
}
Problem p02983 (C++)

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const ll MOD = (ll)(2019);

ll l, r;

ll ans;

int main(void) {
  // Here your code !
  scanf("%lld %lld", &l, &r);

  ans = INF;

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

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

  return 0;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const ll MOD = (ll)(2019);

ll l, r;

ll ans;

int main(void) {
  // Here your code !
  scanf("%lld %lld", &l, &r);

  ans = INF;

  for (ll i = l; i <= l + MOD - 1; ++i) {
    for (ll j = i + 1LL; j <= i + MOD - 1; ++j) {
      if (i >= r || j > r)
        continue;
      ans = min(ans, (i * j) % MOD);
    }
  }

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

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long
#define speed_up                                                               \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define MAX 1000000007

using namespace std;
int main() {
  speed_up ll l, r;
  cin >> l >> r;
  ll out = MAX;
  rep(i, l, r) { rep(j, i + 1, r + 1) out = min(out, (i * j) % 2019); }
  cout << out;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define speed_up                                                               \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define MAX 1000000007

using namespace std;
int main() {
  speed_up ll l, r;
  cin >> l >> r;
  ll out = MAX;
  for (ll i = l; i < r && out; i++) {
    for (ll j = i + 1; j <= r && out; j++)
      out = min(out, (i * j) % 2019);
  }
  cout << out;

  return 0;
}
Problem p02983 (C++)

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

#define IOS                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);
#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;

int main(void) {
  IOS constexpr int M = 2019;
  int l, r;
  cin >> l >> r;

  int ans = 0;
  if (r - l >= M) {
    ans = 0;
  } else {
    int lm = l % M;
    int rm = r % M;
    if (lm >= rm) {
      ans = 0;
    } else {
      ans = M;
      FOR(i, lm, rm) {
        FOR(j, lm + 1, rm + 1) {
          int tmp = i * j % M;
          cerr << tmp << endl;
          if (ans > tmp)
            ans = tmp;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define IOS                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);
#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;

int main(void) {
  IOS constexpr int M = 2019;
  int l, r;
  cin >> l >> r;

  int ans = 0;
  if (r - l >= M) {
    ans = 0;
  } else {
    int lm = l % M;
    int rm = r % M;
    if (lm >= rm) {
      ans = 0;
    } else {
      ans = M;
      FOR(i, lm, rm) {
        FOR(j, lm + 1, rm + 1) {
          int tmp = i * j % M;
          // cerr << tmp << endl;
          if (ans > tmp)
            ans = tmp;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

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

const long long MOD = 2019;

void solve(long long L, long long R) {
  long long ans = 1000000000;
  for (long long i = L; i <= R - 1; i++) {
    for (long long j = i + 1; j <= R; j++) {
      if (ans > (i * j) % MOD)
        ans = (i * j) % MOD;
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long L;
  scanf("%lld", &L);
  long long R;
  scanf("%lld", &R);
  solve(L, R);
  return 0;
}


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

const long long MOD = 2019;

void solve(long long L, long long R) {
  long long ans = 1e9;
  if (R - L > 2019) {
    cout << 0 << endl;
    return;
  }

  for (long long i = L; i <= R - 1; i++) {
    for (long long j = i + 1; j <= R; j++) {
      if (ans > (i * j) % MOD)
        ans = (i * j) % MOD;
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long L;
  scanf("%lld", &L);
  long long R;
  scanf("%lld", &R);
  solve(L, R);
  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 N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) int(x.size())
#define IN(a) cin >> (a)
#define OUT(a) cout << (a) << endl
typedef pair<int, int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main() {
  int l, r;
  cin >> l >> r;
  int ans = 0;
  if (l - r < 2019) {
    ans = 1000000;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        ans = min(ans, ((j % 2019) * (i % 2019)) % 2019);
      }
    }
  }
  OUT(ans);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) int(x.size())
#define IN(a) cin >> (a)
#define OUT(a) cout << (a) << endl
typedef pair<int, int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main() {
  int l, r;
  cin >> l >> r;
  int ans = 0;
  if (r - l < 2019) {
    ans = 1000000;
    for (int i = l; i < r; i++) {
      for (int j = i + 1; j <= r; j++) {
        ans = min(ans, ((j % 2019) * (i % 2019)) % 2019);
      }
    }
  }
  OUT(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 < (int)(n); i++)
#define repi(i, a, b) for (int i = a; i <= (int)(b); i++)

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

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

  int ans = 1001001001;
  repi(i, l, r - 1) repi(j, i + 1, r) {
    int m;
    i %= 2019;
    j %= 2019;
    m = (i * j) % 2019;
    ans = min(ans, m);
  }

  cout << ans << endl;

  return 0;
}


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

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

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

  int ans = 1001001001;
  repi(i, l, r - 1) repi(j, i + 1, r) {
    int mi, mj, m;
    mi = i % 2019;
    mj = j % 2019;
    m = (mi * mj) % 2019;
    ans = min(ans, m);
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include "bits/stdc++.h"

using namespace std;

#define Fast_D cout << fixed << setprecision(13);
#define FastIO                                                                 \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(), v.end()
#define scanstr(s)                                                             \
  cin >> ws;                                                                   \
  getline(cin, s);

#define debug(x, i, j)                                                         \
  cout << #x << " " << #i << " " << #j << " " << x << " " << i << " " << j     \
       << endl

const double PI = 3.141592653589793;

void solve() {
  int l, r;
  cin >> l >> r;
  if (l - r >= 2019) {
    cout << "0";
    return;
  }
  int ans = 2020;
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j <= r; j++) {
      ans = min(ans, (i * j) % 2019);
    }
  }
  cout << ans;
}

int32_t main() {
  FastIO;
  Fast_D;
  int T;
  T = 1;
  while (T--)
    solve();
  return 0;
}


Fixed submission:
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include "bits/stdc++.h"

using namespace std;

#define Fast_D cout << fixed << setprecision(13);
#define FastIO                                                                 \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(), v.end()
#define scanstr(s)                                                             \
  cin >> ws;                                                                   \
  getline(cin, s);

#define debug(x, i, j)                                                         \
  cout << #x << " " << #i << " " << #j << " " << x << " " << i << " " << j     \
       << endl

const double PI = 3.141592653589793;

void solve() {
  int l, r;
  cin >> l >> r;
  if (r - l >= 2019) {
    cout << "0";
    return;
  }
  int ans = 2020;
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j <= r; j++) {
      ans = min(ans, (i * j) % 2019);
    }
  }
  cout << ans;
}

int32_t main() {
  FastIO;
  Fast_D;
  int T;
  T = 1;
  while (T--)
    solve();
  return 0;
}
Problem p02983 (C++)

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

#define rep(i, a, n) for (ll int(i) = (a); (i) < (n); (i)++)
#define urep(i, a, n) for (ll int(i) = (a); (i) > (n); (i)--)
#define MOD 1000000007
#define Imax 2147483647
#define ll long long
#define asort(a) sort(a.begin(), a.end());

using namespace ::std;

int jo(ll int jxo, ll int jyo) { // 累乗
  ll int jhogeo = 1;
  rep(jinto, 0, jyo) jhogeo = jhogeo * jxo;
  return jhogeo;
}
char tobig(char toxbig) { // char大文字化
  return (toxbig - 0x20);
}
char tolow(char toxlow) { // char小文字化
  return (toxlow + 0x20);
}
int ctoi(char cctoi) { // char->int
  if ('0' <= cctoi && cctoi <= '9')
    return (cctoi - '0');
  return -1;
}
int gcd(int gcad, int gcbd) { // 最大公約数
  if (gcad < gcbd)
    return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd = gcad % gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm) { // 最小公倍数
  return (lcam * lcbm) / gcd(lcam, lcbm);
}

int main() {
  ll int L, R;
  cin >> L >> R;
  ll int min = Imax;
  int md;
  rep(i, L, R + 1) {
    if (i > L + 2020)
      break;
    rep(j, i + 1, R + 1) {
      if (j > R + 2020)
        break;
      md = (i * j) % 2019;
      if (md < min)
        min = md;
    }
  }
  cout << min;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Fixed submission:
#include <algorithm>
#include <float.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <numeric>
#include <string.h>
#include <vector>

#define rep(i, a, n) for (ll int(i) = (a); (i) < (n); (i)++)
#define urep(i, a, n) for (ll int(i) = (a); (i) > (n); (i)--)
#define MOD 1000000007
#define Imax 2147483647
#define ll long long
#define asort(a) sort(a.begin(), a.end());

using namespace ::std;

int jo(ll int jxo, ll int jyo) { // 累乗
  ll int jhogeo = 1;
  rep(jinto, 0, jyo) jhogeo = jhogeo * jxo;
  return jhogeo;
}
char tobig(char toxbig) { // char大文字化
  return (toxbig - 0x20);
}
char tolow(char toxlow) { // char小文字化
  return (toxlow + 0x20);
}
int ctoi(char cctoi) { // char->int
  if ('0' <= cctoi && cctoi <= '9')
    return (cctoi - '0');
  return -1;
}
int gcd(int gcad, int gcbd) { // 最大公約数
  if (gcad < gcbd)
    return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd = gcad % gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm) { // 最小公倍数
  return (lcam * lcbm) / gcd(lcam, lcbm);
}

int main() {
  ll int L, R;
  cin >> L >> R;
  ll int min = Imax;
  int md;
  rep(i, L, R + 1) {
    if (i > L + 2020)
      break;
    rep(j, i + 1, R + 1) {
      if (j > i + 2020)
        break;
      md = (i * j) % 2019;
      if (md < min)
        min = md;
    }
  }
  cout << min;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//
Problem p02983 (C++)

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

using namespace std;

const int N = 1e6 + 5;

typedef long long ll;

int a[N], n, m, sum, ans, l, r;

char s[N];

int main() {
  int ans = 2019;
  scanf("%d%d", &l, &r);
  for (int i = l; i < min(l + 2019, r + 1); i++) {
    for (int j = i + 1; j < min(j + 2019, r + 1); j++) {
      int curr = ((ll)i * j) % 2019;
      ans = min(curr, ans);
    }
  }
  printf("%d\n", ans);
}


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

using namespace std;

const int N = 1e6 + 5;

typedef long long ll;

int a[N], n, m, sum, ans, l, r;

char s[N];

int main() {
  int ans = 2019;
  scanf("%d%d", &l, &r);
  for (int i = l; i < min(l + 2019, r + 1); i++) {
    for (int j = i + 1; j < min(i + 2019, r + 1); j++) {
      int curr = ((ll)i * j) % 2019;
      ans = min(curr, ans);
    }
  }
  printf("%d\n", ans);
}
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 ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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

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

  cout << ans << endl;
}

Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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

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

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <algorithm> // sort
#include <cmath>
#include <cstring>
#include <iostream>
#include <map> // pair
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
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 rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define all(x) (x).begin(), (x).end()
const ll mod = 1e9 + 7;
const int INF = 1e9;
const ll INFLONG = 1e18;
int main() {
  ll l, r;
  cin >> l >> r;
  int minimum = 2019;
  for (ll i = l; i <= r && minimum != 0; i++) {
    for (ll j = i + 1; j <= r; j++) {
      if ((i * j) % 2019 < minimum) {
        minimum = (i * j) % 2019;
      }
    }
  }
  cout << minimum;
}


Fixed submission:
#include <algorithm>
#include <algorithm> // sort
#include <cmath>
#include <cstring>
#include <iostream>
#include <map> // pair
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
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 rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define all(x) (x).begin(), (x).end()
const ll mod = 1e9 + 7;
const int INF = 1e9;
const ll INFLONG = 1e18;
int main() {
  ll l, r;
  cin >> l >> r;
  int minimum = 2019;
  for (ll i = l; i <= r && minimum != 0; i++) {
    for (ll j = i + 1; j <= r && j - i <= 2019; j++) {
      if ((i * j) % 2019 < minimum) {
        minimum = (i * j) % 2019;
      }
    }
  }
  cout << minimum;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(ALL(x)), (x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it, x)                                                         \
  for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define debug(x) cerr << #x << "=" << (x) << endl
#define gett() cerr << "Time:" << clock() << "ms." << endl
#define ri(x) scanf("%d", &x)
#define rl(x) scanf("%lld", &x)
#define rlcfpoj(x) scanf("%I64d", &x)
#define pi(x) printf("%d", x)
#define pl(x) printf("%lld", x)
#define plcfpoj(x) printf("%I64d", x)
#define lfd() printf("\n")
#define sp() printf(" ")
int l, r;
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  cin >> l >> r;
  if (l - r >= 2019) { // 夹了1个2019
    cout << 0 << endl;
    return 0;
  }
  int res = 1e9;
  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      int ti = i % 2019;
      int tj = j % 2019;
      res = min(res, (ti * tj) % 2019);
    }
  }
  cout << res << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(ALL(x)), (x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it, x)                                                         \
  for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define debug(x) cerr << #x << "=" << (x) << endl
#define gett() cerr << "Time:" << clock() << "ms." << endl
#define ri(x) scanf("%d", &x)
#define rl(x) scanf("%lld", &x)
#define rlcfpoj(x) scanf("%I64d", &x)
#define pi(x) printf("%d", x)
#define pl(x) printf("%lld", x)
#define plcfpoj(x) printf("%I64d", x)
#define lfd() printf("\n")
#define sp() printf(" ")
int l, r;
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  cin >> l >> r;
  if (r - l >= 2019) { // 夹了1个2019
    cout << 0 << endl;
    return 0;
  }
  int res = 1e9;
  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      int ti = i % 2019;
      int tj = j % 2019;
      res = min(res, (ti * tj) % 2019);
    }
  }
  cout << res << endl;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

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

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

using namespace std;

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  if (r - l >= 2019) {
    cout << 0 << endl;
  } else {
    ll ans = 1000000000000;
    for (ll i = l; i <= r; i++) {
      for (ll k = l; k <= r; i++) {
        ans = min(ans, (i % 2019) * (k % 2019) % 2019);
      }
    }
    cout << ans << endl;
  }
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  if (r - l >= 2019) {
    cout << 0 << endl;
  } else {
    ll ans = 1000000000000;
    for (ll i = l; i <= r; i++) {
      for (ll k = i + 1; k <= r; k++) {
        ans = min(ans, (i % 2019) * (k % 2019) % 2019);
      }
    }
    cout << ans << endl;
  }
}
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;

  long long result = l * (l + 1) % 2019;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      long long v = (i * j) % 2019;
      if (result > v) {
        result = v;
      }
    }
  }

  cout << result << endl;
  return 0;
}


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

using namespace std;

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

  long long result = l * (l + 1) % 2019;
  for (long long i = l; i <= r && i <= l + 2019; i++) {
    for (long long j = i + 1; j <= r && j <= i + 2019; j++) {
      long long v = (i * j) % 2019;
      if (result > v) {
        result = v;
      }
    }
  }

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

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

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

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

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


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

int main() {
  ll l, r;
  cin >> l >> r;
  int ans = 2018;
  for (ll i = l; i < r; i++) {
    for (ll j = l + 1; j <= r; j++) {
      int num = i * j % 2019;
      ans = min(ans, num);
      if (ans == 0)
        break;
    }
    if (ans == 0)
      break;
  }
  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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  ll l, r;
  cin >> l >> r;
  ll i_max = min(r - 1, l + 2019);
  ll j_max = min(r, r + 2019 + 1);
  int ans = 2019;
  for (ll i = l; i <= i_max; ++i) {
    for (ll j = i + 1; j <= j_max; ++j) {
      if ((i * j) % 2019 < ans) {
        ans = (i * j) % 2019;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  ll l, r;
  cin >> l >> r;
  ll i_max = min(r - 1, l + 2019);
  ll j_max = min(r, i_max + 1);
  int ans = 2019;
  for (ll i = l; i <= i_max; ++i) {
    for (ll j = i + 1; j <= j_max; ++j) {
      if ((i * j) % 2019 < ans) {
        ans = (i * j) % 2019;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)

int main() {
  long long int L, R;
  long long int ans = 1000000000000;

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

  for (long long int i = L; i < R; i++) {
    for (long long int j = i + 1; j <= R; j++) {
      if ((i * j) % 2019 < ans)
        ans = (i * j) % 2019;

      if ((i * j) % 2019 < (i * (j + 1)) % 2019)
        j += (2019 - (i * j) % 2019) - 1;
      else
        j += ((i * j) % 2019) / (((i * j) % 2019 - (i * (j + 1)) % 2019));
    }
  }

  printf("%lld\n", ans);
}

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

#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)

int main() {
  long long int L, R;
  long long int ans = 1000000000000;

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

  for (long long int i = L; i < R; i++) {
    for (long long int j = i + 1; j <= R; j++) {
      if ((i * j) % 2019 < ans)
        ans = (i * j) % 2019;

      if (ans == 0) {
        printf("0\n");
        return 0;
      }
    }
  }

  printf("%lld\n", ans);
}
Problem p02983 (C++)

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

using namespace std;

typedef long long ll;

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

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

using namespace std;

typedef long long ll;

int main() {
  ll L, R;
  cin >> L >> R;
  ll min = 100000000000;
  int ans;
  for (ll i = L; i < R; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ans = i * j % 2019;
      if (ans < min) {
        min = ans;
      }
      if (ans == 0) {
        cout << min << endl;
        return 0;
      }
    }
  }
  cout << min << 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 ok() puts(ok ? "Yes" : "No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
// clang++ -std=c++11 -stdlib=libc++

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

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok ? "Yes" : "No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
// clang++ -std=c++11 -stdlib=libc++

int main() {
  ll L, R;
  cin >> L >> R;
  if (R - L >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  int ans = INF;
  for (int i = L; i <= R; i++) {
    for (int j = i + 1; j <= R; j++) {
      int t = (i % 2019) * (j % 2019) % 2019;
      ans = min(ans, t);
    }
  }
  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;
  ll min = 1e+9;
  cin >> L >> R;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ll mod = i * j;
      while (mod > 2019) {
        mod -= 2019;
      }
      if (min > mod)
        min = mod;
    }
  }
  cout << min << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll L, R;
  ll min = 1e+9;
  cin >> L >> R;
  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ll mod = (i * j) % 2019;
      if (mod == 0) {
        cout << mod << endl;
        return 0;
      }
      if (min > mod)
        min = mod;
    }
  }
  cout << min << endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
// 990589
// 4076361
const int mod = 2019;
int a[990589 + 10];
int main() {
  int l, r;
  cin >> l >> r;
  int n1 = l / mod;
  int n2 = r / mod;
  //	if(r%mod==0) n2--;
  int qq = 0;
  //	a[qq++]=n*mod;
  if (n1 == n2) {
    //		printf("%d %d\n",(l%mod),((l+1)%mod));
    //		int woc[2019];

    //		int a1=l+(l+1);
    //		int a2=r*(r-1);
    //		int www=a1/2019;
    //		if(a1%2019!=0) www++;
    //		int www2=a2/2019;
    ////		if(a2%2019!=0)
    //		for(int i=www;i<=www2;i++)
    //		{
    //
    //			if((www*2019)%)
    //		}
    //		cout<<((l%mod)*((l+1)%mod))%mod<<endl;
    long long int minn = 0x3f3f3f3f;
    //		cout<<l<<r<<endl;
    for (long long int i = l; i < r; i++) {
      for (long long int j = i + 1; j <= r; j++) {
        //				cout<<(i*j)%mod<<endl;
        //				getchar();
        minn = min(minn, (i * j) % mod);
        if (minn == 0)
          cout << i << j << endl;
      }
    }
    cout << minn << endl;
  } else {
    cout << 0 << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
// 990589
// 4076361
const int mod = 2019;
int a[990589 + 10];
int main() {
  int l, r;
  cin >> l >> r;
  int n1 = l / mod;
  int n2 = r / mod;
  //	if(r%mod==0) n2--;
  int qq = 0;
  //	a[qq++]=n*mod;
  if (n1 == n2) {
    //		printf("%d %d\n",(l%mod),((l+1)%mod));
    //		int woc[2019];

    //		int a1=l+(l+1);
    //		int a2=r*(r-1);
    //		int www=a1/2019;
    //		if(a1%2019!=0) www++;
    //		int www2=a2/2019;
    ////		if(a2%2019!=0)
    //		for(int i=www;i<=www2;i++)
    //		{
    //
    //			if((www*2019)%)
    //		}
    //		cout<<((l%mod)*((l+1)%mod))%mod<<endl;
    long long int minn = 0x3f3f3f3f;
    //		cout<<l<<r<<endl;
    for (long long int i = l; i < r; i++) {
      for (long long int j = i + 1; j <= r; j++) {
        //				cout<<(i*j)%mod<<endl;
        //				getchar();
        minn = min(minn, (i * j) % mod);
        //			if(minn==0) cout<<i<<j<<endl;
      }
    }
    cout << minn << endl;
  } else {
    cout << 0 << endl;
  }
}
Problem p02983 (C++)

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

using namespace std;

using ll = long long;
using ld = long double;

inline ll ceil_ll(ll x, ll y) { return (x + y - 1) / y; }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << setprecision(8) << setiosflags(ios::fixed);

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

  ll min_v = 2018;
  for (ll i = L; i < L + 2019 && i < R; ++i) {
    for (ll j = i + 1; j < j + 2020 && j <= R; ++j) {
      min_v = min(min_v, (i * j) % 2019);
    }
  }

  cout << min_v << endl;

  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

inline ll ceil_ll(ll x, ll y) { return (x + y - 1) / y; }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << setprecision(8) << setiosflags(ios::fixed);

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

  ll min_v = 2018;
  for (ll i = L; i < L + 2019 && i < R; ++i) {
    for (ll j = i + 1; j < i + 2020 && j <= R; ++j) {
      min_v = min(min_v, (i * j) % 2019);
    }
  }

  cout << min_v << endl;

  return 0;
}
Problem p02983 (C++)

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

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
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;
}
typedef pair<ll, ll> P;

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


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
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;
}
typedef pair<ll, ll> P;

int main() {
  ll L, R;
  cin >> L >> R;
  R = min(R, L + 4038);
  ll ans = 2018;
  for (ll i = L; i <= R; i++) {
    for (ll k = i + 1; k <= R; k++) {
      ll x = i * k % 2019;
      ans = min(ans, x);
    }
  }
  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;
int main() {
  ll l, r;
  cin >> l >> r;
  ll m = min(l + 4038, r);
  ll x = 1000100010;
  ll res = 2019;
  for (ll i = l; i <= r; ++i) {
    for (ll j = i + 1; j <= r; ++j) {
      ll x = i * j % 2019;
      res = min(res, x);
    }
  }
  cout << res << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll l, r;
  cin >> l >> r;
  ll m = min(l + 4038, r);
  ll x = 1000100010;
  ll res = 2019;
  for (ll i = l; i <= m; ++i) {
    for (ll j = i + 1; j <= m; ++j) {
      ll x = i * j % 2019;
      res = min(res, x);
    }
  }
  cout << res << endl;
  return 0;
}
Problem p02983 (C++)

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

int main() {
  int L, R, ans = 2e9, tmp;
  vector<int> v(3000, 0);
  cin >> L >> R;

  for (int i = L; i <= R; i++) {
    tmp = i % 2019;
    v[tmp]++;
  }

  for (int i = 0; i <= 2019; i++) {
    for (int j = 0; j <= 2019; j++) {
      if (v[i] == 0 || v[j] == 0)
        continue;
      else if (i == j && v[i] == 1)
        continue;
      tmp = (i * j) % 2019;
      ans = min(ans, tmp);
    }
  }
  cout << ans << endl;
}


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

int main() {
  int L, R, ans = 2e9, tmp;
  vector<int> v(3000, 0);
  cin >> L >> R;

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

  for (int i = L; i <= R; i++) {
    tmp = i % 2019;
    v[tmp]++;
  }

  for (int i = 0; i <= 2019; i++) {
    for (int j = 0; j <= 2019; j++) {
      if (v[i] == 0 || v[j] == 0)
        continue;
      else if (i == j && v[i] == 1)
        continue;
      tmp = (i * j) % 2019;
      ans = min(ans, tmp);
    }
  }
  cout << ans << endl;
}