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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define rep(i, end) rep2(i, 0, (end))
#define rep2(i, beg, end) for (int i = (beg); i < (end); i++)
#define all(cont) begin(cont), end(cont)
#define INFMAX LLONG_MAX
#define INFMIN LLONG_MIN
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef list<ll> li;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

string gets(bool skipnewline);
vi get_n_array(int n);

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, r;
  cin >> l >> r;
  ll mods[2019] = {};
  rep2(i, l, r + 1) { mods[i % 2019]++; }
  ll minv = INFMAX;
  rep2(i, 0, 2019) {
    if (mods[i] == 0)
      continue;
    mods[i]--;
    rep2(j, i, 2019) {
      if (mods[j] == 0)
        continue;
      minv = min((i * j) % 2019LL, minv);
    }
  }
  cout << minv << endl;
  return 0;
}

string gets(bool skipToNextline) {
  if (skipToNextline)
    gets(false);
  const int BUFF_MAX = 1024;
  char buf[BUFF_MAX];
  cin.getline(buf, sizeof(buf));
  return buf;
}

vi get_n_array(int n) {
  vi v;
  while (n-- > 0) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  return v;
}

Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define rep(i, end) rep2(i, 0, (end))
#define rep2(i, beg, end) for (int i = (beg); i < (end); i++)
#define all(cont) begin(cont), end(cont)
#define INFMAX LLONG_MAX
#define INFMIN LLONG_MIN
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef list<ll> li;
typedef pair<ll, ll> pii;
typedef pair<ll, string> pis;
typedef pair<string, ll> psi;

string gets(bool skipnewline);
vi get_n_array(int n);

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, r;
  cin >> l >> r;
  if (r - l >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  ll mods[2019] = {};
  rep2(i, l, r + 1) { mods[i % 2019]++; }
  ll minv = INFMAX;
  rep2(i, 0, 2019) {
    if (mods[i] == 0)
      continue;
    mods[i]--;
    rep2(j, i, 2019) {
      if (mods[j] == 0)
        continue;
      minv = min((i * j) % 2019LL, minv);
    }
  }
  cout << minv << endl;
  return 0;
}

string gets(bool skipToNextline) {
  if (skipToNextline)
    gets(false);
  const int BUFF_MAX = 1024;
  char buf[BUFF_MAX];
  cin.getline(buf, sizeof(buf));
  return buf;
}

vi get_n_array(int n) {
  vi v;
  while (n-- > 0) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  return v;
}
Problem p02983 (C++)

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

int main() {
  ll l, r, ans = 3000;
  cin >> l >> r;
  for (ll i = l; i <= r; i++) {
    ll num = i % 2019;
    if (num == 0) {
      cout << 0;
      return 0;
    }
    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;
using ll = long long;

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
int n, m;
int ans = 2020;
int main() {
  cin >> n >> m;
  if (n - m + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = n; i < m; i++) {
    for (int j = i + 1; j <= m; j++)
      ans = min(ans, int(1ll * i * j % 2019));
  }
  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
int n, m;
int ans = 2020;
int main() {
  cin >> n >> m;
  if (m - n + 1 >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = n; i < m; i++) {
    for (int j = i + 1; j <= m; j++)
      ans = min(ans, int(1ll * i * j % 2019));
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdint.h>
#include <utility>

using namespace std;

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

  uint64_t min_ = 2018;

  for (uint64_t ii = L; ii < R; ++ii) {
    for (uint64_t jj = ii + 1; jj <= R && jj < ii + 2020; ++jj) {
      min_ = min((ii * jj) % 2019, min_);
    }
  }

  cout << min_ << endl;

  return 0;
}


Fixed submission:
#include <iostream>
#include <stdint.h>
#include <utility>

using namespace std;

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

  uint64_t min_ = 2018;

  for (uint64_t ii = L; ii < R && ii < L + 2030; ++ii) {
    for (uint64_t jj = ii + 1; jj <= R && jj < ii + 2030; ++jj) {
      min_ = min((ii * jj) % 2019, min_);
    }
  }

  cout << min_ << endl;

  return 0;
}
Problem p02983 (C++)

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

#define sswap(x, y)                                                            \
  {                                                                            \
    x += y;                                                                    \
    y = x - y;                                                                 \
    x -= y;                                                                    \
  }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  ll mn = 2019;
  for (ll i = l; i < r; i++)
    for (ll j = i + 1; j <= r; j++) {
      mn = min(mn, (i * j) % 2019);
      if (!mn)
        break;
    }
  cout << mn << ende;
  return 0;
}


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

#define sswap(x, y)                                                            \
  {                                                                            \
    x += y;                                                                    \
    y = x - y;                                                                 \
    x -= y;                                                                    \
  }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  ll mn = 2019;
  for (ll i = l; i < r; i++)
    for (ll j = i + 1; j <= r; j++) {
      mn = min(mn, (i * j) % 2019);
      if (!mn)
        j = i = r + 1;
    }
  cout << mn << ende;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll, unordered_map<ll, ll>> graph;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll l, r;
ll ans = INF;

int main() {
  cin >> l >> r;
  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;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll, unordered_map<ll, ll>> graph;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll l, r;
ll ans = INF;

int main() {
  cin >> l >> r;
  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;
    }
    if (ans == 0)
      break;
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#define REP(i, n) for (LL i = 0, i##_len = (n); i < i##_len; ++i)

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

  LL ans = 2018;
  for (LL i = L; i < R; i++) {
    for (LL j = i + 1; j <= R; j++) {
      LL mod = (i * j) % 2019;
      if (mod < ans)
        ans = mod;
      if (ans == 0)
        break;
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#define REP(i, n) for (LL i = 0, i##_len = (n); i < i##_len; ++i)

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

  LL ans = 2018;
  for (LL i = L; i < R; i++) {
    for (LL j = i + 1; j <= R; j++) {
      LL mod = (i * j) % 2019;
      if (mod < ans)
        ans = mod;
      if (ans == 0)
        break;
    }
    if (ans == 0)
      break;
  }

  std::cout << ans << std::endl;

  return 0;
}
Problem p02983 (C++)

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

#include <array>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main() {
  int64 ll, rr, ans = 3000;
  cin >> ll >> rr;
  for (int64 ii = ll; ii < rr; ii++) {
    for (int64 jj = ii + 1; jj <= rr; jj++) {
      if (ans > (ii * jj) % 2019) {
        ans = (ii * jj) % 2019;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

#include <array>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main() {
  int64 ll, rr, ans = 3000;
  cin >> ll >> rr;
  for (int64 ii = ll; ii < rr && ii <= ll + 2020; ii++) {
    for (int64 jj = ii + 1; jj <= rr && jj <= ii + 2020; jj++) {
      if (ans > (ii * jj) % 2019) {
        ans = (ii * jj) % 2019;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
/* ****mittal**** */
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define pii pair<ll int, ll int>
#define vi vector<ll int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (ll int)x.size()
#define hell 1000000007
#define rep(i, a, b) for (ll int i = a; i < b; i++)
#define repr(i, a, b) for (ll int i = a; i >= b; i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define mp make_pair
using namespace std;

#define N 100005
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  //    cin>>TESTS;
  while (TESTS--) {
    ll l, r;
    cin >> l >> r;
    if (l - r + 1 >= 2019)
      cout << 0;
    else {
      ll ans = hell;
      for (int i = l; i <= r; i++) {
        for (int j = i + 1; j <= r; j++) {
          ll p = i % 2019;
          ll q = j % 2019;
          ans = min(ans, (p * q) % 2019);
        }
      }
      cout << ans;
    }
  }
  return 0;
}

Fixed submission:
/* ****mittal**** */
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define pii pair<ll int, ll int>
#define vi vector<ll int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (ll int)x.size()
#define hell 1000000007
#define rep(i, a, b) for (ll int i = a; i < b; i++)
#define repr(i, a, b) for (ll int i = a; i >= b; i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define mp make_pair
using namespace std;

#define N 100005
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  //    cin>>TESTS;
  while (TESTS--) {
    ll l, r;
    cin >> l >> r;
    if (r - l + 1 >= 2019)
      cout << 0;
    else {
      ll ans = hell;
      for (int i = l; i <= r; i++) {
        for (int j = i + 1; j <= r; j++) {
          ll p = i % 2019;
          ll q = j % 2019;
          ans = min(ans, (p * q) % 2019);
        }
      }
      cout << ans;
    }
  }
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
// 前置き
#pragma region

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (ll i = (ll)(a); i < (ll)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

// 関数定義
#pragma region
// 偶数 ->　true :: 奇数　-> false
bool EVEN(ll a) { return a % 2 - 1; }

// 最大公約数
ll gcd(ll a, ll b) {
  if (!b)
    return a;
  return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

#pragma endregion

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

  int ans = 2019;
  FOR(i, l, r) {
    for (ll j = r; j > l; j--) {
      int ij = (i * j) % 2019;
      ans = min(ans, ij);
    }
  }

  cout << ans << endl;
}


Fixed submission:
// 前置き
#pragma region

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (ll i = (ll)(a); i < (ll)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

// 関数定義
#pragma region
// 偶数 ->　true :: 奇数　-> false
bool EVEN(ll a) { return a % 2 - 1; }

// 最大公約数
ll gcd(ll a, ll b) {
  if (!b)
    return a;
  return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

#pragma endregion

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

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

  int ans = 2019;
  FOR(i, l, r) {
    for (ll j = r; j > l; j--) {
      int ij = (i * j) % 2019;
      ans = min(ans, ij);
    }
  }

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

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

using namespace std;

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

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

  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

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

  cout << ans << endl;
}
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 p = 2019;
  long long l, r;
  cin >> l >> r;
  if (r - l > p) {
    cout << 0 << endl;
  }
  long long best = p - 1;
  for (long long i = l; i <= r; ++i) {
    for (long long j = i + 1; j <= r; ++j) {
      best = min(best, (i * j) % p);
    }
  }
  cout << best << endl;
  return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long p = 2019;
  long long l, r;
  cin >> l >> r;
  if (r - l > p) {
    cout << 0 << endl;
    return 0;
  }
  long long best = p - 1;
  for (long long i = l; i <= r; ++i) {
    for (long long j = i + 1; j <= r; ++j) {
      best = min(best, (i * j) % p);
    }
  }
  cout << best << endl;
  return 0;
}
Problem p02983 (C++)

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

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

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


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

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

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

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

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


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

int main() {
  long long l, r, mn = 2019;
  cin >> l >> r;
  for (long long i = l; i < r && i < l + 2019; i++) {
    for (long long j = i + 1; j <= r && j <= l + 2019; j++) {
      mn = min(mn, i * j % 2019);
    }
  }
  cout << mn << 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, res = 2018;
  cin >> l >> r;
  for (ll i = l; i <= r - 1; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll p = (i * j) % 2019;
      res = min(p, res);
    }
  }
  cout << res;
}


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

int main() {
  ll l, r, res = 2018;
  cin >> l >> r;
  if (r - l >= 2019)
    r = l + 2018;
  for (ll i = l; i <= r - 1; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ll p = (i * j) % 2019;
      res = min(p, res);
    }
  }
  cout << res;
}
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 ll long long
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; i <= r; j++) {
      int x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  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 ll long long
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 x = i * j % 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;
int main() {
  int l, r;
  cin >> l >> r;
  int ans = 2020;
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j <= r; j++) {
      int a = i % 2019;
      int b = j % 2019;
      ans = min(ans, a * b % 2019);
    }
  }
  cout << ans;
}


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

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

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

  int ans = 1 << 30;
  for (int i = L; i < min(R, i + 2019); ++i) {
    for (int j = i + 1; j <= min(R, j + 2019); ++j) {
      ans = min(ans, (i % 2019) * (j % 2019) % 2019);
    }
  }

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

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

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

  int ans = 1 << 30;
  for (int i = L; i < min(R, L + 2019); ++i) {
    for (int j = i + 1; j <= min(R, L + 2019); ++j) {
      ans = min(ans, (i % 2019) * (j % 2019) % 2019);
    }
  }

  cout << ans << endl;
  return 0;
}
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 i, j;
  int tmp = 2018;
  for (int k = l; k < min(r, k + 2019); k++) {
    for (int m = k + 1; m <= min(r, k + 2019); m++) {
      if (((k % 2019) * (m % 2019)) % 2019 < tmp) {
        tmp = ((k % 2019) * (m % 2019)) % 2019;
        i = k;
        j = m;
      }
    }
  }
  cout << tmp << endl;
  return 0;
}

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

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }

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 <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }

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

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

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 x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
}

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

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 x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0);
typedef pair<int, int> PII;

int main() {
  FIO;
  ll l, r;
  cin >> l >> r;
  vector<ll> v;
  if (r - l >= 2019) {
    cout << 0 << endl;
  }
  for (ll i = l; i <= r; i++) {
    v.push_back(i);
  }
  ll n = v.size();
  ll ans = INT_MAX;
  for (ll i = 0; i < n; i++) {
    for (ll j = i + 1; j < n; j++) {
      ll x = v[i] * v[j];
      x %= 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO                                                                    \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0);                                                                  \
  cout.tie(0);
typedef pair<int, int> PII;

int main() {
  FIO;
  ll l, r;
  cin >> l >> r;
  vector<ll> v;
  if (r - l >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (ll i = l; i <= r; i++) {
    v.push_back(i);
  }
  ll n = v.size();
  ll ans = INT_MAX;
  for (ll i = 0; i < n; i++) {
    for (ll j = i + 1; j < n; j++) {
      ll x = v[i] * v[j];
      x %= 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02983 (C++)

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

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i, n) for (int i = (int)0; i < (int)n; i++)
#define REP(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define arr(var, n)                                                            \
  vec var(n);                                                                  \
  rep(i, n) { cin >> var[i]; }
#define all(var) (var).begin(), (var).end()
#define sortall(var) sort(all(var))
#define prt(var) cout << var << endl
#define prtd(n, var) cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl

//----------------------------------------------------------------

int main(void) {
  ll l, r;
  cin >> l >> r;
  if (l - r + 1 > 2018) {
    prt(0);
    return 0;
  }

  ll ans = 2020;
  REP(i, l, r) {
    REP(j, i + 1, r + 1) {
      ll tmp = ((i % 2019) * (j % 2019)) % 2019;
      if (ans > tmp) {
        ans = tmp;
      }
    }
  }

  prt(ans);
}


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

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i, n) for (int i = (int)0; i < (int)n; i++)
#define REP(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define arr(var, n)                                                            \
  vec var(n);                                                                  \
  rep(i, n) { cin >> var[i]; }
#define all(var) (var).begin(), (var).end()
#define sortall(var) sort(all(var))
#define prt(var) cout << var << endl
#define prtd(n, var) cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl

//----------------------------------------------------------------

int main(void) {
  ll l, r;
  cin >> l >> r;
  if (r - l + 1 > 2018) {
    prt(0);
    return 0;
  }

  ll ans = 2020;
  REP(i, l, r) {
    REP(j, i + 1, r + 1) {
      ll tmp = ((i % 2019) * (j % 2019)) % 2019;
      if (ans > tmp) {
        ans = tmp;
      }
    }
  }

  prt(ans);
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto &i : a)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  ll L, R;
  cin >> L >> R;
  ll mod = 2019;
  ll rest = INFINITY;

  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      rest = min(rest, (i * j) % mod);
    }
  }

  cout << rest << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto &i : a)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  ll L, R;
  cin >> L >> R;
  ll mod = 2019;
  ll rest = INFINITY;

  if ((R - L) > mod) {
    R = L + mod;
  }

  for (ll i = L; i <= R - 1; i++) {
    for (ll j = i + 1; j <= R; j++) {
      rest = min(rest, (i * j) % mod);
    }
  }

  cout << rest << 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) < (n); (i)++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pairSS
int main() {
#define int long long
  int r, l;
  cin >> r >> l;
  int ans = 2019;
  for (int i = r; i < l + 1; i++) {
    for (int j = i + 1; j < l + 1; j++) {
      int ss = (i * j) % 2019;
      ans = min(ans, ss);
    }
  }
  cout << ans << endl;
}


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()
#define PB push_back
#define MP make_pairSS
int main() {
#define int long long
  int r, l;
  cin >> r >> l;
  for (int i = r; i < l; i++) {
    if (i % 2019 == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  r = r % 2019;
  l = l % 2019;
  int ans = 2019;
  for (int i = r; i < l + 1; i++) {
    for (int j = i + 1; j < l + 1; j++) {
      int ss = (i * j) % 2019;
      ans = min(ans, ss);
    }
  }
  cout << ans << endl;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {

  unsigned long L, R;
  cin >> L >> R;

  vector<unsigned long> v(R - L + 1);

  unsigned long i, j;
  for (i = L, j = 0; i <= R; i++, j++) {
    v.at(j) = i % 2019;
    if (v.at(j) == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  unsigned long mn = 2019;
  for (i = 0; i < v.size() - 1; i++) {
    for (j = i + 1; j < v.size(); j++) {
      mn = min(mn, (v.at(i) * v.at(j)) % 2019);
    }
  }

  cout << mn << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {

  unsigned long L, R;
  cin >> L >> R;

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

  vector<unsigned long> v(R - L + 1);

  unsigned long i, j;
  for (i = L, j = 0; i <= R; i++, j++) {
    v.at(j) = i % 2019;
    if (v.at(j) == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  unsigned long mn = 2019;
  for (i = 0; i < v.size() - 1; i++) {
    for (j = i + 1; j < v.size(); j++) {
      mn = min(mn, (v.at(i) * v.at(j)) % 2019);
    }
  }

  cout << mn << endl;

  return 0;
}
Problem p02983 (C++)

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

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

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

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

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main(void) {
  long long L, R;
  cin >> L >> R;
  if (L - R <= 2019) {
    long long ans = 2018;
    for (long long i = L; i < R; i++) {
      long long a = i % 2019;
      for (long long j = i + 1; j <= R; j++) {
        long long b = j % 2019;
        long long c = (a * b) % 2019;
        ans = min(c, ans);
      }
    }
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
}

Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  long long L, R;
  cin >> L >> R;
  if (R - L <= 2019) {
    long long ans = 2018;
    for (long long i = L; i < R; i++) {
      long long a = i % 2019;
      for (long long j = i + 1; j <= R; j++) {
        long long b = j % 2019;
        long long c = (a * b) % 2019;
        ans = min(c, ans);
      }
    }
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
}
Problem p02983 (C++)

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

const int MOD = 1000000007;
const int INF = 1e9;

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

  const long long mod = 2019;
  long long ans = 2e9 + 1;
  long long res = 0;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      res = i % mod;
      res *= j;
      res %= mod;
      ans = min(ans, res);
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;

  // int s = l % mod;
  // vector<int> a;
  // a.push_back(l%mod);
  // int cnt = 0;
  // for(int i = l + 1; i <= r; i++){
  //   if(i%mod == s) {
  //     cnt ++;
  //     if(cnt >= 3) break;
  //   }
  //   a.push_back(i%mod);
  // }
  // sort(a.begin(), a.end());
  // // for(int i = 0; i < a.size(); i++) cout << a[i] << endl;
  // cout << a[0] * a[1] % mod << endl;

  return 0;
}

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

const int MOD = 1000000007;
const int INF = 1e9;

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

  const long long mod = 2019;
  long long ans = 2e9 + 1;
  long long res = 0;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      res = i % mod;
      res *= j;
      res %= mod;
      ans = min(ans, res);
      if (ans == 0)
        break;
    }
    if (ans == 0)
      break;
  }
  cout << ans << endl;

  // int s = l % mod;
  // vector<int> a;
  // a.push_back(l%mod);
  // int cnt = 0;
  // for(int i = l + 1; i <= r; i++){
  //   if(i%mod == s) {
  //     cnt ++;
  //     if(cnt >= 3) break;
  //   }
  //   a.push_back(i%mod);
  // }
  // sort(a.begin(), a.end());
  // // for(int i = 0; i < a.size(); i++) cout << a[i] << endl;
  // cout << a[0] * a[1] % mod << endl;

  return 0;
}
Problem p02983 (C++)

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

int main() {
  long long L, R, ans, a;
  double an;
  cin >> L >> R;
  ans = 2019;
  if (L - R > 2019) {
    cout << 0 << endl;
    return 0;
  } else {
    a = R - L;
    L %= 2019;
    R = L + a;
    for (int i = L; i < R; i++) {
      for (int j = i + 1; j < R + 1; j++) {
        a = i * j;
        ans = min(a % 2019, ans);
      }
    }
    cout << ans << endl;
    return 0;
  }
}

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

int main() {
  long long L, R, ans, a;
  double an;
  cin >> L >> R;
  ans = 2019;
  if (R - L > 2019) {
    cout << 0 << endl;
    return 0;
  } else {
    a = R - L;
    L %= 2019;
    R = L + a;
    for (int i = L; i < R; i++) {
      for (int j = i + 1; j < R + 1; j++) {
        a = i * j;
        ans = min(a % 2019, ans);
      }
    }
    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)
const int INF = 2147483647; // int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll l, r;
  cin >> l >> r;
  ll res = 4000;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      res = min(res, i * j % 2019);
      if (res == 0)
        break;
    }
  }
  cout << res << endl;
  return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647; // int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll l, r;
  cin >> l >> r;
  ll res = 4000;
  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      res = min(res, i * j % 2019);
      if (res == 0)
        break;
    }
    if (res == 0)
      break;
  }
  cout << res << endl;
  return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/
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 (int i = l % 2019; i < r - l + (l % 2019); i++) {
    for (int j = i + 1; j < r - l + (l % 2019) + 1; j++) {
      ans = min(ans, (i * j) % 2019);
    }
  }

  // 表示
  cout << ans << endl;
}

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

int main() {

  // 入力
  int l, r;
  cin >> l >> r;

  int ans = 2019;

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

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

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

ll L, R;
ll saisyou = 2019;

int flag1 = 0;
int flag2 = 0;

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

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

  if (saisyou == 0)
    cout << 0 << endl;
  else
    cout << saisyou << endl;
}

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

ll L, R;
ll saisyou = 2019;

int flag1 = 0;
int flag2 = 0;

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

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

  if (saisyou == 0)
    cout << 0 << endl;
  else
    cout << saisyou << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
signed main() {
  int l, r;
  cin >> l >> r;
  if ((l - 1) / 2019 != r / 2019) {
    cout << 0;
    return 0;
  }
  int ans = 2018;
  l %= 2019;
  r %= 2019;
  for (int i = l; i <= r; i++)
    for (int j = i + 1; i <= r; j++)
      ans = min(ans, (i * j) % 2019);
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
signed main() {
  int l, r;
  cin >> l >> r;
  if ((l - 1) / 2019 != r / 2019) {
    cout << 0;
    return 0;
  }
  int ans = 2018;
  l %= 2019;
  r %= 2019;
  for (int i = l; i <= r; i++)
    for (int j = i + 1; 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;

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

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

  cout << min;

  return 0;
}

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

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

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

  cout << min;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;
using ull = unsigned long long;

int main() {
  ull l, r;
  cin >> l >> r;
  ull x = numeric_limits<ull>::max();
  for (ull i = l; i < r; ++i) {
    for (ull j = l + 1; j <= r; ++j) {
      x = min(x, (i * j) % 2019);
    }
  }
  std::cout << x << std::endl;
  return 0;
}

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

using namespace std;
using ull = unsigned long long;

int main() {
  ull l, r;
  cin >> l >> r;
  ull x = numeric_limits<ull>::max();
  for (ull i = l; i < r; ++i) {
    for (ull j = l + 1; j <= r; ++j) {
      if ((i * j) % 2019 == 0) {
        cout << 0 << endl;
        return 0;
      }
      x = min(x, (i * j) % 2019);
    }
  }
  std::cout << x << std::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 mini = 2018;
  if (L - R > 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (long long int i = L; i <= R - 1; i++) {
    for (long long int j = i + 1; j <= R; j++) {
      // cout<<i<<j<<endl;
      mini = min((i * j) % 2019, mini);
    }
  }
  cout << mini << endl;
}

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

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm(a, b) ((a) / __gcd(a, b) * (b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair<LL, LL> L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

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

  LL l, r;
  cin >> l >> r;
  LL res = INF;
  if (l - r >= 2018)
    cout << 0 << endl;
  else {
    for (LL i = l; i <= r; ++i) {
      for (LL j = i + 1; j <= r; ++j) {
        res = min(res, i * j % 2019);
      }
    }
    cout << res << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm(a, b) ((a) / __gcd(a, b) * (b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair<LL, LL> L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

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

  LL l, r;
  cin >> l >> r;
  LL res = INF;
  if (r - l >= 2018)
    cout << 0 << endl;
  else {
    for (LL i = l; i <= r; ++i) {
      for (LL j = i + 1; j <= r; ++j) {
        res = min(res, i * j % 2019);
      }
    }
    cout << res << endl;
  }
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define p_b push_back
#define all(c) c.begin(), c.end()
using namespace std;
typedef long long ll; // printf("%lld ", ll); to out put long
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double eps = 1e-6;
const int MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
bool ODD(ll O) { return (O % 2 != 0); }
ll gcd(ll a, ll b) { return __gcd(a, b); }
int dx[] = {1, 0, -1, 0, -1, 0};
int dy[] = {0, 1, 0, -1, -1, 0};
ll power(ll x, ll y) {
  if (y == 0)
    return 1;
  if (ODD(y))
    return x * power(x, y / 2) * power(x, y / 2);
  return power(x, y / 2) * power(x, y / 2);
}
/*------ never give up --------*/

int main() {
  int t = 1;
  // cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int ans = 1e9 + 5;
    for (int i = a; i <= b; i++) {
      for (int j = i + 1; j <= b; j++) {
        int x = i % 2019;
        int y = j % 2019;
        ans = min(ans, (x * y) % 2019);
        if (ans == 0)
          break;
      }
    }
    cout << ans;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define p_b push_back
#define all(c) c.begin(), c.end()
using namespace std;
typedef long long ll; // printf("%lld ", ll); to out put long
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double eps = 1e-6;
const int MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
bool ODD(ll O) { return (O % 2 != 0); }
ll gcd(ll a, ll b) { return __gcd(a, b); }
int dx[] = {1, 0, -1, 0, -1, 0};
int dy[] = {0, 1, 0, -1, -1, 0};
ll power(ll x, ll y) {
  if (y == 0)
    return 1;
  if (ODD(y))
    return x * power(x, y / 2) * power(x, y / 2);
  return power(x, y / 2) * power(x, y / 2);
}
/*------ never give up --------*/

int main() {
  int t = 1;
  // cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int ans = 1e9 + 5;
    for (int i = a; i <= b; i++) {
      for (int j = i + 1; j <= b; j++) {
        int x = i % 2019;
        int y = j % 2019;
        ans = min(ans, (x * y) % 2019);
        if (ans == 0) {
          cout << ans;
          return 0;
        }
      }
    }
    cout << ans;
  }
  return 0;
}
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)
const ll mod = 2019;
int main(void) {
  // Your code here!
  ll l, r;
  cin >> l >> r;
  if (r - l > 2019) {
    cout << 0 << endl;
  }
  ll ans = 3000;
  rep(l, i, r + 1) { rep(i + 1, j, r + 1) ans = min(i * j % mod, ans); }
  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)
const ll mod = 2019;
int main(void) {
  // Your code here!
  ll l, r;
  cin >> l >> r;
  if (r - l > 2019) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 3000;
  rep(l, i, r + 1) { rep(i + 1, j, r + 1) ans = min(i * j % mod, ans); }
  cout << ans;
}